应征入伍保留学籍申请表联表操作

This commit is contained in:
2025-11-14 16:48:37 +08:00
parent ce41e10c4a
commit 013eaa5d6d
11 changed files with 426 additions and 169 deletions

View File

@@ -64,10 +64,13 @@ public class ApprovalAssigneeListener implements ExecutionListener {
Long enlistmentId = Long.valueOf(execution.getVariable("enlistmentId").toString());
// 获取审核意见
String approvalOpinion = (String) execution.getVariable("comment");
String approvalOpinion = (String) execution.getVariable("approvalOpinion");
// 获取审核状态
Long approvalResult = (Long) execution.getVariable("approvalResult");
// 4. 后续逻辑不变:查询下一个节点负责人并更新变量
Long nextAssigneeId = getNextAssignee(currentNodeName, processInstanceId, enlistmentId, currentActivityId, approvalOpinion);
Long nextAssigneeId = getNextAssignee(currentNodeName, processInstanceId, enlistmentId, currentActivityId, approvalOpinion, approvalResult);
if (nextAssigneeId != null) {
execution.setVariable("approval", nextAssigneeId);
execution.setVariable("currentNode", currentNodeName);
@@ -92,7 +95,7 @@ public class ApprovalAssigneeListener implements ExecutionListener {
/**
* 根据当前节点查询下一个节点的负责人
*/
private Long getNextAssignee(String currentNodeName, String processInstanceId, Long enlistmentId, String currentActivityId, String approvalOpinion) {
private Long getNextAssignee(String currentNodeName, String processInstanceId, Long enlistmentId, String currentActivityId, String approvalOpinion, Long approvalResult) {
EnlistmentReserveMapper rtEnlistmentReserveMapper = (EnlistmentReserveMapper) SpringUtils.getBean(EnlistmentReserveMapper.class);
// 根据Id查询入伍申请记录
EnlistmentReserve enlistmentReserve = rtEnlistmentReserveMapper.selectRtEnlistmentReserveById(enlistmentId);
@@ -112,7 +115,7 @@ public class ApprovalAssigneeListener implements ExecutionListener {
queryUser.setRoleId(105L); // 学务角色固定ID
List<SysUser> academicAffairsUsers = sysUserService.selectAllocatedList(queryUser);
if (academicAffairsUsers.isEmpty()) {
throw new RuntimeException("未查询到角色ID=105(学务)的用户");
throw new RuntimeException("未查询到角色(学务)的用户");
}
// 从学务用户中筛选出部门ID与当前辅导员部门一致的用户
@@ -122,7 +125,7 @@ public class ApprovalAssigneeListener implements ExecutionListener {
.orElseThrow(() -> new RuntimeException("未找到部门ID=" + currentDeptId + "的学务负责人"));
// 添加审批记录
saveApprovalRecord(enlistmentReserve.getId(), enlistmentReserve.getProcessInstanceId(),currentActivityId,currentNodeName, enlistmentReserve.getStudentName(), enlistmentReserve.getStudentNo(), approvalOpinion);
saveApprovalRecord(enlistmentReserve.getId(), enlistmentReserve.getProcessInstanceId(),currentActivityId,currentNodeName, enlistmentReserve.getStudentName(), enlistmentReserve.getStudentNo(), approvalOpinion, approvalResult);
// 返回匹配的学务用户ID作为下一个节点负责人
return targetAcademic.getUserId();
@@ -140,7 +143,7 @@ public class ApprovalAssigneeListener implements ExecutionListener {
qUser.setRoleId(106L); // 二级学院角色固定ID=106
List<SysUser> collegeUsers = sysUserService.selectAllocatedList(qUser);
if (collegeUsers.isEmpty()) {
throw new RuntimeException("未查询到角色ID=106(二级学院)的用户");
throw new RuntimeException("未查询到角色(二级学院)的用户");
}
// 筛选出部门ID学院ID与登录用户所属学院一致的二级学院负责人
@@ -151,32 +154,48 @@ public class ApprovalAssigneeListener implements ExecutionListener {
// 添加审批记录
saveApprovalRecord(enlistmentReserve.getId(), enlistmentReserve.getProcessInstanceId(),currentActivityId,currentNodeName, enlistmentReserve.getStudentName(), enlistmentReserve.getStudentNo(), approvalOpinion);
saveApprovalRecord(enlistmentReserve.getId(), enlistmentReserve.getProcessInstanceId(),currentActivityId,currentNodeName, enlistmentReserve.getStudentName(), enlistmentReserve.getStudentNo(), approvalOpinion, approvalResult);
// 4. 返回匹配的二级学院负责人ID
// 返回匹配的二级学院负责人ID
return targetCollegeLeader.getUserId();
case "二级学院审批":
// 二级学院通过后 → 下一个节点:学籍管理科假设部门ID=30
// 二级学院通过后 → 下一个节点:学籍管理科
// 获取学籍管理科审核人
List<TeacherVo> shenDataInfo = rtEnlistmentReserveMapper.getShenDataInfo("学籍管理科");
if (shenDataInfo.isEmpty()) {
throw new RuntimeException("未查询到对应的用户");
}
// 添加审批记录
saveApprovalRecord(enlistmentReserve.getId(), enlistmentReserve.getProcessInstanceId(),currentActivityId,currentNodeName, enlistmentReserve.getStudentName(), enlistmentReserve.getStudentNo(), approvalOpinion);
return 30L;
saveApprovalRecord(enlistmentReserve.getId(), enlistmentReserve.getProcessInstanceId(),currentActivityId,currentNodeName, enlistmentReserve.getStudentName(), enlistmentReserve.getStudentNo(), approvalOpinion, approvalResult);
// 暂时选择学籍管理科第一个人作为审核人
return shenDataInfo.get(0).getUserId();
case "学籍管理科审批":
// 学籍管理科通过后 → 下一个节点教务处假设部门ID=40
// 学籍管理科通过后 → 下一个节点:教务处主管领导假设部门ID=40
// 获取学教务处主管领导审核人
List<TeacherVo> teacherVos = rtEnlistmentReserveMapper.getShenDataInfo("教务处主管领导");
if (teacherVos.isEmpty()) {
throw new RuntimeException("未查询到对应的用户");
}
// 添加审批记录
saveApprovalRecord(enlistmentReserve.getId(), enlistmentReserve.getProcessInstanceId(),currentActivityId,currentNodeName, enlistmentReserve.getStudentName(), enlistmentReserve.getStudentNo(), approvalOpinion);
return 40L;
saveApprovalRecord(enlistmentReserve.getId(), enlistmentReserve.getProcessInstanceId(),currentActivityId,currentNodeName, enlistmentReserve.getStudentName(), enlistmentReserve.getStudentNo(), approvalOpinion, approvalResult);
// 暂时选择教务处主管领导第一个人作为审核人
return teacherVos.get(0).getUserId();
case "教务处主管领导审批":
// 最后一个节点通过后 → 流程结束(无需设置负责人)
// 添加审批记录
saveApprovalRecord(enlistmentReserve.getId(), enlistmentReserve.getProcessInstanceId(),currentActivityId,currentNodeName, enlistmentReserve.getStudentName(), enlistmentReserve.getStudentNo(), approvalOpinion);
saveApprovalRecord(enlistmentReserve.getId(), enlistmentReserve.getProcessInstanceId(),currentActivityId,currentNodeName, enlistmentReserve.getStudentName(), enlistmentReserve.getStudentNo(), approvalOpinion, approvalResult);
// 改变申请表中的审核状态(审核通过)
enlistmentReserve.setApplyStatus(2L);
@@ -192,7 +211,7 @@ public class ApprovalAssigneeListener implements ExecutionListener {
/**
* 通用审批记录保存方法
*/
private void saveApprovalRecord(Long ApplyId,String processInstanceId, String taskId, String nodeName, String studentName, String studentNo, String approvalOpinion) {
private void saveApprovalRecord(Long ApplyId,String processInstanceId, String taskId, String nodeName, String studentName, String studentNo, String approvalOpinion, Long approvalResult) {
EnlistmentReserveApproval enlistmentReserveApproval = new EnlistmentReserveApproval();
// 赋值
enlistmentReserveApproval.setApplyId(ApplyId);
@@ -204,10 +223,10 @@ public class ApprovalAssigneeListener implements ExecutionListener {
enlistmentReserveApproval.setApproverName(SecurityUtils.getLoginUser().getUser().getNickName());
// 若变量未传递,直接用默认值“同意”(前端点击同意按钮的默认意见)
enlistmentReserveApproval.setApprovalOpinion(approvalOpinion != null ? approvalOpinion : "同意");
if (approvalOpinion != null) {
enlistmentReserveApproval.setApprovalResult(!approvalOpinion.equals("同意") ? 0L : 1L); // 1-通过,若有驳回场景需根据变量调整
}
enlistmentReserveApproval.setApprovalOpinion(approvalOpinion);
// 审核状态
enlistmentReserveApproval.setApprovalResult(approvalResult == null ? 0L : approvalResult);
// 审批时间:当前系统时间
enlistmentReserveApproval.setApprovalTime(new Date());

View File

@@ -34,6 +34,14 @@ public interface EnlistmentReserveMapper extends BaseMapper<EnlistmentReserve> {
// <!-- 根据学号查询辅导员信息 -->
public TeacherVo getCounselorInfo(String stuNo);
/**
* 获取审批用户信息
* @param roleName
* @return
* 邵政文
*/
List<TeacherVo> getShenDataInfo(String roleName);
/**
* 查询应征入伍保留学籍申请列表
*