休学
This commit is contained in:
		@@ -26,29 +26,34 @@ public class EJXYSJListener implements ExecutionListener {
 | 
			
		||||
        if (userId!=null){
 | 
			
		||||
            delegateExecution.setVariable("approval", userId);
 | 
			
		||||
            // todo 企业微信推送消息
 | 
			
		||||
// --- 企业微信推送消息模块 ---
 | 
			
		||||
            /**
 | 
			
		||||
             * 庞世斌
 | 
			
		||||
             */
 | 
			
		||||
            try {
 | 
			
		||||
                // 步骤 2: 【关键】使用 userId 查询对应的企业微信账号 (userName)
 | 
			
		||||
                // 步骤 2: 使用 userId 查询对应的企业微信账号 (userName)
 | 
			
		||||
                String userName = disciplinaryMapper.getUserNameByUserId(userId);
 | 
			
		||||
 | 
			
		||||
                // 步骤 3: 检查 userName 是否存在
 | 
			
		||||
                // 步骤 3: 检查是否成功获取到 userName
 | 
			
		||||
                if (userName != null && !userName.isEmpty()) {
 | 
			
		||||
                    WeChatUtil weChatUtil = SpringUtils.getBean(WeChatUtil.class);
 | 
			
		||||
 | 
			
		||||
                    // 构造包含超链接的消息内容
 | 
			
		||||
                    String content = "您有一条新的学生违纪审批任务待处理,<a href='http://zhxg.gxsdxy.cn/web/#/pages/Approval/index'>请点击前往处理</a>。";
 | 
			
		||||
                    String content = "您有一条新的学生违纪审批任务待处理," +
 | 
			
		||||
                            "<a href='http://zhxg.gxsdxy.cn/web/#/pages/Approval/index'>请点击前往处理</a>";
 | 
			
		||||
 | 
			
		||||
                    // 步骤 4: 【关键】使用 userName 作为接收人发送消息
 | 
			
		||||
                    // 步骤 4: 使用 userName 作为接收人发送消息
 | 
			
		||||
                    weChatUtil.sendTextMessage(userName, content);
 | 
			
		||||
                    log.info("已成功向二级学院书记(userName:{})发送企业微信审批通知。", userName);
 | 
			
		||||
                    log.info("已成功向学务干事(userName:{})发送企业微信审批通知。", userName);
 | 
			
		||||
 | 
			
		||||
                } else {
 | 
			
		||||
                    // 如果找不到userName,记录警告日志,但流程继续
 | 
			
		||||
                    log.warn("找到了二级学院书记审批人(userId:{}),但其对应的企业微信账号(userName)为空,无法发送通知。", userId);
 | 
			
		||||
                    log.warn("找到了审批人(userId:{}),但其对应的企业微信账号(userName)为空,无法发送通知。", userId);
 | 
			
		||||
                }
 | 
			
		||||
            } catch (Exception e) {
 | 
			
		||||
                // 保证即使通知失败,流程也能继续
 | 
			
		||||
                log.error("向二级学院书记(userId:{})发送企业微信通知时出现异常。流程将继续。错误详情: {}", userId, e.getMessage(), e);
 | 
			
		||||
                // 捕获所有异常,仅记录日志,确保主流程不受影响
 | 
			
		||||
                log.error("向学务干事(userId:{})发送企业微信通知时出现异常,但流程将继续。错误详情: {}", userId, e.getMessage(), e);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        }else{
 | 
			
		||||
            throw new RuntimeException("该二级学院书记审批人未配置");
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user