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

Merged
bgy merged 2 commits from bgy into dev 2024-01-10 07:04:53 +00:00
5 changed files with 32 additions and 14 deletions
@@ -43,7 +43,7 @@ public class CaseFlowController {
* 删除案件流程节点信息
*/
@PostMapping("/deleteCaseFlow")
public AjaxResult deleteCaseFlow(@RequestBody MsCaseFlowVO caseFlowVO) {
public AjaxResult deleteCaseFlow(@RequestBody MsCaseFlowVO caseFlowVO) throws Exception {
Boolean result = caseFlowService.deleteCaseFlow(caseFlowVO);
return success(result);
}
@@ -52,7 +52,7 @@ public class CaseFlowController {
* 排序案件流程节点
*/
@PostMapping("/sortCaseFlow")
public AjaxResult sortCaseFlow(@RequestBody MsCaseFlowSearchVO caseFlowSearchVO) {
public AjaxResult sortCaseFlow(@RequestBody MsCaseFlowSearchVO caseFlowSearchVO) throws Exception {
Boolean result = caseFlowService.sortCaseFlow(caseFlowSearchVO);
return success(result);
}
@@ -131,7 +131,8 @@ mybatis:
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# PageHelper分页插件
pagehelper:
helperDialect: mysql
@@ -29,7 +29,8 @@ public class MsCaseFlowSearchVO {
/**
* 案件节点名称
*/
private String nodeName;
private String caseStatusName;
private Integer nodeId;
private Integer pageNum;
private Integer pageSize;
@@ -25,14 +25,14 @@ public interface CaseFlowService {
* @param caseFlowVO
* @return
*/
Boolean deleteCaseFlow(MsCaseFlowVO caseFlowVO);
Boolean deleteCaseFlow(MsCaseFlowVO caseFlowVO) throws Exception;
/**
* 排序案件流程节点
* @param caseFlowSearchVO
* @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.ruoyi.common.core.domain.entity.SysRole;
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.MsCaseFlowRoleRelated;
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.util.NewStringUtil;
import com.ruoyi.system.util.TableDataUtil;
import org.bouncycastle.crypto.DataLengthException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -51,10 +53,13 @@ public class CaseFlowServiceImpl implements CaseFlowService {
//分页查询案件流程节点信息
Map<Integer, List<SysRole>> sysRoleMap = queryRoleByFlowId(null);
Example example = new Example(MsCaseFlow.class);
example.setOrderByClause(" sort DESC ");
example.setOrderByClause(" sort ASC ");
Example.Criteria criteria = example.createCriteria();
if (caseFlowSearchVO.getNodeName() != null) {
criteria.andLike("nodeName", "%" + caseFlowSearchVO.getNodeName() + "%");
if (caseFlowSearchVO.getCaseStatusName() != null) {
criteria.andLike("caseStatusName", "%" + caseFlowSearchVO.getCaseStatusName() + "%");
}
if (caseFlowSearchVO.getNodeId() != null) {
criteria.andEqualTo("nodeId", caseFlowSearchVO.getNodeId());
}
PageHelper.startPage(caseFlowSearchVO.getPageNum(), caseFlowSearchVO.getPageSize());
List<MsCaseFlow> msCaseFlows = msCaseFlowMapper.selectByExample(example);
@@ -82,7 +87,7 @@ public class CaseFlowServiceImpl implements CaseFlowService {
//驳回节点
if (msCaseFlow.getBackFlowId() != null) {
MsCaseFlow msCaseFlow1 = msCaseFlowMapper.selectByPrimaryKey(msCaseFlow.getBackFlowId());
temp.setBackFlowName(msCaseFlow1.getNodeName());
temp.setBackFlowName(msCaseFlow1 != null ? msCaseFlow1.getNodeName() : "");
}
list.add(temp);
}
@@ -201,8 +206,17 @@ public class CaseFlowServiceImpl implements CaseFlowService {
* @return
*/
@Override
public Boolean deleteCaseFlow(MsCaseFlowVO caseFlowVO) {
public Boolean deleteCaseFlow(MsCaseFlowVO caseFlowVO) throws Exception {
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());
if (i > 0) {
@@ -221,7 +235,7 @@ public class CaseFlowServiceImpl implements CaseFlowService {
* @return
*/
@Override
public Boolean sortCaseFlow(MsCaseFlowSearchVO caseFlowVO) {
public Boolean sortCaseFlow(MsCaseFlowSearchVO caseFlowVO) throws Exception {
if (caseFlowVO != null && caseFlowVO.getId() != null && caseFlowVO.getSortType() != null) {
//升序查询所有案件流程信息
Example example = new Example(MsCaseFlow.class);
@@ -241,7 +255,8 @@ public class CaseFlowServiceImpl implements CaseFlowService {
if (caseFlowVO.getSortType() == 0) {
//降序(序号加1)
if (currentIndex == msCaseFlows.size() - 1) {
return false;
throw new Exception("当前是流程最后一个节点,无需降序");
// return false;
} else {
int nextIndex = currentIndex + 1;
MsCaseFlow current = msCaseFlows.get(currentIndex);
@@ -255,7 +270,8 @@ public class CaseFlowServiceImpl implements CaseFlowService {
} else if (caseFlowVO.getSortType() == 1) {
//升序(序号减1)
if (currentIndex == 0) {
return false;
throw new Exception("当前是流程第一个节点,无需升序");
// return false;
} else {
int lastIndex = currentIndex - 1;
MsCaseFlow current = msCaseFlows.get(currentIndex);