|
|
@ -1,18 +1,19 @@
|
|
|
|
package cn.iocoder.yudao.module.bpm.service.message;
|
|
|
|
package cn.iocoder.yudao.module.bpm.service.message;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.framework.web.config.WebProperties;
|
|
|
|
import cn.iocoder.yudao.framework.web.config.WebProperties;
|
|
|
|
import cn.iocoder.yudao.module.bpm.convert.message.BpmMessageConvert;
|
|
|
|
|
|
|
|
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.flowable.engine.RuntimeService;
|
|
|
|
|
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -30,9 +31,15 @@ public class BpmMessageServiceImpl implements BpmMessageService {
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private WebProperties webProperties;
|
|
|
|
private WebProperties webProperties;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
@Lazy
|
|
|
|
|
|
|
|
private NotifyMessageSendApi notifyMessageSendApi;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
@Lazy
|
|
|
|
|
|
|
|
private RuntimeService runtimeService;
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void sendMessageWhenProcessInstanceApprove(BpmMessageSendWhenProcessInstanceApproveReqDTO reqDTO) {
|
|
|
|
public void sendMessageWhenProcessInstanceApprove(BpmMessageSendWhenProcessInstanceApproveReqDTO reqDTO) {
|
|
|
|
|
|
|
|
sendNotifyMessage(reqDTO.getProcessInstanceId(), reqDTO.getStartUserId(), "_PASS", null);
|
|
|
|
// 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()));
|
|
|
@ -41,7 +48,8 @@ public class BpmMessageServiceImpl implements BpmMessageService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void sendMessageWhenProcessInstanceReject(BpmMessageSendWhenProcessInstanceRejectReqDTO reqDTO) {
|
|
|
|
public void sendMessageWhenProcessInstanceReject(BpmMessageSendWhenProcessInstanceRejectReqDTO reqDTO, Map<String, Object> variables) {
|
|
|
|
|
|
|
|
sendNotifyMessage(reqDTO.getProcessInstanceId(), reqDTO.getStartUserId(), "_NOPASS",variables);
|
|
|
|
// Map<String, Object> templateParams = new HashMap<>();
|
|
|
|
// Map<String, Object> templateParams = new HashMap<>();
|
|
|
|
// templateParams.put("processInstanceName", reqDTO.getProcessInstanceName());
|
|
|
|
// templateParams.put("processInstanceName", reqDTO.getProcessInstanceName());
|
|
|
|
// templateParams.put("reason", reqDTO.getReason());
|
|
|
|
// templateParams.put("reason", reqDTO.getReason());
|
|
|
@ -52,6 +60,7 @@ public class BpmMessageServiceImpl implements BpmMessageService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void sendMessageWhenTaskAssigned(BpmMessageSendWhenTaskCreatedReqDTO reqDTO) {
|
|
|
|
public void sendMessageWhenTaskAssigned(BpmMessageSendWhenTaskCreatedReqDTO reqDTO) {
|
|
|
|
|
|
|
|
sendNotifyMessage(reqDTO.getProcessInstanceId(), reqDTO.getStartUserId(), "_UNDEAL", null);
|
|
|
|
// Map<String, Object> templateParams = new HashMap<>();
|
|
|
|
// Map<String, Object> templateParams = new HashMap<>();
|
|
|
|
// templateParams.put("processInstanceName", reqDTO.getProcessInstanceName());
|
|
|
|
// templateParams.put("processInstanceName", reqDTO.getProcessInstanceName());
|
|
|
|
// templateParams.put("taskName", reqDTO.getTaskName());
|
|
|
|
// templateParams.put("taskName", reqDTO.getTaskName());
|
|
|
@ -61,6 +70,23 @@ public class BpmMessageServiceImpl implements BpmMessageService {
|
|
|
|
// BpmMessageEnum.TASK_ASSIGNED.getSmsTemplateCode(), templateParams));
|
|
|
|
// BpmMessageEnum.TASK_ASSIGNED.getSmsTemplateCode(), templateParams));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void sendNotifyMessage(String reqDTO, Long reqDTO1, String type, Map<String, Object> variables) {
|
|
|
|
|
|
|
|
if (variables == null) {
|
|
|
|
|
|
|
|
variables = runtimeService.getVariables(reqDTO);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (variables.containsKey("billType")) {
|
|
|
|
|
|
|
|
String billType = variables.get("billType").toString();
|
|
|
|
|
|
|
|
NotifySendSingleToUserReqDTO notifyReq = new NotifySendSingleToUserReqDTO();
|
|
|
|
|
|
|
|
notifyReq.setUserId(reqDTO1);
|
|
|
|
|
|
|
|
notifyReq.setTemplateCode(billType+ type);
|
|
|
|
|
|
|
|
notifyReq.setTemplateParams(variables);
|
|
|
|
|
|
|
|
notifyReq.setBillType(billType);
|
|
|
|
|
|
|
|
notifyReq.setExtraData(variables);
|
|
|
|
|
|
|
|
notifyReq.setJumpFlag("1");
|
|
|
|
|
|
|
|
notifyMessageSendApi.sendSingleMessageToAdmin(notifyReq);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private String getProcessInstanceDetailUrl(String taskId) {
|
|
|
|
private String getProcessInstanceDetailUrl(String taskId) {
|
|
|
|
return webProperties.getAdminUi().getUrl() + "/bpm/process-instance/detail?id=" + taskId;
|
|
|
|
return webProperties.getAdminUi().getUrl() + "/bpm/process-instance/detail?id=" + taskId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|