正在显示
1 个修改的文件
包含
40 行增加
和
2 行删除
@@ -268,9 +268,9 @@ func (srv *SummaryEvaluationService) EditEvaluationSelfV2(param *command.EditEva | @@ -268,9 +268,9 @@ func (srv *SummaryEvaluationService) EditEvaluationSelfV2(param *command.EditEva | ||
268 | } | 268 | } |
269 | //更新填写值 | 269 | //更新填写值 |
270 | var evaluationValueSlice []*domain.SummaryEvaluationValue // 提交的填写值 | 270 | var evaluationValueSlice []*domain.SummaryEvaluationValue // 提交的填写值 |
271 | + evaluationItemMap := map[int]*domain.EvaluationItemUsed{} | ||
271 | { | 272 | { |
272 | - | ||
273 | - evaluationItemMap := map[int]*domain.EvaluationItemUsed{} // 需要填写那些项 Id=>&domain.EvaluationItemUsed{} | 273 | + // 需要填写那些项 Id=>&domain.EvaluationItemUsed{} |
274 | evaluationValueMap := map[int]*domain.SummaryEvaluationValue{} // 提交的填写值 EvaluationItemId=>&domain.domain.SummaryEvaluationValue{} | 274 | evaluationValueMap := map[int]*domain.SummaryEvaluationValue{} // 提交的填写值 EvaluationItemId=>&domain.domain.SummaryEvaluationValue{} |
275 | evaluationData.TotalRating = nil // 清空评级数量统计 | 275 | evaluationData.TotalRating = nil // 清空评级数量统计 |
276 | // 按照需要填写那些项 设置SummaryEvaluationValue的空白值 | 276 | // 按照需要填写那些项 设置SummaryEvaluationValue的空白值 |
@@ -345,6 +345,44 @@ func (srv *SummaryEvaluationService) EditEvaluationSelfV2(param *command.EditEva | @@ -345,6 +345,44 @@ func (srv *SummaryEvaluationService) EditEvaluationSelfV2(param *command.EditEva | ||
345 | if err != nil { | 345 | if err != nil { |
346 | return nil, err | 346 | return nil, err |
347 | } | 347 | } |
348 | + //查看是否存在上级评估 | ||
349 | + _, evaluationSuperList, err := evaluationRepo.Find(map[string]interface{}{ | ||
350 | + "targetUserId": evaluationData.TargetUser.UserId, | ||
351 | + "typesList": []int{int(domain.EvaluationSuper)}, | ||
352 | + "cycleId": evaluationData.CycleId, | ||
353 | + "limit": 1, | ||
354 | + }) | ||
355 | + if err != nil { | ||
356 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
357 | + } | ||
358 | + //不存在 上级评估,进行同步评估结果 | ||
359 | + if len(evaluationSuperList) == 0 { | ||
360 | + _, evaluationFinishList, err := evaluationRepo.Find(map[string]interface{}{ | ||
361 | + "targetUserId": evaluationData.TargetUser.UserId, | ||
362 | + "typesList": []int{int(domain.EvaluationFinish)}, | ||
363 | + "cycleId": evaluationData.CycleId, | ||
364 | + "limit": 1, | ||
365 | + }) | ||
366 | + if err != nil { | ||
367 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
368 | + } | ||
369 | + itemValuesFinish := []*domain.SummaryEvaluationValue{} | ||
370 | + for _, val := range evaluationValueSlice { | ||
371 | + item, ok := evaluationItemMap[val.EvaluationItemId] | ||
372 | + if !ok { | ||
373 | + continue | ||
374 | + } | ||
375 | + if item.EvaluatorId == 0 { | ||
376 | + itemValuesFinish = append(itemValuesFinish, val) | ||
377 | + } | ||
378 | + } | ||
379 | + if len(evaluationFinishList) > 0 { | ||
380 | + err = srv.syncEvaluationFinishValue(transactionContext, evaluationFinishList[0], itemValuesFinish) | ||
381 | + if err != nil { | ||
382 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
383 | + } | ||
384 | + } | ||
385 | + } | ||
348 | } | 386 | } |
349 | if err := transactionContext.CommitTransaction(); err != nil { | 387 | if err := transactionContext.CommitTransaction(); err != nil { |
350 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 388 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
-
请 注册 或 登录 后发表评论