作者 tangxvhui

调整 人资稽查编辑逻辑

@@ -3,6 +3,7 @@ package service @@ -3,6 +3,7 @@ package service
3 import ( 3 import (
4 "github.com/linmadan/egglib-go/core/application" 4 "github.com/linmadan/egglib-go/core/application"
5 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" 5 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
  6 + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/adapter"
6 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/command" 7 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/command"
7 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" 8 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
8 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/xredis" 9 "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/xredis"
@@ -81,13 +82,17 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit @@ -81,13 +82,17 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit
81 newHrbpItemValueList := []*domain.SummaryEvaluationValue{} 82 newHrbpItemValueList := []*domain.SummaryEvaluationValue{}
82 //新的360评估填写值 SummaryEvaluation.Executor.UserId => []*domain.SummaryEvaluationValue 83 //新的360评估填写值 SummaryEvaluation.Executor.UserId => []*domain.SummaryEvaluationValue
83 new360ItemValueList := map[int][]*domain.SummaryEvaluationValue{} 84 new360ItemValueList := map[int][]*domain.SummaryEvaluationValue{}
  85 +
  86 + newItemValueList := []*domain.SummaryEvaluationValue{}
84 for _, val := range itemUsedList { 87 for _, val := range itemUsedList {
  88 + temp := domain.SummaryEvaluationValue{}
85 if evaluationSuper != nil { 89 if evaluationSuper != nil {
86 newItemValue := domain.SummaryEvaluationValue{} 90 newItemValue := domain.SummaryEvaluationValue{}
87 newItemValue.SetBlankValue(evaluationSuper, val) 91 newItemValue.SetBlankValue(evaluationSuper, val)
88 newItemValue.Remark = itemValueParam[val.Id].Remark 92 newItemValue.Remark = itemValueParam[val.Id].Remark
89 evaluationSuper.FillItemValue(val, &newItemValue, itemValueParam[val.Id].Value) 93 evaluationSuper.FillItemValue(val, &newItemValue, itemValueParam[val.Id].Value)
90 newSuperItemValueList = append(newSuperItemValueList, &newItemValue) 94 newSuperItemValueList = append(newSuperItemValueList, &newItemValue)
  95 + temp = newItemValue
91 } 96 }
92 if evalutionHrbp != nil && val.EvaluatorId == -1 { 97 if evalutionHrbp != nil && val.EvaluatorId == -1 {
93 newItemValue := domain.SummaryEvaluationValue{} 98 newItemValue := domain.SummaryEvaluationValue{}
@@ -95,6 +100,7 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit @@ -95,6 +100,7 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit
95 newItemValue.Remark = itemValueParam[val.Id].Remark 100 newItemValue.Remark = itemValueParam[val.Id].Remark
96 evalutionHrbp.FillItemValue(val, &newItemValue, itemValueParam[val.Id].Value) 101 evalutionHrbp.FillItemValue(val, &newItemValue, itemValueParam[val.Id].Value)
97 newHrbpItemValueList = append(newHrbpItemValueList, &newItemValue) 102 newHrbpItemValueList = append(newHrbpItemValueList, &newItemValue)
  103 + temp = newItemValue
98 } 104 }
99 if val.EvaluatorId > 0 { 105 if val.EvaluatorId > 0 {
100 evaluation360, ok := evaluation360Map[val.EvaluatorId] 106 evaluation360, ok := evaluation360Map[val.EvaluatorId]
@@ -109,8 +115,10 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit @@ -109,8 +115,10 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit
109 evaluation360.FillItemValue(val, &newItemValue, itemValueParam[val.Id].Value) 115 evaluation360.FillItemValue(val, &newItemValue, itemValueParam[val.Id].Value)
110 itemValue360List = append(itemValue360List, &newItemValue) 116 itemValue360List = append(itemValue360List, &newItemValue)
111 new360ItemValueList[evaluation360.Executor.UserId] = itemValue360List 117 new360ItemValueList[evaluation360.Executor.UserId] = itemValue360List
  118 + temp = newItemValue
112 } 119 }
113 } 120 }
  121 + newItemValueList = append(newItemValueList, &temp)
114 } 122 }
115 // 处理上级评估 123 // 处理上级评估
116 if evaluationSuper != nil { 124 if evaluationSuper != nil {
@@ -120,6 +128,10 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit @@ -120,6 +128,10 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit
120 if err != nil { 128 if err != nil {
121 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 129 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
122 } 130 }
  131 + err = evaluationRepo.Save(evaluationSuper)
  132 + if err != nil {
  133 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  134 + }
123 for _, val := range newSuperItemValueList { 135 for _, val := range newSuperItemValueList {
124 err = itemValueRepo.Save(val) 136 err = itemValueRepo.Save(val)
125 if err != nil { 137 if err != nil {
@@ -135,6 +147,10 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit @@ -135,6 +147,10 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit
135 if err != nil { 147 if err != nil {
136 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 148 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
137 } 149 }
  150 + err = evaluationRepo.Save(evalutionHrbp)
  151 + if err != nil {
  152 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  153 + }
138 for _, val := range newHrbpItemValueList { 154 for _, val := range newHrbpItemValueList {
139 err = itemValueRepo.Save(val) 155 err = itemValueRepo.Save(val)
140 if err != nil { 156 if err != nil {
@@ -150,6 +166,10 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit @@ -150,6 +166,10 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit
150 if err != nil { 166 if err != nil {
151 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 167 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
152 } 168 }
  169 + err = evaluationRepo.Save(val)
  170 + if err != nil {
  171 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  172 + }
153 for _, val := range new360ItemValueList[key] { 173 for _, val := range new360ItemValueList[key] {
154 err = itemValueRepo.Save(val) 174 err = itemValueRepo.Save(val)
155 if err != nil { 175 if err != nil {
@@ -160,6 +180,8 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit @@ -160,6 +180,8 @@ func (srv *SummaryEvaluationService) EditEvaluationByHrCheck(param *command.Edit
160 if err := transactionContext.CommitTransaction(); err != nil { 180 if err := transactionContext.CommitTransaction(); err != nil {
161 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 181 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
162 } 182 }
163 -  
164 - return nil, nil 183 + itemValueAdapter := srv.buildSummaryItemValue(itemUsedList, newItemValueList)
  184 + return map[string][]adapter.EvaluationItemAdapter{
  185 + "EvaluationItems": itemValueAdapter,
  186 + }, nil
165 } 187 }