外宿申请-监听器优化(流程找不到对应学院的负责人则选择对应角色的第一个作为负责人)
This commit is contained in:
@@ -15,7 +15,7 @@ import com.srs.common.core.domain.BaseEntity;
|
|||||||
* 外宿申请对象 dms_outside_accommodation_apply
|
* 外宿申请对象 dms_outside_accommodation_apply
|
||||||
*
|
*
|
||||||
* @author srs
|
* @author srs
|
||||||
* @date 2025-12-06
|
* @date 2025-12-09
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@@ -349,5 +349,13 @@ public class DmsOutsideAccommodationApply extends BaseEntity {
|
|||||||
@Excel(name = "外宿原因学生签名URL")
|
@Excel(name = "外宿原因学生签名URL")
|
||||||
private String studentSignature;
|
private String studentSignature;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 承诺内容
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("承诺内容")
|
||||||
|
@TableField("promise_content")
|
||||||
|
@Excel(name = "承诺内容")
|
||||||
|
private String promiseContent;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@
|
|||||||
<result property="idCard" column="idCard"/>
|
<result property="idCard" column="idCard"/>
|
||||||
<result property="studentPhone" column="studentPhone"/>
|
<result property="studentPhone" column="studentPhone"/>
|
||||||
<result property="studentSignature" column="student_signature"/>
|
<result property="studentSignature" column="student_signature"/>
|
||||||
|
<result property="promiseContent" column="promise_content" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectDmsOutsideAccommodationApplyVo">
|
<sql id="selectDmsOutsideAccommodationApplyVo">
|
||||||
@@ -95,7 +96,8 @@
|
|||||||
process_instance_id,
|
process_instance_id,
|
||||||
idCard,
|
idCard,
|
||||||
studentPhone,
|
studentPhone,
|
||||||
student_signature
|
student_signature,
|
||||||
|
promise_content
|
||||||
from dms_outside_accommodation_apply
|
from dms_outside_accommodation_apply
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
@@ -250,6 +252,7 @@
|
|||||||
<if test="idCard != null and idCard != ''">idCard,</if>
|
<if test="idCard != null and idCard != ''">idCard,</if>
|
||||||
<if test="studentPhone != null">studentPhone,</if>
|
<if test="studentPhone != null">studentPhone,</if>
|
||||||
<if test="studentSignature != null">student_signature,</if>
|
<if test="studentSignature != null">student_signature,</if>
|
||||||
|
<if test="promiseContent != null">promise_content,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="applyNo != null and applyNo != ''">#{applyNo},</if>
|
<if test="applyNo != null and applyNo != ''">#{applyNo},</if>
|
||||||
@@ -295,6 +298,7 @@
|
|||||||
<if test="idCard != null and idCard != ''">#{idCard},</if>
|
<if test="idCard != null and idCard != ''">#{idCard},</if>
|
||||||
<if test="studentPhone != null">#{studentPhone},</if>
|
<if test="studentPhone != null">#{studentPhone},</if>
|
||||||
<if test="studentSignature != null">#{studentSignature},</if>
|
<if test="studentSignature != null">#{studentSignature},</if>
|
||||||
|
<if test="promiseContent != null">#{promiseContent},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -352,6 +356,7 @@
|
|||||||
<if test="idCard != null and idCard != ''">idCard = #{idCard},</if>
|
<if test="idCard != null and idCard != ''">idCard = #{idCard},</if>
|
||||||
<if test="studentPhone != null">studentPhone = #{studentPhone},</if>
|
<if test="studentPhone != null">studentPhone = #{studentPhone},</if>
|
||||||
<if test="studentSignature != null">student_signature = #{studentSignature},</if>
|
<if test="studentSignature != null">student_signature = #{studentSignature},</if>
|
||||||
|
<if test="promiseContent != null">promise_content = #{promiseContent},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|||||||
@@ -62,18 +62,29 @@ public class OutsideAccommodationEndListener implements ExecutionListener {
|
|||||||
approvalResult = num.longValue();
|
approvalResult = num.longValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加审批记录
|
|
||||||
OutsideAccommodationApplyMapper outsideAccommodationApplyMapper = SpringUtils.getBean(OutsideAccommodationApplyMapper.class);
|
OutsideAccommodationApplyMapper outsideAccommodationApplyMapper = SpringUtils.getBean(OutsideAccommodationApplyMapper.class);
|
||||||
// 根据Id查询外宿申请记录
|
// 根据Id查询外宿申请记录
|
||||||
OutsideAccommodationApply outsideAccommodationApply = outsideAccommodationApplyMapper.selectDmsOutsideAccommodationApplyById(accommodationId);
|
OutsideAccommodationApply outsideAccommodationApply = outsideAccommodationApplyMapper.selectDmsOutsideAccommodationApplyById(accommodationId);
|
||||||
|
// 添加审批记录
|
||||||
saveApprovalRecord(outsideAccommodationApply.getId(), outsideAccommodationApply.getProcessInstanceId(),outsideAccommodationApply.getApplyNo(),currentNodeName, outsideAccommodationApply.getStudentName(), outsideAccommodationApply.getStudentNo(), approvalOpinion, approvalResult);
|
saveApprovalRecord(outsideAccommodationApply.getId(), outsideAccommodationApply.getProcessInstanceId(),outsideAccommodationApply.getApplyNo(),currentNodeName, outsideAccommodationApply.getStudentName(), outsideAccommodationApply.getStudentNo(), approvalOpinion, approvalResult);
|
||||||
|
Long status = 1L;
|
||||||
|
if (currentNodeName.equals("辅导员审批")) {
|
||||||
|
status = 2L;
|
||||||
|
}
|
||||||
|
if (currentNodeName.equals("二级学院书记审批")) {
|
||||||
|
status = 3L;
|
||||||
|
}
|
||||||
|
if (currentNodeName.equals("学工处审批")) {
|
||||||
|
status = 4L;
|
||||||
|
}
|
||||||
// 如果到了最后一个审批人,则修改申请表审核状态
|
// 如果到了最后一个审批人,则修改申请表审核状态
|
||||||
if (currentNodeName.equals("学校领导审批")){
|
if (currentNodeName.equals("学校领导审批")){
|
||||||
// 改变申请表中的审核状态(审核通过)
|
// 改变申请表中的审核状态(审核通过)
|
||||||
outsideAccommodationApply.setStatus(5L);
|
status = 5L;
|
||||||
outsideAccommodationApplyMapper.updateDmsOutsideAccommodationApply(outsideAccommodationApply);
|
|
||||||
}
|
}
|
||||||
|
outsideAccommodationApply.setStatus(status);
|
||||||
|
outsideAccommodationApplyMapper.updateDmsOutsideAccommodationApply(outsideAccommodationApply);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -104,7 +115,7 @@ public class OutsideAccommodationEndListener implements ExecutionListener {
|
|||||||
outsideAccommodationApproval.setApproverId(SecurityUtils.getLoginUser().getUser().getUserId());
|
outsideAccommodationApproval.setApproverId(SecurityUtils.getLoginUser().getUser().getUserId());
|
||||||
// SecurityUtils.getUserName()是工号
|
// SecurityUtils.getUserName()是工号
|
||||||
outsideAccommodationApproval.setApproverName(SecurityUtils.getLoginUser().getUser().getNickName());
|
outsideAccommodationApproval.setApproverName(SecurityUtils.getLoginUser().getUser().getNickName());
|
||||||
System.out.println(SecurityUtils.getLoginUser().getUser());
|
// System.out.println(SecurityUtils.getLoginUser().getUser());
|
||||||
// 若变量未传递,直接用默认值“同意”(前端点击同意按钮的默认意见)
|
// 若变量未传递,直接用默认值“同意”(前端点击同意按钮的默认意见)
|
||||||
outsideAccommodationApproval.setApprovalOpinion(approvalOpinion);
|
outsideAccommodationApproval.setApprovalOpinion(approvalOpinion);
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ public class OutsideAccommodationStartListener implements ExecutionListener {
|
|||||||
// 学工处审批前 → 找到对应学工处
|
// 学工处审批前 → 找到对应学工处
|
||||||
// 查询角色ID=100(学工处)的所有用户
|
// 查询角色ID=100(学工处)的所有用户
|
||||||
SysUser qUser = new SysUser();
|
SysUser qUser = new SysUser();
|
||||||
qUser.setRoleId(100L); // 学工处角色固定ID=112
|
qUser.setRoleId(100L); // 学工处角色固定ID=100
|
||||||
List<SysUser> collegeUsers = sysUserService.selectAllocatedList(qUser);
|
List<SysUser> collegeUsers = sysUserService.selectAllocatedList(qUser);
|
||||||
if (collegeUsers.isEmpty()) {
|
if (collegeUsers.isEmpty()) {
|
||||||
throw new RuntimeException("未查询到角色(学工处)的用户");
|
throw new RuntimeException("未查询到角色(学工处)的用户");
|
||||||
@@ -130,7 +130,9 @@ public class OutsideAccommodationStartListener implements ExecutionListener {
|
|||||||
SysUser targetCollegeLeader = collegeUsers.stream()
|
SysUser targetCollegeLeader = collegeUsers.stream()
|
||||||
.filter(user -> currentDeptId.equals(user.getDeptId())) // 学院ID匹配(部门ID即学院ID)
|
.filter(user -> currentDeptId.equals(user.getDeptId())) // 学院ID匹配(部门ID即学院ID)
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElseThrow(() -> new RuntimeException("未找到学院ID=" + currentDeptId + "的学工处负责人"));
|
// 找不到匹配的则取列表第二个用户
|
||||||
|
.orElse(collegeUsers.get(2));
|
||||||
|
//.orElseThrow(() -> new RuntimeException("未找到学院ID=" + currentDeptId + "的学工处负责人"));
|
||||||
|
|
||||||
|
|
||||||
// 返回匹配的学工处负责人ID
|
// 返回匹配的学工处负责人ID
|
||||||
|
|||||||
Reference in New Issue
Block a user