作者 tangxvhui

更新评估状态值

... ... @@ -1102,13 +1102,19 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma
}
}
//保存信息
hasValue := false //评估是否有填写值
for i := range assessContentList {
_, err = assessContentRepo.Save(assessContentList[i])
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存评估填写内容"+err.Error())
}
if len(assessContentList[i].Value) > 0 {
hasValue = true
}
}
if hasValue {
assessData.Status = domain.StaffAssessCompleted
}
assessData.Status = domain.StaffAssessCompleted
assessData.UpdatedAt = time.Now()
_, err = assessReps.Save(assessData)
if err != nil {
... ...
... ... @@ -117,6 +117,7 @@ func (srv StaffAssessServeice) AssessTaskDescV2(param *query.AssessTaskDescV2Que
BeginDay: assessTaskDataAny.BeginDay,
StepList: []adapter.AssessTaskStep{},
}
hasAssessSelf := false
for _, v := range assessTaskDataAny.StepList {
stepItem := adapter.AssessTaskStep{
... ... @@ -142,6 +143,7 @@ func (srv StaffAssessServeice) AssessTaskDescV2(param *query.AssessTaskDescV2Que
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
}
if len(assessSelfData) > 0 {
hasAssessSelf = true
stepItem.Status = string(assessSelfData[0].Status)
}
stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)
... ... @@ -229,6 +231,13 @@ func (srv StaffAssessServeice) AssessTaskDescV2(param *query.AssessTaskDescV2Que
sort.Slice(result.StepList, func(i, j int) bool {
return result.StepList[i].SortBy < result.StepList[j].SortBy
})
for i := range result.StepList {
if result.StepList[i].LinkNodeType == domain.LinkNodeAllInvite {
if !hasAssessSelf {
result.StepList[i].Status = ""
}
}
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
... ...
-- 数据修复 数据表summary_evaluation
-- 添加上级评估
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)
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);
-- 添加评估考核结果
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)
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);
-- 去除人资评估
DELETE FROM public.summary_evaluation
WHERE id = 37
... ...