正在显示
2 个修改的文件
包含
35 行增加
和
8 行删除
@@ -603,17 +603,25 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(param *domain. | @@ -603,17 +603,25 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(param *domain. | ||
603 | if err != nil { | 603 | if err != nil { |
604 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 604 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
605 | } | 605 | } |
606 | + | ||
606 | nowTime := time.Now() | 607 | nowTime := time.Now() |
608 | + updatedId := []int{} | ||
607 | // 变更360评估/人资评估/上级评估的开始时间 | 609 | // 变更360评估/人资评估/上级评估的开始时间 |
608 | for _, v := range evaluationList { | 610 | for _, v := range evaluationList { |
609 | if v.BeginTime.After(nowTime) { | 611 | if v.BeginTime.After(nowTime) { |
610 | v.BeginTime = nowTime | 612 | v.BeginTime = nowTime |
613 | + updatedId = append(updatedId, v.Id) | ||
611 | } | 614 | } |
612 | - err = evaluationRepo.Save(v) | ||
613 | - if err != nil { | ||
614 | - return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
615 | - } | ||
616 | } | 615 | } |
616 | + evaluationDao := dao.NewSummaryEvaluationDao(map[string]interface{}{ | ||
617 | + "transactionContext": transactionContext, | ||
618 | + }) | ||
619 | + | ||
620 | + err = evaluationDao.UpdateBeginTime(updatedId, nowTime) | ||
621 | + if err != nil { | ||
622 | + return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
623 | + } | ||
624 | + | ||
617 | if err := transactionContext.CommitTransaction(); err != nil { | 625 | if err := transactionContext.CommitTransaction(); err != nil { |
618 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 626 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
619 | } | 627 | } |
@@ -666,15 +674,20 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(param *doma | @@ -666,15 +674,20 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(param *doma | ||
666 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 674 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
667 | } | 675 | } |
668 | nowTime := time.Now() | 676 | nowTime := time.Now() |
677 | + updatedId := []int{} | ||
669 | // 变更上级评估的开始时间 | 678 | // 变更上级评估的开始时间 |
670 | for _, v := range evaluationList { | 679 | for _, v := range evaluationList { |
671 | if v.BeginTime.After(nowTime) { | 680 | if v.BeginTime.After(nowTime) { |
672 | v.BeginTime = nowTime | 681 | v.BeginTime = nowTime |
682 | + updatedId = append(updatedId, v.Id) | ||
673 | } | 683 | } |
674 | - err = evaluationRepo.Save(v) | ||
675 | - if err != nil { | ||
676 | - return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
677 | - } | 684 | + } |
685 | + evaluationDao := dao.NewSummaryEvaluationDao(map[string]interface{}{ | ||
686 | + "transactionContext": transactionContext, | ||
687 | + }) | ||
688 | + err = evaluationDao.UpdateBeginTime(updatedId, nowTime) | ||
689 | + if err != nil { | ||
690 | + return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
678 | } | 691 | } |
679 | if err := transactionContext.CommitTransaction(); err != nil { | 692 | if err := transactionContext.CommitTransaction(); err != nil { |
680 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 693 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
@@ -134,3 +134,17 @@ func (d *SummaryEvaluationDao) CountTargetUserCycleList(executorId int, evaluati | @@ -134,3 +134,17 @@ func (d *SummaryEvaluationDao) CountTargetUserCycleList(executorId int, evaluati | ||
134 | _, err := tx.QueryOne(pg.Scan(&cnt), sqlStr, condition...) | 134 | _, err := tx.QueryOne(pg.Scan(&cnt), sqlStr, condition...) |
135 | return cnt, err | 135 | return cnt, err |
136 | } | 136 | } |
137 | + | ||
138 | +func (d *SummaryEvaluationDao) UpdateBeginTime(ids []int, beginTime time.Time) error { | ||
139 | + if len(ids) == 0 { | ||
140 | + return nil | ||
141 | + } | ||
142 | + sqlStr := `update summary_evaluation set begin_time =? | ||
143 | + where summary_evaluation.id in(?) ` | ||
144 | + condition := []interface{}{ | ||
145 | + beginTime, pg.In(ids), | ||
146 | + } | ||
147 | + tx := d.transactionContext.PgTx | ||
148 | + _, err := tx.ExecOne(sqlStr, condition...) | ||
149 | + return err | ||
150 | +} |
-
请 注册 或 登录 后发表评论