feat: 待办消息发送及删除

new
chenqp 1 year ago
parent ed5317ee6f
commit 637dd2f5a2

@ -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<String, Object> templateParams = new HashMap<>();
// templateParams.put("processInstanceName", reqDTO.getProcessInstanceName());
// templateParams.put("taskName", reqDTO.getTaskName());

@ -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<BpmTaskTodoPageItemRespVO> 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<String, Object> 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

Loading…
Cancel
Save