优化案例流程排序提示消息

This commit is contained in:
gy b
2024-01-10 15:02:44 +08:00
parent 6daba6ac21
commit 7f31884b08
5 changed files with 32 additions and 14 deletions
@@ -43,7 +43,7 @@ public class CaseFlowController {
* 删除案件流程节点信息 * 删除案件流程节点信息
*/ */
@PostMapping("/deleteCaseFlow") @PostMapping("/deleteCaseFlow")
public AjaxResult deleteCaseFlow(@RequestBody MsCaseFlowVO caseFlowVO) { public AjaxResult deleteCaseFlow(@RequestBody MsCaseFlowVO caseFlowVO) throws Exception {
Boolean result = caseFlowService.deleteCaseFlow(caseFlowVO); Boolean result = caseFlowService.deleteCaseFlow(caseFlowVO);
return success(result); return success(result);
} }
@@ -52,7 +52,7 @@ public class CaseFlowController {
* 排序案件流程节点 * 排序案件流程节点
*/ */
@PostMapping("/sortCaseFlow") @PostMapping("/sortCaseFlow")
public AjaxResult sortCaseFlow(@RequestBody MsCaseFlowSearchVO caseFlowSearchVO) { public AjaxResult sortCaseFlow(@RequestBody MsCaseFlowSearchVO caseFlowSearchVO) throws Exception {
Boolean result = caseFlowService.sortCaseFlow(caseFlowSearchVO); Boolean result = caseFlowService.sortCaseFlow(caseFlowSearchVO);
return success(result); return success(result);
} }
@@ -131,7 +131,8 @@ mybatis:
mapperLocations: classpath*:mapper/**/*Mapper.xml mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件 # 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml configLocation: classpath:mybatis/mybatis-config.xml
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# PageHelper分页插件 # PageHelper分页插件
pagehelper: pagehelper:
helperDialect: mysql helperDialect: mysql
@@ -29,7 +29,8 @@ public class MsCaseFlowSearchVO {
/** /**
* 案件节点名称 * 案件节点名称
*/ */
private String nodeName; private String caseStatusName;
private Integer nodeId;
private Integer pageNum; private Integer pageNum;
private Integer pageSize; private Integer pageSize;
@@ -25,14 +25,14 @@ public interface CaseFlowService {
* @param caseFlowVO * @param caseFlowVO
* @return * @return
*/ */
Boolean deleteCaseFlow(MsCaseFlowVO caseFlowVO); Boolean deleteCaseFlow(MsCaseFlowVO caseFlowVO) throws Exception;
/** /**
* 排序案件流程节点 * 排序案件流程节点
* @param caseFlowSearchVO * @param caseFlowSearchVO
* @return * @return
*/ */
Boolean sortCaseFlow(MsCaseFlowSearchVO caseFlowSearchVO); Boolean sortCaseFlow(MsCaseFlowSearchVO caseFlowSearchVO) throws Exception;
/** /**
* 查询用户角色关联的案件状态 * 查询用户角色关联的案件状态
@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.entity.flow.MsCaseFlow; import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
import com.ruoyi.system.domain.entity.flow.MsCaseFlowRoleRelated; import com.ruoyi.system.domain.entity.flow.MsCaseFlowRoleRelated;
import com.ruoyi.system.domain.vo.flow.MsCaseFlowSearchVO; import com.ruoyi.system.domain.vo.flow.MsCaseFlowSearchVO;
@@ -13,6 +14,7 @@ import com.ruoyi.system.mapper.flow.MsCaseFlowMapper;
import com.ruoyi.system.mapper.flow.MsCaseFlowRoleRelatedMapper; import com.ruoyi.system.mapper.flow.MsCaseFlowRoleRelatedMapper;
import com.ruoyi.system.util.NewStringUtil; import com.ruoyi.system.util.NewStringUtil;
import com.ruoyi.system.util.TableDataUtil; import com.ruoyi.system.util.TableDataUtil;
import org.bouncycastle.crypto.DataLengthException;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -51,10 +53,13 @@ public class CaseFlowServiceImpl implements CaseFlowService {
//分页查询案件流程节点信息 //分页查询案件流程节点信息
Map<Integer, List<SysRole>> sysRoleMap = queryRoleByFlowId(null); Map<Integer, List<SysRole>> sysRoleMap = queryRoleByFlowId(null);
Example example = new Example(MsCaseFlow.class); Example example = new Example(MsCaseFlow.class);
example.setOrderByClause(" sort DESC "); example.setOrderByClause(" sort ASC ");
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
if (caseFlowSearchVO.getNodeName() != null) { if (caseFlowSearchVO.getCaseStatusName() != null) {
criteria.andLike("nodeName", "%" + caseFlowSearchVO.getNodeName() + "%"); criteria.andLike("caseStatusName", "%" + caseFlowSearchVO.getCaseStatusName() + "%");
}
if (caseFlowSearchVO.getNodeId() != null) {
criteria.andEqualTo("nodeId", caseFlowSearchVO.getNodeId());
} }
PageHelper.startPage(caseFlowSearchVO.getPageNum(), caseFlowSearchVO.getPageSize()); PageHelper.startPage(caseFlowSearchVO.getPageNum(), caseFlowSearchVO.getPageSize());
List<MsCaseFlow> msCaseFlows = msCaseFlowMapper.selectByExample(example); List<MsCaseFlow> msCaseFlows = msCaseFlowMapper.selectByExample(example);
@@ -82,7 +87,7 @@ public class CaseFlowServiceImpl implements CaseFlowService {
//驳回节点 //驳回节点
if (msCaseFlow.getBackFlowId() != null) { if (msCaseFlow.getBackFlowId() != null) {
MsCaseFlow msCaseFlow1 = msCaseFlowMapper.selectByPrimaryKey(msCaseFlow.getBackFlowId()); MsCaseFlow msCaseFlow1 = msCaseFlowMapper.selectByPrimaryKey(msCaseFlow.getBackFlowId());
temp.setBackFlowName(msCaseFlow1.getNodeName()); temp.setBackFlowName(msCaseFlow1 != null ? msCaseFlow1.getNodeName() : "");
} }
list.add(temp); list.add(temp);
} }
@@ -201,8 +206,17 @@ public class CaseFlowServiceImpl implements CaseFlowService {
* @return * @return
*/ */
@Override @Override
public Boolean deleteCaseFlow(MsCaseFlowVO caseFlowVO) { public Boolean deleteCaseFlow(MsCaseFlowVO caseFlowVO) throws Exception {
if (caseFlowVO.getId() != null) { if (caseFlowVO.getId() != null) {
//判断是否有其他的流程节点引用
Example example = new Example(MsCaseFlow.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("backFlowId", caseFlowVO.getId());
int count = msCaseFlowMapper.selectCountByExample(example);
if (count > 0) {
throw new Exception("当前流程节点被其他节点引用,无法删除");
// return false;
}
//删除案件流程信息 //删除案件流程信息
int i = msCaseFlowMapper.deleteByPrimaryKey(caseFlowVO.getId()); int i = msCaseFlowMapper.deleteByPrimaryKey(caseFlowVO.getId());
if (i > 0) { if (i > 0) {
@@ -221,7 +235,7 @@ public class CaseFlowServiceImpl implements CaseFlowService {
* @return * @return
*/ */
@Override @Override
public Boolean sortCaseFlow(MsCaseFlowSearchVO caseFlowVO) { public Boolean sortCaseFlow(MsCaseFlowSearchVO caseFlowVO) throws Exception {
if (caseFlowVO != null && caseFlowVO.getId() != null && caseFlowVO.getSortType() != null) { if (caseFlowVO != null && caseFlowVO.getId() != null && caseFlowVO.getSortType() != null) {
//升序查询所有案件流程信息 //升序查询所有案件流程信息
Example example = new Example(MsCaseFlow.class); Example example = new Example(MsCaseFlow.class);
@@ -241,7 +255,8 @@ public class CaseFlowServiceImpl implements CaseFlowService {
if (caseFlowVO.getSortType() == 0) { if (caseFlowVO.getSortType() == 0) {
//降序(序号加1) //降序(序号加1)
if (currentIndex == msCaseFlows.size() - 1) { if (currentIndex == msCaseFlows.size() - 1) {
return false; throw new Exception("当前是流程最后一个节点,无需降序");
// return false;
} else { } else {
int nextIndex = currentIndex + 1; int nextIndex = currentIndex + 1;
MsCaseFlow current = msCaseFlows.get(currentIndex); MsCaseFlow current = msCaseFlows.get(currentIndex);
@@ -255,7 +270,8 @@ public class CaseFlowServiceImpl implements CaseFlowService {
} else if (caseFlowVO.getSortType() == 1) { } else if (caseFlowVO.getSortType() == 1) {
//升序(序号减1) //升序(序号减1)
if (currentIndex == 0) { if (currentIndex == 0) {
return false; throw new Exception("当前是流程第一个节点,无需升序");
// return false;
} else { } else {
int lastIndex = currentIndex - 1; int lastIndex = currentIndex - 1;
MsCaseFlow current = msCaseFlows.get(currentIndex); MsCaseFlow current = msCaseFlows.get(currentIndex);