作者 tangxvhui

修正 ForbidEdit 的字段值

@@ -888,6 +888,12 @@ func (srv *SummaryEvaluationService) GetEvaluationSuper(param *command.QueryEval @@ -888,6 +888,12 @@ func (srv *SummaryEvaluationService) GetEvaluationSuper(param *command.QueryEval
888 itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{ 888 itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{
889 "transactionContext": transactionContext, 889 "transactionContext": transactionContext,
890 }) 890 })
  891 + permissionRepository := factory.CreatePermissionRepository(map[string]interface{}{"transactionContext": transactionContext})
  892 + // 获取权限配置
  893 + _, permissionList, err := permissionRepository.Find(map[string]interface{}{"companyId": param.CompanyId})
  894 + if err != nil {
  895 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  896 + }
891 evaluationData, err := evaluationRepo.FindOne(map[string]interface{}{ 897 evaluationData, err := evaluationRepo.FindOne(map[string]interface{}{
892 "id": param.SummaryEvaluationId, 898 "id": param.SummaryEvaluationId,
893 }) 899 })
@@ -944,6 +950,18 @@ func (srv *SummaryEvaluationService) GetEvaluationSuper(param *command.QueryEval @@ -944,6 +950,18 @@ func (srv *SummaryEvaluationService) GetEvaluationSuper(param *command.QueryEval
944 } 950 }
945 //组合 评估填写的值和评估项 951 //组合 评估填写的值和评估项
946 itemValuesAdapter := srv.buildSummaryItemValue(itemList, itemValues) 952 itemValuesAdapter := srv.buildSummaryItemValue(itemList, itemValues)
  953 + for i, v := range itemValuesAdapter {
  954 + if len(permissionList) > 0 {
  955 + if permissionList[0].OptEvalScore == domain.PermissionOff &&
  956 + v.EvaluatorId > 0 {
  957 + itemValuesAdapter[i].ForbidEdit = true
  958 + }
  959 + if permissionList[0].OptHrScore == domain.PermissionOff &&
  960 + v.EvaluatorId < 0 {
  961 + itemValuesAdapter[i].ForbidEdit = true
  962 + }
  963 + }
  964 + }
947 result := adapter.EvaluationInfoSuperAdapter{ 965 result := adapter.EvaluationInfoSuperAdapter{
948 EvaluationBaseAdapter: evaluationBase, 966 EvaluationBaseAdapter: evaluationBase,
949 // LevelCount: codeList, 967 // LevelCount: codeList,
@@ -1400,9 +1418,17 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command @@ -1400,9 +1418,17 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command
1400 codeList := []*adapter.LevalCodeCount{} 1418 codeList := []*adapter.LevalCodeCount{}
1401 codeMap := map[string]*adapter.LevalCodeCount{} 1419 codeMap := map[string]*adapter.LevalCodeCount{}
1402 for i, v := range itemValuesAdapter { 1420 for i, v := range itemValuesAdapter {
1403 - if v.Weight > 0 {  
1404 - continue 1421 + if len(permissionList) > 0 {
  1422 + if permissionList[0].OptEvalScore == domain.PermissionOff &&
  1423 + v.EvaluatorId > 0 {
  1424 + itemValuesAdapter[i].ForbidEdit = true
  1425 + }
  1426 + if permissionList[0].OptHrScore == domain.PermissionOff &&
  1427 + v.EvaluatorId < 0 {
  1428 + itemValuesAdapter[i].ForbidEdit = true
1405 } 1429 }
  1430 + }
  1431 + if v.Weight == 0 {
1406 if _, ok := codeMap[v.Value]; !ok { 1432 if _, ok := codeMap[v.Value]; !ok {
1407 code := &adapter.LevalCodeCount{ 1433 code := &adapter.LevalCodeCount{
1408 Code: v.Value, 1434 Code: v.Value,
@@ -1414,16 +1440,6 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command @@ -1414,16 +1440,6 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command
1414 } 1440 }
1415 codeMap[v.Value].ItemList = append(codeMap[v.Value].ItemList, v.Name) 1441 codeMap[v.Value].ItemList = append(codeMap[v.Value].ItemList, v.Name)
1416 codeMap[v.Value].Number += 1 1442 codeMap[v.Value].Number += 1
1417 -  
1418 - if len(permissionList) > 0 {  
1419 - if permissionList[0].OptEvalScore == domain.PermissionOff &&  
1420 - v.EvaluatorId > 0 {  
1421 - itemValuesAdapter[i].ForbidEdit = true  
1422 - }  
1423 - if permissionList[0].OptHrScore == domain.PermissionOff &&  
1424 - v.EvaluatorId < 0 {  
1425 - itemValuesAdapter[i].ForbidEdit = true  
1426 - }  
1427 } 1443 }
1428 } 1444 }
1429 1445