From e1856ede152bbe7ab32208716b87c7d289080221 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期二, 27 五月 2025 14:48:43 +0800
Subject: [PATCH] art: 设备管理-三保-并行任务执行, 并行网关多任务处理

---
 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.java |   58 +++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 45 insertions(+), 13 deletions(-)

diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.java
index 28f101e..99720f2 100644
--- a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.java
+++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.java
@@ -1,9 +1,11 @@
 package org.jeecg.modules.flowable.apithird.business.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.commons.collections4.CollectionUtils;
 import org.flowable.engine.HistoryService;
 import org.flowable.engine.history.HistoricActivityInstance;
 import org.jeecg.modules.flowable.apithird.business.dto.FlowMyBusinessDto;
@@ -14,9 +16,10 @@
 import org.jeecg.modules.flowable.util.TimeUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.annotation.Resource;
+import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 
@@ -28,7 +31,7 @@
  */
 @Service
 public class FlowMyBusinessServiceImpl extends ServiceImpl<FlowMyBusinessMapper, FlowMyBusiness> implements IFlowMyBusinessService {
-    @Autowired
+    @Resource
     private FlowMyBusinessMapper flowMyBusinessMapper;
 
     @Autowired
@@ -36,14 +39,14 @@
 
     public HistoricActivityInstance getPreviousNode(String taskId) {
         // 鑾峰彇褰撳墠浠诲姟鐨勬墽琛屽疄渚� ID
-        String executionId = historyService.createHistoricTaskInstanceQuery()
+        String processInstanceId = historyService.createHistoricTaskInstanceQuery()
                 .taskId(taskId)
                 .singleResult()
-                .getExecutionId();
+                .getProcessInstanceId();
 
         // 鏌ヨ鍘嗗彶娲诲姩瀹炰緥
         List<HistoricActivityInstance> historicActivityInstances = historyService.createHistoricActivityInstanceQuery()
-                .executionId(executionId)
+                .processInstanceId(processInstanceId)
                 .activityType("userTask")
                 .finished()
                 .orderByHistoricActivityInstanceEndTime()
@@ -58,13 +61,10 @@
         return null;
     }
 
-    @Transactional(isolation = Isolation.READ_COMMITTED)    // 闄嶄綆闅旂绾у埆
+    @Transactional   // 闄嶄綆闅旂绾у埆
     public FlowMyBusiness getByDataId(String dataId) {
-        LambdaQueryWrapper<FlowMyBusiness> flowMyBusinessLambdaQueryWrapper = new LambdaQueryWrapper<>();
-        flowMyBusinessLambdaQueryWrapper.eq(FlowMyBusiness::getDataId,dataId)
-        ;
         //濡傛灉淇濆瓨鏁版嵁鍓嶆湭璋冪敤蹇呰皟鐨凢lowCommonService.initActBusiness鏂规硶锛屽氨浼氭湁闂
-        FlowMyBusiness business = this.getOne(flowMyBusinessLambdaQueryWrapper);
+        FlowMyBusiness business = flowMyBusinessMapper.selectByDataId(dataId);
         return business;
     }
 
@@ -81,11 +81,10 @@
     /**
      * 娴佺▼-鎴戠殑宸插姙
      * @param flowMyBusinessDto
-     * @param page
      * @return
      */
-    public IPage<FlowTaskDto> getPageListMyBusiness(Page page, FlowMyBusinessDto flowMyBusinessDto){
-        return flowMyBusinessMapper.PageListMyBusiness(page,flowMyBusinessDto);
+    public List<FlowTaskDto> ListMyBusiness(FlowMyBusinessDto flowMyBusinessDto){
+        return flowMyBusinessMapper.ListMyBusiness(flowMyBusinessDto);
     }
 
     /**
@@ -129,4 +128,37 @@
         });
         return flowMyBusinessDtoIPage;
     }
+
+    @Override
+    public FlowMyBusiness getFlowMyBusiness(String instanceId) {
+        List<FlowMyBusiness> businessList = super.list(
+                new QueryWrapper<FlowMyBusiness>().eq("process_instance_id", instanceId));
+        return businessList.isEmpty() ? null : businessList.get(0);
+    }
+
+    @Override
+    public FlowMyBusiness getFlowMyBusiness(String instanceId, String taskId) {
+        List<FlowMyBusiness> businessList = super.list(
+                new QueryWrapper<FlowMyBusiness>().eq("process_instance_id", instanceId).eq("task_id", taskId));
+        return businessList.isEmpty() ? null : businessList.get(0);
+    }
+
+    @Override
+    public FlowMyBusiness selectByDataId(String dataId) {
+        List<FlowMyBusiness> businessList = super.list(
+                new QueryWrapper<FlowMyBusiness>().eq("data_id", dataId));
+        return businessList.isEmpty() ? null : businessList.get(0);
+    }
+
+    @Override
+    public List<FlowMyBusiness> selectListByDataId(String dataId) {
+        //濡傛灉淇濆瓨鏁版嵁鍓嶆湭璋冪敤蹇呰皟鐨凢lowCommonService.initActBusiness鏂规硶锛屽氨浼氭湁闂
+        LambdaQueryWrapper<FlowMyBusiness> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(FlowMyBusiness::getDataId, dataId);
+        List<FlowMyBusiness> list = flowMyBusinessMapper.selectList(queryWrapper);
+        if(CollectionUtils.isEmpty(list)){
+            return Collections.emptyList();
+        }
+        return list;
+    }
 }

--
Gitblit v1.9.3