From a474e9e5d1cf47d6128115b4bdac10e99601f124 Mon Sep 17 00:00:00 2001 From: gssong <1742057357@qq.com> Date: 星期五, 07 六月 2024 21:27:05 +0800 Subject: [PATCH] add 补充全部流程key监听示例 --- ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/TestLeaveServiceImpl.java | 114 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 97 insertions(+), 17 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 9d14bc8..c59b7ad 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 @@ -46,9 +46,7 @@ */ @Override public TestLeaveVo queryById(Long id) { - TestLeaveVo testLeaveVo = baseMapper.selectVoById(id); - testLeaveVo.setProcessInstanceId(workflowService.getInstanceIdByBusinessKey(String.valueOf(id))); - return testLeaveVo; + return baseMapper.selectVoById(id); } /** @@ -117,25 +115,12 @@ } /** - * 鎬讳綋娴佺▼鐩戝惉(渚嬪: 鎻愪氦 閫�鍥� 鎾ら攢 缁堟 浣滃簾绛�) - * - * @param processEvent 鍙傛暟 - */ - @EventListener(condition = "#processEvent.key=='leave1'") - public void processHandler(ProcessEvent processEvent) { - log.info("褰撳墠浠诲姟鎵ц浜唟}", processEvent.toString()); - TestLeave testLeave = baseMapper.selectById(Long.valueOf(processEvent.getBusinessKey())); - testLeave.setStatus(processEvent.getStatus()); - baseMapper.updateById(testLeave); - } - - /** * 鎵ц鍔炵悊浠诲姟鐩戝惉 * * @param processTaskEvent 鍙傛暟 */ @EventListener(condition = "#processTaskEvent.keyNode=='leave1_Activity_14633hx'") - public void processTaskHandler(ProcessTaskEvent processTaskEvent) { + public void leave1Task(ProcessTaskEvent processTaskEvent) { log.info("褰撳墠浠诲姟鎵ц浜唟}", processTaskEvent.toString()); TestLeave testLeave = baseMapper.selectById(Long.valueOf(processTaskEvent.getBusinessKey())); testLeave.setStatus(BusinessStatusEnum.WAITING.getStatus()); @@ -143,4 +128,99 @@ } + /** + * 鎬讳綋娴佺▼鐩戝惉(渚嬪: 鎻愪氦 閫�鍥� 鎾ら攢 缁堟 浣滃簾绛�) + * + * @param processEvent 鍙傛暟 + */ + @EventListener(condition = "#processEvent.key=='leave1'") + public void leave1(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); + } + + /** + * 鎬讳綋娴佺▼鐩戝惉(渚嬪: 鎻愪氦 閫�鍥� 鎾ら攢 缁堟 浣滃簾绛�) + * + * @param processEvent 鍙傛暟 + */ + @EventListener(condition = "#processEvent.key=='leave2'") + public void leave2(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); + } + + /** + * 鎬讳綋娴佺▼鐩戝惉(渚嬪: 鎻愪氦 閫�鍥� 鎾ら攢 缁堟 浣滃簾绛�) + * + * @param processEvent 鍙傛暟 + */ + @EventListener(condition = "#processEvent.key=='leave3'") + public void leave3(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); + } + + /** + * 鎬讳綋娴佺▼鐩戝惉(渚嬪: 鎻愪氦 閫�鍥� 鎾ら攢 缁堟 浣滃簾绛�) + * + * @param processEvent 鍙傛暟 + */ + @EventListener(condition = "#processEvent.key=='leave4'") + public void leave4(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); + } + + /** + * 鎬讳綋娴佺▼鐩戝惉(渚嬪: 鎻愪氦 閫�鍥� 鎾ら攢 缁堟 浣滃簾绛�) + * + * @param processEvent 鍙傛暟 + */ + @EventListener(condition = "#processEvent.key=='leave5'") + public void leave5(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); + } + + /** + * 鎬讳綋娴佺▼鐩戝惉(渚嬪: 鎻愪氦 閫�鍥� 鎾ら攢 缁堟 浣滃簾绛�) + * + * @param processEvent 鍙傛暟 + */ + @EventListener(condition = "#processEvent.key=='leave6'") + public void leave6(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); + } } -- Gitblit v1.9.3