From e36e8f77581314541b27bcf43dd99bbc2c916255 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期一, 13 一月 2025 13:36:12 +0800
Subject: [PATCH] fix 修复 satoken dao层获取timeout为秒导致丢失毫秒进度问题(临时修复 等satoken官方解决)
---
ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/TestLeaveServiceImpl.java | 55 +++++++++++++++++++++++++++++--------------------------
1 files changed, 29 insertions(+), 26 deletions(-)
diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/TestLeaveServiceImpl.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/TestLeaveServiceImpl.java
index aed3e89..f81c85f 100644
--- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/TestLeaveServiceImpl.java
+++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/TestLeaveServiceImpl.java
@@ -1,6 +1,5 @@
package org.dromara.workflow.service.impl;
-import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -47,9 +46,7 @@
*/
@Override
public TestLeaveVo queryById(Long id) {
- TestLeaveVo testLeaveVo = baseMapper.selectVoById(id);
- workflowService.setBusinessInstanceDTO(testLeaveVo, String.valueOf(id));
- return testLeaveVo;
+ return baseMapper.selectVoById(id);
}
/**
@@ -59,13 +56,7 @@
public TableDataInfo<TestLeaveVo> queryPageList(TestLeaveBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<TestLeave> lqw = buildQueryWrapper(bo);
Page<TestLeaveVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
- TableDataInfo<TestLeaveVo> build = TableDataInfo.build(result);
- List<TestLeaveVo> rows = build.getRows();
- if (CollUtil.isNotEmpty(rows)) {
- List<String> ids = StreamUtils.toList(rows, e -> String.valueOf(e.getId()));
- workflowService.setBusinessInstanceListDTO(rows, ids, "id");
- }
- return build;
+ return TableDataInfo.build(result);
}
/**
@@ -92,13 +83,14 @@
@Override
public TestLeaveVo insertByBo(TestLeaveBo bo) {
TestLeave add = MapstructUtils.convert(bo, TestLeave.class);
+ if (StringUtils.isBlank(add.getStatus())) {
+ add.setStatus(BusinessStatusEnum.DRAFT.getStatus());
+ }
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
}
- TestLeaveVo testLeaveVo = MapstructUtils.convert(add, TestLeaveVo.class);
- workflowService.setBusinessInstanceDTO(testLeaveVo, String.valueOf(add.getId()));
- return testLeaveVo;
+ return MapstructUtils.convert(add, TestLeaveVo.class);
}
/**
@@ -108,9 +100,7 @@
public TestLeaveVo updateByBo(TestLeaveBo bo) {
TestLeave update = MapstructUtils.convert(bo, TestLeave.class);
baseMapper.updateById(update);
- TestLeaveVo testLeaveVo = MapstructUtils.convert(update, TestLeaveVo.class);
- workflowService.setBusinessInstanceDTO(testLeaveVo, String.valueOf(update.getId()));
- return testLeaveVo;
+ return MapstructUtils.convert(update, TestLeaveVo.class);
}
/**
@@ -121,34 +111,47 @@
public Boolean deleteWithValidByIds(Collection<Long> ids) {
List<String> idList = StreamUtils.toList(ids, String::valueOf);
workflowService.deleteRunAndHisInstance(idList);
- return baseMapper.deleteBatchIds(ids) > 0;
+ return baseMapper.deleteByIds(ids) > 0;
}
/**
* 鎬讳綋娴佺▼鐩戝惉(渚嬪: 鎻愪氦 閫�鍥� 鎾ら攢 缁堟 浣滃簾绛�)
+ * 姝e父浣跨敤鍙渶#processEvent.key=='leave1'
+ * 绀轰緥涓轰簡鏂逛究鍒欎娇鐢╯tartsWith鍖归厤浜嗗叏閮ㄧず渚媖ey
*
* @param processEvent 鍙傛暟
*/
- @EventListener(condition = "#processEvent.key=='leave1'")
+ @EventListener(condition = "#processEvent.key.startsWith('leave')")
public void processHandler(ProcessEvent processEvent) {
log.info("褰撳墠浠诲姟鎵ц浜唟}", processEvent.toString());
TestLeave testLeave = baseMapper.selectById(Long.valueOf(processEvent.getBusinessKey()));
testLeave.setStatus(processEvent.getStatus());
+ if (processEvent.isSubmit()) {
+ testLeave.setStatus(BusinessStatusEnum.WAITING.getStatus());
+ }
baseMapper.updateById(testLeave);
}
/**
* 鎵ц鍔炵悊浠诲姟鐩戝惉
+ * 绀轰緥锛氫篃鍙�氳繃 @EventListener(condition = "#processTaskEvent.key=='leave1'")杩涜鍒ゆ柇
+ * 鍦ㄦ柟娉曚腑鍒ゆ柇娴佺▼鑺傜偣key
+ * if ("xxx".equals(processTaskEvent.getTaskDefinitionKey())) {
+ * //鎵ц涓氬姟閫昏緫
+ * }
*
* @param processTaskEvent 鍙傛暟
*/
- @EventListener(condition = "#processTaskEvent.keyNode=='leave1_Activity_14633hx'")
+ @EventListener(condition = "#processTaskEvent.key.startsWith('leave')")
public void processTaskHandler(ProcessTaskEvent processTaskEvent) {
- log.info("褰撳墠浠诲姟鎵ц浜唟}", processTaskEvent.toString());
- TestLeave testLeave = baseMapper.selectById(Long.valueOf(processTaskEvent.getBusinessKey()));
- testLeave.setStatus(BusinessStatusEnum.WAITING.getStatus());
- baseMapper.updateById(testLeave);
+ // 鎵�鏈塪emo妗堜緥鐨勭敵璇蜂汉鑺傜偣id
+ String[] ids = {"Activity_14633hx", "Activity_19b1i4j", "Activity_0uscrk3",
+ "Activity_0uscrk3", "Activity_0x6b71j", "Activity_0zy3g6j", "Activity_06a55t0"};
+ if (StringUtils.equalsAny(processTaskEvent.getTaskDefinitionKey(), ids)) {
+ log.info("褰撳墠浠诲姟鎵ц浜唟}", processTaskEvent.toString());
+ TestLeave testLeave = baseMapper.selectById(Long.valueOf(processTaskEvent.getBusinessKey()));
+ testLeave.setStatus(BusinessStatusEnum.WAITING.getStatus());
+ baseMapper.updateById(testLeave);
+ }
}
-
-
}
--
Gitblit v1.9.3