This commit is contained in:
2025-11-28 16:45:01 +08:00
4 changed files with 56 additions and 3 deletions

View File

@@ -84,6 +84,18 @@ public class RtEnlistmentReserveApprovalController extends BaseController {
return toAjax(rtEnlistmentReserveApprovalService.insertRtEnlistmentReserveApproval(rtEnlistmentReserveApproval)); return toAjax(rtEnlistmentReserveApprovalService.insertRtEnlistmentReserveApproval(rtEnlistmentReserveApproval));
} }
/**
* 根据学生姓名、学号、审批人ID判断存在则更新不存在则新增
*/
@PreAuthorize("@ss.hasPermi('routine:enlistmentReserveApproval:add')")
@Log(title = "保留学籍审批记录", businessType = BusinessType.INSERT)
@PostMapping("/insertOrUpdateByStuAndApprover")
@ApiOperation("新增\\修改保留学籍审批记录")
public AjaxResult insertOrUpdateByStuAndApprover(@RequestBody RtEnlistmentReserveApproval rtEnlistmentReserveApproval)
{
return toAjax(rtEnlistmentReserveApprovalService.insertOrUpdateByStuAndApprover(rtEnlistmentReserveApproval));
}
/** /**
* 修改保留学籍审批记录 * 修改保留学籍审批记录
*/ */

View File

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

View File

@@ -1,6 +1,9 @@
package com.srs.routine.service.impl; package com.srs.routine.service.impl;
import java.util.List; import java.util.List;
import com.srs.common.exception.ServiceException;
import com.srs.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -84,4 +87,34 @@ public class RtEnlistmentReserveApprovalServiceImpl extends ServiceImpl<RtEnlist
public int deleteRtEnlistmentReserveApprovalById(Long id) { public int deleteRtEnlistmentReserveApprovalById(Long id) {
return rtEnlistmentReserveApprovalMapper.deleteRtEnlistmentReserveApprovalById(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("approvalResult", "AGREE"); // 学生提交(默认同意)
completeVariables.put("approvalOpinion", "学生自动提交申请,等待辅导员审批"); completeVariables.put("approvalOpinion", "学生自动提交申请,等待辅导员审批");
completeVariables.put("operator", "student"); // 操作人类型 completeVariables.put("operator", "student"); // 操作人类型
// 添加任务分配的备注(便于流程追溯)
taskService.addComment(
studentTask.getId(),
processInstanceId,
"自动分配负责人",
"学生已经重新修改提交申请"
);
// 2. 学生自动完成待办任务 // 2. 学生自动完成待办任务
taskService.complete(studentTask.getId(), completeVariables); taskService.complete(studentTask.getId(), completeVariables);
System.out.println("学生[" + studentUserId + "]已自动完成待办任务任务ID" + studentTask.getId()); System.out.println("学生[" + studentUserId + "]已自动完成待办任务任务ID" + studentTask.getId());
@@ -269,12 +275,12 @@ public class RtEnlistmentReserveServiceImpl extends ServiceImpl<RtEnlistmentRese
for (Task counselorTask : counselorTaskList) { for (Task counselorTask : counselorTaskList) {
taskService.setAssignee(counselorTask.getId(), counselorIdStr); taskService.setAssignee(counselorTask.getId(), counselorIdStr);
// 可选:添加任务分配的备注(便于流程追溯) // 可选:添加任务分配的备注(便于流程追溯)
taskService.addComment( /*taskService.addComment(
counselorTask.getId(), counselorTask.getId(),
processInstanceId, processInstanceId,
"自动分配负责人", "自动分配负责人",
"学生已经重新修改提交申请" "学生已经重新修改提交申请"
); );*/
System.out.println("辅导员审批节点任务[" + counselorTask.getId() + "]已分配负责人:" + counselorIdStr); System.out.println("辅导员审批节点任务[" + counselorTask.getId() + "]已分配负责人:" + counselorIdStr);
} }
} }