保留学籍审核记录根据id新增或修改记录

This commit is contained in:
2025-11-27 17:11:17 +08:00
parent c0fca88261
commit e5e8882b82
4 changed files with 56 additions and 3 deletions

View File

@@ -59,4 +59,6 @@ public interface IRtEnlistmentReserveApprovalService extends IService<RtEnlistme
* @return 结果
*/
int deleteRtEnlistmentReserveApprovalById(Long id);
int insertOrUpdateByStuAndApprover(RtEnlistmentReserveApproval rtEnlistmentReserveApproval);
}

View File

@@ -1,6 +1,9 @@
package com.srs.routine.service.impl;
import java.util.List;
import com.srs.common.exception.ServiceException;
import com.srs.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@@ -84,4 +87,34 @@ public class RtEnlistmentReserveApprovalServiceImpl extends ServiceImpl<RtEnlist
public int deleteRtEnlistmentReserveApprovalById(Long id) {
return rtEnlistmentReserveApprovalMapper.deleteRtEnlistmentReserveApprovalById(id);
}
/**
* 根据学生姓名、学号、审批人ID判断存在则更新不存在则新增
* @param approval 审批记录入参
* @return 数据库影响行数(新增/更新成功返回1无操作返回0
*/
@Override
public int insertOrUpdateByStuAndApprover(RtEnlistmentReserveApproval approval) {
approval.setApprovalTime(DateUtils.getNowDate());
// 入参非空校验
if (approval == null) {
throw new ServiceException("审批记录入参不能为空", 500);
}
// 查询已有审批记录
RtEnlistmentReserveApproval existingApproval = rtEnlistmentReserveApprovalMapper.selectRtEnlistmentReserveApprovalByStuName(
approval.getStudentName(),
approval.getStudentNo(),
approval.getApproverId()
);
// 存在则更新,不存在则新增
if (existingApproval != null) {
// 为更新操作设置主键ID保证MyBatis更新时能定位到数据
approval.setId(existingApproval.getId());
return rtEnlistmentReserveApprovalMapper.updateRtEnlistmentReserveApproval(approval);
} else {
return rtEnlistmentReserveApprovalMapper.insertRtEnlistmentReserveApproval(approval);
}
}
}

View File

@@ -186,7 +186,13 @@ public class RtEnlistmentReserveServiceImpl extends ServiceImpl<RtEnlistmentRese
completeVariables.put("approvalResult", "AGREE"); // 学生提交(默认同意)
completeVariables.put("approvalOpinion", "学生自动提交申请,等待辅导员审批");
completeVariables.put("operator", "student"); // 操作人类型
// 添加任务分配的备注(便于流程追溯)
taskService.addComment(
studentTask.getId(),
processInstanceId,
"自动分配负责人",
"学生已经重新修改提交申请"
);
// 2. 学生自动完成待办任务
taskService.complete(studentTask.getId(), completeVariables);
System.out.println("学生[" + studentUserId + "]已自动完成待办任务任务ID" + studentTask.getId());
@@ -269,12 +275,12 @@ public class RtEnlistmentReserveServiceImpl extends ServiceImpl<RtEnlistmentRese
for (Task counselorTask : counselorTaskList) {
taskService.setAssignee(counselorTask.getId(), counselorIdStr);
// 可选:添加任务分配的备注(便于流程追溯)
taskService.addComment(
/*taskService.addComment(
counselorTask.getId(),
processInstanceId,
"自动分配负责人",
"学生已经重新修改提交申请"
);
);*/
System.out.println("辅导员审批节点任务[" + counselorTask.getId() + "]已分配负责人:" + counselorIdStr);
}
}