正在显示
5 个修改的文件
包含
707 行增加
和
367 行删除
1 | +package service | ||
2 | + | ||
3 | +import ( | ||
4 | + "github.com/linmadan/egglib-go/core/application" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/adapter" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/command" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | ||
9 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/xredis" | ||
10 | +) | ||
11 | + | ||
12 | +// EditEvaluation360 编辑提交360综评 | ||
13 | +func (srv *SummaryEvaluationService) EditEvaluation360(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) { | ||
14 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
15 | + if err != nil { | ||
16 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
17 | + } | ||
18 | + if err := transactionContext.StartTransaction(); err != nil { | ||
19 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
20 | + } | ||
21 | + defer func() { | ||
22 | + _ = transactionContext.RollbackTransaction() | ||
23 | + }() | ||
24 | + evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
25 | + itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
26 | + itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
27 | + | ||
28 | + summaryEvaluation, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId}) | ||
29 | + if err != nil { | ||
30 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
31 | + } | ||
32 | + if summaryEvaluation.Executor.UserId != param.ExecutorId { | ||
33 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限") | ||
34 | + } | ||
35 | + if summaryEvaluation.CompanyId != param.CompanyId { | ||
36 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限") | ||
37 | + } | ||
38 | + // 按照 被评估人加锁 | ||
39 | + lock := xredis.NewLockSummaryEvaluation(summaryEvaluation.TargetUser.UserId) | ||
40 | + err = lock.Lock() | ||
41 | + if err != nil { | ||
42 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未能完全提交评估内容") | ||
43 | + } | ||
44 | + defer func() { | ||
45 | + lock.UnLock() | ||
46 | + }() | ||
47 | + _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{ | ||
48 | + "targetUserId": summaryEvaluation.TargetUser.UserId, | ||
49 | + "typesList": []int{int(domain.EvaluationFinish)}, | ||
50 | + "cycleId": summaryEvaluation.CycleId, | ||
51 | + "limit": 1, | ||
52 | + }) | ||
53 | + if err != nil { | ||
54 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
55 | + } | ||
56 | + // 如果目标员工已经确认考核结果,就不能在进行评估编辑 | ||
57 | + if len(evaluationList) > 0 && evaluationList[0].CheckResult == domain.EvaluationCheckCompleted { | ||
58 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户已经确认该周期的考核结果,不能再编辑!") | ||
59 | + } | ||
60 | + | ||
61 | + // 自评评估内容(自评模板、筛选项目评估人) | ||
62 | + _, itemList, err := itemUsedRepo.Find(map[string]interface{}{ | ||
63 | + "evaluationProjectId": summaryEvaluation.EvaluationProjectId, | ||
64 | + "nodeType": domain.LinkNodeSelfAssessment, | ||
65 | + "evaluatorId": param.ExecutorId, | ||
66 | + }) | ||
67 | + if err != nil { | ||
68 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
69 | + } | ||
70 | + | ||
71 | + // 评估内容对应的分数 | ||
72 | + _, itemValueList, err := itemValueRepo.Find(map[string]interface{}{"summaryEvaluationId": summaryEvaluation.Id}) | ||
73 | + if err != nil { | ||
74 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
75 | + } | ||
76 | + | ||
77 | + err = srv.editEvaluationValue(summaryEvaluation, &itemValueList, itemList, param.EvaluationItems, nil, param.IsTemporary) | ||
78 | + if err != nil { | ||
79 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
80 | + } | ||
81 | + if !param.IsTemporary { | ||
82 | + //变更评估状态为已填写 | ||
83 | + summaryEvaluation.Status = domain.EvaluationCompleted | ||
84 | + } | ||
85 | + | ||
86 | + //保存填写值 | ||
87 | + for _, v := range itemValueList { | ||
88 | + err = itemValueRepo.Save(v) | ||
89 | + if err != nil { | ||
90 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
91 | + } | ||
92 | + } | ||
93 | + | ||
94 | + //保存填写值 | ||
95 | + err = evaluationRepo.Save(summaryEvaluation) | ||
96 | + if err != nil { | ||
97 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
98 | + } | ||
99 | + if !param.IsTemporary { | ||
100 | + err = srv.AfterCompletedEvaluation360Hrbp(transactionContext, summaryEvaluation) | ||
101 | + if err != nil { | ||
102 | + return nil, err | ||
103 | + } | ||
104 | + } | ||
105 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
106 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
107 | + } | ||
108 | + itemValueAdapter := srv.buildSummaryItemValue(itemList, itemValueList) | ||
109 | + return map[string][]adapter.EvaluationItemAdapter{ | ||
110 | + "evaluationItems": itemValueAdapter, | ||
111 | + }, nil | ||
112 | +} |
1 | +package service | ||
2 | + | ||
3 | +import ( | ||
4 | + "time" | ||
5 | + | ||
6 | + "github.com/linmadan/egglib-go/core/application" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/notify" | ||
9 | + roleService "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/role" | ||
10 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/adapter" | ||
11 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/command" | ||
12 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | ||
13 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/dao" | ||
14 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/xredis" | ||
15 | +) | ||
16 | + | ||
17 | +// EditEvaluationHRBP 编辑提交人资综评 | ||
18 | +func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) { | ||
19 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
20 | + if err != nil { | ||
21 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
22 | + } | ||
23 | + if err := transactionContext.StartTransaction(); err != nil { | ||
24 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
25 | + } | ||
26 | + defer func() { | ||
27 | + _ = transactionContext.RollbackTransaction() | ||
28 | + }() | ||
29 | + | ||
30 | + userRepo := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
31 | + evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
32 | + itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
33 | + itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
34 | + | ||
35 | + // 必须是HRBP权限的人才能编辑操作 | ||
36 | + hrbp, err := roleService.GetHrBp(transactionContext, param.CompanyId, param.ExecutorId) | ||
37 | + if err != nil { | ||
38 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
39 | + } | ||
40 | + if hrbp != domain.RoleTypeSystem { | ||
41 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限") | ||
42 | + } | ||
43 | + | ||
44 | + summaryEvaluation, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId}) | ||
45 | + if err != nil { | ||
46 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
47 | + } | ||
48 | + if summaryEvaluation.Types != domain.EvaluationHrbp { | ||
49 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限") | ||
50 | + } | ||
51 | + if summaryEvaluation.CompanyId != param.CompanyId { | ||
52 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限") | ||
53 | + } | ||
54 | + // 按照 被评估人加锁 | ||
55 | + lock := xredis.NewLockSummaryEvaluation(summaryEvaluation.TargetUser.UserId) | ||
56 | + err = lock.Lock() | ||
57 | + if err != nil { | ||
58 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未能完全提交评估内容") | ||
59 | + } | ||
60 | + defer func() { | ||
61 | + lock.UnLock() | ||
62 | + }() | ||
63 | + _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{ | ||
64 | + "targetUserId": summaryEvaluation.TargetUser.UserId, | ||
65 | + "typesList": []int{int(domain.EvaluationFinish)}, | ||
66 | + "cycleId": summaryEvaluation.CycleId, | ||
67 | + "limit": 1, | ||
68 | + }) | ||
69 | + if err != nil { | ||
70 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
71 | + } | ||
72 | + // 如果目标员工已经确认考核结果,就不能在进行评估编辑 | ||
73 | + if len(evaluationList) > 0 && evaluationList[0].CheckResult == domain.EvaluationCheckCompleted { | ||
74 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户已经确认该周期的考核结果,不能再编辑!") | ||
75 | + } | ||
76 | + | ||
77 | + // 自评评估内容(自评模板、筛选项目评估人) | ||
78 | + _, itemList, err := itemUsedRepo.Find(map[string]interface{}{ | ||
79 | + "evaluationProjectId": summaryEvaluation.EvaluationProjectId, | ||
80 | + "nodeType": domain.LinkNodeSelfAssessment, | ||
81 | + "evaluatorId": -1, | ||
82 | + }) | ||
83 | + if err != nil { | ||
84 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
85 | + } | ||
86 | + | ||
87 | + // 评估内容对应的分数 | ||
88 | + _, itemValueList, err := itemValueRepo.Find(map[string]interface{}{"summaryEvaluationId": summaryEvaluation.Id}) | ||
89 | + if err != nil { | ||
90 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
91 | + } | ||
92 | + | ||
93 | + err = srv.editEvaluationValue(summaryEvaluation, &itemValueList, itemList, param.EvaluationItems, nil, param.IsTemporary) | ||
94 | + if err != nil { | ||
95 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
96 | + } | ||
97 | + if !param.IsTemporary { | ||
98 | + //变更评估状态为已填写 | ||
99 | + summaryEvaluation.Status = domain.EvaluationCompleted | ||
100 | + } | ||
101 | + //保存填写值 | ||
102 | + for _, v := range itemValueList { | ||
103 | + err = itemValueRepo.Save(v) | ||
104 | + if err != nil { | ||
105 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
106 | + } | ||
107 | + } | ||
108 | + | ||
109 | + // 针对HRBP类型,更新最后一次操作的HRBP人 | ||
110 | + user, err := userRepo.FindOne(map[string]interface{}{"id": param.ExecutorId}) | ||
111 | + if err != nil { | ||
112 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
113 | + } | ||
114 | + summaryEvaluation.Executor.UserId = param.ExecutorId | ||
115 | + summaryEvaluation.Executor.Account = user.Account | ||
116 | + summaryEvaluation.Executor.UserName = user.Name | ||
117 | + summaryEvaluation.Executor.CompanyName = "" // 暂时无用 | ||
118 | + summaryEvaluation.Status = domain.EvaluationCompleted | ||
119 | + | ||
120 | + //保存填写值 | ||
121 | + err = evaluationRepo.Save(summaryEvaluation) | ||
122 | + if err != nil { | ||
123 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
124 | + } | ||
125 | + if !param.IsTemporary { | ||
126 | + err = srv.AfterCompletedEvaluation360Hrbp(transactionContext, summaryEvaluation) | ||
127 | + if err != nil { | ||
128 | + return nil, err | ||
129 | + } | ||
130 | + } | ||
131 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
132 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
133 | + } | ||
134 | + | ||
135 | + itemValueAdapter := srv.buildSummaryItemValue(itemList, itemValueList) | ||
136 | + return map[string][]adapter.EvaluationItemAdapter{ | ||
137 | + "evaluationItems": itemValueAdapter, | ||
138 | + }, nil | ||
139 | +} | ||
140 | + | ||
141 | +// 提交员工的人资评估 或者 360 评估 | ||
142 | +// 变更上级评估的开始时间 | ||
143 | +// 或者生成考核结果 | ||
144 | +func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp( | ||
145 | + transactionContext application.TransactionContext, | ||
146 | + evaluationData *domain.SummaryEvaluation, | ||
147 | +) error { | ||
148 | + evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{ | ||
149 | + "transactionContext": transactionContext, | ||
150 | + }) | ||
151 | + _, evaluation360HrbList, err := evaluationRepo.Find(map[string]interface{}{ | ||
152 | + "targetUserId": evaluationData.TargetUser.UserId, | ||
153 | + "typesList": []int{int(domain.Evaluation360), int(domain.EvaluationHrbp)}, | ||
154 | + "cycleId": evaluationData.CycleId, | ||
155 | + "limit": 1000, | ||
156 | + }) | ||
157 | + if err != nil { | ||
158 | + return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
159 | + } | ||
160 | + allCompleted := true | ||
161 | + for _, v := range evaluation360HrbList { | ||
162 | + if v.Status == domain.EvaluationUncompleted { | ||
163 | + allCompleted = false | ||
164 | + break | ||
165 | + } | ||
166 | + } | ||
167 | + if !allCompleted { | ||
168 | + return nil | ||
169 | + } | ||
170 | + _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{ | ||
171 | + "targetUserId": evaluationData.TargetUser.UserId, | ||
172 | + "typesList": []int{int(domain.EvaluationSuper)}, | ||
173 | + "cycleId": evaluationData.CycleId, | ||
174 | + "limit": 1, | ||
175 | + }) | ||
176 | + if err != nil { | ||
177 | + return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
178 | + } | ||
179 | + nowTime := time.Now() | ||
180 | + updatedId := []int{} | ||
181 | + // 变更上级评估的开始时间 | ||
182 | + for _, v := range evaluationList { | ||
183 | + if v.BeginTime.After(nowTime) { | ||
184 | + v.BeginTime = nowTime | ||
185 | + updatedId = append(updatedId, v.Id) | ||
186 | + } | ||
187 | + } | ||
188 | + evaluationDao := dao.NewSummaryEvaluationDao(map[string]interface{}{ | ||
189 | + "transactionContext": transactionContext, | ||
190 | + }) | ||
191 | + err = evaluationDao.UpdateBeginTime(updatedId, nowTime) | ||
192 | + if err != nil { | ||
193 | + return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
194 | + } | ||
195 | + if len(evaluationList) == 0 { | ||
196 | + //没有上级评估 | ||
197 | + //直接进入考核结果阶段 | ||
198 | + _, evaluationFinishList, err := evaluationRepo.Find(map[string]interface{}{ | ||
199 | + "targetUserId": evaluationData.TargetUser.UserId, | ||
200 | + "typesList": []int{int(domain.EvaluationFinish)}, | ||
201 | + "cycleId": evaluationData.CycleId, | ||
202 | + "limit": 1, | ||
203 | + }) | ||
204 | + if err != nil { | ||
205 | + return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
206 | + } | ||
207 | + if len(evaluationFinishList) > 0 { | ||
208 | + if evaluationFinishList[0].BeginTime.After(nowTime) { | ||
209 | + evaluationFinishList[0].BeginTime = nowTime | ||
210 | + } | ||
211 | + evaluationFinishList[0].Status = domain.EvaluationCompleted | ||
212 | + err = evaluationRepo.Save(evaluationFinishList[0]) | ||
213 | + if err != nil { | ||
214 | + return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error()) | ||
215 | + } | ||
216 | + //添加确认绩效成绩提醒短信提醒 | ||
217 | + err = notify.AddNotifyConfirmEvaluationScore(evaluationFinishList[0]) | ||
218 | + if err != nil { | ||
219 | + return application.ThrowError(application.TRANSACTION_ERROR, "创建短信提醒失败"+err.Error()) | ||
220 | + } | ||
221 | + } | ||
222 | + | ||
223 | + } | ||
224 | + return nil | ||
225 | +} |
@@ -51,6 +51,7 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu | @@ -51,6 +51,7 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu | ||
51 | if evaluationData.CompanyId != param.CompanyId { | 51 | if evaluationData.CompanyId != param.CompanyId { |
52 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限") | 52 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限") |
53 | } | 53 | } |
54 | + //按照 被评估人加锁 | ||
54 | lock := xredis.NewLockSummaryEvaluation(evaluationData.TargetUser.UserId) | 55 | lock := xredis.NewLockSummaryEvaluation(evaluationData.TargetUser.UserId) |
55 | err = lock.Lock() | 56 | err = lock.Lock() |
56 | if err != nil { | 57 | if err != nil { |
@@ -66,7 +67,6 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu | @@ -66,7 +67,6 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu | ||
66 | if err != nil { | 67 | if err != nil { |
67 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 68 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
68 | } | 69 | } |
69 | - | ||
70 | _, itemValueList, err := itemValueRepo.Find(map[string]interface{}{ | 70 | _, itemValueList, err := itemValueRepo.Find(map[string]interface{}{ |
71 | "summaryEvaluationId": evaluationData.Id, | 71 | "summaryEvaluationId": evaluationData.Id, |
72 | }) | 72 | }) |
@@ -80,13 +80,6 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu | @@ -80,13 +80,6 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu | ||
80 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 80 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
81 | } | 81 | } |
82 | 82 | ||
83 | - //保存填写值 | ||
84 | - for _, v := range itemValueList { | ||
85 | - err = itemValueRepo.Save(v) | ||
86 | - if err != nil { | ||
87 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
88 | - } | ||
89 | - } | ||
90 | if !param.IsTemporary { | 83 | if !param.IsTemporary { |
91 | evaluationData.Status = domain.EvaluationCompleted | 84 | evaluationData.Status = domain.EvaluationCompleted |
92 | //删除旧的填写值,使用新的填写内容 | 85 | //删除旧的填写值,使用新的填写内容 |
@@ -102,6 +95,13 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu | @@ -102,6 +95,13 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu | ||
102 | if err != nil { | 95 | if err != nil { |
103 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 96 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
104 | } | 97 | } |
98 | + //保存填写值 | ||
99 | + for _, v := range itemValueList { | ||
100 | + err = itemValueRepo.Save(v) | ||
101 | + if err != nil { | ||
102 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
103 | + } | ||
104 | + } | ||
105 | if !param.IsTemporary { | 105 | if !param.IsTemporary { |
106 | err = srv.AfterCompletedEvaluationSelf(transactionContext, evaluationData, itemValueList) | 106 | err = srv.AfterCompletedEvaluationSelf(transactionContext, evaluationData, itemValueList) |
107 | if err != nil { | 107 | if err != nil { |
@@ -117,11 +117,11 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu | @@ -117,11 +117,11 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu | ||
117 | }, nil | 117 | }, nil |
118 | } | 118 | } |
119 | 119 | ||
120 | -// 员工提交自评内容后, | ||
121 | -// 员工作为被评估人, | ||
122 | -// 变更360评估/人资评估/的开始时间 | ||
123 | -// 或者变更上级评估的开始时间 | ||
124 | -// 或者生成考核结果 | 120 | +// 员工提交自评内容后,员工作为被评估人, |
121 | +// 变更360评估/人资评估/的开始时间 或者变更上级评估的开始时间 | ||
122 | +// evaluationData 综合自评 | ||
123 | +// evaluationValue 自评的填写内容 | ||
124 | + | ||
125 | func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf( | 125 | func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf( |
126 | transactionContext application.TransactionContext, | 126 | transactionContext application.TransactionContext, |
127 | evaluationData *domain.SummaryEvaluation, | 127 | evaluationData *domain.SummaryEvaluation, |
@@ -132,29 +132,32 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf( | @@ -132,29 +132,32 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf( | ||
132 | }) | 132 | }) |
133 | _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{ | 133 | _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{ |
134 | "targetUserId": evaluationData.TargetUser.UserId, | 134 | "targetUserId": evaluationData.TargetUser.UserId, |
135 | - "typesList": []int{int(domain.Evaluation360), int(domain.EvaluationHrbp)}, | ||
136 | "cycleId": evaluationData.CycleId, | 135 | "cycleId": evaluationData.CycleId, |
137 | - "limit": 1000, | 136 | + "limit": 500, |
138 | }) | 137 | }) |
139 | if err != nil { | 138 | if err != nil { |
140 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 139 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
141 | } | 140 | } |
142 | - if len(evaluationList) == 0 { | ||
143 | - //如果没有360评估和hrbp 评估,查找上级评估 | ||
144 | - _, evaluationList, err = evaluationRepo.Find(map[string]interface{}{ | ||
145 | - "targetUserId": evaluationData.TargetUser.UserId, | ||
146 | - "typesList": []int{int(domain.EvaluationSuper)}, | ||
147 | - "cycleId": evaluationData.CycleId, | ||
148 | - "limit": 10, | ||
149 | - }) | ||
150 | - if err != nil { | ||
151 | - return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 141 | + //查找需要的综合评估 |
142 | + var targetEvaluation []*domain.SummaryEvaluation | ||
143 | + // 查找360 或 hrbp 评估 | ||
144 | + for _, v := range evaluationList { | ||
145 | + if v.Types == domain.Evaluation360 || v.Types == domain.EvaluationHrbp { | ||
146 | + targetEvaluation = append(targetEvaluation, v) | ||
147 | + } | ||
148 | + } | ||
149 | + //没有360 或 hrbp 评估 ,就查找上级评估 | ||
150 | + if len(targetEvaluation) == 0 { | ||
151 | + for _, v := range evaluationList { | ||
152 | + if v.Types == domain.EvaluationSuper { | ||
153 | + targetEvaluation = append(targetEvaluation, v) | ||
154 | + } | ||
152 | } | 155 | } |
153 | } | 156 | } |
154 | nowTime := time.Now() | 157 | nowTime := time.Now() |
155 | updatedId := []int{} | 158 | updatedId := []int{} |
156 | // 变更360评估/人资评估/上级评估的开始时间 | 159 | // 变更360评估/人资评估/上级评估的开始时间 |
157 | - for _, v := range evaluationList { | 160 | + for _, v := range targetEvaluation { |
158 | if v.BeginTime.After(nowTime) { | 161 | if v.BeginTime.After(nowTime) { |
159 | v.BeginTime = nowTime | 162 | v.BeginTime = nowTime |
160 | updatedId = append(updatedId, v.Id) | 163 | updatedId = append(updatedId, v.Id) |
@@ -163,39 +166,41 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf( | @@ -163,39 +166,41 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf( | ||
163 | evaluationDao := dao.NewSummaryEvaluationDao(map[string]interface{}{ | 166 | evaluationDao := dao.NewSummaryEvaluationDao(map[string]interface{}{ |
164 | "transactionContext": transactionContext, | 167 | "transactionContext": transactionContext, |
165 | }) | 168 | }) |
169 | + // 变更360评估/人资评估/上级评估的开始时间 | ||
166 | err = evaluationDao.UpdateBeginTime(updatedId, nowTime) | 170 | err = evaluationDao.UpdateBeginTime(updatedId, nowTime) |
167 | if err != nil { | 171 | if err != nil { |
168 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 172 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
169 | } | 173 | } |
170 | - if len(evaluationList) == 0 { | 174 | + |
175 | + var evaluationFinish *domain.SummaryEvaluation | ||
176 | + //查找综合评估结果 | ||
177 | + for _, v := range evaluationList { | ||
178 | + if v.Types == domain.EvaluationFinish { | ||
179 | + evaluationFinish = v | ||
180 | + break | ||
181 | + } | ||
182 | + } | ||
183 | + if len(targetEvaluation) == 0 { | ||
171 | //没有上级评估、360评估、hrbp 评估 | 184 | //没有上级评估、360评估、hrbp 评估 |
172 | //直接进入考核结果阶段 | 185 | //直接进入考核结果阶段 |
173 | - _, evaluationFinishList, err := evaluationRepo.Find(map[string]interface{}{ | ||
174 | - "targetUserId": evaluationData.TargetUser.UserId, | ||
175 | - "typesList": []int{int(domain.EvaluationFinish)}, | ||
176 | - "cycleId": evaluationData.CycleId, | ||
177 | - "limit": 1, | ||
178 | - }) | ||
179 | - if err != nil { | ||
180 | - return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
181 | - } | ||
182 | - if len(evaluationFinishList) > 0 { | 186 | + if evaluationFinish != nil { |
183 | //进入考核结果 | 187 | //进入考核结果 |
184 | //自评的结束时间 | 188 | //自评的结束时间 |
185 | - if evaluationFinishList[0].BeginTime.After(nowTime) { | ||
186 | - evaluationFinishList[0].BeginTime = nowTime | 189 | + if evaluationFinish.BeginTime.After(nowTime) { |
190 | + evaluationFinish.BeginTime = nowTime | ||
187 | } | 191 | } |
188 | - evaluationFinishList[0].Status = domain.EvaluationCompleted | ||
189 | - err = evaluationRepo.Save(evaluationFinishList[0]) | 192 | + evaluationFinish.Status = domain.EvaluationCompleted |
193 | + err = evaluationRepo.Save(evaluationFinish) | ||
190 | if err != nil { | 194 | if err != nil { |
191 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error()) | 195 | return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error()) |
192 | } | 196 | } |
193 | //添加确认绩效成绩提醒短信提醒 | 197 | //添加确认绩效成绩提醒短信提醒 |
194 | - err = notify.AddNotifyConfirmEvaluationScore(evaluationFinishList[0]) | 198 | + err = notify.AddNotifyConfirmEvaluationScore(evaluationFinish) |
195 | if err != nil { | 199 | if err != nil { |
196 | return application.ThrowError(application.TRANSACTION_ERROR, "创建短信提醒失败"+err.Error()) | 200 | return application.ThrowError(application.TRANSACTION_ERROR, "创建短信提醒失败"+err.Error()) |
197 | } | 201 | } |
198 | } | 202 | } |
199 | } | 203 | } |
204 | + | ||
200 | return nil | 205 | return nil |
201 | } | 206 | } |
@@ -10,7 +10,6 @@ import ( | @@ -10,7 +10,6 @@ import ( | ||
10 | "github.com/linmadan/egglib-go/core/application" | 10 | "github.com/linmadan/egglib-go/core/application" |
11 | "github.com/linmadan/egglib-go/utils/tool_funs" | 11 | "github.com/linmadan/egglib-go/utils/tool_funs" |
12 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" | 12 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" |
13 | - "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/notify" | ||
14 | roleService "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/role" | 13 | roleService "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/role" |
15 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/adapter" | 14 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/adapter" |
16 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/command" | 15 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/command" |
@@ -684,107 +683,107 @@ func (srv *SummaryEvaluationService) getSummaryEvaluation(transactionContext app | @@ -684,107 +683,107 @@ func (srv *SummaryEvaluationService) getSummaryEvaluation(transactionContext app | ||
684 | // 提交员工的人资评估 或者 360 评估 | 683 | // 提交员工的人资评估 或者 360 评估 |
685 | // 变更上级评估的开始时间 | 684 | // 变更上级评估的开始时间 |
686 | // 或者生成考核结果 | 685 | // 或者生成考核结果 |
687 | -func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(param *domain.SummaryEvaluation) error { | ||
688 | - lock := xredis.NewLockSummaryEvaluation(param.TargetUser.UserId) | ||
689 | - err := lock.Lock() | ||
690 | - if err != nil { | ||
691 | - return application.ThrowError(application.INTERNAL_SERVER_ERROR, "未能完全提交评估内容") | ||
692 | - } | ||
693 | - defer func() { | ||
694 | - lock.UnLock() | ||
695 | - }() | ||
696 | - transactionContext, err := factory.CreateTransactionContext(nil) | ||
697 | - if err != nil { | ||
698 | - return application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
699 | - } | ||
700 | - if err := transactionContext.StartTransaction(); err != nil { | ||
701 | - return application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
702 | - } | ||
703 | - defer func() { | ||
704 | - _ = transactionContext.RollbackTransaction() | ||
705 | - }() | 686 | +// func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(param *domain.SummaryEvaluation) error { |
687 | +// lock := xredis.NewLockSummaryEvaluation(param.TargetUser.UserId) | ||
688 | +// err := lock.Lock() | ||
689 | +// if err != nil { | ||
690 | +// return application.ThrowError(application.INTERNAL_SERVER_ERROR, "未能完全提交评估内容") | ||
691 | +// } | ||
692 | +// defer func() { | ||
693 | +// lock.UnLock() | ||
694 | +// }() | ||
695 | +// transactionContext, err := factory.CreateTransactionContext(nil) | ||
696 | +// if err != nil { | ||
697 | +// return application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
698 | +// } | ||
699 | +// if err := transactionContext.StartTransaction(); err != nil { | ||
700 | +// return application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
701 | +// } | ||
702 | +// defer func() { | ||
703 | +// _ = transactionContext.RollbackTransaction() | ||
704 | +// }() | ||
706 | 705 | ||
707 | - evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{ | ||
708 | - "transactionContext": transactionContext, | ||
709 | - }) | ||
710 | - _, evaluation360HrbList, err := evaluationRepo.Find(map[string]interface{}{ | ||
711 | - "targetUserId": param.TargetUser.UserId, | ||
712 | - "typesList": []int{int(domain.Evaluation360), int(domain.EvaluationHrbp)}, | ||
713 | - "cycleId": param.CycleId, | ||
714 | - "limit": 1000, | ||
715 | - }) | ||
716 | - if err != nil { | ||
717 | - return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
718 | - } | ||
719 | - allCompleted := true | ||
720 | - for _, v := range evaluation360HrbList { | ||
721 | - if v.Status == domain.EvaluationUncompleted { | ||
722 | - allCompleted = false | ||
723 | - break | ||
724 | - } | ||
725 | - } | ||
726 | - if !allCompleted { | ||
727 | - return nil | ||
728 | - } | ||
729 | - _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{ | ||
730 | - "targetUserId": param.TargetUser.UserId, | ||
731 | - "typesList": []int{int(domain.EvaluationSuper)}, | ||
732 | - "cycleId": param.CycleId, | ||
733 | - "limit": 1, | ||
734 | - }) | ||
735 | - if err != nil { | ||
736 | - return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
737 | - } | ||
738 | - nowTime := time.Now() | ||
739 | - updatedId := []int{} | ||
740 | - // 变更上级评估的开始时间 | ||
741 | - for _, v := range evaluationList { | ||
742 | - if v.BeginTime.After(nowTime) { | ||
743 | - v.BeginTime = nowTime | ||
744 | - updatedId = append(updatedId, v.Id) | ||
745 | - } | ||
746 | - } | ||
747 | - evaluationDao := dao.NewSummaryEvaluationDao(map[string]interface{}{ | ||
748 | - "transactionContext": transactionContext, | ||
749 | - }) | ||
750 | - err = evaluationDao.UpdateBeginTime(updatedId, nowTime) | ||
751 | - if err != nil { | ||
752 | - return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
753 | - } | ||
754 | - if len(evaluationList) == 0 { | ||
755 | - //没有上级评估 | ||
756 | - //直接进入考核结果阶段 | ||
757 | - _, evaluationFinishList, err := evaluationRepo.Find(map[string]interface{}{ | ||
758 | - "targetUserId": param.TargetUser.UserId, | ||
759 | - "typesList": []int{int(domain.EvaluationFinish)}, | ||
760 | - "cycleId": param.CycleId, | ||
761 | - "limit": 1, | ||
762 | - }) | ||
763 | - if err != nil { | ||
764 | - return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
765 | - } | ||
766 | - if len(evaluationFinishList) > 0 { | ||
767 | - if evaluationFinishList[0].BeginTime.After(nowTime) { | ||
768 | - evaluationFinishList[0].BeginTime = nowTime | ||
769 | - } | ||
770 | - evaluationFinishList[0].Status = domain.EvaluationCompleted | ||
771 | - err = evaluationRepo.Save(evaluationFinishList[0]) | ||
772 | - if err != nil { | ||
773 | - return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error()) | ||
774 | - } | ||
775 | - //添加确认绩效成绩提醒短信提醒 | ||
776 | - err = notify.AddNotifyConfirmEvaluationScore(evaluationFinishList[0]) | ||
777 | - if err != nil { | ||
778 | - return application.ThrowError(application.TRANSACTION_ERROR, "创建短信提醒失败"+err.Error()) | ||
779 | - } | ||
780 | - } | 706 | +// evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{ |
707 | +// "transactionContext": transactionContext, | ||
708 | +// }) | ||
709 | +// _, evaluation360HrbList, err := evaluationRepo.Find(map[string]interface{}{ | ||
710 | +// "targetUserId": param.TargetUser.UserId, | ||
711 | +// "typesList": []int{int(domain.Evaluation360), int(domain.EvaluationHrbp)}, | ||
712 | +// "cycleId": param.CycleId, | ||
713 | +// "limit": 1000, | ||
714 | +// }) | ||
715 | +// if err != nil { | ||
716 | +// return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
717 | +// } | ||
718 | +// allCompleted := true | ||
719 | +// for _, v := range evaluation360HrbList { | ||
720 | +// if v.Status == domain.EvaluationUncompleted { | ||
721 | +// allCompleted = false | ||
722 | +// break | ||
723 | +// } | ||
724 | +// } | ||
725 | +// if !allCompleted { | ||
726 | +// return nil | ||
727 | +// } | ||
728 | +// _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{ | ||
729 | +// "targetUserId": param.TargetUser.UserId, | ||
730 | +// "typesList": []int{int(domain.EvaluationSuper)}, | ||
731 | +// "cycleId": param.CycleId, | ||
732 | +// "limit": 1, | ||
733 | +// }) | ||
734 | +// if err != nil { | ||
735 | +// return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
736 | +// } | ||
737 | +// nowTime := time.Now() | ||
738 | +// updatedId := []int{} | ||
739 | +// // 变更上级评估的开始时间 | ||
740 | +// for _, v := range evaluationList { | ||
741 | +// if v.BeginTime.After(nowTime) { | ||
742 | +// v.BeginTime = nowTime | ||
743 | +// updatedId = append(updatedId, v.Id) | ||
744 | +// } | ||
745 | +// } | ||
746 | +// evaluationDao := dao.NewSummaryEvaluationDao(map[string]interface{}{ | ||
747 | +// "transactionContext": transactionContext, | ||
748 | +// }) | ||
749 | +// err = evaluationDao.UpdateBeginTime(updatedId, nowTime) | ||
750 | +// if err != nil { | ||
751 | +// return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
752 | +// } | ||
753 | +// if len(evaluationList) == 0 { | ||
754 | +// //没有上级评估 | ||
755 | +// //直接进入考核结果阶段 | ||
756 | +// _, evaluationFinishList, err := evaluationRepo.Find(map[string]interface{}{ | ||
757 | +// "targetUserId": param.TargetUser.UserId, | ||
758 | +// "typesList": []int{int(domain.EvaluationFinish)}, | ||
759 | +// "cycleId": param.CycleId, | ||
760 | +// "limit": 1, | ||
761 | +// }) | ||
762 | +// if err != nil { | ||
763 | +// return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
764 | +// } | ||
765 | +// if len(evaluationFinishList) > 0 { | ||
766 | +// if evaluationFinishList[0].BeginTime.After(nowTime) { | ||
767 | +// evaluationFinishList[0].BeginTime = nowTime | ||
768 | +// } | ||
769 | +// evaluationFinishList[0].Status = domain.EvaluationCompleted | ||
770 | +// err = evaluationRepo.Save(evaluationFinishList[0]) | ||
771 | +// if err != nil { | ||
772 | +// return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error()) | ||
773 | +// } | ||
774 | +// //添加确认绩效成绩提醒短信提醒 | ||
775 | +// err = notify.AddNotifyConfirmEvaluationScore(evaluationFinishList[0]) | ||
776 | +// if err != nil { | ||
777 | +// return application.ThrowError(application.TRANSACTION_ERROR, "创建短信提醒失败"+err.Error()) | ||
778 | +// } | ||
779 | +// } | ||
781 | 780 | ||
782 | - } | ||
783 | - if err := transactionContext.CommitTransaction(); err != nil { | ||
784 | - return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
785 | - } | ||
786 | - return nil | ||
787 | -} | 781 | +// } |
782 | +// if err := transactionContext.CommitTransaction(); err != nil { | ||
783 | +// return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
784 | +// } | ||
785 | +// return nil | ||
786 | +// } | ||
788 | 787 | ||
789 | // // 员工提交上级评估后 | 788 | // // 员工提交上级评估后 |
790 | // // 生成考核结果 | 789 | // // 生成考核结果 |
@@ -14,7 +14,6 @@ import ( | @@ -14,7 +14,6 @@ import ( | ||
14 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/command" | 14 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/command" |
15 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | 15 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" |
16 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/dao" | 16 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/dao" |
17 | - "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/xredis" | ||
18 | ) | 17 | ) |
19 | 18 | ||
20 | // Evaluation360List 获取360综评列表 | 19 | // Evaluation360List 获取360综评列表 |
@@ -337,108 +336,108 @@ func (srv *SummaryEvaluationService) GetEvaluation360Complete(param *command.Que | @@ -337,108 +336,108 @@ func (srv *SummaryEvaluationService) GetEvaluation360Complete(param *command.Que | ||
337 | } | 336 | } |
338 | 337 | ||
339 | // EditEvaluation360 编辑提交360综评 | 338 | // EditEvaluation360 编辑提交360综评 |
340 | -func (srv *SummaryEvaluationService) EditEvaluation360(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) { | ||
341 | - lock := xredis.NewLockSummaryEvaluationId(param.SummaryEvaluationId) | ||
342 | - err := lock.Lock() | ||
343 | - if err != nil { | ||
344 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未能完全提交评估内容") | ||
345 | - } | ||
346 | - defer func() { | ||
347 | - lock.UnLock() | ||
348 | - }() | ||
349 | - transactionContext, err := factory.CreateTransactionContext(nil) | ||
350 | - if err != nil { | ||
351 | - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
352 | - } | ||
353 | - if err := transactionContext.StartTransaction(); err != nil { | ||
354 | - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
355 | - } | ||
356 | - defer func() { | ||
357 | - _ = transactionContext.RollbackTransaction() | ||
358 | - }() | ||
359 | - evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
360 | - itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
361 | - itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
362 | - | ||
363 | - summaryEvaluation, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId}) | ||
364 | - if err != nil { | ||
365 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
366 | - } | ||
367 | - if summaryEvaluation.Executor.UserId != param.ExecutorId { | ||
368 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限") | ||
369 | - } | ||
370 | - if summaryEvaluation.CompanyId != param.CompanyId { | ||
371 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限") | ||
372 | - } | ||
373 | - | ||
374 | - _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{ | ||
375 | - "targetUserId": summaryEvaluation.TargetUser.UserId, | ||
376 | - "typesList": []int{int(domain.EvaluationFinish)}, | ||
377 | - "cycleId": summaryEvaluation.CycleId, | ||
378 | - "limit": 1, | ||
379 | - }) | ||
380 | - if err != nil { | ||
381 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
382 | - } | ||
383 | - // 如果目标员工已经确认考核结果,就不能在进行评估编辑 | ||
384 | - if len(evaluationList) > 0 && evaluationList[0].CheckResult == domain.EvaluationCheckCompleted { | ||
385 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户已经确认该周期的考核结果,不能再编辑!") | ||
386 | - } | ||
387 | - | ||
388 | - // 自评评估内容(自评模板、筛选项目评估人) | ||
389 | - _, itemList, err := itemUsedRepo.Find(map[string]interface{}{ | ||
390 | - "evaluationProjectId": summaryEvaluation.EvaluationProjectId, | ||
391 | - "nodeType": domain.LinkNodeSelfAssessment, | ||
392 | - "evaluatorId": param.ExecutorId, | ||
393 | - }) | ||
394 | - if err != nil { | ||
395 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
396 | - } | ||
397 | - | ||
398 | - // 评估内容对应的分数 | ||
399 | - _, itemValueList, err := itemValueRepo.Find(map[string]interface{}{"summaryEvaluationId": summaryEvaluation.Id}) | ||
400 | - if err != nil { | ||
401 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
402 | - } | ||
403 | - | ||
404 | - err = srv.editEvaluationValue(summaryEvaluation, &itemValueList, itemList, param.EvaluationItems, nil, param.IsTemporary) | ||
405 | - if err != nil { | ||
406 | - return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
407 | - } | ||
408 | - if !param.IsTemporary { | ||
409 | - //变更评估状态为已填写 | ||
410 | - summaryEvaluation.Status = domain.EvaluationCompleted | ||
411 | - } | ||
412 | - | ||
413 | - //保存填写值 | ||
414 | - for _, v := range itemValueList { | ||
415 | - err = itemValueRepo.Save(v) | ||
416 | - if err != nil { | ||
417 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
418 | - } | ||
419 | - } | ||
420 | - | ||
421 | - //保存填写值 | ||
422 | - err = evaluationRepo.Save(summaryEvaluation) | ||
423 | - if err != nil { | ||
424 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
425 | - } | ||
426 | - if err := transactionContext.CommitTransaction(); err != nil { | ||
427 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
428 | - } | ||
429 | - | ||
430 | - if !param.IsTemporary { | ||
431 | - err = srv.AfterCompletedEvaluation360Hrbp(summaryEvaluation) | ||
432 | - if err != nil { | ||
433 | - return nil, err | ||
434 | - } | ||
435 | - } | ||
436 | - | ||
437 | - itemValueAdapter := srv.buildSummaryItemValue(itemList, itemValueList) | ||
438 | - return map[string][]adapter.EvaluationItemAdapter{ | ||
439 | - "evaluationItems": itemValueAdapter, | ||
440 | - }, nil | ||
441 | -} | 339 | +// func (srv *SummaryEvaluationService) EditEvaluation360(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) { |
340 | +// lock := xredis.NewLockSummaryEvaluationId(param.SummaryEvaluationId) | ||
341 | +// err := lock.Lock() | ||
342 | +// if err != nil { | ||
343 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未能完全提交评估内容") | ||
344 | +// } | ||
345 | +// defer func() { | ||
346 | +// lock.UnLock() | ||
347 | +// }() | ||
348 | +// transactionContext, err := factory.CreateTransactionContext(nil) | ||
349 | +// if err != nil { | ||
350 | +// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
351 | +// } | ||
352 | +// if err := transactionContext.StartTransaction(); err != nil { | ||
353 | +// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
354 | +// } | ||
355 | +// defer func() { | ||
356 | +// _ = transactionContext.RollbackTransaction() | ||
357 | +// }() | ||
358 | +// evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
359 | +// itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
360 | +// itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
361 | + | ||
362 | +// summaryEvaluation, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId}) | ||
363 | +// if err != nil { | ||
364 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
365 | +// } | ||
366 | +// if summaryEvaluation.Executor.UserId != param.ExecutorId { | ||
367 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限") | ||
368 | +// } | ||
369 | +// if summaryEvaluation.CompanyId != param.CompanyId { | ||
370 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限") | ||
371 | +// } | ||
372 | + | ||
373 | +// _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{ | ||
374 | +// "targetUserId": summaryEvaluation.TargetUser.UserId, | ||
375 | +// "typesList": []int{int(domain.EvaluationFinish)}, | ||
376 | +// "cycleId": summaryEvaluation.CycleId, | ||
377 | +// "limit": 1, | ||
378 | +// }) | ||
379 | +// if err != nil { | ||
380 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
381 | +// } | ||
382 | +// // 如果目标员工已经确认考核结果,就不能在进行评估编辑 | ||
383 | +// if len(evaluationList) > 0 && evaluationList[0].CheckResult == domain.EvaluationCheckCompleted { | ||
384 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户已经确认该周期的考核结果,不能再编辑!") | ||
385 | +// } | ||
386 | + | ||
387 | +// // 自评评估内容(自评模板、筛选项目评估人) | ||
388 | +// _, itemList, err := itemUsedRepo.Find(map[string]interface{}{ | ||
389 | +// "evaluationProjectId": summaryEvaluation.EvaluationProjectId, | ||
390 | +// "nodeType": domain.LinkNodeSelfAssessment, | ||
391 | +// "evaluatorId": param.ExecutorId, | ||
392 | +// }) | ||
393 | +// if err != nil { | ||
394 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
395 | +// } | ||
396 | + | ||
397 | +// // 评估内容对应的分数 | ||
398 | +// _, itemValueList, err := itemValueRepo.Find(map[string]interface{}{"summaryEvaluationId": summaryEvaluation.Id}) | ||
399 | +// if err != nil { | ||
400 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
401 | +// } | ||
402 | + | ||
403 | +// err = srv.editEvaluationValue(summaryEvaluation, &itemValueList, itemList, param.EvaluationItems, nil, param.IsTemporary) | ||
404 | +// if err != nil { | ||
405 | +// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
406 | +// } | ||
407 | +// if !param.IsTemporary { | ||
408 | +// //变更评估状态为已填写 | ||
409 | +// summaryEvaluation.Status = domain.EvaluationCompleted | ||
410 | +// } | ||
411 | + | ||
412 | +// //保存填写值 | ||
413 | +// for _, v := range itemValueList { | ||
414 | +// err = itemValueRepo.Save(v) | ||
415 | +// if err != nil { | ||
416 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
417 | +// } | ||
418 | +// } | ||
419 | + | ||
420 | +// //保存填写值 | ||
421 | +// err = evaluationRepo.Save(summaryEvaluation) | ||
422 | +// if err != nil { | ||
423 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
424 | +// } | ||
425 | +// if err := transactionContext.CommitTransaction(); err != nil { | ||
426 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
427 | +// } | ||
428 | + | ||
429 | +// if !param.IsTemporary { | ||
430 | +// err = srv.AfterCompletedEvaluation360Hrbp(summaryEvaluation) | ||
431 | +// if err != nil { | ||
432 | +// return nil, err | ||
433 | +// } | ||
434 | +// } | ||
435 | + | ||
436 | +// itemValueAdapter := srv.buildSummaryItemValue(itemList, itemValueList) | ||
437 | +// return map[string][]adapter.EvaluationItemAdapter{ | ||
438 | +// "evaluationItems": itemValueAdapter, | ||
439 | +// }, nil | ||
440 | +// } | ||
442 | 441 | ||
443 | // EvaluationHRBPList 获取人资综评列表 | 442 | // EvaluationHRBPList 获取人资综评列表 |
444 | func (srv *SummaryEvaluationService) EvaluationHRBPList(param *command.QueryEvaluationHRList) (map[string]interface{}, error) { | 443 | func (srv *SummaryEvaluationService) EvaluationHRBPList(param *command.QueryEvaluationHRList) (map[string]interface{}, error) { |
@@ -726,128 +725,128 @@ func (srv *SummaryEvaluationService) GetEvaluationHRBPComplete(param *command.Qu | @@ -726,128 +725,128 @@ func (srv *SummaryEvaluationService) GetEvaluationHRBPComplete(param *command.Qu | ||
726 | } | 725 | } |
727 | 726 | ||
728 | // EditEvaluationHRBP 编辑提交人资综评 | 727 | // EditEvaluationHRBP 编辑提交人资综评 |
729 | -func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) { | ||
730 | - lock := xredis.NewLockSummaryEvaluationId(param.SummaryEvaluationId) | ||
731 | - err := lock.Lock() | ||
732 | - if err != nil { | ||
733 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未能完全提交评估内容") | ||
734 | - } | ||
735 | - defer func() { | ||
736 | - lock.UnLock() | ||
737 | - }() | ||
738 | - transactionContext, err := factory.CreateTransactionContext(nil) | ||
739 | - if err != nil { | ||
740 | - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
741 | - } | ||
742 | - if err := transactionContext.StartTransaction(); err != nil { | ||
743 | - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
744 | - } | ||
745 | - defer func() { | ||
746 | - _ = transactionContext.RollbackTransaction() | ||
747 | - }() | ||
748 | - | ||
749 | - userRepo := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
750 | - evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
751 | - itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
752 | - itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
753 | - | ||
754 | - // 必须是HRBP权限的人才能编辑操作 | ||
755 | - hrbp, err := roleService.GetHrBp(transactionContext, param.CompanyId, param.ExecutorId) | ||
756 | - if err != nil { | ||
757 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
758 | - } | ||
759 | - if hrbp != domain.RoleTypeSystem { | ||
760 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限") | ||
761 | - } | ||
762 | - | ||
763 | - summaryEvaluation, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId}) | ||
764 | - if err != nil { | ||
765 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
766 | - } | ||
767 | - if summaryEvaluation.Types != domain.EvaluationHrbp { | ||
768 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限") | ||
769 | - } | ||
770 | - if summaryEvaluation.CompanyId != param.CompanyId { | ||
771 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限") | ||
772 | - } | ||
773 | - | ||
774 | - _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{ | ||
775 | - "targetUserId": summaryEvaluation.TargetUser.UserId, | ||
776 | - "typesList": []int{int(domain.EvaluationFinish)}, | ||
777 | - "cycleId": summaryEvaluation.CycleId, | ||
778 | - "limit": 1, | ||
779 | - }) | ||
780 | - if err != nil { | ||
781 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
782 | - } | ||
783 | - // 如果目标员工已经确认考核结果,就不能在进行评估编辑 | ||
784 | - if len(evaluationList) > 0 && evaluationList[0].CheckResult == domain.EvaluationCheckCompleted { | ||
785 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户已经确认该周期的考核结果,不能再编辑!") | ||
786 | - } | ||
787 | - | ||
788 | - // 自评评估内容(自评模板、筛选项目评估人) | ||
789 | - _, itemList, err := itemUsedRepo.Find(map[string]interface{}{ | ||
790 | - "evaluationProjectId": summaryEvaluation.EvaluationProjectId, | ||
791 | - "nodeType": domain.LinkNodeSelfAssessment, | ||
792 | - "evaluatorId": -1, | ||
793 | - }) | ||
794 | - if err != nil { | ||
795 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
796 | - } | ||
797 | - | ||
798 | - // 评估内容对应的分数 | ||
799 | - _, itemValueList, err := itemValueRepo.Find(map[string]interface{}{"summaryEvaluationId": summaryEvaluation.Id}) | ||
800 | - if err != nil { | ||
801 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
802 | - } | ||
803 | - | ||
804 | - err = srv.editEvaluationValue(summaryEvaluation, &itemValueList, itemList, param.EvaluationItems, nil, param.IsTemporary) | ||
805 | - if err != nil { | ||
806 | - return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
807 | - } | ||
808 | - if !param.IsTemporary { | ||
809 | - //变更评估状态为已填写 | ||
810 | - summaryEvaluation.Status = domain.EvaluationCompleted | ||
811 | - } | ||
812 | - //保存填写值 | ||
813 | - for _, v := range itemValueList { | ||
814 | - err = itemValueRepo.Save(v) | ||
815 | - if err != nil { | ||
816 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
817 | - } | ||
818 | - } | ||
819 | - | ||
820 | - // 针对HRBP类型,更新最后一次操作的HRBP人 | ||
821 | - user, err := userRepo.FindOne(map[string]interface{}{"id": param.ExecutorId}) | ||
822 | - if err != nil { | ||
823 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
824 | - } | ||
825 | - summaryEvaluation.Executor.UserId = param.ExecutorId | ||
826 | - summaryEvaluation.Executor.Account = user.Account | ||
827 | - summaryEvaluation.Executor.UserName = user.Name | ||
828 | - summaryEvaluation.Executor.CompanyName = "" // 暂时无用 | ||
829 | - summaryEvaluation.Status = domain.EvaluationCompleted | ||
830 | - | ||
831 | - //保存填写值 | ||
832 | - err = evaluationRepo.Save(summaryEvaluation) | ||
833 | - if err != nil { | ||
834 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
835 | - } | ||
836 | - if err := transactionContext.CommitTransaction(); err != nil { | ||
837 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
838 | - } | ||
839 | - | ||
840 | - if !param.IsTemporary { | ||
841 | - err = srv.AfterCompletedEvaluation360Hrbp(summaryEvaluation) | ||
842 | - if err != nil { | ||
843 | - return nil, err | ||
844 | - } | ||
845 | - } | ||
846 | - itemValueAdapter := srv.buildSummaryItemValue(itemList, itemValueList) | ||
847 | - return map[string][]adapter.EvaluationItemAdapter{ | ||
848 | - "evaluationItems": itemValueAdapter, | ||
849 | - }, nil | ||
850 | -} | 728 | +// func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) { |
729 | +// lock := xredis.NewLockSummaryEvaluationId(param.SummaryEvaluationId) | ||
730 | +// err := lock.Lock() | ||
731 | +// if err != nil { | ||
732 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未能完全提交评估内容") | ||
733 | +// } | ||
734 | +// defer func() { | ||
735 | +// lock.UnLock() | ||
736 | +// }() | ||
737 | +// transactionContext, err := factory.CreateTransactionContext(nil) | ||
738 | +// if err != nil { | ||
739 | +// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
740 | +// } | ||
741 | +// if err := transactionContext.StartTransaction(); err != nil { | ||
742 | +// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
743 | +// } | ||
744 | +// defer func() { | ||
745 | +// _ = transactionContext.RollbackTransaction() | ||
746 | +// }() | ||
747 | + | ||
748 | +// userRepo := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
749 | +// evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
750 | +// itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
751 | +// itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
752 | + | ||
753 | +// // 必须是HRBP权限的人才能编辑操作 | ||
754 | +// hrbp, err := roleService.GetHrBp(transactionContext, param.CompanyId, param.ExecutorId) | ||
755 | +// if err != nil { | ||
756 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
757 | +// } | ||
758 | +// if hrbp != domain.RoleTypeSystem { | ||
759 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限") | ||
760 | +// } | ||
761 | + | ||
762 | +// summaryEvaluation, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId}) | ||
763 | +// if err != nil { | ||
764 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
765 | +// } | ||
766 | +// if summaryEvaluation.Types != domain.EvaluationHrbp { | ||
767 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限") | ||
768 | +// } | ||
769 | +// if summaryEvaluation.CompanyId != param.CompanyId { | ||
770 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限") | ||
771 | +// } | ||
772 | + | ||
773 | +// _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{ | ||
774 | +// "targetUserId": summaryEvaluation.TargetUser.UserId, | ||
775 | +// "typesList": []int{int(domain.EvaluationFinish)}, | ||
776 | +// "cycleId": summaryEvaluation.CycleId, | ||
777 | +// "limit": 1, | ||
778 | +// }) | ||
779 | +// if err != nil { | ||
780 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
781 | +// } | ||
782 | +// // 如果目标员工已经确认考核结果,就不能在进行评估编辑 | ||
783 | +// if len(evaluationList) > 0 && evaluationList[0].CheckResult == domain.EvaluationCheckCompleted { | ||
784 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户已经确认该周期的考核结果,不能再编辑!") | ||
785 | +// } | ||
786 | + | ||
787 | +// // 自评评估内容(自评模板、筛选项目评估人) | ||
788 | +// _, itemList, err := itemUsedRepo.Find(map[string]interface{}{ | ||
789 | +// "evaluationProjectId": summaryEvaluation.EvaluationProjectId, | ||
790 | +// "nodeType": domain.LinkNodeSelfAssessment, | ||
791 | +// "evaluatorId": -1, | ||
792 | +// }) | ||
793 | +// if err != nil { | ||
794 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
795 | +// } | ||
796 | + | ||
797 | +// // 评估内容对应的分数 | ||
798 | +// _, itemValueList, err := itemValueRepo.Find(map[string]interface{}{"summaryEvaluationId": summaryEvaluation.Id}) | ||
799 | +// if err != nil { | ||
800 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
801 | +// } | ||
802 | + | ||
803 | +// err = srv.editEvaluationValue(summaryEvaluation, &itemValueList, itemList, param.EvaluationItems, nil, param.IsTemporary) | ||
804 | +// if err != nil { | ||
805 | +// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
806 | +// } | ||
807 | +// if !param.IsTemporary { | ||
808 | +// //变更评估状态为已填写 | ||
809 | +// summaryEvaluation.Status = domain.EvaluationCompleted | ||
810 | +// } | ||
811 | +// //保存填写值 | ||
812 | +// for _, v := range itemValueList { | ||
813 | +// err = itemValueRepo.Save(v) | ||
814 | +// if err != nil { | ||
815 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
816 | +// } | ||
817 | +// } | ||
818 | + | ||
819 | +// // 针对HRBP类型,更新最后一次操作的HRBP人 | ||
820 | +// user, err := userRepo.FindOne(map[string]interface{}{"id": param.ExecutorId}) | ||
821 | +// if err != nil { | ||
822 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
823 | +// } | ||
824 | +// summaryEvaluation.Executor.UserId = param.ExecutorId | ||
825 | +// summaryEvaluation.Executor.Account = user.Account | ||
826 | +// summaryEvaluation.Executor.UserName = user.Name | ||
827 | +// summaryEvaluation.Executor.CompanyName = "" // 暂时无用 | ||
828 | +// summaryEvaluation.Status = domain.EvaluationCompleted | ||
829 | + | ||
830 | +// //保存填写值 | ||
831 | +// err = evaluationRepo.Save(summaryEvaluation) | ||
832 | +// if err != nil { | ||
833 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
834 | +// } | ||
835 | +// if err := transactionContext.CommitTransaction(); err != nil { | ||
836 | +// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
837 | +// } | ||
838 | + | ||
839 | +// if !param.IsTemporary { | ||
840 | +// err = srv.AfterCompletedEvaluation360Hrbp(summaryEvaluation) | ||
841 | +// if err != nil { | ||
842 | +// return nil, err | ||
843 | +// } | ||
844 | +// } | ||
845 | +// itemValueAdapter := srv.buildSummaryItemValue(itemList, itemValueList) | ||
846 | +// return map[string][]adapter.EvaluationItemAdapter{ | ||
847 | +// "evaluationItems": itemValueAdapter, | ||
848 | +// }, nil | ||
849 | +// } | ||
851 | 850 | ||
852 | // 修改周期考核的分数 | 851 | // 修改周期考核的分数 |
853 | func (srv *SummaryEvaluationService) ModifyFinishScore(param *command.ModifyFinishScore) error { | 852 | func (srv *SummaryEvaluationService) ModifyFinishScore(param *command.ModifyFinishScore) error { |
-
请 注册 或 登录 后发表评论