Эх сурвалжийг харах

自定义流程接口-流程删除BUG修复

wangliang 3 жил өмнө
parent
commit
70f14619dd

+ 11 - 1
distributed-print/src/main/java/com/qmth/distributed/print/api/TFCustomFlowController.java

@@ -1,6 +1,7 @@
 package com.qmth.distributed.print.api;
 package com.qmth.distributed.print.api;
 
 
 
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.google.gson.Gson;
 import com.google.gson.Gson;
@@ -45,6 +46,7 @@ import javax.validation.constraints.Min;
 import java.security.NoSuchAlgorithmException;
 import java.security.NoSuchAlgorithmException;
 import java.util.*;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -207,7 +209,15 @@ public class TFCustomFlowController {
         if (!customFlowParam.getEnable()) {
         if (!customFlowParam.getEnable()) {
             List<TFCustomFlowEntity> tfCustomFlowEntityList = tfCustomFlowEntityService.findListByCustomFlowId(customFlowParam.getId());
             List<TFCustomFlowEntity> tfCustomFlowEntityList = tfCustomFlowEntityService.findListByCustomFlowId(customFlowParam.getId());
             if (Objects.nonNull(tfCustomFlowEntityList) && tfCustomFlowEntityList.size() > 0) {
             if (Objects.nonNull(tfCustomFlowEntityList) && tfCustomFlowEntityList.size() > 0) {
-                throw ExceptionResultEnum.ERROR.exception("已存在流程数据,不能删除");
+                List<Long> flowIds = tfCustomFlowEntityList.stream().map(e -> e.getFlowId()).collect(Collectors.toList());
+                QueryWrapper<TFFlowApprove> tfFlowApproveQueryWrapper = new QueryWrapper<>();
+                tfFlowApproveQueryWrapper.lambda().ne(TFFlowApprove::getStatus, FlowStatusEnum.FINISH)
+                        .ne(TFFlowApprove::getStatus, FlowStatusEnum.END)
+                        .in(TFFlowApprove::getFlowId, flowIds);
+                int count = tfFlowApproveService.count(tfFlowApproveQueryWrapper);
+                if (count > 0) {
+                    throw ExceptionResultEnum.ERROR.exception("已存在流程数据,不能删除");
+                }
             }
             }
         }
         }
         tfCustomFlow.setEnable(!customFlowParam.getEnable() ? null : customFlowParam.getEnable());
         tfCustomFlow.setEnable(!customFlowParam.getEnable() ? null : customFlowParam.getEnable());