应征入伍保留学籍工作流

This commit is contained in:
2025-11-07 12:20:20 +08:00
parent 6e9d57a5e0
commit aa3246d2cc
2 changed files with 111 additions and 4 deletions

View File

@@ -133,9 +133,9 @@ private static final long serialVersionUID=1L;
/**
* 申请状态0-草稿
*/
@ApiModelProperty("申请状态0-草稿")
@ApiModelProperty("申请状态0-草稿 1-审批中 2-通过 3-驳回)")
@TableField("apply_status")
@Excel(name = "申请状态" , readConverterExp = "申请状态0-草稿")
@Excel(name = "申请状态" , readConverterExp = "申请状态0-草稿 1-审批中 2-通过 3-驳回)")
private Long applyStatus;
/**
@@ -179,5 +179,13 @@ private static final long serialVersionUID=1L;
@Excel(name = "批文号")
private String approvalNo;
@ApiModelProperty("申请日期")
@TableField("create_time")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date createTime;
@ApiModelProperty("更新日期")
@TableField("update_time")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date updateTime;
}

View File

@@ -1,7 +1,20 @@
package com.srs.routine.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.srs.common.core.domain.AjaxResult;
import com.srs.common.doman.dto.ProcessResultDto;
import com.srs.common.doman.vo.TeacherVo;
import com.srs.common.utils.DateUtils;
import com.srs.common.utils.SecurityUtils;
import com.srs.flowable.service.IFlowDefinitionService;
import lombok.extern.slf4j.Slf4j;
import com.srs.routine.mapper.RtStuLeaveApplicationMapper;
import org.flowable.engine.IdentityService;
import org.flowable.engine.TaskService;
import org.flowable.task.api.Task;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@@ -20,6 +33,18 @@ public class RtEnlistmentReserveServiceImpl extends ServiceImpl<RtEnlistmentRese
@Autowired
private RtEnlistmentReserveMapper rtEnlistmentReserveMapper;
@Autowired
private RtStuLeaveApplicationMapper rtStuLeaveApplicationMapper;
@Autowired
IFlowDefinitionService flowDefinitionService;
@Autowired
TaskService taskService;
@Autowired
IdentityService identityService;
/**
* 查询应征入伍保留学籍申请
*
@@ -51,7 +76,17 @@ public class RtEnlistmentReserveServiceImpl extends ServiceImpl<RtEnlistmentRese
@Override
public int insertRtEnlistmentReserve(RtEnlistmentReserve rtEnlistmentReserve) {
rtEnlistmentReserve.setCreateTime(DateUtils.getNowDate());
return rtEnlistmentReserveMapper.insertRtEnlistmentReserve(rtEnlistmentReserve);
// if (rtEnlistmentReserve.getApplyStatus() != null && rtEnlistmentReserve.getApplyStatus().equals("1")) {
rtEnlistmentReserve.setStudentId(SecurityUtils.getUserId());
ProcessResultDto processResultDto = startEnlistmentReserveProcess(rtEnlistmentReserve);
if (processResultDto!=null) {
rtEnlistmentReserve.setProcessInstanceId(processResultDto.getProcessInstanceId());
// rtEnlistmentReserve.setDeployId(processResultDto.getDeploymentId());
// rtEnlistmentReserveMapper.updateRtEnlistmentReserve(rtEnlistmentReserve);
}
// }
return rtEnlistmentReserveMapper.insertRtEnlistmentReserve(rtEnlistmentReserve);
}
/**
@@ -62,10 +97,74 @@ public class RtEnlistmentReserveServiceImpl extends ServiceImpl<RtEnlistmentRese
*/
@Override
public int updateRtEnlistmentReserve(RtEnlistmentReserve rtEnlistmentReserve) {
rtEnlistmentReserve.setUpdateTime(DateUtils.getNowDate());
rtEnlistmentReserve.setUpdateTime(DateUtils.getNowDate());
rtEnlistmentReserve.setUpdateBy(SecurityUtils.getUsername());
// if (rtEnlistmentReserve.getApplyStatus().equals("1")) {
ProcessResultDto processResultDto = startEnlistmentReserveProcess(rtEnlistmentReserve);
if (processResultDto!=null) {
rtEnlistmentReserve.setProcessInstanceId(processResultDto.getProcessInstanceId());
}
// }
return rtEnlistmentReserveMapper.updateRtEnlistmentReserve(rtEnlistmentReserve);
}
/**
* 开启应征入伍保留学籍申请工作流
*
* @param rtEnlistmentReserve
*/
private ProcessResultDto startEnlistmentReserveProcess(RtEnlistmentReserve rtEnlistmentReserve) {
Map<String, Object> variables = new HashMap<>();
variables.put("applyNo", rtEnlistmentReserve.getApplyNo().toString());
// variables.put("applyNo", rtEnlistmentReserve.getReserveNo());
variables.put("stuId", rtEnlistmentReserve.getStudentId());
TeacherVo counselorInfo = rtStuLeaveApplicationMapper.getCounselorInfo(rtEnlistmentReserve.getStudentId());
// 把辅导员的userId放到approval中
variables.put("approval", counselorInfo.getUserId());
variables.put("deptId", counselorInfo.getDeptId());
//flow_m4npextk:28:257686 flow_m4npextk:31:755004
AjaxResult ajaxResult = flowDefinitionService.startProcessInstanceById("flow_r064jfpz:3:1027504", variables);
String code = ajaxResult.get("code").toString();
if (code.equals("200")) {
System.out.println("流程启动成功");
Object obj = ajaxResult.get("data");
ProcessResultDto dto = (ProcessResultDto) obj;
// 操作工作流
// 设置当前用户
identityService.setAuthenticatedUserId(SecurityUtils.getUserId().toString());
// 查询待办任务列表
List<Task> tasks = taskService.createTaskQuery()
.processInstanceId(dto.getProcessInstanceId())
.taskAssignee(SecurityUtils.getUserId().toString())
.active()
.list();
// 保存审核结果到任务变量中
variables.put("approved", true);
// 完成待办任务列表
for (Task task : tasks) {
String taskId = task.getId();
String leaveId = taskService.getVariable(taskId, "enlistmentReserveId").toString();
if (leaveId.equals(rtEnlistmentReserve.getId().toString())) {
taskService.complete(task.getId(), variables);
}
}
// todo 企业微信推送消息
return dto;
} else {
return null;
}
}
/**
* 批量删除应征入伍保留学籍申请
*