Просмотр исходного кода

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

gy b 2 лет назад
Родитель
Сommit
7f31884b08

+ 2
- 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/flow/CaseFlowController.java Просмотреть файл

@@ -43,7 +43,7 @@ public class CaseFlowController {
43 43
      * 删除案件流程节点信息
44 44
      */
45 45
     @PostMapping("/deleteCaseFlow")
46
-    public AjaxResult deleteCaseFlow(@RequestBody MsCaseFlowVO caseFlowVO) {
46
+    public AjaxResult deleteCaseFlow(@RequestBody MsCaseFlowVO caseFlowVO) throws Exception {
47 47
         Boolean result = caseFlowService.deleteCaseFlow(caseFlowVO);
48 48
         return success(result);
49 49
     }
@@ -52,7 +52,7 @@ public class CaseFlowController {
52 52
      * 排序案件流程节点
53 53
      */
54 54
     @PostMapping("/sortCaseFlow")
55
-    public AjaxResult sortCaseFlow(@RequestBody MsCaseFlowSearchVO caseFlowSearchVO) {
55
+    public AjaxResult sortCaseFlow(@RequestBody MsCaseFlowSearchVO caseFlowSearchVO) throws Exception {
56 56
         Boolean result = caseFlowService.sortCaseFlow(caseFlowSearchVO);
57 57
         return success(result);
58 58
     }

+ 2
- 1
ruoyi-admin/src/main/resources/application.yml Просмотреть файл

@@ -131,7 +131,8 @@ mybatis:
131 131
   mapperLocations: classpath*:mapper/**/*Mapper.xml
132 132
   # 加载全局的配置文件
133 133
   configLocation: classpath:mybatis/mybatis-config.xml
134
-
134
+  configuration:
135
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
135 136
 # PageHelper分页插件
136 137
 pagehelper:
137 138
   helperDialect: mysql

+ 2
- 1
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/flow/MsCaseFlowSearchVO.java Просмотреть файл

@@ -29,7 +29,8 @@ public class MsCaseFlowSearchVO {
29 29
     /**
30 30
      * 案件节点名称
31 31
      */
32
-    private String nodeName;
32
+    private String caseStatusName;
33
+    private Integer nodeId;
33 34
     private Integer pageNum;
34 35
     private Integer pageSize;
35 36
 

+ 2
- 2
ruoyi-system/src/main/java/com/ruoyi/system/service/flow/CaseFlowService.java Просмотреть файл

@@ -25,14 +25,14 @@ public interface CaseFlowService {
25 25
      * @param caseFlowVO
26 26
      * @return
27 27
      */
28
-    Boolean deleteCaseFlow(MsCaseFlowVO caseFlowVO);
28
+    Boolean deleteCaseFlow(MsCaseFlowVO caseFlowVO) throws Exception;
29 29
 
30 30
     /**
31 31
      * 排序案件流程节点
32 32
      * @param caseFlowSearchVO
33 33
      * @return
34 34
      */
35
-    Boolean sortCaseFlow(MsCaseFlowSearchVO caseFlowSearchVO);
35
+    Boolean sortCaseFlow(MsCaseFlowSearchVO caseFlowSearchVO) throws Exception;
36 36
 
37 37
     /**
38 38
      * 查询用户角色关联的案件状态

+ 24
- 8
ruoyi-system/src/main/java/com/ruoyi/system/service/flow/CaseFlowServiceImpl.java Просмотреть файл

@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5 5
 import com.ruoyi.common.core.domain.entity.SysRole;
6 6
 import com.ruoyi.common.core.page.TableDataInfo;
7
+import com.ruoyi.common.utils.StringUtils;
7 8
 import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
8 9
 import com.ruoyi.system.domain.entity.flow.MsCaseFlowRoleRelated;
9 10
 import com.ruoyi.system.domain.vo.flow.MsCaseFlowSearchVO;
@@ -13,6 +14,7 @@ import com.ruoyi.system.mapper.flow.MsCaseFlowMapper;
13 14
 import com.ruoyi.system.mapper.flow.MsCaseFlowRoleRelatedMapper;
14 15
 import com.ruoyi.system.util.NewStringUtil;
15 16
 import com.ruoyi.system.util.TableDataUtil;
17
+import org.bouncycastle.crypto.DataLengthException;
16 18
 import org.springframework.beans.BeanUtils;
17 19
 import org.springframework.beans.factory.annotation.Autowired;
18 20
 import org.springframework.stereotype.Service;
@@ -51,10 +53,13 @@ public class CaseFlowServiceImpl implements CaseFlowService {
51 53
             //分页查询案件流程节点信息
52 54
             Map<Integer, List<SysRole>> sysRoleMap = queryRoleByFlowId(null);
53 55
             Example example = new Example(MsCaseFlow.class);
54
-            example.setOrderByClause(" sort DESC ");
56
+            example.setOrderByClause(" sort ASC ");
55 57
             Example.Criteria criteria = example.createCriteria();
56
-            if (caseFlowSearchVO.getNodeName() != null) {
57
-                criteria.andLike("nodeName", "%" + caseFlowSearchVO.getNodeName() + "%");
58
+            if (caseFlowSearchVO.getCaseStatusName() != null) {
59
+                criteria.andLike("caseStatusName", "%" + caseFlowSearchVO.getCaseStatusName() + "%");
60
+            }
61
+            if (caseFlowSearchVO.getNodeId() != null) {
62
+                criteria.andEqualTo("nodeId", caseFlowSearchVO.getNodeId());
58 63
             }
59 64
             PageHelper.startPage(caseFlowSearchVO.getPageNum(), caseFlowSearchVO.getPageSize());
60 65
             List<MsCaseFlow> msCaseFlows = msCaseFlowMapper.selectByExample(example);
@@ -82,7 +87,7 @@ public class CaseFlowServiceImpl implements CaseFlowService {
82 87
                 //驳回节点
83 88
                 if (msCaseFlow.getBackFlowId() != null) {
84 89
                     MsCaseFlow msCaseFlow1 = msCaseFlowMapper.selectByPrimaryKey(msCaseFlow.getBackFlowId());
85
-                    temp.setBackFlowName(msCaseFlow1.getNodeName());
90
+                    temp.setBackFlowName(msCaseFlow1 != null ? msCaseFlow1.getNodeName() : "");
86 91
                 }
87 92
                 list.add(temp);
88 93
             }
@@ -201,8 +206,17 @@ public class CaseFlowServiceImpl implements CaseFlowService {
201 206
      * @return
202 207
      */
203 208
     @Override
204
-    public Boolean deleteCaseFlow(MsCaseFlowVO caseFlowVO) {
209
+    public Boolean deleteCaseFlow(MsCaseFlowVO caseFlowVO) throws Exception {
205 210
         if (caseFlowVO.getId() != null) {
211
+            //判断是否有其他的流程节点引用
212
+            Example example = new Example(MsCaseFlow.class);
213
+            Example.Criteria criteria = example.createCriteria();
214
+            criteria.andEqualTo("backFlowId", caseFlowVO.getId());
215
+            int count = msCaseFlowMapper.selectCountByExample(example);
216
+            if (count > 0) {
217
+                throw new Exception("当前流程节点被其他节点引用,无法删除");
218
+//                return false;
219
+            }
206 220
             //删除案件流程信息
207 221
             int i = msCaseFlowMapper.deleteByPrimaryKey(caseFlowVO.getId());
208 222
             if (i > 0) {
@@ -221,7 +235,7 @@ public class CaseFlowServiceImpl implements CaseFlowService {
221 235
      * @return
222 236
      */
223 237
     @Override
224
-    public Boolean sortCaseFlow(MsCaseFlowSearchVO caseFlowVO) {
238
+    public Boolean sortCaseFlow(MsCaseFlowSearchVO caseFlowVO) throws Exception {
225 239
         if (caseFlowVO != null && caseFlowVO.getId() != null && caseFlowVO.getSortType() != null) {
226 240
             //升序查询所有案件流程信息
227 241
             Example example = new Example(MsCaseFlow.class);
@@ -241,7 +255,8 @@ public class CaseFlowServiceImpl implements CaseFlowService {
241 255
             if (caseFlowVO.getSortType() == 0) {
242 256
                 //降序(序号加1)
243 257
                 if (currentIndex == msCaseFlows.size() - 1) {
244
-                    return false;
258
+                    throw new Exception("当前是流程最后一个节点,无需降序");
259
+//                    return false;
245 260
                 } else {
246 261
                     int nextIndex = currentIndex + 1;
247 262
                     MsCaseFlow current = msCaseFlows.get(currentIndex);
@@ -255,7 +270,8 @@ public class CaseFlowServiceImpl implements CaseFlowService {
255 270
             } else if (caseFlowVO.getSortType() == 1) {
256 271
                 //升序(序号减1)
257 272
                 if (currentIndex == 0) {
258
-                    return false;
273
+                    throw new Exception("当前是流程第一个节点,无需升序");
274
+//                    return false;
259 275
                 } else {
260 276
                     int lastIndex = currentIndex - 1;
261 277
                     MsCaseFlow current = msCaseFlows.get(currentIndex);