From c0c2d095eb1ce9e10c522cfbf6625391435c44d2 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Tue, 24 Sep 2024 15:53:36 +0800 Subject: [PATCH] =?UTF-8?q?modify:=201.=20=E4=BB=BB=E5=8A=A1=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E7=9B=91=E5=90=AC;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../listener/UserTaskCreateOrFinishListener.java | 48 ++++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/UserTaskCreateOrFinishListener.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/UserTaskCreateOrFinishListener.java index d1b9b3a..e54f5ba 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/UserTaskCreateOrFinishListener.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/UserTaskCreateOrFinishListener.java @@ -24,6 +24,7 @@ import com.hz.pm.api.user.security.model.UserFullInfoDTO; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.util.CollUtils; import com.wflow.bean.entity.WflowModelHistorys; +import com.wflow.workflow.enums.ProcessHandlerEnum; import com.wflow.workflow.notify.event.NodeCompleteEvent; import com.wflow.workflow.notify.event.NodeCreateEvent; import com.wflow.workflow.service.ProcessModelHistorysService; @@ -124,12 +125,14 @@ public class UserTaskCreateOrFinishListener { paramObj.setProjectId(purchaseInst.getProjectId()); } String projectName = ""; + String buildOrgName = ""; // 上边查不到ID的时候说明是手动新增的信创项目 if (paramObj.getBidId() == null) { XinchuangInst xinchuangInst = xinchuangInstService.getByInstCode(procInstId); if (xinchuangInst != null) { Xinchuang xinchuang = xinchuangService.getById(xinchuangInst.getXinchuangId()); paramObj.setXinchuangId(xinchuang.getId()); + buildOrgName = xinchuang.getBuildOrgName(); projectName = xinchuang.getProjectName(); } else { ProjectInst projectInst = projectInstService.getByInstCode(procInstId); @@ -141,16 +144,20 @@ public class UserTaskCreateOrFinishListener { } if (paramObj.getProjectId() != null) { Project project = projectService.getNewProject(paramObj.getProjectId()); + buildOrgName = project.getBuildOrgName(); projectName = project.getProjectName(); paramObj.setProjectId(project.getId()); paramObj.setProjectCode(project.getProjectCode()); } - String content = String.format("【%s】的【%s】需要您审核,请及时处理。", projectName, procType.getDesc()); - mhTodoClient.addTodo(paramObj, assignee, todoType, task.getId(), content); + String mhContent = String.format("收到来自%s提交的【%s】的%s,请尽快审批!", + buildOrgName, projectName, getProcessTypeName(procType)); + mhTodoClient.addTodo(paramObj, assignee, todoType, task.getId(), mhContent); // 发送浙政钉工作通知 if (assignee.getAccountId() != null) { + String zzdContent = String.format("收到来自%s提交的【%s】的%s,请尽快登录杭州数字信创平台审批!", + buildOrgName, projectName, getProcessTypeName(procType)); MhZwddWorkNoticeDTO notice = MhZwddWorkNoticeDTO.builder() - .content(content) + .content(zzdContent) .title(todoType.getVal()) .targetUser(assignee.getMhUserId()) .build(); @@ -162,6 +169,10 @@ public class UserTaskCreateOrFinishListener { } } + private static String getProcessTypeName(ProjectProcessType processType) { + return StrUtil.appendIfMissing(StrUtil.removeSuffix(processType.getDesc(), "流程"), "审批"); + } + public void handleEvent(NodeCompleteEvent event) { String procDefId = event.getProcessDefinitionId(); WflowModelHistorys models = processModelHistorysService.getByProcessDefId(procDefId); @@ -192,6 +203,37 @@ public class UserTaskCreateOrFinishListener { } else { mhTodoClient.completeTodo(todoType, task.getId()); } + if (!event.getAction().equals(ProcessHandlerEnum.PASS) + && !event.getAction().equals(ProcessHandlerEnum.SEAL_PASS)) { + String projectName; + Long createBy; + ProjectInst projectInst = projectInstService.getByInstCode(event.getInstCode()); + if (projectInst != null) { + Project project = projectService.getNewestNoNull(projectInst.getProjectId()); + projectName = project.getProjectName(); + createBy = project.getCreateBy(); + } else { + XinchuangInst xinchuangInst = xinchuangInstService.getByInstCode(event.getInstCode()); + if (xinchuangInst == null) { + return; + } + Xinchuang xinchuang = xinchuangService.getById(xinchuangInst.getXinchuangId()); + projectName = xinchuang.getProjectName(); + createBy = Long.parseLong(xinchuang.getCreateBy()); + } + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(createBy); + if (userFullInfo == null || StrUtil.isBlank(userFullInfo.getMhUserId())) { + return; + } + String zzdContent = String.format("您单位的【%s】的%s已被驳回,请按时完成提交!", + projectName, getProcessTypeName(procType)); + MhZwddWorkNoticeDTO notice = MhZwddWorkNoticeDTO.builder() + .content(zzdContent) + .title(todoType.getVal()) + .targetUser(userFullInfo.getMhUserId()) + .build(); + mhApiClient.sendZwddWorkNotice(notice); + } break; default: break;