作者 tangxvhui

调整

@@ -1518,7 +1518,9 @@ func (srv *SummaryEvaluationService) ConfirmScoreEvaluation(param *command.Confi @@ -1518,7 +1518,9 @@ func (srv *SummaryEvaluationService) ConfirmScoreEvaluation(param *command.Confi
1518 return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 1518 return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
1519 } 1519 }
1520 } 1520 }
1521 - 1521 + for i := range itemList {
  1522 + result.ResetTotalRating(itemList[i])
  1523 + }
1522 if err := result.EvaluationTotalScore(itemValues); err != nil { 1524 if err := result.EvaluationTotalScore(itemValues); err != nil {
1523 return application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 1525 return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
1524 } 1526 }
@@ -1688,6 +1690,9 @@ func (srv *SummaryEvaluationService) GetTargetEvaluationResult(param *command.Qu @@ -1688,6 +1690,9 @@ func (srv *SummaryEvaluationService) GetTargetEvaluationResult(param *command.Qu
1688 } 1690 }
1689 // 未完成考核,需要重新计算分数 1691 // 未完成考核,需要重新计算分数
1690 if result.CheckResult == domain.EvaluationCheckUncompleted { 1692 if result.CheckResult == domain.EvaluationCheckUncompleted {
  1693 + for i := range itemList {
  1694 + result.ResetTotalRating(itemList[i])
  1695 + }
1691 if err = result.EvaluationTotalScore(itemValues); err != nil { 1696 if err = result.EvaluationTotalScore(itemValues); err != nil {
1692 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 1697 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
1693 } 1698 }
@@ -1702,7 +1707,7 @@ func (srv *SummaryEvaluationService) GetTargetEvaluationResult(param *command.Qu @@ -1702,7 +1707,7 @@ func (srv *SummaryEvaluationService) GetTargetEvaluationResult(param *command.Qu
1702 1707
1703 // 组合 评估填写的值和评估项 1708 // 组合 评估填写的值和评估项
1704 itemValuesAdapter := srv.buildSummaryItemValue(itemList, itemValues) 1709 itemValuesAdapter := srv.buildSummaryItemValue(itemList, itemValues)
1705 - codeList := make([]*adapter.LevalCodeCount, 0) 1710 +
1706 codeMap := map[string]*adapter.LevalCodeCount{} 1711 codeMap := map[string]*adapter.LevalCodeCount{}
1707 for _, v := range itemValuesAdapter { 1712 for _, v := range itemValuesAdapter {
1708 //处理加分项评级汇总 1713 //处理加分项评级汇总
@@ -1714,13 +1719,23 @@ func (srv *SummaryEvaluationService) GetTargetEvaluationResult(param *command.Qu @@ -1714,13 +1719,23 @@ func (srv *SummaryEvaluationService) GetTargetEvaluationResult(param *command.Qu
1714 ItemList: []string{}, 1719 ItemList: []string{},
1715 } 1720 }
1716 codeMap[v.Value] = code 1721 codeMap[v.Value] = code
1717 - codeList = append(codeList, code)  
1718 } 1722 }
1719 codeMap[v.Value].ItemList = append(codeMap[v.Value].ItemList, v.Name) 1723 codeMap[v.Value].ItemList = append(codeMap[v.Value].ItemList, v.Name)
1720 codeMap[v.Value].Number += 1 1724 codeMap[v.Value].Number += 1
1721 } 1725 }
1722 } 1726 }
1723 - 1727 + codeList := make([]*adapter.LevalCodeCount, 0)
  1728 + for _, val := range result.TotalRating {
  1729 + if codeItem, ok := codeMap[val.Code]; ok {
  1730 + codeList = append(codeList, codeItem)
  1731 + } else {
  1732 + codeList = append(codeList, &adapter.LevalCodeCount{
  1733 + Code: val.Code,
  1734 + Number: 0,
  1735 + ItemList: []string{},
  1736 + })
  1737 + }
  1738 + }
1724 eiAdapter := adapter.EvaluationInfoSuperAdapter{ 1739 eiAdapter := adapter.EvaluationInfoSuperAdapter{
1725 EvaluationBaseAdapter: evaluationBase, 1740 EvaluationBaseAdapter: evaluationBase,
1726 LevelCount: codeList, 1741 LevelCount: codeList,
@@ -73,7 +73,6 @@ type SummaryEvaluationRepository interface { @@ -73,7 +73,6 @@ type SummaryEvaluationRepository interface {
73 // 计算总分。TotalScore 保留1位小数 73 // 计算总分。TotalScore 保留1位小数
74 func (evaluation *SummaryEvaluation) EvaluationTotalScore(valueList []*SummaryEvaluationValue) error { 74 func (evaluation *SummaryEvaluation) EvaluationTotalScore(valueList []*SummaryEvaluationValue) error {
75 //重置计数 75 //重置计数
76 - evaluation.TotalRating = make([]RatingCodeNumber, 0)  
77 evaluation.TotalScore = "0" 76 evaluation.TotalScore = "0"
78 //汇总评估填写值 77 //汇总评估填写值
79 var totalScore float64 78 var totalScore float64