From 6fb712e7b11827b0ee0dffab3039e0d10549d3b7 Mon Sep 17 00:00:00 2001 From: wulin Date: Tue, 12 Jan 2021 11:32:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=B5=8B=E8=AF=95=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E6=B5=81=E7=A8=8B=E8=8A=82=E7=82=B9=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/flow/model/FlowChartRoleDto.java | 9 +++- .../controller/FlowChartController.java | 52 ++++++++++++++++--- .../resources/mapper/flow/FlowChartMapper.xml | 4 +- 3 files changed, 54 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/lz/modules/flow/model/FlowChartRoleDto.java b/src/main/java/com/lz/modules/flow/model/FlowChartRoleDto.java index 30587419..b366691c 100644 --- a/src/main/java/com/lz/modules/flow/model/FlowChartRoleDto.java +++ b/src/main/java/com/lz/modules/flow/model/FlowChartRoleDto.java @@ -2,6 +2,9 @@ package com.lz.modules.flow.model; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; + +import java.util.List; + /** *

*

*流程节点权限对应关系表 @@ -21,12 +24,16 @@ public class FlowChartRoleDto { //角色id @ApiModelProperty(value = "角色id", name = "roleId") private Long roleId; + @ApiModelProperty(value = "角色名称", name = "roleName") + private String roleName; //1默认权限,必带权限,不可修改权限,0可选权限,2被考核人默认权限,必带权限,初始化时获取 @ApiModelProperty(value = "1默认权限,必带权限,不可修改权限,0可选权限,2被考核人默认权限,必带权限,初始化时获取", name = "type") private Integer type; //lz_flow_chart_role_group中的id,分组id - @ApiModelProperty(value = "lz_flow_chart_role_group中的id,分组id", name = "roleGroupId") + @ApiModelProperty(value = "lz_flow_chart_role_group中的id,分组id,如果不为0那么roleDtos需要一起显示", name = "roleGroupId") private Long roleGroupId; + @ApiModelProperty(value = "节点权限列表", name = "roleDtos") + private List roleDtos; /** * * @return 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 64d7c8b3..0df290d7 100644 --- a/src/main/java/com/lz/modules/performance/controller/FlowChartController.java +++ b/src/main/java/com/lz/modules/performance/controller/FlowChartController.java @@ -5,17 +5,11 @@ import com.lz.common.emun.ChartOptType; import com.lz.common.utils.R; import com.lz.modules.app.dto.StaffSimpleDto; import com.lz.modules.app.service.StaffService; -import com.lz.modules.flow.entity.FlowChart; -import com.lz.modules.flow.entity.FlowChartDetailRecord; -import com.lz.modules.flow.entity.FlowChartRole; -import com.lz.modules.flow.entity.FlowManager; +import com.lz.modules.flow.entity.*; import com.lz.modules.flow.model.*; import com.lz.modules.flow.req.FlowChartDetailRecordListReq; import com.lz.modules.flow.req.FlowChartDetailRecordSimpleReq; -import com.lz.modules.flow.service.FlowChartDetailRecordService; -import com.lz.modules.flow.service.FlowChartRoleService; -import com.lz.modules.flow.service.FlowChartService; -import com.lz.modules.flow.service.FlowManagerService; +import com.lz.modules.flow.service.*; import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; @@ -50,6 +44,9 @@ public class FlowChartController { @Autowired private FlowChartRoleService flowChartRoleService; + @Autowired + private FlowChartRoleGroupService flowChartRoleGroupService; + @GetMapping("/getByFlowManagerId") @ApiOperation("获取大流程节点") @ApiResponses({@ApiResponse(code = 200,message = "成功",response = FlowChartDto.class)}) @@ -57,9 +54,48 @@ public class FlowChartController { FlowManager flowManager = flowManagerService.selectFlowManagerById(id); if(flowManager != null){ List flowChartDtos = flowChartService.selectFlowChartDtoByFlowManagerId(flowManager.getId()); + Map flowChartRoleGroupMap = new HashMap<>(); + for (FlowChartDto dto:flowChartDtos ) { List flowChartRoles = flowChartService.selectCanSetChartRoleByChartId(dto.getId()); + //代码层面对分组的数据做树形结构返回 + Long rGroupId = 0l; + FlowChartRoleDto flowChartRoleDto = null; + for (int i = 0; i < flowChartRoles.size(); i++ + ) { + FlowChartRoleDto roleDto = flowChartRoles.get(i); + if(roleDto.getRoleGroupId().longValue() != 0L){ + //查询考评组 + FlowChartRoleGroup flowChartRoleGroup = flowChartRoleGroupMap.get(roleDto.getRoleGroupId()); + if(flowChartRoleGroup == null){ + flowChartRoleGroup = flowChartRoleGroupService.selectFlowChartRoleGroupById(roleDto.getRoleGroupId()); + } + if(flowChartRoleGroup != null){ + + flowChartRoles.remove(i); + flowChartRoleGroupMap.put(flowChartRoleGroup.getId(), flowChartRoleGroup); + if(rGroupId != flowChartRoleGroup.getId()){ + flowChartRoleDto = new FlowChartRoleDto(); + flowChartRoleDto.setChartId(roleDto.getChartId()); + flowChartRoleDto.setRoleName(flowChartRoleGroup.getName()); + flowChartRoleDto.setType(0); + flowChartRoleDto.setRoleId(flowChartRoleGroup.getId()); + flowChartRoleDto.setId(flowChartRoleGroup.getId()); + flowChartRoleDto.setRoleGroupId(flowChartRoleGroup.getId()); + flowChartRoleDto.setRoleDtos(new ArrayList<>()); + flowChartRoles.add(i, flowChartRoleDto); + rGroupId = flowChartRoleGroup.getId(); + }else{ + i--; + } + flowChartRoleDto.getRoleDtos().add(roleDto); + + + } + + } + } dto.setRoleDtos(flowChartRoles); if(groupId > 0){ //获取节点已保存的数据 diff --git a/src/main/resources/mapper/flow/FlowChartMapper.xml b/src/main/resources/mapper/flow/FlowChartMapper.xml index cb60d90b..7b680fe7 100644 --- a/src/main/resources/mapper/flow/FlowChartMapper.xml +++ b/src/main/resources/mapper/flow/FlowChartMapper.xml @@ -121,8 +121,8 @@