正在显示
1 个修改的文件
包含
66 行增加
和
27 行删除
@@ -74,6 +74,9 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit | @@ -74,6 +74,9 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit | ||
74 | var evalutionHrbp *domain.SummaryEvaluation | 74 | var evalutionHrbp *domain.SummaryEvaluation |
75 | // 360评估 SummaryEvaluation.Executor.UserId => SummaryEvaluation | 75 | // 360评估 SummaryEvaluation.Executor.UserId => SummaryEvaluation |
76 | evaluation360Map := map[int]*domain.SummaryEvaluation{} | 76 | evaluation360Map := map[int]*domain.SummaryEvaluation{} |
77 | + // 考核结果 | ||
78 | + var evalutionFinish *domain.SummaryEvaluation | ||
79 | + | ||
77 | for _, val := range allEvaluationList { | 80 | for _, val := range allEvaluationList { |
78 | switch val.Types { | 81 | switch val.Types { |
79 | case domain.Evaluation360: | 82 | case domain.Evaluation360: |
@@ -82,6 +85,8 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit | @@ -82,6 +85,8 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit | ||
82 | evaluationSuper = val | 85 | evaluationSuper = val |
83 | case domain.EvaluationHrbp: | 86 | case domain.EvaluationHrbp: |
84 | evalutionHrbp = val | 87 | evalutionHrbp = val |
88 | + case domain.EvaluationFinish: | ||
89 | + evalutionFinish = val | ||
85 | } | 90 | } |
86 | } | 91 | } |
87 | // 填写值和填写项id的映射 | 92 | // 填写值和填写项id的映射 |
@@ -95,19 +100,13 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit | @@ -95,19 +100,13 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit | ||
95 | newHrbpItemValueList := []*domain.SummaryEvaluationValue{} | 100 | newHrbpItemValueList := []*domain.SummaryEvaluationValue{} |
96 | //新的360评估填写值 SummaryEvaluation.Executor.UserId => []*domain.SummaryEvaluationValue | 101 | //新的360评估填写值 SummaryEvaluation.Executor.UserId => []*domain.SummaryEvaluationValue |
97 | new360ItemValueList := map[int][]*domain.SummaryEvaluationValue{} | 102 | new360ItemValueList := map[int][]*domain.SummaryEvaluationValue{} |
103 | + //新的评估考核结果 | ||
104 | + newFinishItemValueList := []*domain.SummaryEvaluationValue{} | ||
98 | 105 | ||
99 | newItemValueList := []*domain.SummaryEvaluationValue{} | 106 | newItemValueList := []*domain.SummaryEvaluationValue{} |
100 | for _, val := range itemUsedList { | 107 | for _, val := range itemUsedList { |
101 | temp := domain.SummaryEvaluationValue{} | 108 | temp := domain.SummaryEvaluationValue{} |
102 | - if evaluationSuper != nil { | ||
103 | - newItemValue := domain.SummaryEvaluationValue{} | ||
104 | - newItemValue.SetBlankValue(evaluationSuper, val) | ||
105 | - newItemValue.Remark = itemValueParam[val.Id].Remark | ||
106 | - evaluationSuper.FillItemValue(val, &newItemValue, itemValueParam[val.Id].Value) | ||
107 | - newItemValue.HrCheck = param.ExecutorId | ||
108 | - newSuperItemValueList = append(newSuperItemValueList, &newItemValue) | ||
109 | - temp = newItemValue | ||
110 | - } | 109 | + //处理hrbp评的填写项,需要填写哪些 |
111 | if evalutionHrbp != nil && val.EvaluatorId == -1 { | 110 | if evalutionHrbp != nil && val.EvaluatorId == -1 { |
112 | newItemValue := domain.SummaryEvaluationValue{} | 111 | newItemValue := domain.SummaryEvaluationValue{} |
113 | newItemValue.SetBlankValue(evalutionHrbp, val) | 112 | newItemValue.SetBlankValue(evalutionHrbp, val) |
@@ -117,6 +116,7 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit | @@ -117,6 +116,7 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit | ||
117 | newHrbpItemValueList = append(newHrbpItemValueList, &newItemValue) | 116 | newHrbpItemValueList = append(newHrbpItemValueList, &newItemValue) |
118 | temp = newItemValue | 117 | temp = newItemValue |
119 | } | 118 | } |
119 | + //处理360评的填写项,需要填写哪些 | ||
120 | if val.EvaluatorId > 0 { | 120 | if val.EvaluatorId > 0 { |
121 | evaluation360, ok := evaluation360Map[val.EvaluatorId] | 121 | evaluation360, ok := evaluation360Map[val.EvaluatorId] |
122 | if ok { | 122 | if ok { |
@@ -134,27 +134,28 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit | @@ -134,27 +134,28 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit | ||
134 | temp = newItemValue | 134 | temp = newItemValue |
135 | } | 135 | } |
136 | } | 136 | } |
137 | - newItemValueList = append(newItemValueList, &temp) | ||
138 | - } | ||
139 | - // 处理上级评估 | ||
140 | - if evaluationSuper != nil { | ||
141 | - evaluationSuper.EvaluationTotalScore(newSuperItemValueList) | ||
142 | - //删除旧的填写值,使用新的填写内容 | ||
143 | - err = itemValueRepo.RemoveBySummaryEvaluationId(evaluationSuper.Id) | ||
144 | - if err != nil { | ||
145 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
146 | - } | ||
147 | - err = evaluationRepo.Save(evaluationSuper) | ||
148 | - if err != nil { | ||
149 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 137 | + //处理上级评的填写项,需要填写哪些 |
138 | + if evaluationSuper != nil { | ||
139 | + newItemValue := domain.SummaryEvaluationValue{} | ||
140 | + newItemValue.SetBlankValue(evaluationSuper, val) | ||
141 | + newItemValue.Remark = itemValueParam[val.Id].Remark | ||
142 | + evaluationSuper.FillItemValue(val, &newItemValue, itemValueParam[val.Id].Value) | ||
143 | + newItemValue.HrCheck = param.ExecutorId | ||
144 | + newSuperItemValueList = append(newSuperItemValueList, &newItemValue) | ||
145 | + temp = newItemValue | ||
150 | } | 146 | } |
151 | - for _, val := range newSuperItemValueList { | ||
152 | - err = itemValueRepo.Save(val) | ||
153 | - if err != nil { | ||
154 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
155 | - } | 147 | + //处理考核结果 |
148 | + if evalutionFinish != nil { | ||
149 | + newItemValue := domain.SummaryEvaluationValue{} | ||
150 | + newItemValue.SetBlankValue(evalutionFinish, val) | ||
151 | + newItemValue.Remark = itemValueParam[val.Id].Remark | ||
152 | + evalutionFinish.FillItemValue(val, &newItemValue, itemValueParam[val.Id].Value) | ||
153 | + newItemValue.HrCheck = param.ExecutorId | ||
154 | + newFinishItemValueList = append(newFinishItemValueList, &newItemValue) | ||
156 | } | 155 | } |
156 | + newItemValueList = append(newItemValueList, &temp) | ||
157 | } | 157 | } |
158 | + | ||
158 | // 处理人资评估 | 159 | // 处理人资评估 |
159 | if evalutionHrbp != nil { | 160 | if evalutionHrbp != nil { |
160 | evalutionHrbp.EvaluationTotalScore(newHrbpItemValueList) | 161 | evalutionHrbp.EvaluationTotalScore(newHrbpItemValueList) |
@@ -193,6 +194,44 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit | @@ -193,6 +194,44 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit | ||
193 | } | 194 | } |
194 | } | 195 | } |
195 | } | 196 | } |
197 | + // 处理上级评估 | ||
198 | + if evaluationSuper != nil { | ||
199 | + evaluationSuper.EvaluationTotalScore(newSuperItemValueList) | ||
200 | + //删除旧的填写值,使用新的填写内容 | ||
201 | + err = itemValueRepo.RemoveBySummaryEvaluationId(evaluationSuper.Id) | ||
202 | + if err != nil { | ||
203 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
204 | + } | ||
205 | + err = evaluationRepo.Save(evaluationSuper) | ||
206 | + if err != nil { | ||
207 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
208 | + } | ||
209 | + for _, val := range newSuperItemValueList { | ||
210 | + err = itemValueRepo.Save(val) | ||
211 | + if err != nil { | ||
212 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
213 | + } | ||
214 | + } | ||
215 | + } | ||
216 | + // 处理评估考核结果 | ||
217 | + if evalutionFinish != nil { | ||
218 | + evalutionFinish.EvaluationTotalScore(newFinishItemValueList) | ||
219 | + //删除旧的填写值,使用新的填写内容 | ||
220 | + err = itemValueRepo.RemoveBySummaryEvaluationId(evalutionFinish.Id) | ||
221 | + if err != nil { | ||
222 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
223 | + } | ||
224 | + err = evaluationRepo.Save(evalutionFinish) | ||
225 | + if err != nil { | ||
226 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
227 | + } | ||
228 | + for _, val := range newFinishItemValueList { | ||
229 | + err = itemValueRepo.Save(val) | ||
230 | + if err != nil { | ||
231 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
232 | + } | ||
233 | + } | ||
234 | + } | ||
196 | if err := transactionContext.CommitTransaction(); err != nil { | 235 | if err := transactionContext.CommitTransaction(); err != nil { |
197 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 236 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
198 | } | 237 | } |
-
请 注册 或 登录 后发表评论