作者 tangxvhui

调整人资稽查详情数据的获取

@@ -25,8 +25,27 @@ func (srv *SummaryEvaluationService) GetEvaluationShow1(param command.QueryEvalu @@ -25,8 +25,27 @@ 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
  31 + _, evaluationList, err = evaluationRepo.Find(map[string]interface{}{
  32 + "limit": 1,
  33 + "companyId": param.CompanyId,
  34 + "cycleId": param.CycleId,
  35 + "targetUserId": param.TargetUserId,
  36 + "types": domain.EvaluationFinish,
  37 + })
  38 + if err != nil {
  39 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  40 + }
  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 {
30 _, evaluationList, err = evaluationRepo.Find(map[string]interface{}{ 49 _, evaluationList, err = evaluationRepo.Find(map[string]interface{}{
31 "limit": 1, 50 "limit": 1,
32 "companyId": param.CompanyId, 51 "companyId": param.CompanyId,
@@ -37,8 +56,15 @@ func (srv *SummaryEvaluationService) GetEvaluationShow1(param command.QueryEvalu @@ -37,8 +56,15 @@ func (srv *SummaryEvaluationService) GetEvaluationShow1(param command.QueryEvalu
37 if err != nil { 56 if err != nil {
38 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 57 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
39 } 58 }
40 - // 查找上级评估数据  
41 - // 如果没有就查找 360 或人资评估数据 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 }
53 - }  
54 - if len(evaluationList) == 0 {  
55 - return nil, application.ThrowError(application.BUSINESS_ERROR, "该人员没有上级评估、人资评估、360评估。")  
56 - }  
57 -  
58 - var evaluationIds []int64 79 + evaluationIds := []int{}
59 for _, val := range evaluationList { 80 for _, val := range evaluationList {
60 - evaluationIds = append(evaluationIds, int64(val.Id)) 81 + evaluationIds = append(evaluationIds, val.Id)
61 } 82 }
62 - _, evaluationValueList, err := evaluationValueRepo.Find(map[string]interface{}{"summaryEvaluationIdList": evaluationIds}) 83 + _, evaluationValueList, err = evaluationValueRepo.Find(map[string]interface{}{"summaryEvaluationIdList": evaluationIds})
63 if err != nil { 84 if err != nil {
64 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 85 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
65 } 86 }
  87 + }
  88 + if len(evaluationList) == 0 {
  89 + return nil, application.ThrowError(application.BUSINESS_ERROR, "该人员没有上级评估、人资评估、360评估。")
  90 + }
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{}{