|
@@ -56,13 +56,15 @@ func (srv *SummaryEvaluationService) GetEvaluationFinish(param *command.QueryEva |
|
@@ -56,13 +56,15 @@ func (srv *SummaryEvaluationService) GetEvaluationFinish(param *command.QueryEva |
56
|
}
|
56
|
}
|
57
|
// 考核结果不存在 -> 获取上级考核 -> 获取360+HRBP+自评
|
57
|
// 考核结果不存在 -> 获取上级考核 -> 获取360+HRBP+自评
|
58
|
if len(itemValues) == 0 {
|
58
|
if len(itemValues) == 0 {
|
59
|
- itemValues, evaluationList, err := srv.findCycleItemValueByType(transactionContext, result.CycleId, result.TargetUser.UserId, []int{int(domain.EvaluationSuper)})
|
59
|
+ superValues, evaluationList, err := srv.findCycleItemValueByType(transactionContext, result.CycleId, result.TargetUser.UserId, []int{int(domain.EvaluationSuper)})
|
60
|
if err != nil {
|
60
|
if err != nil {
|
61
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
61
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
62
|
}
|
62
|
}
|
63
|
- // 上级评估不存在(有上级考核类型时,不管分数有没有填写都算,没填写当作零)
|
|
|
64
|
- if len(evaluationList) == 0 {
|
|
|
65
|
- itemValues, _, err = srv.findCycleItemValueByType(transactionContext, result.CycleId, result.TargetUser.UserId, []int{int(domain.EvaluationSelf)})
|
63
|
+ // 上级评估存在(有上级考核类型时,不管分数有没有填写都算,没填写当作零)
|
|
|
64
|
+ if len(evaluationList) > 0 {
|
|
|
65
|
+ itemValues = superValues
|
|
|
66
|
+ } else {
|
|
|
67
|
+ selfValues, _, err := srv.findCycleItemValueByType(transactionContext, result.CycleId, result.TargetUser.UserId, []int{int(domain.EvaluationSelf)})
|
66
|
if err != nil {
|
68
|
if err != nil {
|
67
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
69
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
68
|
}
|
70
|
}
|
|
@@ -71,7 +73,7 @@ func (srv *SummaryEvaluationService) GetEvaluationFinish(param *command.QueryEva |
|
@@ -71,7 +73,7 @@ func (srv *SummaryEvaluationService) GetEvaluationFinish(param *command.QueryEva |
71
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
73
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
72
|
}
|
74
|
}
|
73
|
// 自评分数
|
75
|
// 自评分数
|
74
|
- if len(itemValues) == 0 {
|
76
|
+ if len(selfValues) == 0 {
|
75
|
itemValues = hrItemValues
|
77
|
itemValues = hrItemValues
|
76
|
} else {
|
78
|
} else {
|
77
|
// HR360分数 替换 自评分数
|
79
|
// HR360分数 替换 自评分数
|
|
@@ -79,13 +81,23 @@ func (srv *SummaryEvaluationService) GetEvaluationFinish(param *command.QueryEva |
|
@@ -79,13 +81,23 @@ func (srv *SummaryEvaluationService) GetEvaluationFinish(param *command.QueryEva |
79
|
for i := range hrItemValues {
|
81
|
for i := range hrItemValues {
|
80
|
hrItemMap[hrItemValues[i].EvaluationItemId] = hrItemValues[i]
|
82
|
hrItemMap[hrItemValues[i].EvaluationItemId] = hrItemValues[i]
|
81
|
}
|
83
|
}
|
82
|
- for i := range itemValues {
|
|
|
83
|
- it := itemValues[i]
|
84
|
+ for i := range selfValues {
|
|
|
85
|
+ it := selfValues[i]
|
84
|
if v, ok := hrItemMap[it.EvaluationItemId]; ok {
|
86
|
if v, ok := hrItemMap[it.EvaluationItemId]; ok {
|
85
|
- itemValues[i] = v
|
87
|
+ selfValues[i] = v
|
|
|
88
|
+ }
|
86
|
}
|
89
|
}
|
|
|
90
|
+ itemValues = selfValues
|
87
|
}
|
91
|
}
|
88
|
}
|
92
|
}
|
|
|
93
|
+
|
|
|
94
|
+ // 重新计算成绩
|
|
|
95
|
+ result.TotalRating = nil
|
|
|
96
|
+ for i := range itemList {
|
|
|
97
|
+ result.ResetTotalRating(itemList[i])
|
|
|
98
|
+ }
|
|
|
99
|
+ if err = result.EvaluationTotalScore(itemValues); err != nil {
|
|
|
100
|
+ return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
89
|
}
|
101
|
}
|
90
|
}
|
102
|
}
|
91
|
|
103
|
|
|
@@ -203,6 +215,7 @@ func (srv *SummaryEvaluationService) EditEvaluationFinish(param *command.EditEva |
|
@@ -203,6 +215,7 @@ func (srv *SummaryEvaluationService) EditEvaluationFinish(param *command.EditEva |
203
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
215
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
204
|
}
|
216
|
}
|
205
|
}
|
217
|
}
|
|
|
218
|
+
|
206
|
result.Status = domain.EvaluationCompleted
|
219
|
result.Status = domain.EvaluationCompleted
|
207
|
result.CheckResult = domain.EvaluationCheckUncompleted
|
220
|
result.CheckResult = domain.EvaluationCheckUncompleted
|
208
|
err = evaluationRepo.Save(result)
|
221
|
err = evaluationRepo.Save(result)
|