作者 tangxvhui

修正 ForbidEdit 的字段值

... ... @@ -888,6 +888,12 @@ func (srv *SummaryEvaluationService) GetEvaluationSuper(param *command.QueryEval
itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
permissionRepository := factory.CreatePermissionRepository(map[string]interface{}{"transactionContext": transactionContext})
// 获取权限配置
_, permissionList, err := permissionRepository.Find(map[string]interface{}{"companyId": param.CompanyId})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
evaluationData, err := evaluationRepo.FindOne(map[string]interface{}{
"id": param.SummaryEvaluationId,
})
... ... @@ -944,6 +950,18 @@ func (srv *SummaryEvaluationService) GetEvaluationSuper(param *command.QueryEval
}
//组合 评估填写的值和评估项
itemValuesAdapter := srv.buildSummaryItemValue(itemList, itemValues)
for i, v := range itemValuesAdapter {
if len(permissionList) > 0 {
if permissionList[0].OptEvalScore == domain.PermissionOff &&
v.EvaluatorId > 0 {
itemValuesAdapter[i].ForbidEdit = true
}
if permissionList[0].OptHrScore == domain.PermissionOff &&
v.EvaluatorId < 0 {
itemValuesAdapter[i].ForbidEdit = true
}
}
}
result := adapter.EvaluationInfoSuperAdapter{
EvaluationBaseAdapter: evaluationBase,
// LevelCount: codeList,
... ... @@ -1400,21 +1418,6 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command
codeList := []*adapter.LevalCodeCount{}
codeMap := map[string]*adapter.LevalCodeCount{}
for i, v := range itemValuesAdapter {
if v.Weight > 0 {
continue
}
if _, ok := codeMap[v.Value]; !ok {
code := &adapter.LevalCodeCount{
Code: v.Value,
Number: 0,
ItemList: []string{},
}
codeMap[v.Value] = code
codeList = append(codeList, code)
}
codeMap[v.Value].ItemList = append(codeMap[v.Value].ItemList, v.Name)
codeMap[v.Value].Number += 1
if len(permissionList) > 0 {
if permissionList[0].OptEvalScore == domain.PermissionOff &&
v.EvaluatorId > 0 {
... ... @@ -1425,6 +1428,19 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command
itemValuesAdapter[i].ForbidEdit = true
}
}
if v.Weight == 0 {
if _, ok := codeMap[v.Value]; !ok {
code := &adapter.LevalCodeCount{
Code: v.Value,
Number: 0,
ItemList: []string{},
}
codeMap[v.Value] = code
codeList = append(codeList, code)
}
codeMap[v.Value].ItemList = append(codeMap[v.Value].ItemList, v.Name)
codeMap[v.Value].Number += 1
}
}
result := adapter.EvaluationInfoSuperAdapter{
... ...