综合素质-综合素质申请审核代办和学生奖惩-先进班集体

This commit is contained in:
2025-08-26 11:39:52 +08:00
parent fb9f09c523
commit c69f628bbc
2 changed files with 66 additions and 3 deletions

View File

@@ -3,13 +3,22 @@ package com.srs.flowable.listener.disciplinary;
import com.srs.common.utils.WeChatUtil;
import com.srs.common.utils.spring.SpringUtils;
import com.srs.flowable.mapper.DisciplinaryMapper;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
@Slf4j
public class XGLDSHListener implements ExecutionListener {
@Autowired
private WeChatUtil weChatUtil;
@Override
public void notify(DelegateExecution delegateExecution) {
DisciplinaryMapper disciplinaryMapper = SpringUtils.getBean(DisciplinaryMapper.class);
@@ -38,14 +47,14 @@ public class XGLDSHListener implements ExecutionListener {
// 步骤 3: 发送企业微信通知
weChatUtil.sendTextMessage(toUser, content);
// log.info("已成功向角色 '{}' 的成员发送企业微信审批通知。接收人: {}", TARGET_ROLE_KEY, toUser);
log.info("已成功向角色 '{}' 的成员发送企业微信审批通知。接收人: {}", TARGET_ROLE_KEY, toUser);
} else {
// log.warn("角色 '{}' 下找到 {} 个用户,但无对应的企业微信账号,无法发送通知。", TARGET_ROLE_KEY, userIdList.size());
log.warn("角色 '{}' 下找到 {} 个用户,但无对应的企业微信账号,无法发送通知。", TARGET_ROLE_KEY, userIdList.size());
}
} catch (Exception e) {
// log.error("向角色 '{}' 发送企业微信通知时出现异常,但流程将继续。错误详情: {}", TARGET_ROLE_KEY, e.getMessage(), e);
log.error("向角色 '{}' 发送企业微信通知时出现异常,但流程将继续。错误详情: {}", TARGET_ROLE_KEY, e.getMessage(), e);
}
}
}

View File

@@ -0,0 +1,54 @@
package com.srs.flowable.listener.relieve;
import com.srs.common.utils.WeChatUtil;
import com.srs.common.utils.spring.SpringUtils;
import com.srs.flowable.mapper.RelieveMapper;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener;
import org.springframework.stereotype.Component;
/**庞世斌
*
* 根据审批结果给学生发送企业微信通知
*/
@Component
@Slf4j
public class StuReceiveListener implements ExecutionListener {
@Override
public void notify(DelegateExecution delegateExecution) {
RelieveMapper relieveMapper = (RelieveMapper) SpringUtils.getBean("relieveMapper");
try {
// 从流程变量中获取学生 userId之前在发给辅导员时已经存入
Long stuUserId = Long.valueOf(delegateExecution.getVariable("stuUserId").toString());
// 使用 userId 查询对应的企业微信账号
String stuUserName = relieveMapper.getUserNameByUserId(stuUserId);
if (stuUserName != null && !stuUserName.isEmpty()) {
WeChatUtil weChatUtil = SpringUtils.getBean(WeChatUtil.class);
// 根据流程结果拼接不同的提示信息
String approveResult = delegateExecution.getVariable("approveResult") != null
? delegateExecution.getVariable("approveResult").toString()
: "审批已完成";
String content = "您的违纪处理流程有新的进展:" +
approveResult + "" +
"<a href='http://zhxg.gxsdxy.cn/web/#/pages/Approval/index'>点此查看详情</a>";
// 发送企业微信消息
weChatUtil.sendTextMessage(stuUserName, content);
log.info("✅ 已成功向学生(userName:{})发送企业微信审批通知。", stuUserName);
} else {
log.warn("⚠ 找到了学生(stuUserId:{}), 但其对应的企业微信账号为空,无法发送通知。", stuUserId);
}
} catch (Exception e) {
Long stuUserId = Long.valueOf(delegateExecution.getVariable("stuUserId").toString());
log.error("❌ 向学生(stuUserId:{})发送企业微信通知时出现异常,但流程将继续。错误详情:", stuUserId, e);
}
}
}