From 8649df0ca02b37c9dc3264a6c9d839cf6da8f705 Mon Sep 17 00:00:00 2001 From: gssong <1742057357@qq.com> Date: Fri, 7 Jun 2024 22:28:08 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BF=AE=E5=A4=8D=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E5=8A=9E=E7=90=86=E5=AE=8C=E6=88=90=E4=B9=8B=E5=90=8E=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E4=B8=BA=E6=94=B9=E5=8F=98=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workflow/service/impl/TestLeaveServiceImpl.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 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 230e83f7..0bbcca66 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 @@ -85,6 +85,9 @@ public class TestLeaveServiceImpl implements ITestLeaveService { @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()); @@ -115,13 +118,16 @@ public class TestLeaveServiceImpl implements ITestLeaveService { /** * 总体流程监听(例如: 提交 退回 撤销 终止 作废等) + * 正常使用只需#processEvent.key=='leave1' + * 示例为了方便则使用startsWith匹配了全部示例key * * @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()); } @@ -140,6 +146,4 @@ public class TestLeaveServiceImpl implements ITestLeaveService { testLeave.setStatus(BusinessStatusEnum.WAITING.getStatus()); baseMapper.updateById(testLeave); } - - }