正在显示
1 个修改的文件
包含
38 行增加
和
13 行删除
| @@ -25,20 +25,46 @@ func (srv *SummaryEvaluationService) GetEvaluationShow1(param command.QueryEvalu | @@ -25,20 +25,46 @@ func (srv *SummaryEvaluationService) GetEvaluationShow1(param command.QueryEvalu | ||
| 25 | evaluationValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext}) | 25 | evaluationValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext}) |
| 26 | //评估用到的题目 | 26 | //评估用到的题目 |
| 27 | itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext}) | 27 | itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext}) |
| 28 | - | 28 | + //获取 评估考核结果 |
| 29 | var evaluationList []*domain.SummaryEvaluation | 29 | var evaluationList []*domain.SummaryEvaluation |
| 30 | + var evaluationValueList []*domain.SummaryEvaluationValue | ||
| 30 | _, evaluationList, err = evaluationRepo.Find(map[string]interface{}{ | 31 | _, evaluationList, err = evaluationRepo.Find(map[string]interface{}{ |
| 31 | "limit": 1, | 32 | "limit": 1, |
| 32 | "companyId": param.CompanyId, | 33 | "companyId": param.CompanyId, |
| 33 | "cycleId": param.CycleId, | 34 | "cycleId": param.CycleId, |
| 34 | "targetUserId": param.TargetUserId, | 35 | "targetUserId": param.TargetUserId, |
| 35 | - "types": domain.EvaluationSuper, | 36 | + "types": domain.EvaluationFinish, |
| 36 | }) | 37 | }) |
| 37 | if err != nil { | 38 | if err != nil { |
| 38 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 39 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 39 | } | 40 | } |
| 40 | - // 查找上级评估数据 | ||
| 41 | - // 如果没有就查找 360 或人资评估数据 | 41 | + if len(evaluationList) > 0 { |
| 42 | + _, evaluationValueList, err = evaluationValueRepo.Find(map[string]interface{}{"summaryEvaluationId": evaluationList[0].Id}) | ||
| 43 | + if err != nil { | ||
| 44 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + //如果没有评估考核结果,就获取上级评估的内容 | ||
| 48 | + if len(evaluationValueList) == 0 { | ||
| 49 | + _, evaluationList, err = evaluationRepo.Find(map[string]interface{}{ | ||
| 50 | + "limit": 1, | ||
| 51 | + "companyId": param.CompanyId, | ||
| 52 | + "cycleId": param.CycleId, | ||
| 53 | + "targetUserId": param.TargetUserId, | ||
| 54 | + "types": domain.EvaluationSuper, | ||
| 55 | + }) | ||
| 56 | + if err != nil { | ||
| 57 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 58 | + } | ||
| 59 | + if len(evaluationList) > 0 { | ||
| 60 | + _, evaluationValueList, err = evaluationValueRepo.Find(map[string]interface{}{"summaryEvaluationId": evaluationList[0].Id}) | ||
| 61 | + if err != nil { | ||
| 62 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + // 如果没有评估考核结果也没有上级评估的内容 | ||
| 67 | + // 就查找 360 或人资评估数据 | ||
| 42 | if len(evaluationList) == 0 { | 68 | if len(evaluationList) == 0 { |
| 43 | _, evaluationList, err = evaluationRepo.Find(map[string]interface{}{ | 69 | _, evaluationList, err = evaluationRepo.Find(map[string]interface{}{ |
| 44 | "limit": 500, | 70 | "limit": 500, |
| @@ -50,19 +76,18 @@ func (srv *SummaryEvaluationService) GetEvaluationShow1(param command.QueryEvalu | @@ -50,19 +76,18 @@ func (srv *SummaryEvaluationService) GetEvaluationShow1(param command.QueryEvalu | ||
| 50 | if err != nil { | 76 | if err != nil { |
| 51 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 77 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 52 | } | 78 | } |
| 79 | + evaluationIds := []int{} | ||
| 80 | + for _, val := range evaluationList { | ||
| 81 | + evaluationIds = append(evaluationIds, val.Id) | ||
| 82 | + } | ||
| 83 | + _, evaluationValueList, err = evaluationValueRepo.Find(map[string]interface{}{"summaryEvaluationIdList": evaluationIds}) | ||
| 84 | + if err != nil { | ||
| 85 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 86 | + } | ||
| 53 | } | 87 | } |
| 54 | if len(evaluationList) == 0 { | 88 | if len(evaluationList) == 0 { |
| 55 | return nil, application.ThrowError(application.BUSINESS_ERROR, "该人员没有上级评估、人资评估、360评估。") | 89 | return nil, application.ThrowError(application.BUSINESS_ERROR, "该人员没有上级评估、人资评估、360评估。") |
| 56 | } | 90 | } |
| 57 | - | ||
| 58 | - var evaluationIds []int64 | ||
| 59 | - for _, val := range evaluationList { | ||
| 60 | - evaluationIds = append(evaluationIds, int64(val.Id)) | ||
| 61 | - } | ||
| 62 | - _, evaluationValueList, err := evaluationValueRepo.Find(map[string]interface{}{"summaryEvaluationIdList": evaluationIds}) | ||
| 63 | - if err != nil { | ||
| 64 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 65 | - } | ||
| 66 | evaluationProjectId := evaluationList[0].EvaluationProjectId | 91 | evaluationProjectId := evaluationList[0].EvaluationProjectId |
| 67 | //获取所有题目 | 92 | //获取所有题目 |
| 68 | _, itemUsedList, err := itemUsedRepo.Find(map[string]interface{}{ | 93 | _, itemUsedList, err := itemUsedRepo.Find(map[string]interface{}{ |
-
请 注册 或 登录 后发表评论