2 Commits dd11821e3d ... feb836798f

Autor SHA1 Mensaje Fecha
  jihs feb836798f Merge branch 'master' of http://139.196.39.194:9021/chenc/cd-work-flow-service hace 3 años
  jihs 7bf8044bc3 更新 hace 3 años

+ 14 - 0
jeecg-boot/jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/web/ActivitiModelController.java

@@ -3,6 +3,7 @@ package org.jeecg.modules.activiti.web;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -20,9 +21,12 @@ import org.activiti.engine.repository.ProcessDefinition;
 import org.activiti.engine.runtime.ProcessInstance;
 import org.activiti.engine.task.Task;
 import org.activiti.image.ProcessDiagramGenerator;
+import org.checkerframework.checker.units.qual.A;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.exception.JeecgBootException;
+import org.jeecg.modules.activiti.entity.ActNode;
 import org.jeecg.modules.activiti.entity.ActZprocess;
+import org.jeecg.modules.activiti.service.IActNodeService;
 import org.jeecg.modules.activiti.service.Impl.ActZprocessServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -36,6 +40,7 @@ import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 @Controller
 @RequestMapping("/activiti/models")
@@ -55,6 +60,8 @@ public class ActivitiModelController {
     private ObjectMapper objectMapper;
     @Autowired
     private ActZprocessServiceImpl actZprocessService;
+    @Autowired
+    private IActNodeService actNodeService;
 
     @RequestMapping("/modelListData")
     @ResponseBody
@@ -145,6 +152,13 @@ public class ActivitiModelController {
             if(model.getProcesses().size()==0){
                 return Result.error("模型不符要求,请至少设计一条主线流程");
             }
+            List<String> nodeIds = model.getProcesses().get(0).getFlowElements().stream().map(t -> t.getId()).collect(Collectors.toList());
+            List<ActNode> nodeList = actNodeService.list(new QueryWrapper<ActNode>().in("node_id", nodeIds));
+            if(nodeList.size()!=0){
+                return Result.error("流程id名称已经存在:"+nodeList.get(0).getNodeId());
+            }
+
+
             byte[] bpmnBytes = new BpmnXMLConverter().convertToXML(model);
 
             // 部署发布模型流程

+ 0 - 1
jeecg-boot/jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/web/ActivitiProcessController.java

@@ -380,5 +380,4 @@ public class ActivitiProcessController {
         ProcessNodeVo node = actZprocessService.getNode(nodeId);
         return Result.ok(node);
     }
-
 }