作者 tangxvhui
... ... @@ -1371,6 +1371,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,
... ... @@ -1393,13 +1403,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 {
... ... @@ -1420,7 +1429,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())
... ... @@ -1442,15 +1451,16 @@ 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 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 {
... ...