作者 郑周

Merge branch 'dev-zhengzhou' into test

... ... @@ -56,13 +56,15 @@ func (srv *SummaryEvaluationService) GetEvaluationFinish(param *command.QueryEva
}
// 考核结果不存在 -> 获取上级考核 -> 获取360+HRBP+自评
if len(itemValues) == 0 {
itemValues, evaluationList, err := srv.findCycleItemValueByType(transactionContext, result.CycleId, result.TargetUser.UserId, []int{int(domain.EvaluationSuper)})
superValues, evaluationList, err := srv.findCycleItemValueByType(transactionContext, result.CycleId, result.TargetUser.UserId, []int{int(domain.EvaluationSuper)})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
// 上级评估不存在(有上级考核类型时,不管分数有没有填写都算,没填写当作零)
if len(evaluationList) == 0 {
itemValues, _, err = srv.findCycleItemValueByType(transactionContext, result.CycleId, result.TargetUser.UserId, []int{int(domain.EvaluationSelf)})
// 上级评估存在(有上级考核类型时,不管分数有没有填写都算,没填写当作零)
if len(evaluationList) > 0 {
itemValues = superValues
} else {
selfValues, _, err := srv.findCycleItemValueByType(transactionContext, result.CycleId, result.TargetUser.UserId, []int{int(domain.EvaluationSelf)})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
... ... @@ -71,7 +73,7 @@ func (srv *SummaryEvaluationService) GetEvaluationFinish(param *command.QueryEva
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
// 自评分数
if len(itemValues) == 0 {
if len(selfValues) == 0 {
itemValues = hrItemValues
} else {
// HR360分数 替换 自评分数
... ... @@ -79,14 +81,24 @@ func (srv *SummaryEvaluationService) GetEvaluationFinish(param *command.QueryEva
for i := range hrItemValues {
hrItemMap[hrItemValues[i].EvaluationItemId] = hrItemValues[i]
}
for i := range itemValues {
it := itemValues[i]
for i := range selfValues {
it := selfValues[i]
if v, ok := hrItemMap[it.EvaluationItemId]; ok {
itemValues[i] = v
selfValues[i] = v
}
}
itemValues = selfValues
}
}
// 重新计算成绩
result.TotalRating = nil
for i := range itemList {
result.ResetTotalRating(itemList[i])
}
if err = result.EvaluationTotalScore(itemValues); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
}
evaluationBase := srv.getSummaryEvaluation(transactionContext, result)
... ... @@ -203,6 +215,7 @@ func (srv *SummaryEvaluationService) EditEvaluationFinish(param *command.EditEva
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
}
result.Status = domain.EvaluationCompleted
result.CheckResult = domain.EvaluationCheckUncompleted
err = evaluationRepo.Save(result)
... ...
... ... @@ -1622,15 +1622,12 @@ func (srv *SummaryEvaluationService) GetTargetEvaluationResult(param *command.Qu
}
}
}
}
// 未完成考核,需要重新计算分数
if result.CheckResult == domain.EvaluationCheckUncompleted {
result.TotalRating = nil
for i := range itemList {
result.ResetTotalRating(itemList[i])
}
//存在 超级管理员直接修改填写 总分的情况,此时不重新计算总分
if result.TotalScore == "0" || result.TotalScore == "" {
// 未完成考核,需要重新计算分数
if result.CheckResult == domain.EvaluationCheckUncompleted {
result.TotalRating = nil
for i := range itemList {
result.ResetTotalRating(itemList[i])
}
if err = result.EvaluationTotalScore(itemValues); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
... ...