fix(流程管理):

1.新增取消流程申请
2.更换包路径
approve-sys
DESKTOP-J8LE24C\cqjx 4 years ago
parent 4aea7c26c6
commit 78a20f70f4

@ -10,6 +10,8 @@
访问链接http://129.211.46.183/ 访问链接http://129.211.46.183/
#####为了方便体验,请勿删除和改动初始化的几个流程和表单,感谢!有其它流程实现,请自行定义新流程、表单。
## 工作流交流群 ## 工作流交流群
QQ群 [![加入QQ群](https://img.shields.io/badge/782924350-blue.svg)](https://jq.qq.com/?_wv=1027&k=2zE87c2G) 点击按钮入群。 QQ群 [![加入QQ群](https://img.shields.io/badge/782924350-blue.svg)](https://jq.qq.com/?_wv=1027&k=2zE87c2G) 点击按钮入群。

@ -1,4 +1,4 @@
package com.ruoyi.common.constant; package com.ruoyi.flowable.common.constant;
/** /**
* *

@ -1,4 +1,4 @@
package com.ruoyi.common.enums; package com.ruoyi.flowable.common.enums;
/** /**
* *
@ -15,7 +15,8 @@ public enum FlowComment {
REBACK("2", "退回意见"), REBACK("2", "退回意见"),
REJECT("3", "驳回意见"), REJECT("3", "驳回意见"),
DELEGATE("4", "委派意见"), DELEGATE("4", "委派意见"),
ASSIGN("5", "转办意见"); ASSIGN("5", "转办意见"),
STOP("6", "终止流程");
/** /**
* *

@ -40,6 +40,12 @@ public class FlowTaskController {
return flowTaskService.myProcess(pageNum, pageSize); return flowTaskService.myProcess(pageNum, pageSize);
} }
@ApiOperation(value = "取消申请", response = FlowTaskDto.class)
@PostMapping(value = "/stopProcess")
public AjaxResult stopProcess(@RequestBody FlowTaskVo flowTaskVo) {
return flowTaskService.stopProcess(flowTaskVo);
}
@ApiOperation(value = "撤回流程", response = FlowTaskDto.class) @ApiOperation(value = "撤回流程", response = FlowTaskDto.class)
@PostMapping(value = "/revokeProcess") @PostMapping(value = "/revokeProcess")
public AjaxResult revokeProcess(@RequestBody FlowTaskVo flowTaskVo) { public AjaxResult revokeProcess(@RequestBody FlowTaskVo flowTaskVo) {

@ -87,6 +87,13 @@ public interface IFlowTaskService {
*/ */
AjaxResult myProcess(Integer pageNum, Integer pageSize); AjaxResult myProcess(Integer pageNum, Integer pageSize);
/**
*
* @param flowTaskVo
* @return
*/
AjaxResult stopProcess(FlowTaskVo flowTaskVo);
/** /**
* *
* @param flowTaskVo * @param flowTaskVo

@ -1,17 +1,16 @@
package com.ruoyi.flowable.service.impl; package com.ruoyi.flowable.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.constant.ProcessConstants; import com.ruoyi.flowable.common.constant.ProcessConstants;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.enums.FlowComment; import com.ruoyi.flowable.common.enums.FlowComment;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.flowable.domain.dto.FlowProcDefDto; import com.ruoyi.flowable.domain.dto.FlowProcDefDto;
import com.ruoyi.flowable.factory.FlowServiceFactory; import com.ruoyi.flowable.factory.FlowServiceFactory;
import com.ruoyi.flowable.service.IFlowDefinitionService; import com.ruoyi.flowable.service.IFlowDefinitionService;
import com.ruoyi.flowable.service.ISysDeployFormService; import com.ruoyi.flowable.service.ISysDeployFormService;
import com.ruoyi.system.domain.SysForm; import com.ruoyi.system.domain.SysForm;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.service.ISysDeptService; import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysPostService; import com.ruoyi.system.service.ISysPostService;
import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.ISysUserService;
@ -24,9 +23,7 @@ import org.flowable.engine.repository.ProcessDefinitionQuery;
import org.flowable.engine.runtime.ProcessInstance; import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.image.impl.DefaultProcessDiagramGenerator; import org.flowable.image.impl.DefaultProcessDiagramGenerator;
import org.flowable.task.api.Task; import org.flowable.task.api.Task;
import org.flowable.task.api.TaskQuery;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -34,7 +31,6 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* *

@ -4,11 +4,11 @@ package com.ruoyi.flowable.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.ruoyi.common.constant.ProcessConstants; import com.ruoyi.flowable.common.constant.ProcessConstants;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.enums.FlowComment; import com.ruoyi.flowable.common.enums.FlowComment;
import com.ruoyi.common.exception.CustomException; import com.ruoyi.common.exception.CustomException;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.flowable.domain.dto.FlowCommentDto; import com.ruoyi.flowable.domain.dto.FlowCommentDto;
@ -483,6 +483,43 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
return AjaxResult.success(page); return AjaxResult.success(page);
} }
/**
*
*
* @param flowTaskVo
* @return
*/
@Override
public AjaxResult stopProcess(FlowTaskVo flowTaskVo) {
Task task = taskService.createTaskQuery().processInstanceId(flowTaskVo.getInstanceId()).singleResult();
if (task == null) {
throw new CustomException("流程未启动或已执行完成,无法撤回");
}
SysUser loginUser = SecurityUtils.getLoginUser().getUser();
ProcessInstance processInstance =
runtimeService.createProcessInstanceQuery().processInstanceId(flowTaskVo.getInstanceId()).singleResult();
BpmnModel bpmnModel = repositoryService.getBpmnModel(processInstance.getProcessDefinitionId());
if (Objects.nonNull(bpmnModel)) {
Process process = bpmnModel.getMainProcess();
List<EndEvent> endNodes = process.findFlowElementsOfType(EndEvent.class, false);
if (CollectionUtils.isNotEmpty(endNodes)) {
Authentication.setAuthenticatedUserId(loginUser.getUserId().toString());
taskService.addComment(task.getId(), processInstance.getProcessInstanceId(), FlowComment.STOP.getType(),
StringUtils.isBlank(flowTaskVo.getComment()) ? "取消申请" : flowTaskVo.getComment());
String endId = endNodes.get(0).getId();
List<Execution> executions =
runtimeService.createExecutionQuery().parentId(processInstance.getProcessInstanceId()).list();
List<String> executionIds = new ArrayList<>();
executions.forEach(execution -> executionIds.add(execution.getId()));
runtimeService.createChangeActivityStateBuilder().moveExecutionsToSingleActivityId(executionIds,
endId).changeState();
}
}
return AjaxResult.success();
}
/** /**
* *
* *

@ -19,10 +19,10 @@ export function complete(data) {
}) })
} }
// 撤回任务 // 取消申请
export function revokeProcess(data) { export function stopProcess(data) {
return request({ return request({
url: '/flowable/task/revokeProcess', url: '/flowable/task/stopProcess',
method: 'post', method: 'post',
data: data data: data
}) })

@ -107,8 +107,8 @@
size="mini" size="mini"
type="text" type="text"
icon="el-icon-tickets" icon="el-icon-tickets"
@click="handleRevoke(scope.row)" @click="handleStop(scope.row)"
>撤回</el-button> >取消申请</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
@ -171,7 +171,7 @@ import {
exportDeployment, exportDeployment,
flowRecord flowRecord
} from "@/api/flowable/finished"; } from "@/api/flowable/finished";
import { myProcessList,revokeProcess } from "@/api/flowable/process"; import { myProcessList,stopProcess } from "@/api/flowable/process";
import {listDefinition} from "@/api/flowable/definition"; import {listDefinition} from "@/api/flowable/definition";
export default { export default {
name: "Deploy", name: "Deploy",
@ -297,13 +297,12 @@ export default {
} }
}) })
}, },
/** 撤回流程申请 */ /** 取消流程申请 */
handleRevoke(row){ handleStop(row){
const params = { const params = {
procInsId: null,
instanceId: row.procInsId instanceId: row.procInsId
} }
revokeProcess(params).then( res => { stopProcess(params).then( res => {
this.msgSuccess(res.msg); this.msgSuccess(res.msg);
this.getList(); this.getList();
}); });

Loading…
Cancel
Save