add 启动流程
This commit is contained in:
+11
-2
@@ -6,12 +6,10 @@ import com.jero.common.util.MessageUtils;
|
||||
import com.jero.modules.activiti.process.fb.entity.ProcessFbEntryChange;
|
||||
import com.jero.modules.activiti.process.fb.service.IProcessFbEntryChangeService;
|
||||
import com.jero.modules.laws.common.constant.ResultCommon;
|
||||
import com.jero.modules.laws.dataCenter.entity.LawsDataCenterFile;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -48,4 +46,15 @@ public class ProcessFbEntryChangeController extends JeroController<ProcessFbEntr
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
@AutoLog(value = "标准法规入库_变更流程-通过id查询")
|
||||
@ApiOperation(value = "标准法规入库_变更流程-通过id查询", notes = "标准法规入库_变更流程-通过id查询")
|
||||
@GetMapping(value = "/queryBusinessInfo")
|
||||
public Result<ProcessFbEntryChange> queryBusinessInfo(@RequestParam(name = "id") String id) {
|
||||
ProcessFbEntryChange processFbEntryChange = processFbEntryChangeService.queryBusinessInfo(id);
|
||||
if (processFbEntryChange == null) {
|
||||
return Result.error(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
|
||||
}
|
||||
return Result.OK(processFbEntryChange);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.jero.modules.activiti.process.fb.controller;
|
||||
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.util.MessageUtils;
|
||||
import com.jero.modules.activiti.process.fb.entity.ProcessFbEntryChange;
|
||||
import com.jero.modules.activiti.process.fb.service.IProcessHandleService;
|
||||
import com.jero.modules.activiti.process.fb.vo.ProcessInfoVO;
|
||||
import com.jero.modules.laws.common.constant.ResultCommon;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
* @Date: 2023/11/2 16:56
|
||||
* @Description: 流程处理
|
||||
*/
|
||||
@Api(tags="流程处理")
|
||||
@RestController
|
||||
@RequestMapping("/process/fb/handle")
|
||||
@Slf4j
|
||||
public class ProcessHandleController {
|
||||
|
||||
@Autowired
|
||||
private IProcessHandleService processHandleService;
|
||||
|
||||
@AutoLog(value = "流程处理-启动流程")
|
||||
@ApiOperation(value = "流程处理-启动流程", notes = "流程处理-启动流程")
|
||||
@PostMapping(value = "/startProcess")
|
||||
public Result<T> startProcess(@Validated @RequestBody ProcessInfoVO processInfoVO) {
|
||||
processHandleService.startProcess(processInfoVO);
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
}
|
||||
+7
@@ -24,4 +24,11 @@ public interface IProcessFbEntryChangeService extends IService<ProcessFbEntryCha
|
||||
* @Description: 编辑业务信息
|
||||
**/
|
||||
void editBusinessInfo(ProcessFbEntryChange processFbEntryChange);
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
* @Date: 2023/11/2 16:34
|
||||
* @Description: 通过id查询
|
||||
**/
|
||||
ProcessFbEntryChange queryBusinessInfo(String id);
|
||||
}
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.jero.modules.activiti.process.fb.service;
|
||||
|
||||
import com.jero.modules.activiti.process.fb.vo.ProcessInfoVO;
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
* @Date: 2023/11/2 17:01
|
||||
* @Description: 流程办理
|
||||
*/
|
||||
public interface IProcessHandleService {
|
||||
/**
|
||||
* @Author: liao
|
||||
* @Date: 2023/11/2 17:04
|
||||
* @Description: 启动流程
|
||||
**/
|
||||
void startProcess(ProcessInfoVO processInfoVO);
|
||||
}
|
||||
+10
@@ -42,4 +42,14 @@ public class ProcessFbEntryChangeServiceImpl extends ServiceImpl<ProcessFbEntryC
|
||||
public void editBusinessInfo(ProcessFbEntryChange processFbEntryChange) {
|
||||
updateById(processFbEntryChange);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
* @Date: 2023/11/2 16:34
|
||||
* @Description: 通过id查询
|
||||
**/
|
||||
@Override
|
||||
public ProcessFbEntryChange queryBusinessInfo(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
}
|
||||
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
package com.jero.modules.activiti.process.fb.service.impl;
|
||||
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.modules.activiti.entity.ProcessAll;
|
||||
import com.jero.modules.activiti.entity.ProcessApprovalRecord;
|
||||
import com.jero.modules.activiti.process.fb.service.IProcessHandleService;
|
||||
import com.jero.modules.activiti.process.fb.vo.ProcessInfoVO;
|
||||
import com.jero.modules.activiti.service.ProcessAllService;
|
||||
import com.jero.modules.activiti.service.ProcessApprovalRecordService;
|
||||
import com.jero.modules.laws.common.util.CurrentUserUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.engine.RuntimeService;
|
||||
import org.activiti.engine.TaskService;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
* @Date: 2023/11/2 17:01
|
||||
* @Description: 流程办理
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = JeroBootException.class)
|
||||
public class ProcessHandleServiceImpl implements IProcessHandleService {
|
||||
|
||||
@Resource
|
||||
private RuntimeService runtimeService;
|
||||
@Resource
|
||||
private TaskService taskService;
|
||||
@Resource
|
||||
private ProcessAllService processAllService; // 流程实例总表
|
||||
@Resource
|
||||
private ProcessApprovalRecordService processApprovalRecordService; // 任务审批表
|
||||
|
||||
/**
|
||||
* @Author: liao
|
||||
* @Date: 2023/11/2 17:04
|
||||
* @Description: 启动流程
|
||||
**/
|
||||
@Override
|
||||
public void startProcess(ProcessInfoVO processInfoVO) {
|
||||
String processDefinitionId = processInfoVO.getProcessDefinitionId(); // 流程定义id
|
||||
Map<String, Object> userInfoMap = processInfoVO.getUserInfoMap(); // 用户变量map
|
||||
String userId = CurrentUserUtil.getId();
|
||||
userInfoMap.put("engineer", userId); // 第一个任务节点设置成自己
|
||||
// 根据流程定义id和变量map启动流程
|
||||
ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinitionId, userInfoMap);
|
||||
|
||||
String processInstanceId = processInstance.getId(); // 流程实例id
|
||||
// 根据流程实例id更新流程总表
|
||||
ProcessAll process = processAllService.getByProcessInstanceId(processInstanceId);
|
||||
process.setCreateUserId(userId); // 流程创建人
|
||||
process.setPrcName(processInfoVO.getProcessName()); // 流程名称
|
||||
process.setMes(processInfoVO.getProcessDescription()); // 流程说明
|
||||
process.setDueTime(processInfoVO.getProcessDueDate()); // 流程截止时间
|
||||
process.setProjectId(processInfoVO.getBusinessId()); // 业务id
|
||||
processAllService.updateById(process);
|
||||
|
||||
// 根据流程实例id和任务处理人查询任务
|
||||
Task task = taskService.createTaskQuery()
|
||||
.processInstanceId(processInstanceId)
|
||||
.taskAssignee(userId).singleResult();
|
||||
String taskId = task.getId();
|
||||
|
||||
// 更新审批记录
|
||||
ProcessApprovalRecord approvalRecord = processApprovalRecordService.getToDoByTaskId(taskId);
|
||||
approvalRecord.setCommitFlag(1); // 审批意见(1通过,2驳回)
|
||||
approvalRecord.setCommitText(processInfoVO.getHandleText()); // 审批内容
|
||||
approvalRecord.setCommitFile(processInfoVO.getHandleFile()); // 审批附件
|
||||
approvalRecord.setFinishFlag(2); // 完成注记(1进行中,2已完成)
|
||||
approvalRecord.setEndTime(new Date()); // 完成时间
|
||||
processApprovalRecordService.updateById(approvalRecord);
|
||||
|
||||
// 完成任务
|
||||
taskService.complete(taskId);
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -56,6 +56,6 @@ public class ProcessInfoVO {
|
||||
|
||||
/**人员信息*/
|
||||
@ApiModelProperty(value = "人员信息")
|
||||
private Map<String, String> userInfoMap;
|
||||
private Map<String, Object> userInfoMap;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user