From 425f6d30a612d1a433fdbcedaf832729f9e13c57 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Tue, 31 May 2022 10:20:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=99=E5=86=85=E4=BF=A1=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../annotation/ActivitiNoticeOperation.java | 9 ++- .../common/aspect/ActivitiNoticeAspect.java | 79 ++++++++++--------- .../listener/DemandDataListener.java | 2 +- .../listener/CorrectionListener.java | 2 +- .../listener/DataCenterListener.java | 2 +- .../ResourceUndercarriageListener.java | 2 +- .../listener/ResourceOwnerListener.java | 2 +- 7 files changed, 56 insertions(+), 42 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/common/annotation/ActivitiNoticeOperation.java b/renren-admin/src/main/java/io/renren/common/annotation/ActivitiNoticeOperation.java index fb11aff0..b4a0a2c1 100644 --- a/renren-admin/src/main/java/io/renren/common/annotation/ActivitiNoticeOperation.java +++ b/renren-admin/src/main/java/io/renren/common/annotation/ActivitiNoticeOperation.java @@ -13,9 +13,16 @@ import java.lang.annotation.*; public @interface ActivitiNoticeOperation { /** - * 流程名称 + * 节点名称 * * @return */ String value() default ""; + + /** + * 流程名称 + * + * @return + */ + String process() default ""; } diff --git a/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java b/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java index 35b920ad..5cab0772 100644 --- a/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java +++ b/renren-admin/src/main/java/io/renren/common/aspect/ActivitiNoticeAspect.java @@ -5,6 +5,7 @@ import io.renren.common.annotation.ActivitiNoticeOperation; import io.renren.modules.notice.dto.SysNoticeDTO; import io.renren.modules.notice.enums.NoticeStatusEnum; import io.renren.modules.notice.service.SysNoticeService; +import io.renren.modules.sys.dto.SysUserDTO; import io.renren.modules.sys.service.SysUserService; import org.activiti.engine.delegate.DelegateTask; import org.activiti.engine.delegate.TaskListener; @@ -92,42 +93,48 @@ public class ActivitiNoticeAspect { try { String finalCreator = creator; CompletableFuture.runAsync(() -> { // 发起人 - SysNoticeDTO dto = new SysNoticeDTO(); - dto.setType(2); - dto.setTitle("流程流转系统通知"); - dto.setContent("您发起的流程当前审核节点为:" + activitiNoticeOperation.value() + "
当前审核人为" + sysUserService.get(Long.valueOf(delegateTask.getAssignee())).getRealName()); // 通知内容 - dto.setReceiverType(1); - dto.setReceiverTypeIds(finalCreator); - dto.setStatus(NoticeStatusEnum.SEND.value()); - dto.setSenderName("流程系统"); - dto.setSenderDate(new Date()); - dto.setCreator(sysUserService.getByUsername("admin").getId()); - dto.setCreateDate(new Date()); - sysNoticeService.save(dto); - }).thenRunAsync(() -> { // 审批者 - SysNoticeDTO dto = new SysNoticeDTO(); - dto.setType(2); - dto.setTitle("流程流转系统通知"); - dto.setContent(sysUserService.get(Long.valueOf(finalCreator)).getRealName() + "发起的流程当前审核节点为:" + activitiNoticeOperation.value() + "
当前审核人指派为您"); // 通知内容 - dto.setReceiverType(1); - dto.setReceiverTypeIds(delegateTask.getAssignee()); - dto.setStatus(NoticeStatusEnum.SEND.value()); - 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(); - }); + SysUserDTO assignee = sysUserService.get(Long.valueOf(delegateTask.getAssignee())); + String content = "您发起的流程<" + activitiNoticeOperation.process() + ">当前审核节点为:" + + activitiNoticeOperation.value() + + "
当前审核人为\"" + + assignee.getDeptName() + "\"审核负责人\"" + assignee.getRealName(); + SysNoticeDTO dto = new SysNoticeDTO(); + dto.setType(2); + dto.setTitle("流程流转系统通知"); + dto.setContent(content); // 通知内容 + dto.setReceiverType(1); + dto.setReceiverTypeIds(finalCreator); + dto.setStatus(NoticeStatusEnum.SEND.value()); + dto.setSenderName("流程系统"); + dto.setSenderDate(new Date()); + dto.setCreator(sysUserService.getByUsername("admin").getId()); + dto.setCreateDate(new Date()); + sysNoticeService.save(dto); + }).thenRunAsync(() -> { // 审批者 + SysUserDTO owner = sysUserService.get(Long.valueOf(finalCreator)); + String content = owner.getRealName() + "发起的流程<" + activitiNoticeOperation.process() + ">当前审核节点为:" + activitiNoticeOperation.value() + "
当前审核人指派为您"; + SysNoticeDTO dto = new SysNoticeDTO(); + dto.setType(2); + dto.setTitle("流程流转系统通知"); + dto.setContent(content); // 通知内容 + dto.setReceiverType(1); + dto.setReceiverTypeIds(delegateTask.getAssignee()); + dto.setStatus(NoticeStatusEnum.SEND.value()); + 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); + work_.remove(kv.get("id").toString()); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + }).start(); + }); } catch (Exception e) { logger.error("发送通知消息异常", e); } diff --git a/renren-admin/src/main/java/io/renren/modules/demanData/listener/DemandDataListener.java b/renren-admin/src/main/java/io/renren/modules/demanData/listener/DemandDataListener.java index ce83dc96..f68f5f90 100644 --- a/renren-admin/src/main/java/io/renren/modules/demanData/listener/DemandDataListener.java +++ b/renren-admin/src/main/java/io/renren/modules/demanData/listener/DemandDataListener.java @@ -76,7 +76,7 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti } @Override - @ActivitiNoticeOperation("需求部门审批") + @ActivitiNoticeOperation(value = "需求部门审批", process = "能力需求申请") public void notify(DelegateTask delegateTask) { logger.error("----------------------进入能力需求受理者1节点---------------------------"); logger.error("事件类型:" + delegateTask.getEventName()); diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java b/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java index 3103dd8d..aebfc761 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/listener/CorrectionListener.java @@ -67,7 +67,7 @@ public class CorrectionListener implements TaskListener, ExecutionListener, Acti private TAbilityApplicationService tAbilityApplicationService; @Override - @ActivitiNoticeOperation("资源部门负责人审批") + @ActivitiNoticeOperation(value = "资源部门负责人审批", process = "能力申请流程") public void notify(DelegateTask delegateTask) { logger.error("-------------------------进入部门动态审批人流程-------------------------------"); final String eventName = delegateTask.getEventName(); diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/listener/DataCenterListener.java b/renren-admin/src/main/java/io/renren/modules/processForm/listener/DataCenterListener.java index 89e5a4ab..79c6ccac 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/listener/DataCenterListener.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/listener/DataCenterListener.java @@ -66,7 +66,7 @@ public class DataCenterListener implements TaskListener, ExecutionListener, Acti } @Override - @ActivitiNoticeOperation("大数据局负责人审批") + @ActivitiNoticeOperation(value = "大数据局负责人审批", process = "能力申请流程") public void notify(DelegateTask delegateTask) { logger.error("事件类型:" + delegateTask.getEventName()); final String eventName = delegateTask.getEventName(); diff --git a/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java b/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java index a86b29e2..514a3cec 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/listener/ResourceUndercarriageListener.java @@ -55,7 +55,7 @@ public class ResourceUndercarriageListener implements TaskListener, ExecutionLis private ResourceService resourceService; @Override - @ActivitiNoticeOperation("资源下线前资源所属部门审批人审批") + @ActivitiNoticeOperation(value = "资源下线前资源所属部门审批人审批", process = "能力资源下架") public void notify(DelegateTask delegateTask) { logger.error("----------------------进入资源所有者节点---------------------------"); logger.error("事件类型:" + delegateTask.getEventName()); diff --git a/renren-admin/src/main/java/io/renren/modules/resourceMountApply/listener/ResourceOwnerListener.java b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/listener/ResourceOwnerListener.java index 3db084bc..b8c6d7f3 100644 --- a/renren-admin/src/main/java/io/renren/modules/resourceMountApply/listener/ResourceOwnerListener.java +++ b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/listener/ResourceOwnerListener.java @@ -75,7 +75,7 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A } @Override - @ActivitiNoticeOperation("资源所属部门审批人审批") + @ActivitiNoticeOperation(value = "资源所属部门审批人审批", process = "能力资源上架") public void notify(DelegateTask delegateTask) { logger.error("----------------------进入资源所有者节点---------------------------"); logger.error("事件类型:" + delegateTask.getEventName());