审核人也接受消息通知

This commit is contained in:
wangliwen 2022-05-30 18:12:34 +08:00
parent c4e2427668
commit 10b9bf8906
1 changed files with 37 additions and 23 deletions

View File

@ -91,29 +91,43 @@ public class ActivitiNoticeAspect {
} }
try { try {
String finalCreator = creator; String finalCreator = creator;
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> { // 发起人
SysNoticeDTO dto = new SysNoticeDTO(); SysNoticeDTO dto = new SysNoticeDTO();
dto.setType(2); dto.setType(2);
dto.setTitle("流程流转系统通知"); dto.setTitle("流程流转系统通知");
dto.setContent("您发起的流程当前审核节点为:" + activitiNoticeOperation.value() + "<br>当前审核人为" + sysUserService.get(Long.valueOf(delegateTask.getAssignee())).getRealName()); // 通知内容 dto.setContent("您发起的流程当前审核节点为:" + activitiNoticeOperation.value() + "<br>当前审核人为" + sysUserService.get(Long.valueOf(delegateTask.getAssignee())).getRealName()); // 通知内容
dto.setReceiverType(1); dto.setReceiverType(1);
dto.setReceiverTypeIds(finalCreator); dto.setReceiverTypeIds(finalCreator);
dto.setStatus(NoticeStatusEnum.SEND.value()); dto.setStatus(NoticeStatusEnum.SEND.value());
dto.setSenderName("流程系统"); dto.setSenderName("流程系统");
dto.setSenderDate(new Date()); dto.setSenderDate(new Date());
dto.setCreator(sysUserService.getByUsername("admin").getId()); dto.setCreator(sysUserService.getByUsername("admin").getId());
dto.setCreateDate(new Date()); dto.setCreateDate(new Date());
sysNoticeService.save(dto); sysNoticeService.save(dto);
}).thenRunAsync(() -> { }).thenRunAsync(() -> { // 审批者
new Thread(() -> { SysNoticeDTO dto = new SysNoticeDTO();
try { dto.setType(2);
Thread.sleep(200); dto.setTitle("流程流转系统通知");
} catch (InterruptedException e) { dto.setContent(sysUserService.get(Long.valueOf(finalCreator)).getRealName() + "发起的流程当前审核节点为:" + activitiNoticeOperation.value() + "<br>当前审核人指派为您"); // 通知内容
throw new RuntimeException(e); dto.setReceiverType(1);
} dto.setReceiverTypeIds(delegateTask.getAssignee());
work_.remove(kv.get("id").toString()); dto.setStatus(NoticeStatusEnum.SEND.value());
}).start(); dto.setSenderName("流程系统");
}); dto.setSenderDate(new Date());
dto.setCreator(sysUserService.getByUsername("admin").getId());
dto.setCreateDate(new Date());
sysNoticeService.save(dto);
})
.thenRunAsync(() -> {
new Thread(() -> {
try {
Thread.sleep(200);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
work_.remove(kv.get("id").toString());
}).start();
});
} catch (Exception e) { } catch (Exception e) {
logger.error("发送通知消息异常", e); logger.error("发送通知消息异常", e);
} }