正在显示
9 个修改的文件
包含
371 行增加
和
66 行删除
@@ -71,6 +71,7 @@ type EvaluationBaseAdapter struct { | @@ -71,6 +71,7 @@ type EvaluationBaseAdapter struct { | ||
71 | Status string `json:"status"` //完成状态 | 71 | Status string `json:"status"` //完成状态 |
72 | CheckResult string `json:"checkResult"` //确认绩效结果 | 72 | CheckResult string `json:"checkResult"` //确认绩效结果 |
73 | TotalScore string `json:"totalScore"` //评估总分 | 73 | TotalScore string `json:"totalScore"` //评估总分 |
74 | + Version string `json:"version"` //评估填写方式 | ||
74 | } | 75 | } |
75 | 76 | ||
76 | // 自评估内容详情 | 77 | // 自评估内容详情 |
1 | package service | 1 | package service |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "fmt" | ||
5 | + "strings" | ||
4 | "time" | 6 | "time" |
5 | 7 | ||
6 | "github.com/linmadan/egglib-go/core/application" | 8 | "github.com/linmadan/egglib-go/core/application" |
@@ -172,15 +174,11 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf( | @@ -172,15 +174,11 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf( | ||
172 | } | 174 | } |
173 | 175 | ||
174 | var evaluationFinish *domain.SummaryEvaluation | 176 | var evaluationFinish *domain.SummaryEvaluation |
175 | - noSuper := true | ||
176 | //查找综合评估结果 | 177 | //查找综合评估结果 |
177 | for _, v := range evaluationList { | 178 | for _, v := range evaluationList { |
178 | if v.Types == domain.EvaluationFinish { | 179 | if v.Types == domain.EvaluationFinish { |
179 | evaluationFinish = v | 180 | evaluationFinish = v |
180 | } | 181 | } |
181 | - if v.Types == domain.EvaluationSuper { | ||
182 | - noSuper = false | ||
183 | - } | ||
184 | } | 182 | } |
185 | if len(targetEvaluation) == 0 { | 183 | if len(targetEvaluation) == 0 { |
186 | //没有上级评估、360评估、hrbp 评估 | 184 | //没有上级评估、360评估、hrbp 评估 |
@@ -203,45 +201,154 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf( | @@ -203,45 +201,154 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf( | ||
203 | } | 201 | } |
204 | } | 202 | } |
205 | } | 203 | } |
206 | - _ = noSuper | ||
207 | - // if noSuper && evaluationFinish != nil { | ||
208 | - //没有上级评估 同步数据到考核结果 | ||
209 | - | ||
210 | - // itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{ | ||
211 | - // "transactionContext": transactionContext, | ||
212 | - // }) | ||
213 | - // _, itemList, err := itemUsedRepo.Find(map[string]interface{}{ | ||
214 | - // "evaluationProjectId": evaluationData.EvaluationProjectId, | ||
215 | - // "nodeType": domain.LinkNodeSelfAssessment, | ||
216 | - // }) | ||
217 | - // if err != nil { | ||
218 | - // return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
219 | - // } | ||
220 | - // //提取非360,hrbp 的评估项 | ||
221 | - // updateValue := []*domain.SummaryEvaluationValue{} | ||
222 | - // for _, val := range itemList { | ||
223 | - // if val.EvaluatorId != 0 { | ||
224 | - // continue | ||
225 | - // } | ||
226 | - // for _, val2 := range evaluationValue { | ||
227 | - // if val.Id == val2.EvaluationItemId { | ||
228 | - // updateValue = append(updateValue, val2) | ||
229 | - // break | ||
230 | - // } | ||
231 | - // } | ||
232 | - // } | ||
233 | - // //同步数据 | ||
234 | - // err = srv.syncEvaluationFinishValue(transactionContext, evaluationFinish, updateValue) | ||
235 | - // if err != nil { | ||
236 | - // return err | ||
237 | - // } | ||
238 | - | ||
239 | - // } else if len(targetEvaluation) == 0 && evaluationFinish != nil { | ||
240 | - // err = evaluationRepo.Save(evaluationFinish) | ||
241 | - // if err != nil { | ||
242 | - // return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error()) | ||
243 | - // } | ||
244 | - // } | ||
245 | 204 | ||
246 | return nil | 205 | return nil |
247 | } | 206 | } |
207 | + | ||
208 | +// 编辑综合自评详情 | ||
209 | +func (srv *SummaryEvaluationService) EditEvaluationSelfV2(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) { | ||
210 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
211 | + if err != nil { | ||
212 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
213 | + } | ||
214 | + if err := transactionContext.StartTransaction(); err != nil { | ||
215 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
216 | + } | ||
217 | + defer func() { | ||
218 | + _ = transactionContext.RollbackTransaction() | ||
219 | + }() | ||
220 | + evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{ | ||
221 | + "transactionContext": transactionContext, | ||
222 | + }) | ||
223 | + itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{ | ||
224 | + "transactionContext": transactionContext, | ||
225 | + }) | ||
226 | + | ||
227 | + itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{ | ||
228 | + "transactionContext": transactionContext, | ||
229 | + }) | ||
230 | + evaluationData, err := evaluationRepo.FindOne(map[string]interface{}{ | ||
231 | + "id": param.SummaryEvaluationId, | ||
232 | + }) | ||
233 | + if err != nil { | ||
234 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取评估"+err.Error()) | ||
235 | + } | ||
236 | + if evaluationData.Types != domain.EvaluationSelf { | ||
237 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限") | ||
238 | + } | ||
239 | + | ||
240 | + if evaluationData.Executor.UserId != param.ExecutorId { | ||
241 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限") | ||
242 | + } | ||
243 | + if evaluationData.CompanyId != param.CompanyId { | ||
244 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限") | ||
245 | + } | ||
246 | + //按照 被评估人加锁 | ||
247 | + lock := xredis.NewLockSummaryEvaluation(evaluationData.TargetUser.UserId) | ||
248 | + err = lock.Lock() | ||
249 | + if err != nil { | ||
250 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未能完全提交评估内容") | ||
251 | + } | ||
252 | + defer func() { | ||
253 | + lock.UnLock() | ||
254 | + }() | ||
255 | + _, itemList, err := itemUsedRepo.Find(map[string]interface{}{ | ||
256 | + "evaluationProjectId": evaluationData.EvaluationProjectId, | ||
257 | + "nodeType": domain.LinkNodeSelfAssessment, | ||
258 | + }) | ||
259 | + if err != nil { | ||
260 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
261 | + } | ||
262 | + _, itemValueList, err := itemValueRepo.Find(map[string]interface{}{ | ||
263 | + "summaryEvaluationId": evaluationData.Id, | ||
264 | + }) | ||
265 | + | ||
266 | + if err != nil { | ||
267 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
268 | + } | ||
269 | + //更新填写值 | ||
270 | + var evaluationValueSlice []*domain.SummaryEvaluationValue // 提交的填写值 | ||
271 | + { | ||
272 | + | ||
273 | + evaluationItemMap := map[int]*domain.EvaluationItemUsed{} // 需要填写那些项 Id=>&domain.EvaluationItemUsed{} | ||
274 | + evaluationValueMap := map[int]*domain.SummaryEvaluationValue{} // 提交的填写值 EvaluationItemId=>&domain.domain.SummaryEvaluationValue{} | ||
275 | + evaluationData.TotalRating = nil // 清空评级数量统计 | ||
276 | + // 按照需要填写那些项 设置SummaryEvaluationValue的空白值 | ||
277 | + for _, v := range itemList { | ||
278 | + newValue := &domain.SummaryEvaluationValue{} | ||
279 | + newValue.SetBlankValue(evaluationData, v) | ||
280 | + evaluationValueMap[v.Id] = newValue | ||
281 | + evaluationItemMap[v.Id] = v | ||
282 | + evaluationValueSlice = append(evaluationValueSlice, newValue) | ||
283 | + } | ||
284 | + //如果存在旧值 | ||
285 | + //新值的id 替换为旧值id | ||
286 | + for _, v := range itemValueList { | ||
287 | + if mValue, ok := evaluationValueMap[v.EvaluationItemId]; ok { | ||
288 | + mValue.Id = v.Id | ||
289 | + } | ||
290 | + } | ||
291 | + //填入提交的更新值 | ||
292 | + for _, v := range param.EvaluationItems { | ||
293 | + v.Value = strings.TrimSpace(v.Value) | ||
294 | + newItemValue, ok := evaluationValueMap[v.EvaluationItemId] | ||
295 | + if !ok { | ||
296 | + continue | ||
297 | + } | ||
298 | + evaluationItem, ok := evaluationItemMap[v.EvaluationItemId] | ||
299 | + if !ok { | ||
300 | + continue | ||
301 | + } | ||
302 | + if !param.IsTemporary { | ||
303 | + //除了综合自评,其他的评估任务 评估项直接全部按必填项处理 | ||
304 | + if len(v.Value) == 0 { | ||
305 | + e := fmt.Sprintf("%s-%s 未填写", evaluationItem.Category, evaluationItem.Name) | ||
306 | + return nil, application.ThrowError(application.BUSINESS_ERROR, e) | ||
307 | + } | ||
308 | + } | ||
309 | + //填充评估填写值 | ||
310 | + newItemValue.Remark = v.Remark | ||
311 | + err := evaluationData.FillItemValue(evaluationItem, newItemValue, v.Value) | ||
312 | + if err != nil { | ||
313 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
314 | + } | ||
315 | + } | ||
316 | + evaluationData.EvaluationTotalScore(evaluationValueSlice) | ||
317 | + } | ||
318 | + | ||
319 | + if !param.IsTemporary { | ||
320 | + evaluationData.Status = domain.EvaluationCompleted | ||
321 | + //删除旧的填写值,使用新的填写内容 | ||
322 | + err = itemValueRepo.RemoveBySummaryEvaluationId(evaluationData.Id) | ||
323 | + if err != nil { | ||
324 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
325 | + } | ||
326 | + for _, val := range itemValueList { | ||
327 | + val.Id = 0 | ||
328 | + } | ||
329 | + } | ||
330 | + err = evaluationRepo.Save(evaluationData) | ||
331 | + if err != nil { | ||
332 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
333 | + } | ||
334 | + //保存填写值 | ||
335 | + for _, v := range itemValueList { | ||
336 | + err = itemValueRepo.Save(v) | ||
337 | + if err != nil { | ||
338 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
339 | + } | ||
340 | + } | ||
341 | + if !param.IsTemporary { | ||
342 | + err = srv.AfterCompletedEvaluationSelf(transactionContext, evaluationData, itemValueList) | ||
343 | + if err != nil { | ||
344 | + return nil, err | ||
345 | + } | ||
346 | + } | ||
347 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
348 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
349 | + } | ||
350 | + itemValueAdapter := srv.buildSummaryItemValue(itemList, itemValueList) | ||
351 | + return map[string][]adapter.EvaluationItemAdapter{ | ||
352 | + "EvaluationItems": itemValueAdapter, | ||
353 | + }, nil | ||
354 | +} |
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 | +) | ||
10 | + | ||
11 | +// GetEvaluation360Complete 获取360综评详情(他人评估目标用户)(已完成状态) | ||
12 | +func (srv *SummaryEvaluationService) GetEvaluation360CompleteV2(param *command.QueryEvaluation360) (*adapter.EvaluationInfoSelfAdapter, error) { | ||
13 | + transactionContext, err := factory.ValidateStartTransaction(param) | ||
14 | + if err != nil { | ||
15 | + return nil, err | ||
16 | + } | ||
17 | + defer func() { | ||
18 | + _ = transactionContext.RollbackTransaction() | ||
19 | + }() | ||
20 | + | ||
21 | + evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
22 | + evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
23 | + itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
24 | + _, evaluations, err := evaluationRepo.Find(map[string]interface{}{ | ||
25 | + "companyId": param.CompanyId, | ||
26 | + "cycleId": param.CycleId, | ||
27 | + "targetUserId": param.TargetUserId, | ||
28 | + "types": domain.Evaluation360, | ||
29 | + "status": domain.EvaluationCompleted, | ||
30 | + "limit": 1000, | ||
31 | + }) | ||
32 | + if err != nil { | ||
33 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
34 | + } | ||
35 | + | ||
36 | + if len(evaluations) == 0 { | ||
37 | + list := make([]adapter.EvaluationItemAdapter, 0) | ||
38 | + res := adapter.EvaluationInfoSelfAdapter{ | ||
39 | + EvaluationItems: list, | ||
40 | + } | ||
41 | + return &res, nil | ||
42 | + } | ||
43 | + | ||
44 | + executorMap := map[int]domain.StaffDesc{} // 执行人 | ||
45 | + evaluationIds := make([]int, 0) // 评估周期ID | ||
46 | + for i := range evaluations { | ||
47 | + executor := evaluations[i].Executor | ||
48 | + executorMap[executor.UserId] = executor | ||
49 | + | ||
50 | + evaluationIds = append(evaluationIds, evaluations[i].Id) | ||
51 | + } | ||
52 | + // 得到项目ID | ||
53 | + evaluationProjectId := evaluations[0].EvaluationProjectId | ||
54 | + // 360评估内容(自评模板) | ||
55 | + _, itemList, err := evaluationItemRepo.Find(map[string]interface{}{ | ||
56 | + "evaluationProjectId": evaluationProjectId, | ||
57 | + "nodeType": domain.LinkNodeSelfAssessment, | ||
58 | + }) | ||
59 | + if err != nil { | ||
60 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
61 | + } | ||
62 | + | ||
63 | + // 评估内容对应的分数 | ||
64 | + _, itemValues, err := itemValueRepo.Find(map[string]interface{}{ | ||
65 | + "summaryEvaluationIdList": evaluationIds, | ||
66 | + "types": domain.Evaluation360, | ||
67 | + }) | ||
68 | + if err != nil { | ||
69 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
70 | + } | ||
71 | + | ||
72 | + filterItemList := make([]*domain.EvaluationItemUsed, 0) // 筛选有评估人的评估内容 | ||
73 | + for i := range itemList { | ||
74 | + if itemList[i].EvaluatorId > 0 { | ||
75 | + filterItemList = append(filterItemList, itemList[i]) | ||
76 | + } | ||
77 | + } | ||
78 | + // 获取组装基本信息 | ||
79 | + evaluationBase := srv.getSummaryEvaluation(transactionContext, evaluations[0]) | ||
80 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
81 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
82 | + } | ||
83 | + | ||
84 | + itemValuesAdapter := srv.buildSummaryItemValue(filterItemList, itemValues) | ||
85 | + for i := range itemValuesAdapter { // 评估人名称赋值 | ||
86 | + if executor, ok := executorMap[itemValuesAdapter[i].EvaluatorId]; ok { | ||
87 | + itemValuesAdapter[i].EvaluatorName = executor.UserName | ||
88 | + } | ||
89 | + } | ||
90 | + result := adapter.EvaluationInfoSelfAdapter{ | ||
91 | + EvaluationBaseAdapter: evaluationBase, | ||
92 | + EvaluationItems: itemValuesAdapter, | ||
93 | + } | ||
94 | + return &result, nil | ||
95 | +} |
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 | +) | ||
10 | + | ||
11 | +// GetEvaluationHRBPComplete 获取人资综评详情(他人评估目标用户)(已完成状态) | ||
12 | +func (srv *SummaryEvaluationService) GetEvaluationHRBPCompleteV2(param *command.QueryEvaluationHRBP) (*adapter.EvaluationInfoSelfAdapter, error) { | ||
13 | + transactionContext, err := factory.ValidateStartTransaction(param) | ||
14 | + if err != nil { | ||
15 | + return nil, err | ||
16 | + } | ||
17 | + defer func() { | ||
18 | + _ = transactionContext.RollbackTransaction() | ||
19 | + }() | ||
20 | + | ||
21 | + evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
22 | + evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
23 | + itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
24 | + | ||
25 | + _, evaluations, err := evaluationRepo.Find(map[string]interface{}{ | ||
26 | + "limit": 2, | ||
27 | + "companyId": param.CompanyId, | ||
28 | + "cycleId": param.CycleId, | ||
29 | + "targetUserId": param.TargetUserId, | ||
30 | + "status": domain.EvaluationCompleted, | ||
31 | + "types": domain.EvaluationHrbp}, | ||
32 | + ) | ||
33 | + if err != nil { | ||
34 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
35 | + } | ||
36 | + | ||
37 | + if len(evaluations) == 0 { | ||
38 | + list := make([]adapter.EvaluationItemAdapter, 0) | ||
39 | + res := adapter.EvaluationInfoSelfAdapter{ | ||
40 | + EvaluationItems: list, | ||
41 | + } | ||
42 | + return &res, nil | ||
43 | + } | ||
44 | + | ||
45 | + evaluationIds := make([]int, 0) // 评估周期ID | ||
46 | + for i := range evaluations { | ||
47 | + evaluationIds = append(evaluationIds, evaluations[i].Id) | ||
48 | + } | ||
49 | + // 得到项目ID | ||
50 | + evaluationProjectId := evaluations[0].EvaluationProjectId | ||
51 | + | ||
52 | + // 自评评估内容(自评模板、筛选项目评估人) | ||
53 | + _, itemList, err := evaluationItemRepo.Find(map[string]interface{}{ | ||
54 | + "evaluationProjectId": evaluationProjectId, | ||
55 | + "nodeType": domain.LinkNodeSelfAssessment, | ||
56 | + "evaluatorId": -1, | ||
57 | + }) | ||
58 | + if err != nil { | ||
59 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
60 | + } | ||
61 | + | ||
62 | + // 评估内容对应的分数 | ||
63 | + _, itemValues, err := itemValueRepo.Find(map[string]interface{}{ | ||
64 | + "summaryEvaluationIdList": evaluationIds, | ||
65 | + "types": domain.EvaluationHrbp, | ||
66 | + }) | ||
67 | + if err != nil { | ||
68 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
69 | + } | ||
70 | + // 获取组装基本信息 | ||
71 | + evaluationBase := srv.getSummaryEvaluation(transactionContext, evaluations[0]) | ||
72 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
73 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
74 | + } | ||
75 | + | ||
76 | + itemValuesAdapter := srv.buildSummaryItemValue(itemList, itemValues) | ||
77 | + for i := range itemValuesAdapter { // 评估人名称赋值 | ||
78 | + itemValuesAdapter[i].EvaluatorName = evaluations[0].Executor.UserName | ||
79 | + } | ||
80 | + result := adapter.EvaluationInfoSelfAdapter{ | ||
81 | + EvaluationBaseAdapter: evaluationBase, | ||
82 | + EvaluationItems: itemValuesAdapter, | ||
83 | + } | ||
84 | + return &result, nil | ||
85 | +} |
@@ -453,6 +453,7 @@ func (srv *SummaryEvaluationService) getSummaryEvaluation(transactionContext app | @@ -453,6 +453,7 @@ func (srv *SummaryEvaluationService) getSummaryEvaluation(transactionContext app | ||
453 | Status: string(evaluationData.Status), | 453 | Status: string(evaluationData.Status), |
454 | CheckResult: string(evaluationData.CheckResult), | 454 | CheckResult: string(evaluationData.CheckResult), |
455 | TotalScore: evaluationData.TotalScore, | 455 | TotalScore: evaluationData.TotalScore, |
456 | + Version: evaluationData.Version, | ||
456 | } | 457 | } |
457 | //获取用户信息 | 458 | //获取用户信息 |
458 | companyRepo := factory.CreateCompanyRepository(map[string]interface{}{"transactionContext": transactionContext}) | 459 | companyRepo := factory.CreateCompanyRepository(map[string]interface{}{"transactionContext": transactionContext}) |
@@ -239,11 +239,11 @@ func (srv *SummaryEvaluationService) GetEvaluation360(param *command.QueryEvalua | @@ -239,11 +239,11 @@ func (srv *SummaryEvaluationService) GetEvaluation360(param *command.QueryEvalua | ||
239 | } | 239 | } |
240 | // 评估项截止时间 | 240 | // 评估项截止时间 |
241 | endTime := sEvaluation.EndTime.Local().Format("2006-01-02 15:04:05") | 241 | endTime := sEvaluation.EndTime.Local().Format("2006-01-02 15:04:05") |
242 | - return map[string]interface{}{"endTime": endTime, "list": itemValuesAdapter}, nil | 242 | + return map[string]interface{}{"endTime": endTime, "version": sEvaluation.Version, "list": itemValuesAdapter}, nil |
243 | } | 243 | } |
244 | 244 | ||
245 | // GetEvaluation360Complete 获取360综评详情(他人评估目标用户)(已完成状态) | 245 | // GetEvaluation360Complete 获取360综评详情(他人评估目标用户)(已完成状态) |
246 | -func (srv *SummaryEvaluationService) GetEvaluation360Complete(param *command.QueryEvaluation360) (*[]adapter.EvaluationItemAdapter, error) { | 246 | +func (srv *SummaryEvaluationService) GetEvaluation360Complete(param *command.QueryEvaluation360) ([]adapter.EvaluationItemAdapter, error) { |
247 | transactionContext, err := factory.ValidateStartTransaction(param) | 247 | transactionContext, err := factory.ValidateStartTransaction(param) |
248 | if err != nil { | 248 | if err != nil { |
249 | return nil, err | 249 | return nil, err |
@@ -261,7 +261,7 @@ func (srv *SummaryEvaluationService) GetEvaluation360Complete(param *command.Que | @@ -261,7 +261,7 @@ func (srv *SummaryEvaluationService) GetEvaluation360Complete(param *command.Que | ||
261 | "targetUserId": param.TargetUserId, | 261 | "targetUserId": param.TargetUserId, |
262 | "types": domain.Evaluation360, | 262 | "types": domain.Evaluation360, |
263 | "status": domain.EvaluationCompleted, | 263 | "status": domain.EvaluationCompleted, |
264 | - "limit": 99999, | 264 | + "limit": 1000, |
265 | }) | 265 | }) |
266 | if err != nil { | 266 | if err != nil { |
267 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 267 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
@@ -269,7 +269,7 @@ func (srv *SummaryEvaluationService) GetEvaluation360Complete(param *command.Que | @@ -269,7 +269,7 @@ func (srv *SummaryEvaluationService) GetEvaluation360Complete(param *command.Que | ||
269 | 269 | ||
270 | if len(evaluations) == 0 { | 270 | if len(evaluations) == 0 { |
271 | list := make([]adapter.EvaluationItemAdapter, 0) | 271 | list := make([]adapter.EvaluationItemAdapter, 0) |
272 | - return &list, nil | 272 | + return list, nil |
273 | } | 273 | } |
274 | 274 | ||
275 | executorMap := map[int]domain.StaffDesc{} // 执行人 | 275 | executorMap := map[int]domain.StaffDesc{} // 执行人 |
@@ -306,7 +306,6 @@ func (srv *SummaryEvaluationService) GetEvaluation360Complete(param *command.Que | @@ -306,7 +306,6 @@ func (srv *SummaryEvaluationService) GetEvaluation360Complete(param *command.Que | ||
306 | filterItemList = append(filterItemList, itemList[i]) | 306 | filterItemList = append(filterItemList, itemList[i]) |
307 | } | 307 | } |
308 | } | 308 | } |
309 | - | ||
310 | if err := transactionContext.CommitTransaction(); err != nil { | 309 | if err := transactionContext.CommitTransaction(); err != nil { |
311 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 310 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
312 | } | 311 | } |
@@ -317,22 +316,7 @@ func (srv *SummaryEvaluationService) GetEvaluation360Complete(param *command.Que | @@ -317,22 +316,7 @@ func (srv *SummaryEvaluationService) GetEvaluation360Complete(param *command.Que | ||
317 | itemValuesAdapter[i].EvaluatorName = executor.UserName | 316 | itemValuesAdapter[i].EvaluatorName = executor.UserName |
318 | } | 317 | } |
319 | } | 318 | } |
320 | - | ||
321 | - //result := adapter.EvaluationInfoAdapter{ | ||
322 | - // SummaryEvaluationId: sEvaluation.Id, | ||
323 | - // CycleId: int(sEvaluation.CycleId), | ||
324 | - // CycleName: sEvaluation.CycleName, | ||
325 | - // EvaluationProjectId: sEvaluation.EvaluationProjectId, | ||
326 | - // EvaluationProjectName: sEvaluation.EvaluationProjectName, | ||
327 | - // LinkNodeId: sEvaluation.NodeId, | ||
328 | - // BeginTime: sEvaluation.BeginTime.Format("2006-01-02 15:04:05"), | ||
329 | - // EndTime: sEvaluation.EndTime.Format("2006-01-02 15:04:05"), | ||
330 | - // TargetUserId: sEvaluation.TargetUser.UserId, | ||
331 | - // TargetUserName: sEvaluation.TargetUser.UserName, | ||
332 | - // Status: string(sEvaluation.Status), | ||
333 | - // EvaluationItems: itemValuesAdapter, | ||
334 | - //} | ||
335 | - return &itemValuesAdapter, nil | 319 | + return itemValuesAdapter, nil |
336 | } | 320 | } |
337 | 321 | ||
338 | // EvaluationHRBPList 获取人资综评列表 | 322 | // EvaluationHRBPList 获取人资综评列表 |
@@ -549,7 +533,7 @@ func (srv *SummaryEvaluationService) GetEvaluationHRBP(param *command.QueryEvalu | @@ -549,7 +533,7 @@ func (srv *SummaryEvaluationService) GetEvaluationHRBP(param *command.QueryEvalu | ||
549 | 533 | ||
550 | // 评估项截止时间 | 534 | // 评估项截止时间 |
551 | endTime := sEvaluation.EndTime.Local().Format("2006-01-02 15:04:05") | 535 | endTime := sEvaluation.EndTime.Local().Format("2006-01-02 15:04:05") |
552 | - return map[string]interface{}{"endTime": endTime, "list": itemValuesAdapter}, nil | 536 | + return map[string]interface{}{"endTime": endTime, "version": sEvaluation.Version, "list": itemValuesAdapter}, nil |
553 | } | 537 | } |
554 | 538 | ||
555 | // GetEvaluationHRBPComplete 获取人资综评详情(已完成状态) | 539 | // GetEvaluationHRBPComplete 获取人资综评详情(已完成状态) |
@@ -25,7 +25,7 @@ type SummaryEvaluation struct { | @@ -25,7 +25,7 @@ type SummaryEvaluation struct { | ||
25 | EndTime time.Time `json:"endTime"` //截止时间 | 25 | EndTime time.Time `json:"endTime"` //截止时间 |
26 | TotalScore string `json:"totalScore"` //最终上级评估得分. | 26 | TotalScore string `json:"totalScore"` //最终上级评估得分. |
27 | TotalRating []RatingCodeNumber `json:"totalRating"` //汇总各个评级的数量 | 27 | TotalRating []RatingCodeNumber `json:"totalRating"` //汇总各个评级的数量 |
28 | - Version string `json:"version"` //填写评估值的规则版本 v1,v2 | 28 | + Version string `json:"version"` //填写评估值的规则版本 v1,v2 ,填写方式对应方法 SummaryEvaluation.FillItemValue |
29 | CreatedAt time.Time `json:"createdAt"` //数据创建时间 | 29 | CreatedAt time.Time `json:"createdAt"` //数据创建时间 |
30 | UpdatedAt time.Time `json:"updatedAt"` //数据更新时间 | 30 | UpdatedAt time.Time `json:"updatedAt"` //数据更新时间 |
31 | DeletedAt *time.Time `json:"deletedAt"` //数据删除时间 | 31 | DeletedAt *time.Time `json:"deletedAt"` //数据删除时间 |
@@ -180,6 +180,21 @@ func (c *SummaryEvaluationController) GetEvaluation360Complete() { | @@ -180,6 +180,21 @@ func (c *SummaryEvaluationController) GetEvaluation360Complete() { | ||
180 | c.Response(data, err) | 180 | c.Response(data, err) |
181 | } | 181 | } |
182 | 182 | ||
183 | +func (c *SummaryEvaluationController) GetEvaluation360CompleteV2() { | ||
184 | + srv := service.NewSummaryEvaluationService() | ||
185 | + in := &command.QueryEvaluation360{} | ||
186 | + err := c.BindJSON(in) | ||
187 | + if err != nil { | ||
188 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
189 | + c.Response(nil, e) | ||
190 | + return | ||
191 | + } | ||
192 | + userReq := middlewares.GetUser(c.Ctx) | ||
193 | + in.CompanyId = int(userReq.CompanyId) | ||
194 | + data, err := srv.GetEvaluation360CompleteV2(in) | ||
195 | + c.Response(data, err) | ||
196 | +} | ||
197 | + | ||
183 | func (c *SummaryEvaluationController) EditEvaluation360() { | 198 | func (c *SummaryEvaluationController) EditEvaluation360() { |
184 | srv := service.NewSummaryEvaluationService() | 199 | srv := service.NewSummaryEvaluationService() |
185 | in := &command.EditEvaluationValue{} | 200 | in := &command.EditEvaluationValue{} |
@@ -242,6 +257,21 @@ func (c *SummaryEvaluationController) GetEvaluationHRBPComplete() { | @@ -242,6 +257,21 @@ func (c *SummaryEvaluationController) GetEvaluationHRBPComplete() { | ||
242 | c.Response(data, err) | 257 | c.Response(data, err) |
243 | } | 258 | } |
244 | 259 | ||
260 | +func (c *SummaryEvaluationController) GetEvaluationHRBPCompleteV2() { | ||
261 | + srv := service.NewSummaryEvaluationService() | ||
262 | + in := &command.QueryEvaluationHRBP{} | ||
263 | + err := c.BindJSON(in) | ||
264 | + if err != nil { | ||
265 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
266 | + c.Response(nil, e) | ||
267 | + return | ||
268 | + } | ||
269 | + userReq := middlewares.GetUser(c.Ctx) | ||
270 | + in.CompanyId = int(userReq.CompanyId) | ||
271 | + data, err := srv.GetEvaluationHRBPCompleteV2(in) | ||
272 | + c.Response(data, err) | ||
273 | +} | ||
274 | + | ||
245 | func (c *SummaryEvaluationController) EditEvaluationHRBP() { | 275 | func (c *SummaryEvaluationController) EditEvaluationHRBP() { |
246 | srv := service.NewSummaryEvaluationService() | 276 | srv := service.NewSummaryEvaluationService() |
247 | in := &command.EditEvaluationValue{} | 277 | in := &command.EditEvaluationValue{} |
@@ -42,6 +42,8 @@ func init() { | @@ -42,6 +42,8 @@ func init() { | ||
42 | web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()), | 42 | web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()), |
43 | web.NSCtrlPost("/self/summary", (*controllers.SummaryEvaluationController).CountEvaluationSelfLevelV2), | 43 | web.NSCtrlPost("/self/summary", (*controllers.SummaryEvaluationController).CountEvaluationSelfLevelV2), |
44 | web.NSCtrlPost("/cycle_project/list", (*controllers.SummaryEvaluationController).ListCycleAndProject), | 44 | web.NSCtrlPost("/cycle_project/list", (*controllers.SummaryEvaluationController).ListCycleAndProject), |
45 | + web.NSCtrlPost("/evaluation-360all", (*controllers.SummaryEvaluationController).GetEvaluation360CompleteV2), | ||
46 | + web.NSCtrlPost("/evaluation-hrAll", (*controllers.SummaryEvaluationController).GetEvaluationHRBPCompleteV2), | ||
45 | ) | 47 | ) |
46 | web.AddNamespace(summaryV2) | 48 | web.AddNamespace(summaryV2) |
47 | } | 49 | } |
-
请 注册 或 登录 后发表评论