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());