捕获站内信通知异常

This commit is contained in:
wangliwen 2022-07-07 14:58:09 +08:00
parent 2041c6b558
commit ca667cb116
1 changed files with 41 additions and 33 deletions

View File

@ -44,7 +44,7 @@ import java.util.concurrent.Executors;
@Component
public class ActivitiNoticeAspect {
private static Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm);
private static final ExecutorService executor = Executors.newWorkStealingPool(cpuNUm * 3);
private static Logger logger = LoggerFactory.getLogger(ActivitiNoticeAspect.class);
@Autowired
private SysNoticeService sysNoticeService;
@ -327,6 +327,7 @@ public class ActivitiNoticeAspect {
try {
String finalCreator = creator;
CompletableFuture.runAsync(() -> { // 发起人
try {
SysUserDTO assignee = sysUserService.get(Long.valueOf(delegateTask.getAssignee()));
logger.error("审核人:" + assignee.getId());
String content = "【通知】您发起的流程 " + activitiNoticeOperation.process() + " 当前审核节点为:" + activitiNoticeOperation.value() + ";当前审核人为:\"" + assignee.getDeptName() + "\"审核负责人\"" + assignee.getRealName() + "\"";
@ -344,7 +345,11 @@ public class ActivitiNoticeAspect {
dto.setCreateDate(new Date());
dto.setFrom("通知");
sysNoticeService.save(dto);
} catch (Exception exception) {
logger.error("通知发起人失败", exception);
}
}, executor).thenRunAsync(() -> { // 审批者
try {
SysUserDTO owner = sysUserService.get(Long.valueOf(finalCreator));
String content = "【通知】" + owner.getRealName() + "发起的流程" + activitiNoticeOperation.process() + "已进入审核节点:" + activitiNoticeOperation.value() + ";当前审核人指派为您";
SysNoticeDTO dto = new SysNoticeDTO();
@ -360,6 +365,9 @@ public class ActivitiNoticeAspect {
dto.setCreateDate(new Date());
dto.setFrom("通知");
sysNoticeService.save(dto);
} catch (Exception exception) {
logger.error("通知审批人失败", exception);
}
}, executor);
} catch (Exception e) {
logger.error("发送通知消息异常", e);