作者 tangxvhui

更新评估状态值

@@ -1102,13 +1102,19 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma @@ -1102,13 +1102,19 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma
1102 } 1102 }
1103 } 1103 }
1104 //保存信息 1104 //保存信息
  1105 + hasValue := false //评估是否有填写值
1105 for i := range assessContentList { 1106 for i := range assessContentList {
1106 _, err = assessContentRepo.Save(assessContentList[i]) 1107 _, err = assessContentRepo.Save(assessContentList[i])
1107 if err != nil { 1108 if err != nil {
1108 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存评估填写内容"+err.Error()) 1109 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存评估填写内容"+err.Error())
1109 } 1110 }
  1111 + if len(assessContentList[i].Value) > 0 {
  1112 + hasValue = true
  1113 + }
  1114 + }
  1115 + if hasValue {
  1116 + assessData.Status = domain.StaffAssessCompleted
1110 } 1117 }
1111 - assessData.Status = domain.StaffAssessCompleted  
1112 assessData.UpdatedAt = time.Now() 1118 assessData.UpdatedAt = time.Now()
1113 _, err = assessReps.Save(assessData) 1119 _, err = assessReps.Save(assessData)
1114 if err != nil { 1120 if err != nil {
@@ -117,6 +117,7 @@ func (srv StaffAssessServeice) AssessTaskDescV2(param *query.AssessTaskDescV2Que @@ -117,6 +117,7 @@ func (srv StaffAssessServeice) AssessTaskDescV2(param *query.AssessTaskDescV2Que
117 BeginDay: assessTaskDataAny.BeginDay, 117 BeginDay: assessTaskDataAny.BeginDay,
118 StepList: []adapter.AssessTaskStep{}, 118 StepList: []adapter.AssessTaskStep{},
119 } 119 }
  120 + hasAssessSelf := false
120 121
121 for _, v := range assessTaskDataAny.StepList { 122 for _, v := range assessTaskDataAny.StepList {
122 stepItem := adapter.AssessTaskStep{ 123 stepItem := adapter.AssessTaskStep{
@@ -142,6 +143,7 @@ func (srv StaffAssessServeice) AssessTaskDescV2(param *query.AssessTaskDescV2Que @@ -142,6 +143,7 @@ func (srv StaffAssessServeice) AssessTaskDescV2(param *query.AssessTaskDescV2Que
142 return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error()) 143 return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
143 } 144 }
144 if len(assessSelfData) > 0 { 145 if len(assessSelfData) > 0 {
  146 + hasAssessSelf = true
145 stepItem.Status = string(assessSelfData[0].Status) 147 stepItem.Status = string(assessSelfData[0].Status)
146 } 148 }
147 stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime) 149 stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)
@@ -229,6 +231,13 @@ func (srv StaffAssessServeice) AssessTaskDescV2(param *query.AssessTaskDescV2Que @@ -229,6 +231,13 @@ func (srv StaffAssessServeice) AssessTaskDescV2(param *query.AssessTaskDescV2Que
229 sort.Slice(result.StepList, func(i, j int) bool { 231 sort.Slice(result.StepList, func(i, j int) bool {
230 return result.StepList[i].SortBy < result.StepList[j].SortBy 232 return result.StepList[i].SortBy < result.StepList[j].SortBy
231 }) 233 })
  234 + for i := range result.StepList {
  235 + if result.StepList[i].LinkNodeType == domain.LinkNodeAllInvite {
  236 + if !hasAssessSelf {
  237 + result.StepList[i].Status = ""
  238 + }
  239 + }
  240 + }
232 if err := transactionContext.CommitTransaction(); err != nil { 241 if err := transactionContext.CommitTransaction(); err != nil {
233 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 242 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
234 } 243 }
  1 +-- 数据修复 数据表summary_evaluation
  2 +-- 添加上级评估
  3 +INSERT INTO public.summary_evaluation (id, company_id, evaluation_project_id, evaluation_project_name, cycle_id, cycle_name, target_user, target_department, executor, "types", status, check_result, begin_time, end_time, total_score, created_at, updated_at, deleted_at, node_id, total_rating)
  4 + VALUES (DEFAULT, 1, 1632655294074982400, '鄢铃真0303', 1630442543739047936, '202303绩效考核', '{"userId": "3245763368183552", "account": "18650060951", "userName": "鄢铃真", "companyName": ""}'::jsonb, '[{"departmentId": "181", "departmentName": "人力行政部"}, {"departmentId": "60", "departmentName": "人资部"}, {"departmentId": "62", "departmentName": "行政部"}]'::jsonb, '{"userId": "3242583253399296", "account": "13400519725", "userName": "洪启帆", "companyName": ""}'::jsonb, 3, 'uncompleted', 'uncompleted', '2023-04-03 23:59:00.000', '2023-04-07 23:59:59.000 +0800', NULL, '2023-04-04 14:54:40.498', '2023-04-04 14:54:40.498', NULL, 1632653755742687233, NULL);
  5 +
  6 +-- 添加评估考核结果
  7 +INSERT INTO public.summary_evaluation (id, company_id, evaluation_project_id, evaluation_project_name, cycle_id, cycle_name, target_user, target_department, executor, "types", status, check_result, begin_time, end_time, total_score, created_at, updated_at, deleted_at, node_id, total_rating)
  8 + VALUES (DEFAULT, 1, 1632655294074982400, '鄢铃真0303', 1630442543739047936, '202303绩效考核', '{"userId": "3245763368183552", "account": "18650060951", "userName": "鄢铃真", "companyName": ""}'::jsonb, '[{"departmentId": "181", "departmentName": "人力行政部"}, {"departmentId": "60", "departmentName": "人资部"}, {"departmentId": "62", "departmentName": "行政部"}]'::jsonb, '{"userId": "", "account": "", "userName": "", "companyName": ""}'::jsonb, 5, 'uncompleted', 'uncompleted', '2023-04-07 23:59:00.000', '2023-04-09 23:59:00.000', NULL, '2023-04-04 14:54:40.498', '2023-04-04 14:54:40.498', NULL, 1632653755742687233, NULL);
  9 +
  10 +-- 去除人资评估
  11 +DELETE FROM public.summary_evaluation
  12 +WHERE id = 37