提交测试属性流程节点权限

This commit is contained in:
wulin 2021-01-12 11:32:04 +08:00
parent d4e9320d56
commit 6fb712e7b1
3 changed files with 54 additions and 11 deletions

View File

@ -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;
/**
* <p>
* </p>*流程节点权限对应关系表
@ -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<FlowChartRoleDto> roleDtos;
/**
*
* @return

View File

@ -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<FlowChartDto> flowChartDtos = flowChartService.selectFlowChartDtoByFlowManagerId(flowManager.getId());
Map<Long, FlowChartRoleGroup> flowChartRoleGroupMap = new HashMap<>();
for (FlowChartDto dto:flowChartDtos
) {
List<FlowChartRoleDto> 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){
//获取节点已保存的数据

View File

@ -121,8 +121,8 @@
<select id="selectCanSetChartRoleByChartId" resultType="com.lz.modules.flow.model.FlowChartRoleDto" >
SELECT crole.id as id, crole.chart_id as chart_id, crole.role_id as role_id, role.name as role_name,
crole.type as type FROM lz_flow_chart_role crole left join lz_record_role role on role.id=crole.role_id
where crole.chart_id=#{id} and crole.type = 0 and crole.is_delete=0
crole.type as type, crole.role_group_id as role_group_id FROM lz_flow_chart_role crole left join lz_record_role role on role.id=crole.role_id
where crole.chart_id=#{id} and crole.type = 0 and crole.is_delete=0 order by crole.role_group_id
</select>
</mapper>