Quellcode durchsuchen

更改条件判断

hym vor 4 Jahren
Ursprung
Commit
0cdbabd5e2

+ 12 - 12
operation_manager/src/main/java/com/huaxu/process/service/impl/WorkFlowServiceImpl.java

@@ -164,19 +164,19 @@ public class WorkFlowServiceImpl implements WorkFlowService {
         companyIds.forEach(id->{
             int uniqueCount = processDefinitionMapper.checkProcessUnique(null, tenantId,
                     id,processDefinition.getTaskType());
-            if (uniqueCount > 0) {
-                throw new ServiceException(ResultStatus.PROCESS_ALREADY_EXISTS);
+            if (uniqueCount <= 0) {
+                processDefinition.setVersion(1);
+                processDefinition.setRunningVersion(0);
+                processDefinition.setTenantId(tenantId);
+                String processKey="A"+UUID.randomUUID().toString();
+                processDefinition.setProcessKey(processKey);
+                processDefinition.setCompanyOrgId(id);
+                processDefinition.setStatus(1);
+                processDefinition.setCreateBy(UserUtil.getCurrentUser().getUsername());
+                processDefinition.setDateCreate(new Date());
+                processDefinitionMapper.insert(processDefinition);
+
             }
-            processDefinition.setVersion(1);
-            processDefinition.setRunningVersion(0);
-            processDefinition.setTenantId(tenantId);
-            String processKey="A"+UUID.randomUUID().toString();
-            processDefinition.setProcessKey(processKey);
-            processDefinition.setCompanyOrgId(id);
-            processDefinition.setStatus(1);
-            processDefinition.setCreateBy(UserUtil.getCurrentUser().getUsername());
-            processDefinition.setDateCreate(new Date());
-            processDefinitionMapper.insert(processDefinition);
 
         });
         log.info("end add ProcessDefinition " );

+ 1 - 0
operation_manager/src/main/resources/mapper/ProcessDefinitionMapper.xml

@@ -313,6 +313,7 @@
     <select id="checkProcessUnique" resultType="java.lang.Integer">
         select count(*) from sc_process_definition
         <where>
+          status=1
             <if test="tenantId != null and tenantId != ''">
                 and tenant_id = #{tenantId}
             </if>