作者 郑周

1. 员工确认分数,增加判断 是否存在考核结果,如果存在就不在进行分数计算

... ... @@ -1373,6 +1373,16 @@ func (srv *SummaryEvaluationService) ConfirmScoreEvaluation(param *command.Confi
return application.ThrowError(application.TRANSACTION_ERROR, "前面流程暂未完成提交评估内容")
}
// 按评估项优先级顺序(已确认考核结果 ->上级评估 ->HR或360评估或自评)
_, itemValues, err := itemValueRepo.Find(map[string]interface{}{"summaryEvaluationId": result.Id, "limit": 1})
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
// 如果已经存在考核结果分数,不再进行分数计算(如.超管多次修改员工多次确认)
if len(itemValues) > 0 {
// do nothing...
} else {
// 周期内所有评估类型
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
"companyId": result.CompanyId,
"cycleId": result.CycleId,
... ... @@ -1395,13 +1405,12 @@ func (srv *SummaryEvaluationService) ConfirmScoreEvaluation(param *command.Confi
var itemList []*domain.EvaluationItemUsed
var itemValues []*domain.SummaryEvaluationValue
// 获取自评模板内容
// 获取自评模板
_, itemList, err = evaluationItemRepo.Find(map[string]interface{}{"evaluationProjectId": result.EvaluationProjectId, "nodeType": domain.LinkNodeSelfAssessment})
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
// 按评估项优先级顺序(已确认考核结果 ->上级评估 ->HR或360评估或自评)
if super != nil {
_, itemValues, err = itemValueRepo.Find(map[string]interface{}{"summaryEvaluationId": super.Id}) // 获取已填写的评估内容
if err != nil {
... ... @@ -1422,7 +1431,7 @@ func (srv *SummaryEvaluationService) ConfirmScoreEvaluation(param *command.Confi
}
}
if len(evaluationIds) > 0 {
// 获取已填写的评估内容
// 已填写的评估内容
_, itemValues, err = itemValueRepo.Find(map[string]interface{}{"summaryEvaluationIdList": evaluationIds})
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
... ... @@ -1444,17 +1453,17 @@ func (srv *SummaryEvaluationService) ConfirmScoreEvaluation(param *command.Confi
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
}
//重置评级汇总
// 重置评级汇总
result.TotalRating = nil
for i := range itemList {
result.ResetTotalRating(itemList[i])
}
//存在 超级管理员直接修改填写 总分的情况,此时不重新计算总分
if result.TotalScore == "0" || result.TotalScore == "" {
// 计算分数
if err := result.EvaluationTotalScore(itemValues); err != nil {
return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
}
result.CheckResult = domain.EvaluationCheckCompleted
if err := evaluationRepo.Save(result); err != nil {
return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ...