From 637dd2f5a2cd7df531f219e79e099d4996c09aae Mon Sep 17 00:00:00 2001 From: chenqp <965586934@qq.com> Date: Sun, 20 Aug 2023 00:34:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BE=85=E5=8A=9E=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=8F=91=E9=80=81=E5=8F=8A=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../message/BpmMessageServiceImpl.java | 2 +- .../bpm/service/task/BpmTaskServiceImpl.java | 23 ++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/message/BpmMessageServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/message/BpmMessageServiceImpl.java index b88a1684..6243a81c 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/message/BpmMessageServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/message/BpmMessageServiceImpl.java @@ -60,7 +60,7 @@ public class BpmMessageServiceImpl implements BpmMessageService { @Override public void sendMessageWhenTaskAssigned(BpmMessageSendWhenTaskCreatedReqDTO reqDTO) { - sendNotifyMessage(reqDTO.getProcessInstanceId(), reqDTO.getStartUserId(), "_UNDEAL", null); +// sendNotifyMessage(reqDTO.getProcessInstanceId(), reqDTO.getStartUserId(), "_UNDEAL", null); // Map templateParams = new HashMap<>(); // templateParams.put("processInstanceName", reqDTO.getProcessInstanceName()); // templateParams.put("taskName", reqDTO.getTaskName()); diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java index 44c91ebe..d99fcf48 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java @@ -22,10 +22,13 @@ import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum; import cn.iocoder.yudao.module.bpm.service.message.BpmMessageService; import cn.iocoder.yudao.module.system.api.dept.DeptApi; import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; +import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi; +import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO; import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import lombok.extern.slf4j.Slf4j; import org.flowable.engine.HistoryService; +import org.flowable.engine.RuntimeService; import org.flowable.engine.TaskService; import org.flowable.engine.history.HistoricProcessInstance; import org.flowable.engine.runtime.ProcessInstance; @@ -33,6 +36,7 @@ import org.flowable.task.api.Task; import org.flowable.task.api.TaskQuery; import org.flowable.task.api.history.HistoricTaskInstance; import org.flowable.task.api.history.HistoricTaskInstanceQuery; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.support.TransactionSynchronization; @@ -74,7 +78,12 @@ public class BpmTaskServiceImpl implements BpmTaskService { private BpmTaskExtMapper taskExtMapper; @Resource private BpmMessageService messageService; - + @Resource + @Lazy + private RuntimeService runtimeService; + @Resource + @Lazy + private NotifyMessageSendApi notifyMessageSendApi; @Override public PageResult getTodoTaskPage(Long userId, BpmTaskTodoPageReqVO pageVO) { // 查询待办任务 @@ -253,6 +262,18 @@ public class BpmTaskServiceImpl implements BpmTaskService { BpmTaskExtDO taskExtDO = BpmTaskConvert.INSTANCE.convert2TaskExt(task).setResult(BpmProcessInstanceResultEnum.PROCESS.getResult()); taskExtMapper.insert(taskExtDO); + Map variables = runtimeService.getVariables(task.getProcessInstanceId()); + if (variables.containsKey("billType")) { + String billType = variables.get("billType").toString(); + NotifySendSingleToUserReqDTO notifyReq = new NotifySendSingleToUserReqDTO(); + notifyReq.setUserId(taskExtDO.getAssigneeUserId()); + notifyReq.setTemplateCode(billType + "_UNDEAL"); + notifyReq.setTemplateParams(variables); + notifyReq.setBillType(billType); + notifyReq.setExtraData(variables); + notifyReq.setJumpFlag("1"); + notifyMessageSendApi.sendSingleMessageToAdmin(notifyReq); + } } @Override