From 1b9936ba920d65df09ab8dba79c6252568ee26e4 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期三, 26 三月 2025 12:16:02 +0800
Subject: [PATCH] 任务统计bug
---
flowable/src/main/java/com/ycl/service/impl/FlowDefinitionServiceImpl.java | 27 +++++++++++++++++++++++----
1 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/flowable/src/main/java/com/ycl/service/impl/FlowDefinitionServiceImpl.java b/flowable/src/main/java/com/ycl/service/impl/FlowDefinitionServiceImpl.java
index f1ff087..d27ae14 100644
--- a/flowable/src/main/java/com/ycl/service/impl/FlowDefinitionServiceImpl.java
+++ b/flowable/src/main/java/com/ycl/service/impl/FlowDefinitionServiceImpl.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
+import com.ycl.cmd.RemoveDeploymentCacheCMD;
import com.ycl.common.constant.ProcessConstants;
import com.ycl.common.core.domain.AjaxResult;
import com.ycl.common.core.domain.entity.SysUser;
@@ -20,6 +21,7 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.flowable.bpmn.model.BpmnModel;
+import org.flowable.engine.ManagementService;
import org.flowable.engine.repository.Deployment;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.engine.repository.ProcessDefinitionQuery;
@@ -27,6 +29,8 @@
import org.flowable.image.impl.DefaultProcessDiagramGenerator;
import org.flowable.task.api.Task;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.io.IOException;
@@ -49,12 +53,10 @@
public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFlowDefinitionService {
private final ISysDeployFormService sysDeployFormService;
-
private final ISysUserService sysUserService;
-
private final ISysDeptService sysDeptService;
-
private final FlowDeployMapper flowDeployMapper;
+ private final ManagementService managementService;
private static final String BPMN_FILE_SUFFIX = ".bpmn";
@@ -118,7 +120,7 @@
/**
- * 瀵煎叆娴佺▼鏂囦欢
+ * 瀵煎叆娴佺▼鏂囦欢锛岃嚜鍔ㄩ儴缃�
*
* 褰撴瘡涓猭ey鐨勬祦绋嬬涓�娆¢儴缃叉椂锛屾寚瀹氱増鏈负1銆傚鍏跺悗鎵�鏈変娇鐢ㄧ浉鍚宬ey鐨勬祦绋嬪畾涔夛紝
* 閮ㄧ讲鏃剁増鏈細鍦ㄨkey褰撳墠宸查儴缃茬殑鏈�楂樼増鏈彿鍩虹涓婂姞1銆俴ey鍙傛暟鐢ㄤ簬鍖哄垎娴佺▼瀹氫箟
@@ -132,6 +134,21 @@
ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().deploymentId(deploy.getId()).singleResult();
repositoryService.setProcessDefinitionCategory(definition.getId(), category);
+ }
+
+ @Override
+ public void updateProcess(String deploymentId, String name, String category, InputStream in) {
+ if (! StringUtils.hasText(deploymentId)) {
+ throw new RuntimeException("璇ユ祦绋嬬涓�娆¢儴缃诧紝璇风洿鎺ラ�夋嫨淇濆瓨鎸夐挳");
+ }
+ ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deploymentId).singleResult();
+ if (Objects.isNull(processDefinition)) {
+ throw new RuntimeException("娴佺▼瀹氫箟涓嶅瓨鍦�");
+ }
+ // 1.鏇存柊娴佺▼鍥炬暟鎹�
+ flowDeployMapper.updateProcess(in, deploymentId);
+ // 2.娓呴櫎璇ユ祦绋嬬殑缂撳瓨锛屼娇鍏堕噸鏂板姞杞芥柊鐨勬祦绋嬪浘
+ managementService.executeCommand(new RemoveDeploymentCacheCMD(processDefinition.getId()));
}
/**
@@ -237,9 +254,11 @@
* @param deployId 娴佺▼閮ㄧ讲ID act_ge_bytearray 琛ㄤ腑 deployment_id鍊�
*/
@Override
+ @Transactional(rollbackFor = Exception.class)
public void delete(String deployId) {
// true 鍏佽绾ц仈鍒犻櫎 ,涓嶈缃細瀵艰嚧鏁版嵁搴撳閿叧鑱斿紓甯�
repositoryService.deleteDeployment(deployId, true);
+ // TODO 鍒犻櫎椤圭洰缁戝畾鐨�
}
--
Gitblit v1.8.0