作者 tangxvhui

调整

... ... @@ -1518,7 +1518,9 @@ func (srv *SummaryEvaluationService) ConfirmScoreEvaluation(param *command.Confi
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
}
for i := range itemList {
result.ResetTotalRating(itemList[i])
}
if err := result.EvaluationTotalScore(itemValues); err != nil {
return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
... ... @@ -1688,6 +1690,9 @@ func (srv *SummaryEvaluationService) GetTargetEvaluationResult(param *command.Qu
}
// 未完成考核,需要重新计算分数
if result.CheckResult == domain.EvaluationCheckUncompleted {
for i := range itemList {
result.ResetTotalRating(itemList[i])
}
if err = result.EvaluationTotalScore(itemValues); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
... ... @@ -1702,7 +1707,7 @@ func (srv *SummaryEvaluationService) GetTargetEvaluationResult(param *command.Qu
// 组合 评估填写的值和评估项
itemValuesAdapter := srv.buildSummaryItemValue(itemList, itemValues)
codeList := make([]*adapter.LevalCodeCount, 0)
codeMap := map[string]*adapter.LevalCodeCount{}
for _, v := range itemValuesAdapter {
//处理加分项评级汇总
... ... @@ -1714,13 +1719,23 @@ func (srv *SummaryEvaluationService) GetTargetEvaluationResult(param *command.Qu
ItemList: []string{},
}
codeMap[v.Value] = code
codeList = append(codeList, code)
}
codeMap[v.Value].ItemList = append(codeMap[v.Value].ItemList, v.Name)
codeMap[v.Value].Number += 1
}
}
codeList := make([]*adapter.LevalCodeCount, 0)
for _, val := range result.TotalRating {
if codeItem, ok := codeMap[val.Code]; ok {
codeList = append(codeList, codeItem)
} else {
codeList = append(codeList, &adapter.LevalCodeCount{
Code: val.Code,
Number: 0,
ItemList: []string{},
})
}
}
eiAdapter := adapter.EvaluationInfoSuperAdapter{
EvaluationBaseAdapter: evaluationBase,
LevelCount: codeList,
... ...
... ... @@ -73,7 +73,6 @@ type SummaryEvaluationRepository interface {
// 计算总分。TotalScore 保留1位小数
func (evaluation *SummaryEvaluation) EvaluationTotalScore(valueList []*SummaryEvaluationValue) error {
//重置计数
evaluation.TotalRating = make([]RatingCodeNumber, 0)
evaluation.TotalScore = "0"
//汇总评估填写值
var totalScore float64
... ...