|
@@ -111,7 +111,7 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri |
|
@@ -111,7 +111,7 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri |
111
|
|
111
|
|
112
|
var cntAll360 int
|
112
|
var cntAll360 int
|
113
|
var cntUncompleted360 int
|
113
|
var cntUncompleted360 int
|
114
|
- //查找360评估,统计未完成的
|
114
|
+ //查找360评估,统计全部的
|
115
|
cntAll360, _, err = evaluationRepo.Find(map[string]interface{}{
|
115
|
cntAll360, _, err = evaluationRepo.Find(map[string]interface{}{
|
116
|
"types": int(domain.Evaluation360),
|
116
|
"types": int(domain.Evaluation360),
|
117
|
"executorId": param.UserId,
|
117
|
"executorId": param.UserId,
|
|
@@ -140,7 +140,7 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri |
|
@@ -140,7 +140,7 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri |
140
|
var cntAllSuper int
|
140
|
var cntAllSuper int
|
141
|
var cntUncompletedSuper int
|
141
|
var cntUncompletedSuper int
|
142
|
|
142
|
|
143
|
- //查询需要执行上级评估,统计未完成
|
143
|
+ //查询需要执行上级评估,全部的
|
144
|
cntAllSuper, _, err = evaluationRepo.Find(map[string]interface{}{
|
144
|
cntAllSuper, _, err = evaluationRepo.Find(map[string]interface{}{
|
145
|
"types": int(domain.EvaluationSuper),
|
145
|
"types": int(domain.EvaluationSuper),
|
146
|
"executorId": param.UserId,
|
146
|
"executorId": param.UserId,
|
|
@@ -169,7 +169,7 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri |
|
@@ -169,7 +169,7 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri |
169
|
var cntAllHrbp int
|
169
|
var cntAllHrbp int
|
170
|
var cntUncompletedHrbp int
|
170
|
var cntUncompletedHrbp int
|
171
|
|
171
|
|
172
|
- //查询需要执行人资评估,统计未完成
|
172
|
+ //查询需要执行人资评估,全部的
|
173
|
cntAllHrbp, _, err = evaluationRepo.Find(map[string]interface{}{
|
173
|
cntAllHrbp, _, err = evaluationRepo.Find(map[string]interface{}{
|
174
|
"types": int(domain.EvaluationHrbp),
|
174
|
"types": int(domain.EvaluationHrbp),
|
175
|
"limit": 1,
|
175
|
"limit": 1,
|
|
@@ -555,14 +555,7 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu |
|
@@ -555,14 +555,7 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu |
555
|
}
|
555
|
}
|
556
|
}
|
556
|
}
|
557
|
if !param.IsTemporary {
|
557
|
if !param.IsTemporary {
|
558
|
- if evaluationData.Status == domain.EvaluationUncompleted {
|
|
|
559
|
- err = srv.AfterCompletedEvaluationSelf(transactionContext, evaluationData)
|
|
|
560
|
- if err != nil {
|
|
|
561
|
- return nil, err
|
|
|
562
|
- }
|
|
|
563
|
- }
|
|
|
564
|
evaluationData.Status = domain.EvaluationCompleted
|
558
|
evaluationData.Status = domain.EvaluationCompleted
|
565
|
-
|
|
|
566
|
}
|
559
|
}
|
567
|
err = evaluationRepo.Save(evaluationData)
|
560
|
err = evaluationRepo.Save(evaluationData)
|
568
|
if err != nil {
|
561
|
if err != nil {
|
|
@@ -571,6 +564,13 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu |
|
@@ -571,6 +564,13 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu |
571
|
if err := transactionContext.CommitTransaction(); err != nil {
|
564
|
if err := transactionContext.CommitTransaction(); err != nil {
|
572
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
565
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
573
|
}
|
566
|
}
|
|
|
567
|
+ if !param.IsTemporary {
|
|
|
568
|
+ err = srv.AfterCompletedEvaluationSelf(evaluationData)
|
|
|
569
|
+ if err != nil {
|
|
|
570
|
+ return nil, err
|
|
|
571
|
+ }
|
|
|
572
|
+ }
|
|
|
573
|
+
|
574
|
itemValueAdapter := srv.buildSummaryItemValue(itemList, itemValueList)
|
574
|
itemValueAdapter := srv.buildSummaryItemValue(itemList, itemValueList)
|
575
|
return map[string][]adapter.EvaluationItemAdapter{
|
575
|
return map[string][]adapter.EvaluationItemAdapter{
|
576
|
"EvaluationItems": itemValueAdapter,
|
576
|
"EvaluationItems": itemValueAdapter,
|
|
@@ -580,7 +580,17 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu |
|
@@ -580,7 +580,17 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu |
580
|
// 员工提交自评内容后,
|
580
|
// 员工提交自评内容后,
|
581
|
// 员工作为被评估人,
|
581
|
// 员工作为被评估人,
|
582
|
// 变更360评估/人资评估/的开始时间
|
582
|
// 变更360评估/人资评估/的开始时间
|
583
|
-func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(transactionContext application.TransactionContext, param *domain.SummaryEvaluation) error {
|
583
|
+func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(param *domain.SummaryEvaluation) error {
|
|
|
584
|
+ transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
585
|
+ if err != nil {
|
|
|
586
|
+ return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
587
|
+ }
|
|
|
588
|
+ if err := transactionContext.StartTransaction(); err != nil {
|
|
|
589
|
+ return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
590
|
+ }
|
|
|
591
|
+ defer func() {
|
|
|
592
|
+ _ = transactionContext.RollbackTransaction()
|
|
|
593
|
+ }()
|
584
|
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
|
594
|
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
|
585
|
"transactionContext": transactionContext,
|
595
|
"transactionContext": transactionContext,
|
586
|
})
|
596
|
})
|
|
@@ -593,20 +603,37 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(transactionCon |
|
@@ -593,20 +603,37 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(transactionCon |
593
|
if err != nil {
|
603
|
if err != nil {
|
594
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
604
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
595
|
}
|
605
|
}
|
|
|
606
|
+ nowTime := time.Now()
|
596
|
// 变更360评估/人资评估/上级评估的开始时间
|
607
|
// 变更360评估/人资评估/上级评估的开始时间
|
597
|
for _, v := range evaluationList {
|
608
|
for _, v := range evaluationList {
|
598
|
- v.BeginTime = time.Now()
|
609
|
+ if v.BeginTime.After(nowTime) {
|
|
|
610
|
+ v.BeginTime = nowTime
|
|
|
611
|
+ }
|
599
|
err = evaluationRepo.Save(v)
|
612
|
err = evaluationRepo.Save(v)
|
600
|
if err != nil {
|
613
|
if err != nil {
|
601
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
614
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
602
|
}
|
615
|
}
|
603
|
}
|
616
|
}
|
|
|
617
|
+ if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
618
|
+ return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
619
|
+ }
|
604
|
return nil
|
620
|
return nil
|
605
|
}
|
621
|
}
|
606
|
|
622
|
|
607
|
// 被评估员工的人资评估 或者 360 评估,
|
623
|
// 被评估员工的人资评估 或者 360 评估,
|
608
|
// 变更上级评估的开始时间
|
624
|
// 变更上级评估的开始时间
|
609
|
-func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(transactionContext application.TransactionContext, param *domain.SummaryEvaluation) error {
|
625
|
+func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(param *domain.SummaryEvaluation) error {
|
|
|
626
|
+ transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
627
|
+ if err != nil {
|
|
|
628
|
+ return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
629
|
+ }
|
|
|
630
|
+ if err := transactionContext.StartTransaction(); err != nil {
|
|
|
631
|
+ return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
632
|
+ }
|
|
|
633
|
+ defer func() {
|
|
|
634
|
+ _ = transactionContext.RollbackTransaction()
|
|
|
635
|
+ }()
|
|
|
636
|
+
|
610
|
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
|
637
|
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
|
611
|
"transactionContext": transactionContext,
|
638
|
"transactionContext": transactionContext,
|
612
|
})
|
639
|
})
|
|
@@ -638,14 +665,20 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(transaction |
|
@@ -638,14 +665,20 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(transaction |
638
|
if err != nil {
|
665
|
if err != nil {
|
639
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
666
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
640
|
}
|
667
|
}
|
|
|
668
|
+ nowTime := time.Now()
|
641
|
// 变更上级评估的开始时间
|
669
|
// 变更上级评估的开始时间
|
642
|
for _, v := range evaluationList {
|
670
|
for _, v := range evaluationList {
|
643
|
- v.BeginTime = time.Now()
|
671
|
+ if v.BeginTime.After(nowTime) {
|
|
|
672
|
+ v.BeginTime = nowTime
|
|
|
673
|
+ }
|
644
|
err = evaluationRepo.Save(v)
|
674
|
err = evaluationRepo.Save(v)
|
645
|
if err != nil {
|
675
|
if err != nil {
|
646
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
676
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
647
|
}
|
677
|
}
|
648
|
}
|
678
|
}
|
|
|
679
|
+ if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
680
|
+ return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
681
|
+ }
|
649
|
return nil
|
682
|
return nil
|
650
|
}
|
683
|
}
|
651
|
|
684
|
|