工作流消息通知集成

This commit is contained in:
Wayne 2024-05-07 09:14:17 +08:00
parent 702e8b0427
commit 9165ca7baa
4 changed files with 26 additions and 10 deletions

View File

@ -17,7 +17,7 @@
<module>yudao-module-infra</module> <module>yudao-module-infra</module>
<module>yudao-module-fta</module> <module>yudao-module-fta</module>
<!-- <module>yudao-module-member</module>--> <!-- <module>yudao-module-member</module>-->
<!-- <module>yudao-module-bpm</module>--> <module>yudao-module-bpm</module>
<!-- <module>yudao-module-report</module>--> <!-- <module>yudao-module-report</module>-->
<!-- <module>yudao-module-mp</module>--> <!-- <module>yudao-module-mp</module>-->
<!-- <module>yudao-module-pay</module>--> <!-- <module>yudao-module-pay</module>-->

View File

@ -6,6 +6,8 @@ import cn.iocoder.yudao.module.bpm.enums.message.BpmMessageEnum;
import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceApproveReqDTO; import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceApproveReqDTO;
import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceRejectReqDTO; import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceRejectReqDTO;
import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenTaskCreatedReqDTO; import cn.iocoder.yudao.module.bpm.service.message.dto.BpmMessageSendWhenTaskCreatedReqDTO;
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.sms.SmsSendApi; import cn.iocoder.yudao.module.system.api.sms.SmsSendApi;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -31,13 +33,17 @@ public class BpmMessageServiceImpl implements BpmMessageService {
@Resource @Resource
private WebProperties webProperties; private WebProperties webProperties;
@Resource
private NotifyMessageSendApi notifySendApi;
@Override @Override
public void sendMessageWhenProcessInstanceApprove(BpmMessageSendWhenProcessInstanceApproveReqDTO reqDTO) { public void sendMessageWhenProcessInstanceApprove(BpmMessageSendWhenProcessInstanceApproveReqDTO reqDTO) {
Map<String, Object> templateParams = new HashMap<>(); Map<String, Object> templateParams = new HashMap<>();
templateParams.put("processInstanceName", reqDTO.getProcessInstanceName()); templateParams.put("processInstanceName", reqDTO.getProcessInstanceName());
templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId())); templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId()));
smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getStartUserId(), String templateCode = "fta_workflow_task_pass";
BpmMessageEnum.PROCESS_INSTANCE_APPROVE.getSmsTemplateCode(), templateParams)); notifySendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO().setUserId(reqDTO.getStartUserId())
.setTemplateCode(templateCode).setTemplateParams(templateParams));
} }
@Override @Override
@ -46,19 +52,20 @@ public class BpmMessageServiceImpl implements BpmMessageService {
templateParams.put("processInstanceName", reqDTO.getProcessInstanceName()); templateParams.put("processInstanceName", reqDTO.getProcessInstanceName());
templateParams.put("reason", reqDTO.getReason()); templateParams.put("reason", reqDTO.getReason());
templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId())); templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId()));
smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getStartUserId(), String templateCode = "fta_workflow_task_not_pass";
BpmMessageEnum.PROCESS_INSTANCE_REJECT.getSmsTemplateCode(), templateParams)); notifySendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO().setUserId(reqDTO.getStartUserId())
.setTemplateCode(templateCode).setTemplateParams(templateParams));
} }
@Override @Override
public void sendMessageWhenTaskAssigned(BpmMessageSendWhenTaskCreatedReqDTO reqDTO) { public void sendMessageWhenTaskAssigned(BpmMessageSendWhenTaskCreatedReqDTO reqDTO) {
Map<String, Object> templateParams = new HashMap<>(); Map<String,Object> templateParams = new HashMap<String,Object>();
templateParams.put("processInstanceName", reqDTO.getProcessInstanceName()); templateParams.put("processInstanceName", reqDTO.getProcessInstanceName());
templateParams.put("startUserNickname",reqDTO.getStartUserNickname());
templateParams.put("taskName", reqDTO.getTaskName()); templateParams.put("taskName", reqDTO.getTaskName());
templateParams.put("startUserNickname", reqDTO.getStartUserNickname()); String templateCode = "fta_workflow_task";
templateParams.put("detailUrl", getProcessInstanceDetailUrl(reqDTO.getProcessInstanceId())); notifySendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO().setUserId(reqDTO.getAssigneeUserId())
smsSendApi.sendSingleSmsToAdmin(BpmMessageConvert.INSTANCE.convert(reqDTO.getAssigneeUserId(), .setTemplateCode(templateCode).setTemplateParams(templateParams));
BpmMessageEnum.TASK_ASSIGNED.getSmsTemplateCode(), templateParams));
} }
private String getProcessInstanceDetailUrl(String taskId) { private String getProcessInstanceDetailUrl(String taskId) {

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo; package cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo;
import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum;
import lombok.*; import lombok.*;
import java.time.LocalDate; import java.time.LocalDate;

View File

@ -79,4 +79,12 @@ public class EnterpriseInformationRespVO {
@ExcelProperty("经营许可范围") @ExcelProperty("经营许可范围")
private String operatePermitRange; private String operatePermitRange;
@Schema(description = "审批结果", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelIgnore
private Integer status;
@Schema(description = "流程编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelIgnore
private String processInstanceId;
} }