|
@@ -200,11 +200,12 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri |
|
@@ -200,11 +200,12 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri |
200
|
}
|
200
|
}
|
201
|
|
201
|
|
202
|
//查找当前周期,我的考核结果
|
202
|
//查找当前周期,我的考核结果
|
203
|
- _, myEvaluationSuper, _ := evaluationRepo.Find(map[string]interface{}{
|
|
|
204
|
- "types": int(domain.EvaluationSuper),
|
203
|
+ _, myEvaluationFinish, _ := evaluationRepo.Find(map[string]interface{}{
|
|
|
204
|
+ "types": int(domain.EvaluationFinish),
|
205
|
"limit": 1,
|
205
|
"limit": 1,
|
206
|
"targetUserId": param.UserId,
|
206
|
"targetUserId": param.UserId,
|
207
|
"cycleId": param.CycleId,
|
207
|
"cycleId": param.CycleId,
|
|
|
208
|
+ "beginTime": time.Now(),
|
208
|
})
|
209
|
})
|
209
|
|
210
|
|
210
|
if err := transactionContext.CommitTransaction(); err != nil {
|
211
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
@@ -243,15 +244,13 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri |
|
@@ -243,15 +244,13 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri |
243
|
}
|
244
|
}
|
244
|
menu1.Child = append(menu1.Child, menu1_1)
|
245
|
menu1.Child = append(menu1.Child, menu1_1)
|
245
|
}
|
246
|
}
|
246
|
- if len(myEvaluationSuper) > 0 {
|
|
|
247
|
- if myEvaluationSuper[0].CheckResult == domain.EvaluationCheckCompleted {
|
247
|
+ if len(myEvaluationFinish) > 0 {
|
|
|
248
|
+ if myEvaluationFinish[0].CheckResult == domain.EvaluationCheckCompleted {
|
248
|
menu1_2.StatusName = "已完成"
|
249
|
menu1_2.StatusName = "已完成"
|
249
|
} else {
|
250
|
} else {
|
250
|
menu1_2.StatusName = "未完成"
|
251
|
menu1_2.StatusName = "未完成"
|
251
|
}
|
252
|
}
|
252
|
- if myEvaluationSuper[0].Status == domain.EvaluationCompleted {
|
|
|
253
|
- menu1.Child = append(menu1.Child, menu1_2)
|
|
|
254
|
- }
|
253
|
+ menu1.Child = append(menu1.Child, menu1_2)
|
255
|
}
|
254
|
}
|
256
|
|
255
|
|
257
|
if len(selfEvaluation) > 0 {
|
256
|
if len(selfEvaluation) > 0 {
|
|
@@ -670,18 +669,14 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(param *domain. |
|
@@ -670,18 +669,14 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(param *domain. |
670
|
if err != nil {
|
669
|
if err != nil {
|
671
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
670
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
672
|
}
|
671
|
}
|
673
|
- if len(evaluationList) == 0 {
|
|
|
674
|
- // 获取考核结果阶段
|
|
|
675
|
- finishEvaluation := *param
|
|
|
676
|
- finishEvaluation.BeginTime = time.Now()
|
|
|
677
|
- finishEvaluation.CreatedAt = time.Now()
|
|
|
678
|
- finishEvaluation.UpdatedAt = time.Now()
|
|
|
679
|
- finishEvaluation.Executor = domain.StaffDesc{}
|
|
|
680
|
- finishEvaluation.Id = 0
|
|
|
681
|
- finishEvaluation.Types = domain.EvaluationFinish
|
|
|
682
|
- err = evaluationRepo.Save(&finishEvaluation)
|
|
|
683
|
- if err != nil {
|
|
|
684
|
- return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error())
|
672
|
+ if len(evaluationList) > 0 {
|
|
|
673
|
+ // 进入考核结果阶段
|
|
|
674
|
+ if evaluationList[0].BeginTime.After(nowTime) {
|
|
|
675
|
+ evaluationList[0].BeginTime = nowTime
|
|
|
676
|
+ err = evaluationRepo.Save(evaluationList[0])
|
|
|
677
|
+ if err != nil {
|
|
|
678
|
+ return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error())
|
|
|
679
|
+ }
|
685
|
}
|
680
|
}
|
686
|
}
|
681
|
}
|
687
|
}
|
682
|
}
|
|
@@ -773,19 +768,13 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(param *doma |
|
@@ -773,19 +768,13 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(param *doma |
773
|
if err != nil {
|
768
|
if err != nil {
|
774
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
769
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
775
|
}
|
770
|
}
|
776
|
- if len(evaluationList) == 0 {
|
|
|
777
|
- finishEvaluation := *param
|
|
|
778
|
- finishEvaluation.BeginTime = time.Now()
|
|
|
779
|
- finishEvaluation.CreatedAt = time.Now()
|
|
|
780
|
- finishEvaluation.UpdatedAt = time.Now()
|
|
|
781
|
- finishEvaluation.Executor = domain.StaffDesc{}
|
|
|
782
|
- finishEvaluation.Id = 0
|
|
|
783
|
- finishEvaluation.Types = domain.EvaluationFinish
|
|
|
784
|
- finishEvaluation.TotalScore = ""
|
|
|
785
|
- finishEvaluation.TotalRating = []domain.RatingCodeNumber{}
|
|
|
786
|
- err = evaluationRepo.Save(&finishEvaluation)
|
|
|
787
|
- if err != nil {
|
|
|
788
|
- return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error())
|
771
|
+ if len(evaluationList) > 0 {
|
|
|
772
|
+ if evaluationList[0].BeginTime.After(nowTime) {
|
|
|
773
|
+ evaluationList[0].BeginTime = nowTime
|
|
|
774
|
+ err = evaluationRepo.Save(evaluationList[0])
|
|
|
775
|
+ if err != nil {
|
|
|
776
|
+ return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error())
|
|
|
777
|
+ }
|
789
|
}
|
778
|
}
|
790
|
}
|
779
|
}
|
791
|
}
|
780
|
}
|
|
@@ -795,7 +784,7 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(param *doma |
|
@@ -795,7 +784,7 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(param *doma |
795
|
return nil
|
784
|
return nil
|
796
|
}
|
785
|
}
|
797
|
|
786
|
|
798
|
-// 员工提交上级评估
|
787
|
+// 员工提交上级评估后
|
799
|
// 生成考核结果
|
788
|
// 生成考核结果
|
800
|
func (srv *SummaryEvaluationService) AfterCompletedEvaluationSuper(param *domain.SummaryEvaluation) error {
|
789
|
func (srv *SummaryEvaluationService) AfterCompletedEvaluationSuper(param *domain.SummaryEvaluation) error {
|
801
|
lock := xredis.NewLockSummaryEvaluation(param.TargetUser.UserId)
|
790
|
lock := xredis.NewLockSummaryEvaluation(param.TargetUser.UserId)
|
|
@@ -831,19 +820,14 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSuper(param *domain |
|
@@ -831,19 +820,14 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSuper(param *domain |
831
|
if err != nil {
|
820
|
if err != nil {
|
832
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
821
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
833
|
}
|
822
|
}
|
834
|
- if len(evaluationList) == 0 {
|
|
|
835
|
- finishEvaluation := *param
|
|
|
836
|
- finishEvaluation.BeginTime = time.Now()
|
|
|
837
|
- finishEvaluation.CreatedAt = time.Now()
|
|
|
838
|
- finishEvaluation.UpdatedAt = time.Now()
|
|
|
839
|
- finishEvaluation.Executor = domain.StaffDesc{}
|
|
|
840
|
- finishEvaluation.Id = 0
|
|
|
841
|
- finishEvaluation.Types = domain.EvaluationFinish
|
|
|
842
|
- finishEvaluation.TotalScore = ""
|
|
|
843
|
- finishEvaluation.TotalRating = []domain.RatingCodeNumber{}
|
|
|
844
|
- err = evaluationRepo.Save(&finishEvaluation)
|
|
|
845
|
- if err != nil {
|
|
|
846
|
- return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error())
|
823
|
+ nowTime := time.Now()
|
|
|
824
|
+ if len(evaluationList) > 0 {
|
|
|
825
|
+ if evaluationList[0].BeginTime.After(nowTime) {
|
|
|
826
|
+ evaluationList[0].BeginTime = nowTime
|
|
|
827
|
+ err = evaluationRepo.Save(evaluationList[0])
|
|
|
828
|
+ if err != nil {
|
|
|
829
|
+ return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error())
|
|
|
830
|
+ }
|
847
|
}
|
831
|
}
|
848
|
}
|
832
|
}
|
849
|
if err := transactionContext.CommitTransaction(); err != nil {
|
833
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
@@ -1609,8 +1593,12 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command |
|
@@ -1609,8 +1593,12 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command |
1609
|
return &result, nil
|
1593
|
return &result, nil
|
1610
|
}
|
1594
|
}
|
1611
|
|
1595
|
|
1612
|
-// 获取周期综合评估下,周期评估列表
|
|
|
1613
|
func (srv *SummaryEvaluationService) ListAllEvaluationSuper(param *command.QueryEvaluationList) (map[string]interface{}, error) {
|
1596
|
func (srv *SummaryEvaluationService) ListAllEvaluationSuper(param *command.QueryEvaluationList) (map[string]interface{}, error) {
|
|
|
1597
|
+ return nil, nil
|
|
|
1598
|
+}
|
|
|
1599
|
+
|
|
|
1600
|
+// 按周期获取所有员工的评估考核结果
|
|
|
1601
|
+func (srv *SummaryEvaluationService) ListAllEvaluationFinish(param *command.QueryEvaluationList) (map[string]interface{}, error) {
|
1614
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
1602
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
1615
|
if err != nil {
|
1603
|
if err != nil {
|
1616
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
1604
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
@@ -1654,7 +1642,7 @@ func (srv *SummaryEvaluationService) ListAllEvaluationSuper(param *command.Query |
|
@@ -1654,7 +1642,7 @@ func (srv *SummaryEvaluationService) ListAllEvaluationSuper(param *command.Query |
1654
|
//获取评估列表信息
|
1642
|
//获取评估列表信息
|
1655
|
condition1 := map[string]interface{}{
|
1643
|
condition1 := map[string]interface{}{
|
1656
|
"cycleId": param.CycleId,
|
1644
|
"cycleId": param.CycleId,
|
1657
|
- "types": int(domain.EvaluationSuper),
|
1645
|
+ "types": int(domain.EvaluationFinish),
|
1658
|
"limit": limit,
|
1646
|
"limit": limit,
|
1659
|
"beginTime": time.Now(),
|
1647
|
"beginTime": time.Now(),
|
1660
|
}
|
1648
|
}
|
|
@@ -1755,12 +1743,14 @@ func (srv *SummaryEvaluationService) editEvaluationValue( |
|
@@ -1755,12 +1743,14 @@ func (srv *SummaryEvaluationService) editEvaluationValue( |
1755
|
}
|
1743
|
}
|
1756
|
evaluationItemMap := map[int]*domain.EvaluationItemUsed{}
|
1744
|
evaluationItemMap := map[int]*domain.EvaluationItemUsed{}
|
1757
|
evaluationValueMap := map[int]*domain.SummaryEvaluationValue{}
|
1745
|
evaluationValueMap := map[int]*domain.SummaryEvaluationValue{}
|
|
|
1746
|
+ evaluationValueSlice := []*domain.SummaryEvaluationValue{}
|
1758
|
evaluationData.TotalRating = nil //清空评级数量统计
|
1747
|
evaluationData.TotalRating = nil //清空评级数量统计
|
1759
|
for _, v := range evaluationItems {
|
1748
|
for _, v := range evaluationItems {
|
1760
|
newValue := &domain.SummaryEvaluationValue{}
|
1749
|
newValue := &domain.SummaryEvaluationValue{}
|
1761
|
newValue.SetBlankValue(evaluationData, v)
|
1750
|
newValue.SetBlankValue(evaluationData, v)
|
1762
|
evaluationValueMap[v.Id] = newValue
|
1751
|
evaluationValueMap[v.Id] = newValue
|
1763
|
evaluationItemMap[v.Id] = v
|
1752
|
evaluationItemMap[v.Id] = v
|
|
|
1753
|
+ evaluationValueSlice = append(evaluationValueSlice, newValue)
|
1764
|
//重置计数
|
1754
|
//重置计数
|
1765
|
evaluationData.ResetTotalRating(v)
|
1755
|
evaluationData.ResetTotalRating(v)
|
1766
|
}
|
1756
|
}
|
|
@@ -1818,10 +1808,14 @@ func (srv *SummaryEvaluationService) editEvaluationValue( |
|
@@ -1818,10 +1808,14 @@ func (srv *SummaryEvaluationService) editEvaluationValue( |
1818
|
}
|
1808
|
}
|
1819
|
}
|
1809
|
}
|
1820
|
//完全更新itemValueList
|
1810
|
//完全更新itemValueList
|
1821
|
- *itemValueList = (*itemValueList)[0:0]
|
|
|
1822
|
- for _, v := range evaluationValueMap {
|
|
|
1823
|
- *itemValueList = append(*itemValueList, v)
|
|
|
1824
|
- }
|
1811
|
+ *itemValueList = evaluationValueSlice
|
|
|
1812
|
+ // *itemValueList = (*itemValueList)[0:0]
|
|
|
1813
|
+ // for _, v := range evaluationValueMap {
|
|
|
1814
|
+ // *itemValueList = append(*itemValueList, v)
|
|
|
1815
|
+ // }
|
|
|
1816
|
+ // sort.Slice(*itemValueList, func(i, j int) bool {
|
|
|
1817
|
+ // return (*itemValueList)[i].EvaluationItemId < (*itemValueList)[j].EvaluationItemId
|
|
|
1818
|
+ // })
|
1825
|
// 计算总得分
|
1819
|
// 计算总得分
|
1826
|
err := evaluationData.EvaluationTotalScore(*itemValueList)
|
1820
|
err := evaluationData.EvaluationTotalScore(*itemValueList)
|
1827
|
if err != nil {
|
1821
|
if err != nil {
|