|
@@ -185,8 +185,8 @@ func (srv *SummaryEvaluationService) Evaluation360List(param *command.QueryEvalu |
|
@@ -185,8 +185,8 @@ func (srv *SummaryEvaluationService) Evaluation360List(param *command.QueryEvalu |
185
|
return grid, nil
|
185
|
return grid, nil
|
186
|
}
|
186
|
}
|
187
|
|
187
|
|
188
|
-// GetEvaluation360 获取360综评详情(登录人作为评估人,评估内容)
|
|
|
189
|
-func (srv *SummaryEvaluationService) GetEvaluation360(param *command.QueryEvaluation360) (*adapter.EvaluationInfoAdapter, error) {
|
188
|
+// GetEvaluation360 获取360综评详情(我评估目标用户)
|
|
|
189
|
+func (srv *SummaryEvaluationService) GetEvaluation360(param *command.QueryEvaluation360My) (*adapter.EvaluationInfoAdapter, error) {
|
190
|
transactionContext, err := factory.ValidateStartTransaction(param)
|
190
|
transactionContext, err := factory.ValidateStartTransaction(param)
|
191
|
if err != nil {
|
191
|
if err != nil {
|
192
|
return nil, err
|
192
|
return nil, err
|
|
@@ -199,31 +199,19 @@ func (srv *SummaryEvaluationService) GetEvaluation360(param *command.QueryEvalua |
|
@@ -199,31 +199,19 @@ func (srv *SummaryEvaluationService) GetEvaluation360(param *command.QueryEvalua |
199
|
evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext})
|
199
|
evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext})
|
200
|
itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext})
|
200
|
itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext})
|
201
|
|
201
|
|
202
|
- //sEvaluation, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId})
|
|
|
203
|
- //if err != nil {
|
|
|
204
|
- // return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
205
|
- //}
|
|
|
206
|
- _, evaluations, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
207
|
- "limit": 1,
|
|
|
208
|
- "companyId": param.CompanyId,
|
|
|
209
|
- "cycleId": param.CycleId,
|
|
|
210
|
- "targetUserId": param.TargetUserId,
|
|
|
211
|
- "types": domain.Evaluation360},
|
|
|
212
|
- )
|
202
|
+ sEvaluation, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId})
|
213
|
if err != nil {
|
203
|
if err != nil {
|
214
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
204
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
215
|
}
|
205
|
}
|
216
|
- if len(evaluations) == 0 { // 数据不存在
|
|
|
217
|
- result := adapter.EvaluationInfoAdapter{}
|
|
|
218
|
- result.EvaluationItems = make([]adapter.EvaluationItemAdapter, 0)
|
|
|
219
|
- return &result, nil
|
206
|
+ if err != nil {
|
|
|
207
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
220
|
}
|
208
|
}
|
221
|
- sEvaluation := evaluations[0]
|
|
|
222
|
|
209
|
|
223
|
// 360评估内容(自评模板、筛选项目评估人)
|
210
|
// 360评估内容(自评模板、筛选项目评估人)
|
224
|
_, itemList, err := evaluationItemRepo.Find(map[string]interface{}{
|
211
|
_, itemList, err := evaluationItemRepo.Find(map[string]interface{}{
|
225
|
"evaluationProjectId": sEvaluation.EvaluationProjectId,
|
212
|
"evaluationProjectId": sEvaluation.EvaluationProjectId,
|
226
|
"nodeType": domain.LinkNodeSelfAssessment,
|
213
|
"nodeType": domain.LinkNodeSelfAssessment,
|
|
|
214
|
+ "companyId": param.CompanyId,
|
227
|
"evaluatorId": param.UserId,
|
215
|
"evaluatorId": param.UserId,
|
228
|
})
|
216
|
})
|
229
|
if err != nil {
|
217
|
if err != nil {
|
|
@@ -259,7 +247,7 @@ func (srv *SummaryEvaluationService) GetEvaluation360(param *command.QueryEvalua |
|
@@ -259,7 +247,7 @@ func (srv *SummaryEvaluationService) GetEvaluation360(param *command.QueryEvalua |
259
|
}
|
247
|
}
|
260
|
|
248
|
|
261
|
// GetEvaluation360All 获取360综评详情-上级综评(所有的评估人,评估内容)
|
249
|
// GetEvaluation360All 获取360综评详情-上级综评(所有的评估人,评估内容)
|
262
|
-func (srv *SummaryEvaluationService) GetEvaluation360All(param *command.QueryEvaluation360) (*adapter.EvaluationInfoAdapter, error) {
|
250
|
+func (srv *SummaryEvaluationService) GetEvaluation360All(param *command.QueryEvaluation360) (*[]adapter.EvaluationItemAdapter, error) {
|
263
|
transactionContext, err := factory.ValidateStartTransaction(param)
|
251
|
transactionContext, err := factory.ValidateStartTransaction(param)
|
264
|
if err != nil {
|
252
|
if err != nil {
|
265
|
return nil, err
|
253
|
return nil, err
|
|
@@ -268,7 +256,6 @@ func (srv *SummaryEvaluationService) GetEvaluation360All(param *command.QueryEva |
|
@@ -268,7 +256,6 @@ func (srv *SummaryEvaluationService) GetEvaluation360All(param *command.QueryEva |
268
|
_ = transactionContext.RollbackTransaction()
|
256
|
_ = transactionContext.RollbackTransaction()
|
269
|
}()
|
257
|
}()
|
270
|
|
258
|
|
271
|
- userRepo := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
272
|
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext})
|
259
|
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext})
|
273
|
evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext})
|
260
|
evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext})
|
274
|
itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext})
|
261
|
itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
@@ -282,17 +269,25 @@ func (srv *SummaryEvaluationService) GetEvaluation360All(param *command.QueryEva |
|
@@ -282,17 +269,25 @@ func (srv *SummaryEvaluationService) GetEvaluation360All(param *command.QueryEva |
282
|
if err != nil {
|
269
|
if err != nil {
|
283
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
270
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
284
|
}
|
271
|
}
|
|
|
272
|
+
|
285
|
if len(evaluations) == 0 {
|
273
|
if len(evaluations) == 0 {
|
286
|
- result := adapter.EvaluationInfoAdapter{}
|
|
|
287
|
- result.EvaluationItems = make([]adapter.EvaluationItemAdapter, 0)
|
|
|
288
|
- return &result, nil
|
|
|
289
|
- //return nil, application.ThrowError(application.BUSINESS_ERROR, "数据不存在")
|
274
|
+ list := make([]adapter.EvaluationItemAdapter, 0)
|
|
|
275
|
+ return &list, nil
|
290
|
}
|
276
|
}
|
291
|
- sEvaluation := evaluations[0]
|
|
|
292
|
|
277
|
|
|
|
278
|
+ executorMap := map[int]domain.StaffDesc{} // 执行人
|
|
|
279
|
+ evaluationIds := make([]int, 0) // 评估周期ID
|
|
|
280
|
+ for i := range evaluations {
|
|
|
281
|
+ executor := evaluations[i].Executor
|
|
|
282
|
+ executorMap[executor.UserId] = executor
|
|
|
283
|
+
|
|
|
284
|
+ evaluationIds = append(evaluationIds, evaluations[i].Id)
|
|
|
285
|
+ }
|
|
|
286
|
+ // 得到项目ID
|
|
|
287
|
+ evaluationProjectId := evaluations[0].EvaluationProjectId
|
293
|
// 360评估内容(自评模板)
|
288
|
// 360评估内容(自评模板)
|
294
|
_, itemList, err := evaluationItemRepo.Find(map[string]interface{}{
|
289
|
_, itemList, err := evaluationItemRepo.Find(map[string]interface{}{
|
295
|
- "evaluationProjectId": sEvaluation.EvaluationProjectId,
|
290
|
+ "evaluationProjectId": evaluationProjectId,
|
296
|
"nodeType": domain.LinkNodeSelfAssessment,
|
291
|
"nodeType": domain.LinkNodeSelfAssessment,
|
297
|
})
|
292
|
})
|
298
|
if err != nil {
|
293
|
if err != nil {
|
|
@@ -300,28 +295,18 @@ func (srv *SummaryEvaluationService) GetEvaluation360All(param *command.QueryEva |
|
@@ -300,28 +295,18 @@ func (srv *SummaryEvaluationService) GetEvaluation360All(param *command.QueryEva |
300
|
}
|
295
|
}
|
301
|
|
296
|
|
302
|
// 评估内容对应的分数
|
297
|
// 评估内容对应的分数
|
303
|
- _, itemValues, err := itemValueRepo.Find(map[string]interface{}{"summaryEvaluationId": sEvaluation.Id})
|
298
|
+ _, itemValues, err := itemValueRepo.Find(map[string]interface{}{
|
|
|
299
|
+ "summaryEvaluationIdList": evaluationIds,
|
|
|
300
|
+ "types": domain.Evaluation360,
|
|
|
301
|
+ })
|
304
|
if err != nil {
|
302
|
if err != nil {
|
305
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
303
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
306
|
}
|
304
|
}
|
307
|
|
305
|
|
308
|
- // 评估人ID -> User
|
|
|
309
|
- evaluatorMap := map[int]*domain.User{}
|
|
|
310
|
- evaluatorIds := make([]int, 0)
|
|
|
311
|
filterItemList := make([]*domain.EvaluationItemUsed, 0) // 筛选有评估人的评估内容
|
306
|
filterItemList := make([]*domain.EvaluationItemUsed, 0) // 筛选有评估人的评估内容
|
312
|
for i := range itemList {
|
307
|
for i := range itemList {
|
313
|
if itemList[i].EvaluatorId > 0 {
|
308
|
if itemList[i].EvaluatorId > 0 {
|
314
|
filterItemList = append(filterItemList, itemList[i])
|
309
|
filterItemList = append(filterItemList, itemList[i])
|
315
|
- evaluatorIds = append(evaluatorIds, itemList[i].EvaluatorId)
|
|
|
316
|
- }
|
|
|
317
|
- }
|
|
|
318
|
- if len(evaluatorIds) > 0 {
|
|
|
319
|
- _, users, err := userRepo.Find(map[string]interface{}{"ids": evaluatorIds})
|
|
|
320
|
- if err != nil {
|
|
|
321
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
322
|
- }
|
|
|
323
|
- for i := range users {
|
|
|
324
|
- evaluatorMap[int(users[i].Id)] = users[i]
|
|
|
325
|
}
|
310
|
}
|
326
|
}
|
311
|
}
|
327
|
|
312
|
|
|
@@ -331,26 +316,26 @@ func (srv *SummaryEvaluationService) GetEvaluation360All(param *command.QueryEva |
|
@@ -331,26 +316,26 @@ func (srv *SummaryEvaluationService) GetEvaluation360All(param *command.QueryEva |
331
|
|
316
|
|
332
|
itemValuesAdapter := srv.buildSummaryItemValue(filterItemList, itemValues)
|
317
|
itemValuesAdapter := srv.buildSummaryItemValue(filterItemList, itemValues)
|
333
|
for i := range itemValuesAdapter { // 评估人名称赋值
|
318
|
for i := range itemValuesAdapter { // 评估人名称赋值
|
334
|
- if user, ok := evaluatorMap[itemValuesAdapter[i].EvaluatorId]; ok {
|
|
|
335
|
- itemValuesAdapter[i].EvaluatorName = user.Name
|
319
|
+ if executor, ok := executorMap[itemValuesAdapter[i].EvaluatorId]; ok {
|
|
|
320
|
+ itemValuesAdapter[i].EvaluatorName = executor.UserName
|
336
|
}
|
321
|
}
|
337
|
}
|
322
|
}
|
338
|
|
323
|
|
339
|
- result := adapter.EvaluationInfoAdapter{
|
|
|
340
|
- SummaryEvaluationId: sEvaluation.Id,
|
|
|
341
|
- CycleId: int(sEvaluation.CycleId),
|
|
|
342
|
- CycleName: sEvaluation.CycleName,
|
|
|
343
|
- EvaluationProjectId: sEvaluation.EvaluationProjectId,
|
|
|
344
|
- EvaluationProjectName: sEvaluation.EvaluationProjectName,
|
|
|
345
|
- LinkNodeId: sEvaluation.NodeId,
|
|
|
346
|
- BeginTime: sEvaluation.BeginTime.Format("2006-01-02 15:04:05"),
|
|
|
347
|
- EndTime: sEvaluation.EndTime.Format("2006-01-02 15:04:05"),
|
|
|
348
|
- TargetUserId: sEvaluation.TargetUser.UserId,
|
|
|
349
|
- TargetUserName: sEvaluation.TargetUser.UserName,
|
|
|
350
|
- Status: string(sEvaluation.Status),
|
|
|
351
|
- EvaluationItems: itemValuesAdapter,
|
|
|
352
|
- }
|
|
|
353
|
- return &result, nil
|
324
|
+ //result := adapter.EvaluationInfoAdapter{
|
|
|
325
|
+ // SummaryEvaluationId: sEvaluation.Id,
|
|
|
326
|
+ // CycleId: int(sEvaluation.CycleId),
|
|
|
327
|
+ // CycleName: sEvaluation.CycleName,
|
|
|
328
|
+ // EvaluationProjectId: sEvaluation.EvaluationProjectId,
|
|
|
329
|
+ // EvaluationProjectName: sEvaluation.EvaluationProjectName,
|
|
|
330
|
+ // LinkNodeId: sEvaluation.NodeId,
|
|
|
331
|
+ // BeginTime: sEvaluation.BeginTime.Format("2006-01-02 15:04:05"),
|
|
|
332
|
+ // EndTime: sEvaluation.EndTime.Format("2006-01-02 15:04:05"),
|
|
|
333
|
+ // TargetUserId: sEvaluation.TargetUser.UserId,
|
|
|
334
|
+ // TargetUserName: sEvaluation.TargetUser.UserName,
|
|
|
335
|
+ // Status: string(sEvaluation.Status),
|
|
|
336
|
+ // EvaluationItems: itemValuesAdapter,
|
|
|
337
|
+ //}
|
|
|
338
|
+ return &itemValuesAdapter, nil
|
354
|
}
|
339
|
}
|
355
|
|
340
|
|
356
|
// EditEvaluation360 编辑提交360综评
|
341
|
// EditEvaluation360 编辑提交360综评
|
|
@@ -595,7 +580,7 @@ func (srv *SummaryEvaluationService) EvaluationHRBPList(param *command.QueryEval |
|
@@ -595,7 +580,7 @@ func (srv *SummaryEvaluationService) EvaluationHRBPList(param *command.QueryEval |
595
|
}
|
580
|
}
|
596
|
|
581
|
|
597
|
// GetEvaluationHRBP 获取人资综评详情
|
582
|
// GetEvaluationHRBP 获取人资综评详情
|
598
|
-func (srv *SummaryEvaluationService) GetEvaluationHRBP(param *command.QueryEvaluationHRBP) (*adapter.EvaluationInfoAdapter, error) {
|
583
|
+func (srv *SummaryEvaluationService) GetEvaluationHRBP(param *command.QueryEvaluationHRBP) (*[]adapter.EvaluationItemAdapter, error) {
|
599
|
transactionContext, err := factory.ValidateStartTransaction(param)
|
584
|
transactionContext, err := factory.ValidateStartTransaction(param)
|
600
|
if err != nil {
|
585
|
if err != nil {
|
601
|
return nil, err
|
586
|
return nil, err
|
|
@@ -619,17 +604,26 @@ func (srv *SummaryEvaluationService) GetEvaluationHRBP(param *command.QueryEvalu |
|
@@ -619,17 +604,26 @@ func (srv *SummaryEvaluationService) GetEvaluationHRBP(param *command.QueryEvalu |
619
|
if err != nil {
|
604
|
if err != nil {
|
620
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
605
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
621
|
}
|
606
|
}
|
622
|
- if len(evaluations) == 0 { // 数据不存在
|
|
|
623
|
- result := adapter.EvaluationInfoAdapter{}
|
|
|
624
|
- result.EvaluationItems = make([]adapter.EvaluationItemAdapter, 0)
|
|
|
625
|
- return &result, nil
|
|
|
626
|
- //return nil, application.ThrowError(application.BUSINESS_ERROR, "数据不存在")
|
607
|
+
|
|
|
608
|
+ if len(evaluations) == 0 {
|
|
|
609
|
+ list := make([]adapter.EvaluationItemAdapter, 0)
|
|
|
610
|
+ return &list, nil
|
|
|
611
|
+ }
|
|
|
612
|
+
|
|
|
613
|
+ executorMap := map[int]domain.StaffDesc{} // 执行人
|
|
|
614
|
+ evaluationIds := make([]int, 0) // 评估周期ID
|
|
|
615
|
+ for i := range evaluations {
|
|
|
616
|
+ executor := evaluations[i].Executor
|
|
|
617
|
+ executorMap[executor.UserId] = executor
|
|
|
618
|
+
|
|
|
619
|
+ evaluationIds = append(evaluationIds, evaluations[i].Id)
|
627
|
}
|
620
|
}
|
628
|
- sEvaluation := evaluations[0]
|
621
|
+ // 得到项目ID
|
|
|
622
|
+ evaluationProjectId := evaluations[0].EvaluationProjectId
|
629
|
|
623
|
|
630
|
// 自评评估内容(自评模板、筛选项目评估人)
|
624
|
// 自评评估内容(自评模板、筛选项目评估人)
|
631
|
_, itemList, err := evaluationItemRepo.Find(map[string]interface{}{
|
625
|
_, itemList, err := evaluationItemRepo.Find(map[string]interface{}{
|
632
|
- "evaluationProjectId": sEvaluation.EvaluationProjectId,
|
626
|
+ "evaluationProjectId": evaluationProjectId,
|
633
|
"nodeType": domain.LinkNodeSelfAssessment,
|
627
|
"nodeType": domain.LinkNodeSelfAssessment,
|
634
|
"evaluatorId": -1,
|
628
|
"evaluatorId": -1,
|
635
|
})
|
629
|
})
|
|
@@ -638,7 +632,10 @@ func (srv *SummaryEvaluationService) GetEvaluationHRBP(param *command.QueryEvalu |
|
@@ -638,7 +632,10 @@ func (srv *SummaryEvaluationService) GetEvaluationHRBP(param *command.QueryEvalu |
638
|
}
|
632
|
}
|
639
|
|
633
|
|
640
|
// 评估内容对应的分数
|
634
|
// 评估内容对应的分数
|
641
|
- _, itemValues, err := itemValueRepo.Find(map[string]interface{}{"summaryEvaluationId": sEvaluation.Id})
|
635
|
+ _, itemValues, err := itemValueRepo.Find(map[string]interface{}{
|
|
|
636
|
+ "summaryEvaluationIdList": evaluationIds,
|
|
|
637
|
+ "types": domain.EvaluationHrbp,
|
|
|
638
|
+ })
|
642
|
if err != nil {
|
639
|
if err != nil {
|
643
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
640
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
644
|
}
|
641
|
}
|
|
@@ -648,21 +645,21 @@ func (srv *SummaryEvaluationService) GetEvaluationHRBP(param *command.QueryEvalu |
|
@@ -648,21 +645,21 @@ func (srv *SummaryEvaluationService) GetEvaluationHRBP(param *command.QueryEvalu |
648
|
}
|
645
|
}
|
649
|
|
646
|
|
650
|
itemValuesAdapter := srv.buildSummaryItemValue(itemList, itemValues)
|
647
|
itemValuesAdapter := srv.buildSummaryItemValue(itemList, itemValues)
|
651
|
- result := adapter.EvaluationInfoAdapter{
|
|
|
652
|
- SummaryEvaluationId: sEvaluation.Id,
|
|
|
653
|
- CycleId: int(sEvaluation.CycleId),
|
|
|
654
|
- CycleName: sEvaluation.CycleName,
|
|
|
655
|
- EvaluationProjectId: sEvaluation.EvaluationProjectId,
|
|
|
656
|
- EvaluationProjectName: sEvaluation.EvaluationProjectName,
|
|
|
657
|
- LinkNodeId: sEvaluation.NodeId,
|
|
|
658
|
- BeginTime: sEvaluation.BeginTime.Format("2006-01-02 15:04:05"),
|
|
|
659
|
- EndTime: sEvaluation.EndTime.Format("2006-01-02 15:04:05"),
|
|
|
660
|
- TargetUserId: sEvaluation.TargetUser.UserId,
|
|
|
661
|
- TargetUserName: sEvaluation.TargetUser.UserName,
|
|
|
662
|
- Status: string(sEvaluation.Status),
|
|
|
663
|
- EvaluationItems: itemValuesAdapter,
|
|
|
664
|
- }
|
|
|
665
|
- return &result, nil
|
648
|
+ //result := adapter.EvaluationInfoAdapter{
|
|
|
649
|
+ // SummaryEvaluationId: sEvaluation.Id,
|
|
|
650
|
+ // CycleId: int(sEvaluation.CycleId),
|
|
|
651
|
+ // CycleName: sEvaluation.CycleName,
|
|
|
652
|
+ // EvaluationProjectId: sEvaluation.EvaluationProjectId,
|
|
|
653
|
+ // EvaluationProjectName: sEvaluation.EvaluationProjectName,
|
|
|
654
|
+ // LinkNodeId: sEvaluation.NodeId,
|
|
|
655
|
+ // BeginTime: sEvaluation.BeginTime.Format("2006-01-02 15:04:05"),
|
|
|
656
|
+ // EndTime: sEvaluation.EndTime.Format("2006-01-02 15:04:05"),
|
|
|
657
|
+ // TargetUserId: sEvaluation.TargetUser.UserId,
|
|
|
658
|
+ // TargetUserName: sEvaluation.TargetUser.UserName,
|
|
|
659
|
+ // Status: string(sEvaluation.Status),
|
|
|
660
|
+ // EvaluationItems: itemValuesAdapter,
|
|
|
661
|
+ //}
|
|
|
662
|
+ return &itemValuesAdapter, nil
|
666
|
}
|
663
|
}
|
667
|
|
664
|
|
668
|
// EditEvaluationHRBP 编辑提交人资综评
|
665
|
// EditEvaluationHRBP 编辑提交人资综评
|