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

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);
/**
* 查询应征入伍保留学籍申请列表
*

View File

@@ -1,69 +1,98 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.srs.flowable.mapper.EnlistmentReserveMapper">
<resultMap type="EnlistmentReserve" id="RtEnlistmentReserveResult">
<result property="id" column="id" />
<result property="applyNo" column="apply_no" />
<result property="studentId" column="student_id" />
<result property="teacherName" column="teacher_name" />
<result property="studentName" column="student_name" />
<result property="gender" column="gender" />
<result property="nation" column="nation" />
<result property="grade" column="grade" />
<result property="studentNo" column="student_no" />
<result property="className" column="class_name" />
<result property="major" column="major" />
<result property="familyAddress" column="family_address" />
<result property="parentPhone" column="parent_phone" />
<result property="applyReason" column="apply_reason" />
<result property="applyStatus" column="apply_status" />
<result property="processInstanceId" column="process_instance_id" />
<result property="reserveNo" column="reserve_no" />
<result property="reserveStartDate" column="reserve_start_date" />
<result property="reserveEndDate" column="reserve_end_date" />
<result property="approvalNo" column="approval_no" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="id" column="id"/>
<result property="applyNo" column="apply_no"/>
<result property="studentId" column="student_id"/>
<result property="teacherName" column="teacher_name"/>
<result property="studentName" column="student_name"/>
<result property="gender" column="gender"/>
<result property="nation" column="nation"/>
<result property="grade" column="grade"/>
<result property="studentNo" column="student_no"/>
<result property="className" column="class_name"/>
<result property="major" column="major"/>
<result property="familyAddress" column="family_address"/>
<result property="parentPhone" column="parent_phone"/>
<result property="applyReason" column="apply_reason"/>
<result property="applyStatus" column="apply_status"/>
<result property="processInstanceId" column="process_instance_id"/>
<result property="reserveNo" column="reserve_no"/>
<result property="reserveStartDate" column="reserve_start_date"/>
<result property="reserveEndDate" column="reserve_end_date"/>
<result property="approvalNo" column="approval_no"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectRtEnlistmentReserveVo">
select id, apply_no, student_id, teacher_name, student_name, gender, nation, grade, student_no, class_name, major, family_address, parent_phone, apply_reason, apply_status, process_instance_id, reserve_no, reserve_start_date, reserve_end_date, approval_no, create_time, update_time from rt_enlistment_reserve
select id,
apply_no,
student_id,
teacher_name,
student_name,
gender,
nation,
grade,
student_no,
class_name,
major,
family_address,
parent_phone,
apply_reason,
apply_status,
process_instance_id,
reserve_no,
reserve_start_date,
reserve_end_date,
approval_no,
create_time,
update_time
from rt_enlistment_reserve
</sql>
<select id="selectRtEnlistmentReserveList" parameterType="EnlistmentReserve" resultMap="RtEnlistmentReserveResult">
<include refid="selectRtEnlistmentReserveVo"/>
<where>
<if test="applyNo != null and applyNo != ''"> and apply_no = #{applyNo}</if>
<if test="studentId != null "> and student_id = #{studentId}</if>
<if test="teacherName != null and teacherName != ''"> and teacher_name like concat('%', #{teacherName}, '%')</if>
<if test="studentName != null and studentName != ''"> and student_name like concat('%', #{studentName}, '%')</if>
<if test="gender != null and gender != ''"> and gender = #{gender}</if>
<if test="nation != null and nation != ''"> and nation = #{nation}</if>
<if test="grade != null and grade != ''"> and grade = #{grade}</if>
<if test="studentNo != null and studentNo != ''"> and student_no = #{studentNo}</if>
<if test="className != null and className != ''"> and class_name like concat('%', #{className}, '%')</if>
<if test="major != null and major != ''"> and major = #{major}</if>
<if test="familyAddress != null and familyAddress != ''"> and family_address = #{familyAddress}</if>
<if test="parentPhone != null and parentPhone != ''"> and parent_phone = #{parentPhone}</if>
<if test="applyReason != null and applyReason != ''"> and apply_reason = #{applyReason}</if>
<if test="applyStatus != null "> and apply_status = #{applyStatus}</if>
<if test="processInstanceId != null and processInstanceId != ''"> and process_instance_id = #{processInstanceId}</if>
<if test="reserveNo != null and reserveNo != ''"> and reserve_no = #{reserveNo}</if>
<if test="reserveStartDate != null "> and reserve_start_date = #{reserveStartDate}</if>
<if test="reserveEndDate != null "> and reserve_end_date = #{reserveEndDate}</if>
<if test="approvalNo != null and approvalNo != ''"> and approval_no = #{approvalNo}</if>
<if test="applyNo != null and applyNo != ''">and apply_no = #{applyNo}</if>
<if test="studentId != null ">and student_id = #{studentId}</if>
<if test="teacherName != null and teacherName != ''">and teacher_name like concat('%', #{teacherName},
'%')
</if>
<if test="studentName != null and studentName != ''">and student_name like concat('%', #{studentName},
'%')
</if>
<if test="gender != null and gender != ''">and gender = #{gender}</if>
<if test="nation != null and nation != ''">and nation = #{nation}</if>
<if test="grade != null and grade != ''">and grade = #{grade}</if>
<if test="studentNo != null and studentNo != ''">and student_no = #{studentNo}</if>
<if test="className != null and className != ''">and class_name like concat('%', #{className}, '%')</if>
<if test="major != null and major != ''">and major = #{major}</if>
<if test="familyAddress != null and familyAddress != ''">and family_address = #{familyAddress}</if>
<if test="parentPhone != null and parentPhone != ''">and parent_phone = #{parentPhone}</if>
<if test="applyReason != null and applyReason != ''">and apply_reason = #{applyReason}</if>
<if test="applyStatus != null ">and apply_status = #{applyStatus}</if>
<if test="processInstanceId != null and processInstanceId != ''">and process_instance_id =
#{processInstanceId}
</if>
<if test="reserveNo != null and reserveNo != ''">and reserve_no = #{reserveNo}</if>
<if test="reserveStartDate != null ">and reserve_start_date = #{reserveStartDate}</if>
<if test="reserveEndDate != null ">and reserve_end_date = #{reserveEndDate}</if>
<if test="approvalNo != null and approvalNo != ''">and approval_no = #{approvalNo}</if>
</where>
</select>
<select id="selectRtEnlistmentReserveById" parameterType="Long" resultMap="RtEnlistmentReserveResult">
<include refid="selectRtEnlistmentReserveVo"/>
where id = #{id}
</select>
<select id="selectRtEnlistmentReserveByProcessInstanceId" parameterType="String" resultMap="RtEnlistmentReserveResult">
<select id="selectRtEnlistmentReserveByProcessInstanceId" parameterType="String"
resultMap="RtEnlistmentReserveResult">
<include refid="selectRtEnlistmentReserveVo"/>
where process_instance_id = #{processInstanceId}
</select>
@@ -78,6 +107,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE a.stu_no = #{stuNo}
</select>
<!-- 获取审批用户信息 -->
<select id="getShenDataInfo" resultType="com.srs.common.doman.vo.TeacherVo">
SELECT a.user_id userId, a.dept_id deptId, a.nick_name userNick, a.user_name userName
FROM sys_user a
LEFT JOIN sys_user_role b ON a.user_id = b.user_id
LEFT JOIN sys_role c ON b.role_id = c.role_id
WHERE c.role_name = #{roleName}
</select>
<insert id="insertRtEnlistmentReserve" parameterType="RtEnlistmentReserve" useGeneratedKeys="true" keyProperty="id">
insert into rt_enlistment_reserve
<trim prefix="(" suffix=")" suffixOverrides=",">
@@ -157,7 +195,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteRtEnlistmentReserveById" parameterType="Long">
delete from rt_enlistment_reserve where id = #{id}
delete
from rt_enlistment_reserve
where id = #{id}
</delete>
<delete id="deleteRtEnlistmentReserveByIds" parameterType="String">