案例流程管理查询接口
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.web.controller.flow;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.system.domain.vo.flow.MsCaseFlowSearchVO;
|
||||
import com.ruoyi.system.domain.vo.flow.MsCaseFlowVO;
|
||||
import com.ruoyi.system.service.flow.CaseFlowService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static com.ruoyi.common.core.domain.AjaxResult.success;
|
||||
|
||||
/**
|
||||
* 案件流程管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/case/flow")
|
||||
public class CaseFlowController {
|
||||
@Autowired
|
||||
CaseFlowService caseFlowService;
|
||||
|
||||
/**
|
||||
* 查询案件流程节点信息
|
||||
*/
|
||||
@PostMapping("/queryCaseFlowInfo")
|
||||
public AjaxResult queryCaseFlowInfo(@RequestBody MsCaseFlowSearchVO caseFlowSearchVO) {
|
||||
Object obj = caseFlowService.queryCaseFlowInfo(caseFlowSearchVO);
|
||||
return success(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或编辑案件流程节点信息
|
||||
*/
|
||||
@PostMapping("/saveCaseFlow")
|
||||
public AjaxResult addCaseFlow(@RequestBody MsCaseFlowVO caseFlowVO) {
|
||||
Boolean result = caseFlowService.addCaseFlow(caseFlowVO);
|
||||
return success(result);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除案件流程节点信息
|
||||
*/
|
||||
@PostMapping("/deleteCaseFlow")
|
||||
public AjaxResult deleteCaseFlow(@RequestBody MsCaseFlowVO caseFlowVO) {
|
||||
Boolean result = caseFlowService.deleteCaseFlow(caseFlowVO);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 排序案件流程节点
|
||||
*/
|
||||
@PostMapping("/sortCaseFlow")
|
||||
public AjaxResult sortCaseFlow(@RequestBody MsCaseFlowVO caseFlowVO) {
|
||||
Boolean result = caseFlowService.sortCaseFlow(caseFlowVO);
|
||||
return success(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.ruoyi.system.domain.entity.flow;
|
||||
|
||||
import javax.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Table(name = "ms_case_flow")
|
||||
public class MsCaseFlow {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 案件节点id
|
||||
*/
|
||||
@Column(name = "node_id")
|
||||
private Integer nodeId;
|
||||
|
||||
/**
|
||||
* 案件节点名称
|
||||
*/
|
||||
@Column(name = "node_name")
|
||||
private String nodeName;
|
||||
|
||||
/**
|
||||
* 顺序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 案件状态名称
|
||||
*/
|
||||
@Column(name = "case_status_name")
|
||||
private String caseStatusName;
|
||||
|
||||
/**
|
||||
* 驳回节点id
|
||||
*/
|
||||
@Column(name = "back_flow_id")
|
||||
private Integer backFlowId;
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.ruoyi.system.domain.entity.flow;
|
||||
|
||||
import javax.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Table(name = "ms_case_flow_role_related")
|
||||
public class MsCaseFlowRoleRelated {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(generator = "JDBC")
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 案件流程id
|
||||
*/
|
||||
@Column(name = "flow_id")
|
||||
private Integer flowId;
|
||||
|
||||
/**
|
||||
* 用户角色id
|
||||
*/
|
||||
private Long roleid;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.ruoyi.system.domain.vo.flow;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class MsCaseFlowSearchVO {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 案件节点名称
|
||||
*/
|
||||
private String nodeName;
|
||||
private Integer pageNum;
|
||||
private Integer pageSize;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.ruoyi.system.domain.vo.flow;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Data
|
||||
public class MsCaseFlowVO {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 案件节点id
|
||||
*/
|
||||
private Integer nodeId;
|
||||
|
||||
/**
|
||||
* 案件节点名称
|
||||
*/
|
||||
private String nodeName;
|
||||
|
||||
/**
|
||||
* 顺序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 案件状态名称
|
||||
*/
|
||||
private String caseStatusName;
|
||||
|
||||
/**
|
||||
* 驳回节点id
|
||||
*/
|
||||
private Integer backFlowId;
|
||||
private String backFlowName;
|
||||
private String roleNames;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.ruoyi.system.mapper.flow;
|
||||
|
||||
import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
public interface MsCaseFlowMapper extends Mapper<MsCaseFlow> {
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.ruoyi.system.mapper.flow;
|
||||
|
||||
import com.ruoyi.system.domain.entity.flow.MsCaseFlowRoleRelated;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
public interface MsCaseFlowRoleRelatedMapper extends Mapper<MsCaseFlowRoleRelated> {
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.ruoyi.system.service.flow;
|
||||
|
||||
import com.ruoyi.system.domain.vo.flow.MsCaseFlowSearchVO;
|
||||
import com.ruoyi.system.domain.vo.flow.MsCaseFlowVO;
|
||||
|
||||
public interface CaseFlowService {
|
||||
/**
|
||||
* 查询案件流程节点信息
|
||||
* @param caseFlowSearchVO
|
||||
* @return
|
||||
*/
|
||||
Object queryCaseFlowInfo(MsCaseFlowSearchVO caseFlowSearchVO);
|
||||
|
||||
/**
|
||||
* 新增或编辑案件流程节点信息
|
||||
* @param caseFlowVO
|
||||
* @return
|
||||
*/
|
||||
Boolean addCaseFlow(MsCaseFlowVO caseFlowVO);
|
||||
|
||||
/**
|
||||
* 删除案件流程节点信息
|
||||
* @param caseFlowVO
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteCaseFlow(MsCaseFlowVO caseFlowVO);
|
||||
|
||||
/**
|
||||
* 排序案件流程节点
|
||||
* @param caseFlowVO
|
||||
* @return
|
||||
*/
|
||||
Boolean sortCaseFlow(MsCaseFlowVO caseFlowVO);
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
package com.ruoyi.system.service.flow;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.system.domain.SysOperLog;
|
||||
import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
|
||||
import com.ruoyi.system.domain.entity.flow.MsCaseFlowRoleRelated;
|
||||
import com.ruoyi.system.domain.vo.flow.MsCaseFlowSearchVO;
|
||||
import com.ruoyi.system.domain.vo.flow.MsCaseFlowVO;
|
||||
import com.ruoyi.system.mapper.SysRoleMapper;
|
||||
import com.ruoyi.system.mapper.flow.MsCaseFlowMapper;
|
||||
import com.ruoyi.system.mapper.flow.MsCaseFlowRoleRelatedMapper;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.deepoove.poi.data.NumberingRenderData.build;
|
||||
import static com.ruoyi.common.utils.PageUtils.startPage;
|
||||
import static jdk.nashorn.internal.runtime.Debug.id;
|
||||
|
||||
@Service
|
||||
public class CaseFlowServiceImpl implements CaseFlowService {
|
||||
@Autowired
|
||||
MsCaseFlowMapper msCaseFlowMapper;
|
||||
@Autowired
|
||||
MsCaseFlowRoleRelatedMapper msCaseFlowRoleRelatedMapper;
|
||||
@Autowired
|
||||
SysRoleMapper sysRoleMapper;
|
||||
|
||||
/**
|
||||
* 查询案件流程节点信息
|
||||
*
|
||||
* @param caseFlowSearchVO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object queryCaseFlowInfo(MsCaseFlowSearchVO caseFlowSearchVO) {
|
||||
//查询某个案件流程节点信息
|
||||
if (caseFlowSearchVO.getId() != null) {
|
||||
return msCaseFlowMapper.selectByPrimaryKey(caseFlowSearchVO.getId());
|
||||
} else if (caseFlowSearchVO == null) {
|
||||
return msCaseFlowMapper.selectAll();
|
||||
} else if (caseFlowSearchVO.getPageNum() == null || caseFlowSearchVO.getPageSize() == null) {
|
||||
return msCaseFlowMapper.selectAll();
|
||||
} else {
|
||||
Map<Integer, List<SysRole>> sysRoleMap = queryRoleByFlowId(null);
|
||||
Example example = new Example(MsCaseFlow.class);
|
||||
example.setOrderByClause(" sort DESC ");
|
||||
Example.Criteria criteria = example.createCriteria();
|
||||
if (caseFlowSearchVO.getNodeName() != null) {
|
||||
criteria.andLike("nodeName", "%" + caseFlowSearchVO.getNodeName() + "%");
|
||||
}
|
||||
PageHelper.startPage(caseFlowSearchVO.getPageNum(), caseFlowSearchVO.getPageSize());
|
||||
List<MsCaseFlow> msCaseFlows = msCaseFlowMapper.selectByExample(example);
|
||||
PageInfo<MsCaseFlow> pageInfo = new PageInfo<>(msCaseFlows);
|
||||
PageInfo<MsCaseFlowVO> newpageInfo = new PageInfo<>();
|
||||
BeanUtils.copyProperties(pageInfo, newpageInfo);
|
||||
List<MsCaseFlowVO> list = new ArrayList<>();
|
||||
for (int i = 0; i < msCaseFlows.size(); i++) {
|
||||
MsCaseFlow msCaseFlow = msCaseFlows.get(i);
|
||||
MsCaseFlowVO temp = new MsCaseFlowVO();
|
||||
BeanUtils.copyProperties(msCaseFlow, temp);
|
||||
//关联的角色
|
||||
List<String> roleNames = new ArrayList<>();
|
||||
if (sysRoleMap.containsKey(msCaseFlow.getId())) {
|
||||
List<SysRole> sysRoles = sysRoleMap.get(msCaseFlow.getId());
|
||||
roleNames = sysRoles
|
||||
.stream()
|
||||
.map(sysRole -> sysRole.getRoleName())
|
||||
.collect(Collectors.toList());
|
||||
temp.setRoleNames(roleNames.toString());
|
||||
}
|
||||
//驳回节点
|
||||
if (msCaseFlow.getBackFlowId() != null) {
|
||||
MsCaseFlow msCaseFlow1 = msCaseFlowMapper.selectByPrimaryKey(msCaseFlow.getBackFlowId());
|
||||
temp.setBackFlowName(msCaseFlow1.getNodeName());
|
||||
}
|
||||
list.add(temp);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询流程信息相关的角色信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Map<Integer, List<SysRole>> queryRoleByFlowId(Integer flowId) {
|
||||
Map<Integer, List<SysRole>> map = new HashMap<>();
|
||||
Example example = new Example(MsCaseFlowRoleRelated.class);
|
||||
Example.Criteria criteria = example.createCriteria();
|
||||
if (flowId != null) {
|
||||
criteria.andEqualTo("flowId", flowId);
|
||||
}
|
||||
List<MsCaseFlowRoleRelated> msCaseFlowRoleRelateds = msCaseFlowRoleRelatedMapper.selectByExample(example);
|
||||
for (int i = 0; i < msCaseFlowRoleRelateds.size(); i++) {
|
||||
Integer flowId1 = msCaseFlowRoleRelateds.get(i).getFlowId();
|
||||
if (msCaseFlowRoleRelateds.get(i).getRoleid() != null) {
|
||||
SysRole sysRole = sysRoleMapper.selectRoleById(msCaseFlowRoleRelateds.get(i).getRoleid());
|
||||
if (map.containsKey(flowId1)) {
|
||||
map.get(flowId1).add(sysRole);
|
||||
} else {
|
||||
List<SysRole> newList = new ArrayList<>();
|
||||
newList.add(sysRole);
|
||||
map.put(flowId1, newList);
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或编辑案件流程节点信息
|
||||
*
|
||||
* @param caseFlowVO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean addCaseFlow(MsCaseFlowVO caseFlowVO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除案件流程节点信息
|
||||
*
|
||||
* @param caseFlowVO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteCaseFlow(MsCaseFlowVO caseFlowVO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 排序案件流程节点
|
||||
*
|
||||
* @param caseFlowVO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean sortCaseFlow(MsCaseFlowVO caseFlowVO) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.flow.MsCaseFlowMapper">
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.system.domain.entity.flow.MsCaseFlow">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="node_id" jdbcType="INTEGER" property="nodeId" />
|
||||
<result column="node_name" jdbcType="VARCHAR" property="nodeName" />
|
||||
<result column="sort" jdbcType="INTEGER" property="sort" />
|
||||
<result column="case_status_name" jdbcType="VARCHAR" property="caseStatusName" />
|
||||
<result column="back_flow_id" jdbcType="INTEGER" property="backFlowId" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.flow.MsCaseFlowRoleRelatedMapper">
|
||||
<resultMap id="BaseResultMap" type="com.ruoyi.system.domain.entity.flow.MsCaseFlowRoleRelated">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="flow_id" jdbcType="INTEGER" property="flowId" />
|
||||
<result column="roleid" jdbcType="BIGINT" property="roleid" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -3,10 +3,10 @@ jdbc.url=jdbc:mysql://121.40.189.20:3306/mediation_system?serverTimezone=Asia/Sh
|
||||
jdbc.user=root
|
||||
jdbc.password=YMzc157#
|
||||
#目标模块项目路径
|
||||
targetprojectpath=D:/ymPro/Mediation-Backend/ruoyi-system
|
||||
targetprojectpath=E:/WorkCode/SH/Mediation-Backend/ruoyi-system
|
||||
#模块名称
|
||||
moduleName=mscase
|
||||
moduleName=flow
|
||||
#表名
|
||||
tableName=ms_case_application
|
||||
tableName=ms_case_flow_role_related
|
||||
#主键
|
||||
premaryId=id
|
||||
|
||||
Reference in New Issue
Block a user