删除所有运行中的流程接口

This commit is contained in:
wangliwen 2022-08-02 15:32:08 +08:00
parent d96f797813
commit 95989cc59c
1 changed files with 27 additions and 11 deletions

View File

@ -11,34 +11,39 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.runtime.ProcessInstanceQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import java.util.Map;
/**
* 运行中的流程
*
*/
@RestController
@RequestMapping("/act/running")
@Api(tags="运行中的流程")
@Api(tags = "运行中的流程")
public class ActRunningController {
@Autowired
private ActRunningService actRunningService;
@Autowired
private RuntimeService runtimeService;
@GetMapping("page")
@ApiOperation("运行中的流程-分页查询")
@LogOperation("运行中的流程-分页查询")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = "id", value = "实例ID", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "definitionKey", value = "definitionKey", paramType = "query", dataType="String")
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = "id", value = "实例ID", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "definitionKey", value = "definitionKey", paramType = "query", dataType = "String")
})
// @RequiresPermissions("sys:running:all")
public Result<PageData<Map<String, Object>>> page(@ApiIgnore @RequestParam Map<String, Object> params){
public Result<PageData<Map<String, Object>>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
PageData<Map<String, Object>> page = actRunningService.page(params);
return new Result<PageData<Map<String, Object>>>().ok(page);
@ -48,18 +53,29 @@ public class ActRunningController {
@ApiOperation("删除运行中的流程")
@LogOperation("删除运行中的流程")
// @RequiresPermissions("sys:running:all")
@ApiImplicitParam(name = "id", value = "ID", paramType = "query", dataType="String")
@ApiImplicitParam(name = "id", value = "ID", paramType = "query", dataType = "String")
public Result deleteInstance(@PathVariable("id") String id) {
actRunningService.delete(id);
return new Result();
}
@GetMapping("deleteAllInstance")
public Result deleteAllInstance() {
ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery();
List<ProcessInstance> processInstanceList = processInstanceQuery.list();
processInstanceList.stream().forEach(index -> {
actRunningService.delete(index.getId());
});
return new Result();
}
@PostMapping("start")
@ApiOperation("启动流程实例依据流程定义KEY启动流程实例")
@LogOperation("启动流程实例依据流程定义KEY启动流程实例")
@ApiImplicitParam(name = "key", value = "流程定义标识key", paramType = "query", dataType="String")
@ApiImplicitParam(name = "key", value = "流程定义标识key", paramType = "query", dataType = "String")
// @RequiresPermissions("sys:running:all")
public Result<ProcessInstanceDTO> start(String key){
public Result<ProcessInstanceDTO> start(String key) {
ProcessInstanceDTO dto = actRunningService.startProcess(key);
return new Result().ok(dto);
}
@ -68,7 +84,7 @@ public class ActRunningController {
@ApiOperation("启动流程实例依据流程定义ID和业务唯一标示启动实例")
@LogOperation("启动流程实例依据流程定义ID和业务唯一标示启动实例")
// @RequiresPermissions("sys:running:all")
public Result<ProcessInstanceDTO> startOfBusinessKey(@RequestBody ProcessStartDTO processStartDTO){
public Result<ProcessInstanceDTO> startOfBusinessKey(@RequestBody ProcessStartDTO processStartDTO) {
ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO);
return new Result().ok(dto);
}