|
@@ -306,10 +306,10 @@ func (srv *SummaryEvaluationService) GetEvaluationSelfByCycle(param *command.Que |
|
@@ -306,10 +306,10 @@ func (srv *SummaryEvaluationService) GetEvaluationSelfByCycle(param *command.Que |
306
|
"transactionContext": transactionContext,
|
306
|
"transactionContext": transactionContext,
|
307
|
})
|
307
|
})
|
308
|
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
|
308
|
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
|
309
|
- "limit": 1,
|
|
|
310
|
- "cycleId": param.CycleId,
|
|
|
311
|
- "executorId": param.UserId,
|
|
|
312
|
- "types": domain.EvaluationSelf,
|
309
|
+ "limit": 1,
|
|
|
310
|
+ "cycleId": param.CycleId,
|
|
|
311
|
+ "targetUserId": param.TargetUserId,
|
|
|
312
|
+ "types": domain.EvaluationSelf,
|
313
|
})
|
313
|
})
|
314
|
if err != nil {
|
314
|
if err != nil {
|
315
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
315
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
@@ -318,6 +318,9 @@ func (srv *SummaryEvaluationService) GetEvaluationSelfByCycle(param *command.Que |
|
@@ -318,6 +318,9 @@ func (srv *SummaryEvaluationService) GetEvaluationSelfByCycle(param *command.Que |
318
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
318
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
319
|
}
|
319
|
}
|
320
|
evaluationData := evaluationList[0]
|
320
|
evaluationData := evaluationList[0]
|
|
|
321
|
+ if evaluationData.CompanyId != param.CompanyId {
|
|
|
322
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, "没有操作权限")
|
|
|
323
|
+ }
|
321
|
_, itemList, err := evaluationItemRepo.Find(map[string]interface{}{
|
324
|
_, itemList, err := evaluationItemRepo.Find(map[string]interface{}{
|
322
|
"evaluationProjectId": evaluationData.EvaluationProjectId,
|
325
|
"evaluationProjectId": evaluationData.EvaluationProjectId,
|
323
|
"nodeType": int(domain.LinkNodeSelfAssessment),
|
326
|
"nodeType": int(domain.LinkNodeSelfAssessment),
|
|
@@ -462,54 +465,19 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu |
|
@@ -462,54 +465,19 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu |
462
|
if err != nil {
|
465
|
if err != nil {
|
463
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
466
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
464
|
}
|
467
|
}
|
465
|
- evaluationItemMap := map[int]*domain.EvaluationItemUsed{}
|
|
|
466
|
- evaluationValueMap := map[int]*domain.SummaryEvaluationValue{}
|
|
|
467
|
- evaluationData.TotalRating = nil //清空评级数量统计
|
|
|
468
|
- for _, v := range itemList {
|
|
|
469
|
- newValue := &domain.SummaryEvaluationValue{}
|
|
|
470
|
- newValue.SetBlankValue(evaluationData, v)
|
|
|
471
|
- evaluationValueMap[v.Id] = newValue
|
|
|
472
|
- evaluationItemMap[v.Id] = v
|
|
|
473
|
- //重置计数
|
|
|
474
|
- evaluationData.ResetTotalRating(v)
|
468
|
+
|
|
|
469
|
+ err = srv.editEvaluationValue(evaluationData, &itemValueList, itemList, param.EvaluationItems, nil)
|
|
|
470
|
+ if err != nil {
|
|
|
471
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
475
|
}
|
472
|
}
|
|
|
473
|
+ evaluationData.Status = domain.EvaluationCompleted
|
|
|
474
|
+ //保存填写值
|
476
|
for _, v := range itemValueList {
|
475
|
for _, v := range itemValueList {
|
477
|
- if mValue, ok := evaluationValueMap[v.EvaluationItemId]; ok {
|
|
|
478
|
- mValue.Id = v.Id
|
|
|
479
|
- }
|
|
|
480
|
- }
|
|
|
481
|
- for _, v := range param.EvaluationItems {
|
|
|
482
|
- updatedData, ok := evaluationValueMap[v.EvaluationItemId]
|
|
|
483
|
- if !ok {
|
|
|
484
|
- continue
|
|
|
485
|
- }
|
|
|
486
|
- evaluationItem, ok := evaluationItemMap[v.EvaluationItemId]
|
|
|
487
|
- if !ok {
|
|
|
488
|
- continue
|
|
|
489
|
- }
|
|
|
490
|
- //填充评估填写值
|
|
|
491
|
- err = updatedData.FillValue(evaluationItem, v.Value, v.Remark)
|
|
|
492
|
- if err != nil {
|
|
|
493
|
- return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
494
|
- }
|
|
|
495
|
- }
|
|
|
496
|
-
|
|
|
497
|
- evaluationValueList := []*domain.SummaryEvaluationValue{}
|
|
|
498
|
- for _, v := range evaluationValueMap {
|
|
|
499
|
- //保存填写值
|
|
|
500
|
err = itemValueRepo.Save(v)
|
476
|
err = itemValueRepo.Save(v)
|
501
|
if err != nil {
|
477
|
if err != nil {
|
502
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
478
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
503
|
}
|
479
|
}
|
504
|
- evaluationValueList = append(evaluationValueList, v)
|
|
|
505
|
}
|
480
|
}
|
506
|
- //计算总得分
|
|
|
507
|
- err = evaluationData.EvaluationTotalScore(evaluationValueList)
|
|
|
508
|
- if err != nil {
|
|
|
509
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
510
|
- }
|
|
|
511
|
- evaluationData.Status = domain.EvaluationCompleted
|
|
|
512
|
- //保存填写值
|
|
|
513
|
err = evaluationRepo.Save(evaluationData)
|
481
|
err = evaluationRepo.Save(evaluationData)
|
514
|
if err != nil {
|
482
|
if err != nil {
|
515
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
483
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
@@ -517,7 +485,7 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu |
|
@@ -517,7 +485,7 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu |
517
|
if err := transactionContext.CommitTransaction(); err != nil {
|
485
|
if err := transactionContext.CommitTransaction(); err != nil {
|
518
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
486
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
519
|
}
|
487
|
}
|
520
|
- itemValueAdapter := srv.buildSummaryItemValue(itemList, evaluationValueList)
|
488
|
+ itemValueAdapter := srv.buildSummaryItemValue(itemList, itemValueList)
|
521
|
return map[string][]adapter.EvaluationItemAdapter{
|
489
|
return map[string][]adapter.EvaluationItemAdapter{
|
522
|
"EvaluationItems": itemValueAdapter,
|
490
|
"EvaluationItems": itemValueAdapter,
|
523
|
}, nil
|
491
|
}, nil
|
|
@@ -588,7 +556,7 @@ func (srv *SummaryEvaluationService) CountEvaluationSelfLevel(param *command.Que |
|
@@ -588,7 +556,7 @@ func (srv *SummaryEvaluationService) CountEvaluationSelfLevel(param *command.Que |
588
|
assessDao := dao.NewStaffAssessDao(map[string]interface{}{
|
556
|
assessDao := dao.NewStaffAssessDao(map[string]interface{}{
|
589
|
"transactionContext": transactionContext,
|
557
|
"transactionContext": transactionContext,
|
590
|
})
|
558
|
})
|
591
|
- levelCodeCountList, err := assessDao.CountAssessContentLevelCode(param.UserId, domain.AssessSelf, param.CycleId)
|
559
|
+ levelCodeCountList, err := assessDao.CountAssessContentLevelCode(param.TargetUserId, domain.AssessSelf, param.CycleId)
|
592
|
if err != nil {
|
560
|
if err != nil {
|
593
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
561
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
594
|
}
|
562
|
}
|
|
@@ -603,10 +571,10 @@ func (srv *SummaryEvaluationService) CountEvaluationSelfLevel(param *command.Que |
|
@@ -603,10 +571,10 @@ func (srv *SummaryEvaluationService) CountEvaluationSelfLevel(param *command.Que |
603
|
"transactionContext": transactionContext,
|
571
|
"transactionContext": transactionContext,
|
604
|
})
|
572
|
})
|
605
|
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
|
573
|
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
|
606
|
- "limit": 1,
|
|
|
607
|
- "cycleId": param.CycleId,
|
|
|
608
|
- "executorId": param.UserId,
|
|
|
609
|
- "types": domain.EvaluationSelf,
|
574
|
+ "limit": 1,
|
|
|
575
|
+ "cycleId": param.CycleId,
|
|
|
576
|
+ "targetUserId": param.TargetUserId,
|
|
|
577
|
+ "types": domain.EvaluationSelf,
|
610
|
})
|
578
|
})
|
611
|
if err != nil {
|
579
|
if err != nil {
|
612
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
580
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
@@ -764,24 +732,6 @@ func (srv *SummaryEvaluationService) GetEvaluationSuper(param *command.QueryEval |
|
@@ -764,24 +732,6 @@ func (srv *SummaryEvaluationService) GetEvaluationSuper(param *command.QueryEval |
764
|
}
|
732
|
}
|
765
|
//组合 评估填写的值和评估项
|
733
|
//组合 评估填写的值和评估项
|
766
|
itemValuesAdapter := srv.buildSummaryItemValue(itemList, itemValues)
|
734
|
itemValuesAdapter := srv.buildSummaryItemValue(itemList, itemValues)
|
767
|
- // codeList := []*adapter.LevalCodeCount{}
|
|
|
768
|
- // codeMap := map[string]*adapter.LevalCodeCount{}
|
|
|
769
|
- // for _, v := range itemValuesAdapter {
|
|
|
770
|
- // if v.Weight > 0 {
|
|
|
771
|
- // continue
|
|
|
772
|
- // }
|
|
|
773
|
- // if _, ok := codeMap[v.Value]; !ok {
|
|
|
774
|
- // code := &adapter.LevalCodeCount{
|
|
|
775
|
- // Code: v.Value,
|
|
|
776
|
- // Number: 0,
|
|
|
777
|
- // ItemList: []string{},
|
|
|
778
|
- // }
|
|
|
779
|
- // codeMap[v.Value] = code
|
|
|
780
|
- // codeList = append(codeList, code)
|
|
|
781
|
- // }
|
|
|
782
|
- // codeMap[v.Value].ItemList = append(codeMap[v.Value].ItemList, v.Name)
|
|
|
783
|
- // codeMap[v.Value].Number += 1
|
|
|
784
|
- // }
|
|
|
785
|
result := adapter.EvaluationInfoSuperAdapter{
|
735
|
result := adapter.EvaluationInfoSuperAdapter{
|
786
|
EvaluationBaseAdapter: evaluationBase,
|
736
|
EvaluationBaseAdapter: evaluationBase,
|
787
|
// LevelCount: codeList,
|
737
|
// LevelCount: codeList,
|
|
@@ -849,62 +799,20 @@ func (srv *SummaryEvaluationService) EditEvaluationSuper(param *command.EditEval |
|
@@ -849,62 +799,20 @@ func (srv *SummaryEvaluationService) EditEvaluationSuper(param *command.EditEval |
849
|
if err != nil {
|
799
|
if err != nil {
|
850
|
return nil, err
|
800
|
return nil, err
|
851
|
}
|
801
|
}
|
852
|
- evaluationItemMap := map[int]*domain.EvaluationItemUsed{}
|
|
|
853
|
- evaluationValueMap := map[int]*domain.SummaryEvaluationValue{}
|
|
|
854
|
- evaluationData.TotalRating = nil //清空评级数量统计
|
|
|
855
|
- for _, v := range itemList {
|
|
|
856
|
- newValue := &domain.SummaryEvaluationValue{}
|
|
|
857
|
- //初始一个空白的value
|
|
|
858
|
- newValue.SetBlankValue(evaluationData, v)
|
|
|
859
|
- evaluationValueMap[v.Id] = newValue
|
|
|
860
|
- evaluationItemMap[v.Id] = v
|
|
|
861
|
- //重置评级统计数量
|
|
|
862
|
- evaluationData.ResetTotalRating(v)
|
|
|
863
|
- }
|
|
|
864
|
- for _, v := range itemValueList {
|
|
|
865
|
- if mValue, ok := evaluationValueMap[v.EvaluationItemId]; ok {
|
|
|
866
|
- mValue.Id = v.Id
|
|
|
867
|
- }
|
|
|
868
|
- }
|
|
|
869
|
|
802
|
|
870
|
- for _, v := range param.EvaluationItems {
|
|
|
871
|
- updatedData, ok := evaluationValueMap[v.EvaluationItemId]
|
|
|
872
|
- if !ok {
|
|
|
873
|
- continue
|
|
|
874
|
- }
|
|
|
875
|
- evaluationItem, ok := evaluationItemMap[v.EvaluationItemId]
|
|
|
876
|
- if !ok {
|
|
|
877
|
- continue
|
|
|
878
|
- }
|
|
|
879
|
- if defaultValue, ok := hrbpOr360ItemValue[v.EvaluationItemId]; ok {
|
|
|
880
|
- //填充值
|
|
|
881
|
- err = updatedData.FillValue(evaluationItem, defaultValue.Value, v.Remark)
|
|
|
882
|
- if err != nil {
|
|
|
883
|
- return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
884
|
- }
|
|
|
885
|
- } else {
|
|
|
886
|
- err = updatedData.FillValue(evaluationItem, v.Value, v.Remark)
|
|
|
887
|
- if err != nil {
|
|
|
888
|
- return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
889
|
- }
|
|
|
890
|
- }
|
803
|
+ err = srv.editEvaluationValue(evaluationData, &itemValueList, itemList, param.EvaluationItems, hrbpOr360ItemValue)
|
|
|
804
|
+ if err != nil {
|
|
|
805
|
+ return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
891
|
}
|
806
|
}
|
892
|
- evaluationValueList := []*domain.SummaryEvaluationValue{}
|
|
|
893
|
- for _, v := range evaluationValueMap {
|
807
|
+ //变更评估状态为已填写
|
|
|
808
|
+ evaluationData.Status = domain.EvaluationCompleted
|
|
|
809
|
+ for _, v := range itemValueList {
|
894
|
//保存填写值
|
810
|
//保存填写值
|
895
|
err = itemValueRepo.Save(v)
|
811
|
err = itemValueRepo.Save(v)
|
896
|
if err != nil {
|
812
|
if err != nil {
|
897
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
813
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
898
|
}
|
814
|
}
|
899
|
- evaluationValueList = append(evaluationValueList, v)
|
|
|
900
|
}
|
815
|
}
|
901
|
- //计算总得分
|
|
|
902
|
- err = evaluationData.EvaluationTotalScore(evaluationValueList)
|
|
|
903
|
- if err != nil {
|
|
|
904
|
- return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
905
|
- }
|
|
|
906
|
- //变更评估状态为已填写
|
|
|
907
|
- evaluationData.Status = domain.EvaluationCompleted
|
|
|
908
|
//保存填写值
|
816
|
//保存填写值
|
909
|
err = evaluationRepo.Save(evaluationData)
|
817
|
err = evaluationRepo.Save(evaluationData)
|
910
|
if err != nil {
|
818
|
if err != nil {
|
|
@@ -913,7 +821,7 @@ func (srv *SummaryEvaluationService) EditEvaluationSuper(param *command.EditEval |
|
@@ -913,7 +821,7 @@ func (srv *SummaryEvaluationService) EditEvaluationSuper(param *command.EditEval |
913
|
if err := transactionContext.CommitTransaction(); err != nil {
|
821
|
if err := transactionContext.CommitTransaction(); err != nil {
|
914
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
822
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
915
|
}
|
823
|
}
|
916
|
- itemValueAdapter := srv.buildSummaryItemValue(itemList, evaluationValueList)
|
824
|
+ itemValueAdapter := srv.buildSummaryItemValue(itemList, itemValueList)
|
917
|
return map[string][]adapter.EvaluationItemAdapter{
|
825
|
return map[string][]adapter.EvaluationItemAdapter{
|
918
|
"EvaluationItems": itemValueAdapter,
|
826
|
"EvaluationItems": itemValueAdapter,
|
919
|
}, nil
|
827
|
}, nil
|
|
@@ -922,7 +830,7 @@ func (srv *SummaryEvaluationService) EditEvaluationSuper(param *command.EditEval |
|
@@ -922,7 +830,7 @@ func (srv *SummaryEvaluationService) EditEvaluationSuper(param *command.EditEval |
922
|
// getEvaluationSuperDefaultValue
|
830
|
// getEvaluationSuperDefaultValue
|
923
|
// 按照权限设置,是否获取上级评估内容的默认值
|
831
|
// 按照权限设置,是否获取上级评估内容的默认值
|
924
|
func (srv *SummaryEvaluationService) getEvaluationSuperDefaultValue(transactionContext application.TransactionContext, evaluationData *domain.SummaryEvaluation) (
|
832
|
func (srv *SummaryEvaluationService) getEvaluationSuperDefaultValue(transactionContext application.TransactionContext, evaluationData *domain.SummaryEvaluation) (
|
925
|
- map[int]*domain.SummaryEvaluationValue, error) {
|
833
|
+ []*domain.SummaryEvaluationValue, error) {
|
926
|
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
|
834
|
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
|
927
|
"transactionContext": transactionContext,
|
835
|
"transactionContext": transactionContext,
|
928
|
})
|
836
|
})
|
|
@@ -968,9 +876,7 @@ func (srv *SummaryEvaluationService) getEvaluationSuperDefaultValue(transactionC |
|
@@ -968,9 +876,7 @@ func (srv *SummaryEvaluationService) getEvaluationSuperDefaultValue(transactionC |
968
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
876
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
969
|
}
|
877
|
}
|
970
|
// 记录人资评估或者360评估的 填写项id
|
878
|
// 记录人资评估或者360评估的 填写项id
|
971
|
- hrbpOr360ItemValue := map[int]*domain.SummaryEvaluationValue{}
|
|
|
972
|
-
|
|
|
973
|
- result := map[int]*domain.SummaryEvaluationValue{}
|
879
|
+ hrbpOr360ItemValue := []*domain.SummaryEvaluationValue{}
|
974
|
if permissionData.OptEvalScore == domain.PermissionOff {
|
880
|
if permissionData.OptEvalScore == domain.PermissionOff {
|
975
|
//上级是否可以修改360°综评分数
|
881
|
//上级是否可以修改360°综评分数
|
976
|
//获取360综合评分
|
882
|
//获取360综合评分
|
|
@@ -979,7 +885,7 @@ func (srv *SummaryEvaluationService) getEvaluationSuperDefaultValue(transactionC |
|
@@ -979,7 +885,7 @@ func (srv *SummaryEvaluationService) getEvaluationSuperDefaultValue(transactionC |
979
|
if v.Types != domain.Evaluation360 {
|
885
|
if v.Types != domain.Evaluation360 {
|
980
|
continue
|
886
|
continue
|
981
|
}
|
887
|
}
|
982
|
- hrbpOr360ItemValue[v.EvaluationItemId] = v
|
888
|
+ hrbpOr360ItemValue = append(hrbpOr360ItemValue, v)
|
983
|
}
|
889
|
}
|
984
|
}
|
890
|
}
|
985
|
if permissionData.OptHrScore == domain.PermissionOff {
|
891
|
if permissionData.OptHrScore == domain.PermissionOff {
|
|
@@ -991,10 +897,10 @@ func (srv *SummaryEvaluationService) getEvaluationSuperDefaultValue(transactionC |
|
@@ -991,10 +897,10 @@ func (srv *SummaryEvaluationService) getEvaluationSuperDefaultValue(transactionC |
991
|
continue
|
897
|
continue
|
992
|
}
|
898
|
}
|
993
|
|
899
|
|
994
|
- hrbpOr360ItemValue[v.EvaluationItemId] = v
|
900
|
+ hrbpOr360ItemValue = append(hrbpOr360ItemValue, v)
|
995
|
}
|
901
|
}
|
996
|
}
|
902
|
}
|
997
|
- return result, nil
|
903
|
+ return hrbpOr360ItemValue, nil
|
998
|
}
|
904
|
}
|
999
|
|
905
|
|
1000
|
// 获取执行人的上级评估的列表
|
906
|
// 获取执行人的上级评估的列表
|
|
@@ -1209,10 +1115,10 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command |
|
@@ -1209,10 +1115,10 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command |
1209
|
"transactionContext": transactionContext,
|
1115
|
"transactionContext": transactionContext,
|
1210
|
})
|
1116
|
})
|
1211
|
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
|
1117
|
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
|
1212
|
- "limit": 1,
|
|
|
1213
|
- "cycleId": param.CycleId,
|
|
|
1214
|
- "executorId": param.UserId,
|
|
|
1215
|
- "types": domain.EvaluationSuper,
|
1118
|
+ "limit": 1,
|
|
|
1119
|
+ "cycleId": param.CycleId,
|
|
|
1120
|
+ "targetUserId": param.TargetUserId,
|
|
|
1121
|
+ "types": domain.EvaluationSuper,
|
1216
|
})
|
1122
|
})
|
1217
|
if err != nil {
|
1123
|
if err != nil {
|
1218
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
1124
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
@@ -1221,9 +1127,6 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command |
|
@@ -1221,9 +1127,6 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command |
1221
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有找到符合条件的数据")
|
1127
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有找到符合条件的数据")
|
1222
|
}
|
1128
|
}
|
1223
|
evaluationData := evaluationList[0]
|
1129
|
evaluationData := evaluationList[0]
|
1224
|
- // if evaluationData.Types == domain.EvaluationSuper {
|
|
|
1225
|
- // return nil, application.ThrowError(application.BUSINESS_ERROR, "没有操作权限")
|
|
|
1226
|
- // }
|
|
|
1227
|
if evaluationData.CompanyId == param.CompanyId {
|
1130
|
if evaluationData.CompanyId == param.CompanyId {
|
1228
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "没有操作权限")
|
1131
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "没有操作权限")
|
1229
|
}
|
1132
|
}
|
|
@@ -1402,3 +1305,78 @@ func (srv *SummaryEvaluationService) ListAllEvaluationSuper(param *command.Query |
|
@@ -1402,3 +1305,78 @@ func (srv *SummaryEvaluationService) ListAllEvaluationSuper(param *command.Query |
1402
|
result := tool_funs.SimpleWrapGridMap(int64(cnt), evaluationListAdapter)
|
1305
|
result := tool_funs.SimpleWrapGridMap(int64(cnt), evaluationListAdapter)
|
1403
|
return result, nil
|
1306
|
return result, nil
|
1404
|
}
|
1307
|
}
|
|
|
1308
|
+
|
|
|
1309
|
+// editEvaluationValue 编辑评估的填写值
|
|
|
1310
|
+// evaluationData 对应的评估任务
|
|
|
1311
|
+// evaluationItems 对应的评估项
|
|
|
1312
|
+// oldItemValue 旧的评估项填写的值
|
|
|
1313
|
+// updatedValue 新填的评估值
|
|
|
1314
|
+// defaultItemvalue 评估项保持的默认值
|
|
|
1315
|
+func (srv *SummaryEvaluationService) editEvaluationValue(
|
|
|
1316
|
+ evaluationData *domain.SummaryEvaluation,
|
|
|
1317
|
+ itemValueList *[]*domain.SummaryEvaluationValue,
|
|
|
1318
|
+ evaluationItems []*domain.EvaluationItemUsed,
|
|
|
1319
|
+ updatedValue []command.UpdatedItemValue,
|
|
|
1320
|
+ defaultItemValue []*domain.SummaryEvaluationValue,
|
|
|
1321
|
+) error {
|
|
|
1322
|
+ evaluationItemMap := map[int]*domain.EvaluationItemUsed{}
|
|
|
1323
|
+ evaluationValueMap := map[int]*domain.SummaryEvaluationValue{}
|
|
|
1324
|
+ evaluationData.TotalRating = nil //清空评级数量统计
|
|
|
1325
|
+ for _, v := range evaluationItems {
|
|
|
1326
|
+ newValue := &domain.SummaryEvaluationValue{}
|
|
|
1327
|
+ newValue.SetBlankValue(evaluationData, v)
|
|
|
1328
|
+ evaluationValueMap[v.Id] = newValue
|
|
|
1329
|
+ evaluationItemMap[v.Id] = v
|
|
|
1330
|
+ //重置计数
|
|
|
1331
|
+ evaluationData.ResetTotalRating(v)
|
|
|
1332
|
+ }
|
|
|
1333
|
+ //新值的id 替换为旧值id
|
|
|
1334
|
+ for _, v := range *itemValueList {
|
|
|
1335
|
+ if mValue, ok := evaluationValueMap[v.EvaluationItemId]; ok {
|
|
|
1336
|
+ mValue.Id = v.Id
|
|
|
1337
|
+ }
|
|
|
1338
|
+ }
|
|
|
1339
|
+ //填入填写的更新值
|
|
|
1340
|
+ for _, v := range updatedValue {
|
|
|
1341
|
+ newItemValue, ok := evaluationValueMap[v.EvaluationItemId]
|
|
|
1342
|
+ if !ok {
|
|
|
1343
|
+ continue
|
|
|
1344
|
+ }
|
|
|
1345
|
+ evaluationItem, ok := evaluationItemMap[v.EvaluationItemId]
|
|
|
1346
|
+ if !ok {
|
|
|
1347
|
+ continue
|
|
|
1348
|
+ }
|
|
|
1349
|
+ //填充评估填写值
|
|
|
1350
|
+ err := newItemValue.FillValue(evaluationItem, v.Value, v.Remark)
|
|
|
1351
|
+ if err != nil {
|
|
|
1352
|
+ return err
|
|
|
1353
|
+ }
|
|
|
1354
|
+ }
|
|
|
1355
|
+ // 填入固定的默认值
|
|
|
1356
|
+ for _, v := range defaultItemValue {
|
|
|
1357
|
+ newItemValue, ok := evaluationValueMap[v.EvaluationItemId]
|
|
|
1358
|
+ if !ok {
|
|
|
1359
|
+ continue
|
|
|
1360
|
+ }
|
|
|
1361
|
+ evaluationItem, ok := evaluationItemMap[v.EvaluationItemId]
|
|
|
1362
|
+ if !ok {
|
|
|
1363
|
+ continue
|
|
|
1364
|
+ }
|
|
|
1365
|
+ //填充评估填写值
|
|
|
1366
|
+ err := newItemValue.FillValue(evaluationItem, v.Value, v.Remark)
|
|
|
1367
|
+ if err != nil {
|
|
|
1368
|
+ return err
|
|
|
1369
|
+ }
|
|
|
1370
|
+ }
|
|
|
1371
|
+ //完全更新itemValueList
|
|
|
1372
|
+ *itemValueList = (*itemValueList)[0:0]
|
|
|
1373
|
+ for _, v := range evaluationValueMap {
|
|
|
1374
|
+ *itemValueList = append(*itemValueList, v)
|
|
|
1375
|
+ }
|
|
|
1376
|
+ // 计算总得分
|
|
|
1377
|
+ err := evaluationData.EvaluationTotalScore(nil)
|
|
|
1378
|
+ if err != nil {
|
|
|
1379
|
+ return err
|
|
|
1380
|
+ }
|
|
|
1381
|
+ return nil
|
|
|
1382
|
+} |