正在显示
6 个修改的文件
包含
24 行增加
和
6 行删除
@@ -5,6 +5,7 @@ type EditEvaluationValue struct { | @@ -5,6 +5,7 @@ type EditEvaluationValue struct { | ||
5 | ExecutorId int `json:"-"` // 执行人id | 5 | ExecutorId int `json:"-"` // 执行人id |
6 | CompanyId int `json:"-"` // 公司id | 6 | CompanyId int `json:"-"` // 公司id |
7 | EvaluationItems []UpdatedItemValue `json:"evaluationItems"` | 7 | EvaluationItems []UpdatedItemValue `json:"evaluationItems"` |
8 | + IsTemporary bool `json:"isTemporary"` //是否是临时提交 | ||
8 | } | 9 | } |
9 | 10 | ||
10 | type UpdatedItemValue struct { | 11 | type UpdatedItemValue struct { |
@@ -465,11 +465,13 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu | @@ -465,11 +465,13 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu | ||
465 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 465 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
466 | } | 466 | } |
467 | 467 | ||
468 | - err = srv.editEvaluationValue(evaluationData, &itemValueList, itemList, param.EvaluationItems, nil) | 468 | + err = srv.editEvaluationValue(evaluationData, &itemValueList, itemList, param.EvaluationItems, nil, param.IsTemporary) |
469 | if err != nil { | 469 | if err != nil { |
470 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 470 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
471 | } | 471 | } |
472 | + if !param.IsTemporary { | ||
472 | evaluationData.Status = domain.EvaluationCompleted | 473 | evaluationData.Status = domain.EvaluationCompleted |
474 | + } | ||
473 | //保存填写值 | 475 | //保存填写值 |
474 | for _, v := range itemValueList { | 476 | for _, v := range itemValueList { |
475 | err = itemValueRepo.Save(v) | 477 | err = itemValueRepo.Save(v) |
@@ -801,12 +803,14 @@ func (srv *SummaryEvaluationService) EditEvaluationSuper(param *command.EditEval | @@ -801,12 +803,14 @@ func (srv *SummaryEvaluationService) EditEvaluationSuper(param *command.EditEval | ||
801 | return nil, err | 803 | return nil, err |
802 | } | 804 | } |
803 | 805 | ||
804 | - err = srv.editEvaluationValue(evaluationData, &itemValueList, itemList, param.EvaluationItems, hrbpOr360ItemValue) | 806 | + err = srv.editEvaluationValue(evaluationData, &itemValueList, itemList, param.EvaluationItems, hrbpOr360ItemValue, param.IsTemporary) |
805 | if err != nil { | 807 | if err != nil { |
806 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 808 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
807 | } | 809 | } |
810 | + if !param.IsTemporary { | ||
808 | //变更评估状态为已填写 | 811 | //变更评估状态为已填写 |
809 | evaluationData.Status = domain.EvaluationCompleted | 812 | evaluationData.Status = domain.EvaluationCompleted |
813 | + } | ||
810 | for _, v := range itemValueList { | 814 | for _, v := range itemValueList { |
811 | //保存填写值 | 815 | //保存填写值 |
812 | err = itemValueRepo.Save(v) | 816 | err = itemValueRepo.Save(v) |
@@ -1337,6 +1341,7 @@ func (srv *SummaryEvaluationService) editEvaluationValue( | @@ -1337,6 +1341,7 @@ func (srv *SummaryEvaluationService) editEvaluationValue( | ||
1337 | evaluationItems []*domain.EvaluationItemUsed, | 1341 | evaluationItems []*domain.EvaluationItemUsed, |
1338 | updatedValue []command.UpdatedItemValue, | 1342 | updatedValue []command.UpdatedItemValue, |
1339 | defaultItemValue []*domain.SummaryEvaluationValue, | 1343 | defaultItemValue []*domain.SummaryEvaluationValue, |
1344 | + IsTemporary bool, | ||
1340 | ) error { | 1345 | ) error { |
1341 | evaluationItemMap := map[int]*domain.EvaluationItemUsed{} | 1346 | evaluationItemMap := map[int]*domain.EvaluationItemUsed{} |
1342 | evaluationValueMap := map[int]*domain.SummaryEvaluationValue{} | 1347 | evaluationValueMap := map[int]*domain.SummaryEvaluationValue{} |
@@ -1344,6 +1349,9 @@ func (srv *SummaryEvaluationService) editEvaluationValue( | @@ -1344,6 +1349,9 @@ func (srv *SummaryEvaluationService) editEvaluationValue( | ||
1344 | for _, v := range evaluationItems { | 1349 | for _, v := range evaluationItems { |
1345 | newValue := &domain.SummaryEvaluationValue{} | 1350 | newValue := &domain.SummaryEvaluationValue{} |
1346 | newValue.SetBlankValue(evaluationData, v) | 1351 | newValue.SetBlankValue(evaluationData, v) |
1352 | + if IsTemporary { | ||
1353 | + newValue.IsTemporary = 1 | ||
1354 | + } | ||
1347 | evaluationValueMap[v.Id] = newValue | 1355 | evaluationValueMap[v.Id] = newValue |
1348 | evaluationItemMap[v.Id] = v | 1356 | evaluationItemMap[v.Id] = v |
1349 | //重置计数 | 1357 | //重置计数 |
@@ -390,12 +390,15 @@ func (srv *SummaryEvaluationService) EditEvaluation360(param *command.EditEvalua | @@ -390,12 +390,15 @@ func (srv *SummaryEvaluationService) EditEvaluation360(param *command.EditEvalua | ||
390 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 390 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
391 | } | 391 | } |
392 | 392 | ||
393 | - err = srv.editEvaluationValue(summaryEvaluation, &itemValueList, itemList, param.EvaluationItems, nil) | 393 | + err = srv.editEvaluationValue(summaryEvaluation, &itemValueList, itemList, param.EvaluationItems, nil, param.IsTemporary) |
394 | if err != nil { | 394 | if err != nil { |
395 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 395 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
396 | } | 396 | } |
397 | - | 397 | + if !param.IsTemporary { |
398 | + //变更评估状态为已填写 | ||
398 | summaryEvaluation.Status = domain.EvaluationCompleted | 399 | summaryEvaluation.Status = domain.EvaluationCompleted |
400 | + } | ||
401 | + | ||
399 | //保存填写值 | 402 | //保存填写值 |
400 | for _, v := range itemValueList { | 403 | for _, v := range itemValueList { |
401 | err = itemValueRepo.Save(v) | 404 | err = itemValueRepo.Save(v) |
@@ -702,12 +705,14 @@ func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvalu | @@ -702,12 +705,14 @@ func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvalu | ||
702 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 705 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
703 | } | 706 | } |
704 | 707 | ||
705 | - err = srv.editEvaluationValue(summaryEvaluation, &itemValueList, itemList, param.EvaluationItems, nil) | 708 | + err = srv.editEvaluationValue(summaryEvaluation, &itemValueList, itemList, param.EvaluationItems, nil, param.IsTemporary) |
706 | if err != nil { | 709 | if err != nil { |
707 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 710 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
708 | } | 711 | } |
709 | - | 712 | + if !param.IsTemporary { |
713 | + //变更评估状态为已填写 | ||
710 | summaryEvaluation.Status = domain.EvaluationCompleted | 714 | summaryEvaluation.Status = domain.EvaluationCompleted |
715 | + } | ||
711 | //保存填写值 | 716 | //保存填写值 |
712 | for _, v := range itemValueList { | 717 | for _, v := range itemValueList { |
713 | err = itemValueRepo.Save(v) | 718 | err = itemValueRepo.Save(v) |
@@ -19,6 +19,7 @@ type SummaryEvaluationValue struct { | @@ -19,6 +19,7 @@ type SummaryEvaluationValue struct { | ||
19 | Rating RatingLevel `json:"rating"` //评级时的填写值 | 19 | Rating RatingLevel `json:"rating"` //评级时的填写值 |
20 | CreatedAt time.Time `json:"createdAt"` //数据创建时间 | 20 | CreatedAt time.Time `json:"createdAt"` //数据创建时间 |
21 | UpdatedAt time.Time `json:"updatedAt"` //数据更新时间 | 21 | UpdatedAt time.Time `json:"updatedAt"` //数据更新时间 |
22 | + IsTemporary int `json:"IsTemporary"` // 0-正式数据 1-临时提交的数据 | ||
22 | } | 23 | } |
23 | 24 | ||
24 | type SummaryEvaluationValueRepository interface { | 25 | type SummaryEvaluationValueRepository interface { |
@@ -20,4 +20,5 @@ type SummaryEvaluationValue struct { | @@ -20,4 +20,5 @@ type SummaryEvaluationValue struct { | ||
20 | Remark string //填写的内容反馈 | 20 | Remark string //填写的内容反馈 |
21 | CreatedAt time.Time //数据创建时间 | 21 | CreatedAt time.Time //数据创建时间 |
22 | UpdatedAt time.Time //数据更新时间 | 22 | UpdatedAt time.Time //数据更新时间 |
23 | + IsTemporary int `pg:",use_zero"` // 0-正式数据 1-临时提交的数据 | ||
23 | } | 24 | } |
@@ -34,6 +34,7 @@ func (repo *SummaryEvaluationValueRepository) TransformToDomain(d *models.Summar | @@ -34,6 +34,7 @@ func (repo *SummaryEvaluationValueRepository) TransformToDomain(d *models.Summar | ||
34 | Rating: d.Rating, | 34 | Rating: d.Rating, |
35 | CreatedAt: d.CreatedAt, | 35 | CreatedAt: d.CreatedAt, |
36 | UpdatedAt: d.UpdatedAt, | 36 | UpdatedAt: d.UpdatedAt, |
37 | + IsTemporary: d.IsTemporary, | ||
37 | } | 38 | } |
38 | } | 39 | } |
39 | 40 | ||
@@ -50,6 +51,7 @@ func (repo *SummaryEvaluationValueRepository) Save(param *domain.SummaryEvaluati | @@ -50,6 +51,7 @@ func (repo *SummaryEvaluationValueRepository) Save(param *domain.SummaryEvaluati | ||
50 | Remark: param.Remark, | 51 | Remark: param.Remark, |
51 | CreatedAt: param.CreatedAt, | 52 | CreatedAt: param.CreatedAt, |
52 | UpdatedAt: param.UpdatedAt, | 53 | UpdatedAt: param.UpdatedAt, |
54 | + IsTemporary: param.IsTemporary, | ||
53 | } | 55 | } |
54 | db := repo.transactionContext.PgTx | 56 | db := repo.transactionContext.PgTx |
55 | if m.Id == 0 { | 57 | if m.Id == 0 { |
-
请 注册 或 登录 后发表评论