Parcourir la source

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

gy b il y a 2 ans
Parent
révision
7f31884b08

+ 2
- 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/flow/CaseFlowController.java Voir le fichier

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

+ 2
- 1
ruoyi-admin/src/main/resources/application.yml Voir le fichier

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

+ 2
- 1
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/flow/MsCaseFlowSearchVO.java Voir le fichier

29
     /**
29
     /**
30
      * 案件节点名称
30
      * 案件节点名称
31
      */
31
      */
32
-    private String nodeName;
32
+    private String caseStatusName;
33
+    private Integer nodeId;
33
     private Integer pageNum;
34
     private Integer pageNum;
34
     private Integer pageSize;
35
     private Integer pageSize;
35
 
36
 

+ 2
- 2
ruoyi-system/src/main/java/com/ruoyi/system/service/flow/CaseFlowService.java Voir le fichier

25
      * @param caseFlowVO
25
      * @param caseFlowVO
26
      * @return
26
      * @return
27
      */
27
      */
28
-    Boolean deleteCaseFlow(MsCaseFlowVO caseFlowVO);
28
+    Boolean deleteCaseFlow(MsCaseFlowVO caseFlowVO) throws Exception;
29
 
29
 
30
     /**
30
     /**
31
      * 排序案件流程节点
31
      * 排序案件流程节点
32
      * @param caseFlowSearchVO
32
      * @param caseFlowSearchVO
33
      * @return
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 Voir le fichier

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