正在显示
4 个修改的文件
包含
47 行增加
和
47 行删除
@@ -56,7 +56,7 @@ func (srv *SummaryEvaluationService) ExportAllEvaluationSuper(param *command.Que | @@ -56,7 +56,7 @@ func (srv *SummaryEvaluationService) ExportAllEvaluationSuper(param *command.Que | ||
56 | //获取评估列表信息 | 56 | //获取评估列表信息 |
57 | condition1 := map[string]interface{}{ | 57 | condition1 := map[string]interface{}{ |
58 | "cycleId": param.CycleId, | 58 | "cycleId": param.CycleId, |
59 | - "types": int(domain.EvaluationSuper), | 59 | + "types": int(domain.EvaluationFinish), |
60 | "limit": limit, | 60 | "limit": limit, |
61 | } | 61 | } |
62 | if offset > 0 { | 62 | if offset > 0 { |
@@ -177,6 +177,12 @@ func sendSummaryEvaluation(project *domain.EvaluationProject, | @@ -177,6 +177,12 @@ func sendSummaryEvaluation(project *domain.EvaluationProject, | ||
177 | //确定上级评估 | 177 | //确定上级评估 |
178 | newEvaluationList = append(newEvaluationList, evaluationTemp) | 178 | newEvaluationList = append(newEvaluationList, evaluationTemp) |
179 | } | 179 | } |
180 | + // 确定 考核结果 的评估记录 | ||
181 | + evaluationTemp.Types = domain.EvaluationFinish | ||
182 | + evaluationTemp.Executor = domain.StaffDesc{} | ||
183 | + evaluationTemp.BeginTime = endTimeSuper | ||
184 | + evaluationTemp.EndTime = endTimeSuper.Add(2 * 24 * time.Hour) | ||
185 | + newEvaluationList = append(newEvaluationList, evaluationTemp) | ||
180 | } | 186 | } |
181 | summaryEvaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext}) | 187 | summaryEvaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext}) |
182 | for i := range newEvaluationList { | 188 | for i := range newEvaluationList { |
@@ -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,16 +244,14 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri | @@ -243,16 +244,14 @@ 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) | 253 | menu1.Child = append(menu1.Child, menu1_2) |
254 | } | 254 | } |
255 | - } | ||
256 | 255 | ||
257 | if len(selfEvaluation) > 0 { | 256 | if len(selfEvaluation) > 0 { |
258 | menuList = append(menuList, menu1) | 257 | menuList = append(menuList, menu1) |
@@ -670,21 +669,17 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(param *domain. | @@ -670,21 +669,17 @@ 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) | 672 | + if len(evaluationList) > 0 { |
673 | + // 进入考核结果阶段 | ||
674 | + if evaluationList[0].BeginTime.After(nowTime) { | ||
675 | + evaluationList[0].BeginTime = nowTime | ||
676 | + err = evaluationRepo.Save(evaluationList[0]) | ||
683 | if err != nil { | 677 | if err != nil { |
684 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error()) | 678 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error()) |
685 | } | 679 | } |
686 | } | 680 | } |
687 | } | 681 | } |
682 | + } | ||
688 | if err := transactionContext.CommitTransaction(); err != nil { | 683 | if err := transactionContext.CommitTransaction(); err != nil { |
689 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 684 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
690 | } | 685 | } |
@@ -773,29 +768,23 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(param *doma | @@ -773,29 +768,23 @@ 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) | 771 | + if len(evaluationList) > 0 { |
772 | + if evaluationList[0].BeginTime.After(nowTime) { | ||
773 | + evaluationList[0].BeginTime = nowTime | ||
774 | + err = evaluationRepo.Save(evaluationList[0]) | ||
787 | if err != nil { | 775 | if err != nil { |
788 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error()) | 776 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error()) |
789 | } | 777 | } |
790 | } | 778 | } |
791 | } | 779 | } |
780 | + } | ||
792 | if err := transactionContext.CommitTransaction(); err != nil { | 781 | if err := transactionContext.CommitTransaction(); err != nil { |
793 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 782 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
794 | } | 783 | } |
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,21 +820,16 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSuper(param *domain | @@ -831,21 +820,16 @@ 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) | 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]) | ||
845 | if err != nil { | 828 | if err != nil { |
846 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error()) | 829 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error()) |
847 | } | 830 | } |
848 | } | 831 | } |
832 | + } | ||
849 | if err := transactionContext.CommitTransaction(); err != nil { | 833 | if err := transactionContext.CommitTransaction(); err != nil { |
850 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 834 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
851 | } | 835 | } |
@@ -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 { |
@@ -120,7 +120,7 @@ func (repo *SummaryEvaluationValueRepository) Find(queryOptions map[string]inter | @@ -120,7 +120,7 @@ func (repo *SummaryEvaluationValueRepository) Find(queryOptions map[string]inter | ||
120 | if v, ok := queryOptions["types"]; ok { | 120 | if v, ok := queryOptions["types"]; ok { |
121 | query.Where("types=?", v) | 121 | query.Where("types=?", v) |
122 | } | 122 | } |
123 | - | 123 | + query.Order("evaluation_item_id") |
124 | count, err := query.SelectAndCount() | 124 | count, err := query.SelectAndCount() |
125 | if err != nil { | 125 | if err != nil { |
126 | return 0, nil, err | 126 | return 0, nil, err |
-
请 注册 或 登录 后发表评论