diff --git a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java index bb59aaed..a69cb6e9 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/FlowStartServiceImpl.java @@ -24,10 +24,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.interceptor.TransactionAspectSupport; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; @@ -80,6 +77,9 @@ public class FlowStartServiceImpl extends ServiceImpl evaluationGroups = evaluationGroupService.selectEvaluationGroupByIds(ids); + Map> mustRole = new HashMap<>(); + Map> selfMustRole = new HashMap<>(); + for (int n = 0; n < evaluationGroups.size(); n++ ) { EvaluationGroup evaluationGroup = evaluationGroups.get(n); @@ -202,7 +205,7 @@ public class FlowStartServiceImpl extends ServiceImpl> staffManages, List staffIds){ + Map> staffManages, List staffIds, + Map> mustRole, Map> selfMustRole){ List resultModelDtos = resultModelService.selectResultDtoByGroupId(evaluationGroup.getId()); @@ -317,8 +321,24 @@ public class FlowStartServiceImpl extends ServiceImpl flowChartRoles = null; + //获取必备权限 + if(mustRole.containsKey(flow.getChartId())){ + flowChartRoles = mustRole.get(flow.getChartId()); + }else{ + flowChartRoles = + flowChartRoleService.selectFlowChartRolesByChartIdAndType(flow.getChartId(), 1); + mustRole.put(flow.getChartId(), flowChartRoles); + } + + + if(flowChartDetailRecord.getOptType().intValue() == ChartOptType.APPOINT.getCode()){//指定人员的 + + String[] optIds = flowChartDetailRecord.getOptIds().split(","); + + for (String id:optIds ) { @@ -334,6 +354,20 @@ public class FlowStartServiceImpl extends ServiceImpl 0){//设置必备权限 + String roles = flowChartRoles.stream().map(new Function() { + @Override + public String apply(FlowChartRole flowChartRole) { + return flowChartRole.getRoleId().toString(); + } + }).collect(Collectors.joining(",")); + if(flowApprovalRole.getRoleId() == null || flowApprovalRole.getRoleId().length() == 0){ + flowApprovalRole.setRoleId(roles); + }else{ + flowApprovalRole.setRoleId(flowChartDetailRecord.getRoleIds() + "," + roles); + } + } } //stepIndex++; if(flowApprovalRole != null){ @@ -341,6 +375,17 @@ public class FlowStartServiceImpl extends ServiceImpl flowChartRoles1 = + flowChartRoleService.selectFlowChartRolesByChartIdAndType(flow.getChartId(), 2); + selfMustRole.put(flow.getChartId(), flowChartRoles1); + flowChartRoles.addAll(flowChartRoles1); + } + } flowApprovalRole = new FlowApprovalRole(); flowApprovalRole.setFlowId(flow.getId()); flowApprovalRole.setStepType(flowChartDetailRecord.getStepType()); @@ -349,9 +394,25 @@ public class FlowStartServiceImpl extends ServiceImpl 0){//设置必备权限 + String roles = flowChartRoles.stream().map(new Function() { + @Override + public String apply(FlowChartRole flowChartRole) { + return flowChartRole.getRoleId().toString(); + } + }).collect(Collectors.joining(",")); + if(flowApprovalRole.getRoleId() == null || flowApprovalRole.getRoleId().length() == 0){ + flowApprovalRole.setRoleId(roles); + }else{ + flowApprovalRole.setRoleId(flowChartDetailRecord.getRoleIds() + "," + roles); + } + } + stepIndex++; } + + } //插入记录/flowChart/saveDetailProcs if(flowApprovalRoles.size() > 0){ diff --git a/src/main/java/com/lz/modules/performance/controller/FlowChartController.java b/src/main/java/com/lz/modules/performance/controller/FlowChartController.java index e0a016a7..394fa38c 100644 --- a/src/main/java/com/lz/modules/performance/controller/FlowChartController.java +++ b/src/main/java/com/lz/modules/performance/controller/FlowChartController.java @@ -145,49 +145,15 @@ public class FlowChartController { if(flowChartDetailRecordListReq.getRecordSimpleDtos() != null && flowChartDetailRecordListReq.getRecordSimpleDtos().size() > 0){ List inserts = new ArrayList<>(); List updaes = new ArrayList<>(); - Map> mustRole = new HashMap<>(); - Map> selfMustRole = new HashMap<>(); + int index = 0; for (FlowChartDetailRecordSimpleReq req:flowChartDetailRecordListReq.getRecordSimpleDtos() ) { FlowChartDetailRecord flowChartDetailRecord = new FlowChartDetailRecord(); BeanUtils.copyProperties(req, flowChartDetailRecord); flowChartDetailRecord.setChartId(flowChartDetailRecordListReq.getId()); - List flowChartRoles = null; - if(mustRole.containsKey(flowChartDetailRecordListReq.getId())){ - flowChartRoles = mustRole.get(flowChartDetailRecordListReq.getId()); - }else{ - flowChartRoles = - flowChartRoleService.selectFlowChartRolesByChartIdAndType(flowChartDetailRecordListReq.getId(), 1); - mustRole.put(flowChartDetailRecordListReq.getId(), flowChartRoles); - } - if(flowChartDetailRecord.getOptType().intValue() == -1){//考核人是自己的 - //获取被考核人的必备权限 - if(selfMustRole.containsKey(flowChartDetailRecordListReq.getId())){ - flowChartRoles.addAll(selfMustRole.get(flowChartDetailRecordListReq.getId())); - }else{ - List flowChartRoles1 = - flowChartRoleService.selectFlowChartRolesByChartIdAndType(flowChartDetailRecordListReq.getId(), 2); - selfMustRole.put(flowChartDetailRecordListReq.getId(), flowChartRoles1); - flowChartRoles.addAll(flowChartRoles1); - } - } - - if(flowChartRoles != null && flowChartRoles.size() > 0){//设置必备权限 - String roles = flowChartRoles.stream().map(new Function() { - @Override - public String apply(FlowChartRole flowChartRole) { - return flowChartRole.getRoleId().toString(); - } - }).collect(Collectors.joining(",")); - if(flowChartDetailRecord.getRoleIds() == null || flowChartDetailRecord.getRoleIds().length() == 0){ - flowChartDetailRecord.setRoleIds(roles); - }else{ - flowChartDetailRecord.setRoleIds(flowChartDetailRecord.getRoleIds() + "," + roles); - } - } flowChartDetailRecord.setEvaluationGroupId(flowChartDetailRecordListReq.getEvaluationGroupId()); flowChartDetailRecord.setStepIndex(index);