作者 郑周

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

@@ -1373,6 +1373,16 @@ func (srv *SummaryEvaluationService) ConfirmScoreEvaluation(param *command.Confi @@ -1373,6 +1373,16 @@ func (srv *SummaryEvaluationService) ConfirmScoreEvaluation(param *command.Confi
1373 return application.ThrowError(application.TRANSACTION_ERROR, "前面流程暂未完成提交评估内容") 1373 return application.ThrowError(application.TRANSACTION_ERROR, "前面流程暂未完成提交评估内容")
1374 } 1374 }
1375 1375
  1376 + // 按评估项优先级顺序(已确认考核结果 ->上级评估 ->HR或360评估或自评)
  1377 + _, itemValues, err := itemValueRepo.Find(map[string]interface{}{"summaryEvaluationId": result.Id, "limit": 1})
  1378 + if err != nil {
  1379 + return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  1380 + }
  1381 + // 如果已经存在考核结果分数,不再进行分数计算(如.超管多次修改员工多次确认)
  1382 + if len(itemValues) > 0 {
  1383 + // do nothing...
  1384 + } else {
  1385 + // 周期内所有评估类型
1376 _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{ 1386 _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
1377 "companyId": result.CompanyId, 1387 "companyId": result.CompanyId,
1378 "cycleId": result.CycleId, 1388 "cycleId": result.CycleId,
@@ -1395,13 +1405,12 @@ func (srv *SummaryEvaluationService) ConfirmScoreEvaluation(param *command.Confi @@ -1395,13 +1405,12 @@ func (srv *SummaryEvaluationService) ConfirmScoreEvaluation(param *command.Confi
1395 var itemList []*domain.EvaluationItemUsed 1405 var itemList []*domain.EvaluationItemUsed
1396 var itemValues []*domain.SummaryEvaluationValue 1406 var itemValues []*domain.SummaryEvaluationValue
1397 1407
1398 - // 获取自评模板内容 1408 + // 获取自评模板
1399 _, itemList, err = evaluationItemRepo.Find(map[string]interface{}{"evaluationProjectId": result.EvaluationProjectId, "nodeType": domain.LinkNodeSelfAssessment}) 1409 _, itemList, err = evaluationItemRepo.Find(map[string]interface{}{"evaluationProjectId": result.EvaluationProjectId, "nodeType": domain.LinkNodeSelfAssessment})
1400 if err != nil { 1410 if err != nil {
1401 return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1411 return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
1402 } 1412 }
1403 1413
1404 - // 按评估项优先级顺序(已确认考核结果 ->上级评估 ->HR或360评估或自评)  
1405 if super != nil { 1414 if super != nil {
1406 _, itemValues, err = itemValueRepo.Find(map[string]interface{}{"summaryEvaluationId": super.Id}) // 获取已填写的评估内容 1415 _, itemValues, err = itemValueRepo.Find(map[string]interface{}{"summaryEvaluationId": super.Id}) // 获取已填写的评估内容
1407 if err != nil { 1416 if err != nil {
@@ -1422,7 +1431,7 @@ func (srv *SummaryEvaluationService) ConfirmScoreEvaluation(param *command.Confi @@ -1422,7 +1431,7 @@ func (srv *SummaryEvaluationService) ConfirmScoreEvaluation(param *command.Confi
1422 } 1431 }
1423 } 1432 }
1424 if len(evaluationIds) > 0 { 1433 if len(evaluationIds) > 0 {
1425 - // 获取已填写的评估内容 1434 + // 已填写的评估内容
1426 _, itemValues, err = itemValueRepo.Find(map[string]interface{}{"summaryEvaluationIdList": evaluationIds}) 1435 _, itemValues, err = itemValueRepo.Find(map[string]interface{}{"summaryEvaluationIdList": evaluationIds})
1427 if err != nil { 1436 if err != nil {
1428 return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1437 return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
@@ -1444,17 +1453,17 @@ func (srv *SummaryEvaluationService) ConfirmScoreEvaluation(param *command.Confi @@ -1444,17 +1453,17 @@ func (srv *SummaryEvaluationService) ConfirmScoreEvaluation(param *command.Confi
1444 return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1453 return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
1445 } 1454 }
1446 } 1455 }
1447 - //重置评级汇总 1456 + // 重置评级汇总
1448 result.TotalRating = nil 1457 result.TotalRating = nil
1449 for i := range itemList { 1458 for i := range itemList {
1450 result.ResetTotalRating(itemList[i]) 1459 result.ResetTotalRating(itemList[i])
1451 } 1460 }
1452 - //存在 超级管理员直接修改填写 总分的情况,此时不重新计算总分  
1453 - if result.TotalScore == "0" || result.TotalScore == "" { 1461 + // 计算分数
1454 if err := result.EvaluationTotalScore(itemValues); err != nil { 1462 if err := result.EvaluationTotalScore(itemValues); err != nil {
1455 return application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 1463 return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
1456 } 1464 }
1457 } 1465 }
  1466 +
1458 result.CheckResult = domain.EvaluationCheckCompleted 1467 result.CheckResult = domain.EvaluationCheckCompleted
1459 if err := evaluationRepo.Save(result); err != nil { 1468 if err := evaluationRepo.Save(result); err != nil {
1460 return application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 1469 return application.ThrowError(application.TRANSACTION_ERROR, err.Error())