作者 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,21 +1418,6 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command @@ -1400,21 +1418,6 @@ 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  
1405 - }  
1406 - if _, ok := codeMap[v.Value]; !ok {  
1407 - code := &adapter.LevalCodeCount{  
1408 - Code: v.Value,  
1409 - Number: 0,  
1410 - ItemList: []string{},  
1411 - }  
1412 - codeMap[v.Value] = code  
1413 - codeList = append(codeList, code)  
1414 - }  
1415 - codeMap[v.Value].ItemList = append(codeMap[v.Value].ItemList, v.Name)  
1416 - codeMap[v.Value].Number += 1  
1417 -  
1418 if len(permissionList) > 0 { 1421 if len(permissionList) > 0 {
1419 if permissionList[0].OptEvalScore == domain.PermissionOff && 1422 if permissionList[0].OptEvalScore == domain.PermissionOff &&
1420 v.EvaluatorId > 0 { 1423 v.EvaluatorId > 0 {
@@ -1425,6 +1428,19 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command @@ -1425,6 +1428,19 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command
1425 itemValuesAdapter[i].ForbidEdit = true 1428 itemValuesAdapter[i].ForbidEdit = true
1426 } 1429 }
1427 } 1430 }
  1431 + if v.Weight == 0 {
  1432 + if _, ok := codeMap[v.Value]; !ok {
  1433 + code := &adapter.LevalCodeCount{
  1434 + Code: v.Value,
  1435 + Number: 0,
  1436 + ItemList: []string{},
  1437 + }
  1438 + codeMap[v.Value] = code
  1439 + codeList = append(codeList, code)
  1440 + }
  1441 + codeMap[v.Value].ItemList = append(codeMap[v.Value].ItemList, v.Name)
  1442 + codeMap[v.Value].Number += 1
  1443 + }
1428 } 1444 }
1429 1445
1430 result := adapter.EvaluationInfoSuperAdapter{ 1446 result := adapter.EvaluationInfoSuperAdapter{