From 7fa9a3706373a8a4d676f39cb4041496468790f0 Mon Sep 17 00:00:00 2001 From: weishengyou <2454197255@qq.com> Date: Thu, 2 Apr 2026 12:43:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(flowable):=20=E6=B7=BB=E5=8A=A0=E7=A9=BA?= =?UTF-8?q?=E5=80=BC=E6=A3=80=E6=9F=A5=E9=81=BF=E5=85=8D=E7=A9=BA=E6=8C=87?= =?UTF-8?q?=E9=92=88=E5=BC=82=E5=B8=B8=20=E5=9C=A8LeadStartListener?= =?UTF-8?q?=E5=92=8CBoStartListener=E4=B8=AD=E6=B7=BB=E5=8A=A0=E5=AF=B9?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=BB=93=E6=9E=9C=E7=9A=84=E7=A9=BA=E5=80=BC?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=EF=BC=8C=E9=98=B2=E6=AD=A2=E5=BD=93=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E7=BB=93=E6=9E=9C=E4=B8=BA=E7=A9=BA=E6=97=B6=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E7=A9=BA=E6=8C=87=E9=92=88=E5=BC=82=E5=B8=B8=E3=80=82?= =?UTF-8?q?=E5=90=8C=E6=97=B6=E6=B7=BB=E5=8A=A0=E7=9B=B8=E5=BA=94=E7=9A=84?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=AD=A6=E5=91=8A=E4=BF=A1=E6=81=AF=EF=BC=8C?= =?UTF-8?q?=E4=BE=BF=E4=BA=8E=E9=97=AE=E9=A2=98=E6=8E=92=E6=9F=A5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flowable/listener/BoStartListener.java | 19 ++++++++++++++----- .../flowable/listener/LeadStartListener.java | 4 ++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/srs-flowable/src/main/java/com/srs/flowable/listener/BoStartListener.java b/srs-flowable/src/main/java/com/srs/flowable/listener/BoStartListener.java index 667fc7b..b48c781 100644 --- a/srs-flowable/src/main/java/com/srs/flowable/listener/BoStartListener.java +++ b/srs-flowable/src/main/java/com/srs/flowable/listener/BoStartListener.java @@ -40,6 +40,9 @@ public class BoStartListener implements ExecutionListener { // 获取校领导信息 String roleKey = "xldsp"; //角色key List lingDataInfo = leaveMapper.getShenDataInfo(roleKey); + if (lingDataInfo == null || lingDataInfo.isEmpty()) { + log.warn("未找到校领导(roleKey={})信息,跳过学工领导通知。", roleKey); + } // 设置流程变量 //delegateExecution.setVariable("approval", secondaryLeaderInfo.getUserId()); @@ -52,8 +55,10 @@ public class BoStartListener implements ExecutionListener { // 步骤 3: 检查是否成功获取到 userName //向系统发送通知 NotificationManage notificationManage = new NotificationManage(); - notificationManage.setContent("您有一条【学工领导已提交请假申请审批】需待处理"); // 消息内容 - notificationManage.setReceiver(lingDataInfo.get(0).getUserId()); + if (lingDataInfo != null && !lingDataInfo.isEmpty()) { + notificationManage.setContent("您有一条【学工领导已提交请假申请审批】需待处理"); // 消息内容 + notificationManage.setReceiver(lingDataInfo.get(0).getUserId()); + } NotificationManage userManage = leaveMapper.selectCphMsgListForFlowable(notificationManage); if (userManage != null) { //删除指定通知信息 @@ -62,9 +67,13 @@ public class BoStartListener implements ExecutionListener { //向学工领导添加通知信息 // 获取二级学院书记信息 List secondaryLeaderInfo = leaveMapper.getSecondaryLeaderInfo(deptId); - //由于这里查到了多个数据,由于时间原因,暂时还没有研究到工作流中多用户节点的同时进行(所以取了第一条数据用于发消息) - notificationManage.setContent("您有一条【二级学院书记已提交请假申请审批】需待处理"); // 消息内容 - notificationManage.setSender(secondaryLeaderInfo.get(0).getUserId()); // 发送方 + if (secondaryLeaderInfo == null || secondaryLeaderInfo.isEmpty()) { + log.warn("未找到二级学院书记信息,deptId={},跳过通知。", deptId); + } else { + //由于这里查到了多个数据,由于时间原因,暂时还没有研究到工作流中多用户节点的同时进行(所以取了第一条数据用于发消息) + notificationManage.setContent("您有一条【二级学院书记已提交请假申请审批】需待处理"); // 消息内容 + notificationManage.setSender(secondaryLeaderInfo.get(0).getUserId()); // 发送方 + } notificationManage.setReceiver(Long.parseLong(approval)); // 接收方 NotificationManage userManages = leaveMapper.selectCphMsgListForFlowable(notificationManage); if (userManages == null) { diff --git a/srs-flowable/src/main/java/com/srs/flowable/listener/LeadStartListener.java b/srs-flowable/src/main/java/com/srs/flowable/listener/LeadStartListener.java index 6ef63ef..ed85abe 100644 --- a/srs-flowable/src/main/java/com/srs/flowable/listener/LeadStartListener.java +++ b/srs-flowable/src/main/java/com/srs/flowable/listener/LeadStartListener.java @@ -42,6 +42,10 @@ public class LeadStartListener implements ExecutionListener { // 获取学工信息 //TeacherVo updateDeptId = leaveMapper.getUpdateDeptId(approval); List updateDeptIdInfo = leaveMapper.getUpdateDeptIdInfo(1045L); + if (updateDeptIdInfo == null || updateDeptIdInfo.isEmpty()) { + log.warn("未找到学工领导信息,跳过审批人设置与通知。"); + return; + } // 设置流程变量 delegateExecution.setVariable("approval", updateDeptIdInfo.get(0).getUserId());