ProcessDefinitionController.java
4.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
package com.trash.activiti.controller;
import com.trash.common.annotation.Log;
import com.trash.common.core.controller.BaseController;
import com.trash.common.core.domain.AjaxResult;
import com.trash.common.core.page.PageDomain;
import com.trash.common.core.page.TableDataInfo;
import com.trash.common.core.page.TableSupport;
import com.trash.common.enums.BusinessType;
import com.trash.activiti.domain.dto.ProcessDefinitionDTO;
import com.trash.activiti.service.IProcessDefinitionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* 汇讯数码科技(深圳)有限公司
* 创建日期:2020/10/22-15:16
* 版本 开发者 日期
* 1.0 Danny 2020/10/22
*/
@RestController
@RequestMapping("/processDefinition")
public class ProcessDefinitionController extends BaseController {
@Autowired
private IProcessDefinitionService processDefinitionService;
/**
* 获取流程定义集合
*
* @param processDefinition
* @return
*/
@GetMapping(value = "/list")
public TableDataInfo list(ProcessDefinitionDTO processDefinition) {
PageDomain pageDomain = TableSupport.buildPageRequest();
return getDataTable(processDefinitionService.selectProcessDefinitionList(processDefinition, pageDomain));
}
/**
*
* @return
*/
@GetMapping(value = "/getDefinitions/{instanceId}")
public AjaxResult getDefinitionsByInstanceId(@PathVariable("instanceId") String instanceId){
return AjaxResult.success(processDefinitionService.getDefinitionsByInstanceId(instanceId));
}
/**
* 删除流程定义
*
* @param deploymentId
* @return
*/
@Log(title = "流程定义管理", businessType = BusinessType.DELETE)
@DeleteMapping(value = "/remove/{deploymentId}")
public AjaxResult delDefinition(@PathVariable("deploymentId") String deploymentId) {
return toAjax(processDefinitionService.deleteProcessDefinitionById(deploymentId));
}
/**
* 上传并部署流程定义
*
* @param file
* @return
* @throws IOException
*/
@Log(title = "流程定义管理", businessType = BusinessType.IMPORT)
@PostMapping(value = "/uploadStreamAndDeployment")
public AjaxResult uploadStreamAndDeployment(@RequestParam("file") MultipartFile file) throws IOException {
processDefinitionService.uploadStreamAndDeployment(file);
return AjaxResult.success();
}
/**
* 启动挂起流程流程定义
*
* @param processDefinition
* @return
*/
@Log(title = "流程定义管理", businessType = BusinessType.UPDATE)
@PostMapping("/suspendOrActiveApply")
@ResponseBody
public AjaxResult suspendOrActiveApply(@RequestBody ProcessDefinitionDTO processDefinition) {
processDefinitionService.suspendOrActiveApply(processDefinition.getId(), processDefinition.getSuspendState());
return AjaxResult.success();
}
/**
* 上传流程流程定义
*
* @param multipartFile
* @return
* @throws IOException
*/
@Log(title = "流程定义管理", businessType = BusinessType.IMPORT)
@PostMapping(value = "/upload")
public AjaxResult upload(@RequestParam("processFile") MultipartFile multipartFile) throws IOException {
if (!multipartFile.isEmpty()) {
String fileName = processDefinitionService.upload(multipartFile);
return AjaxResult.success("操作成功", fileName);
}
return AjaxResult.error("不允许上传空文件!");
}
/**
* 通过stringBPMN添加流程定义
*
* @param stringBPMN
* @return
*/
@PostMapping(value = "/addDeploymentByString")
public AjaxResult addDeploymentByString(@RequestParam("stringBPMN") String stringBPMN) {
processDefinitionService.addDeploymentByString(stringBPMN);
return AjaxResult.success();
}
/**
* 获取流程定义XML
*
* @param response
* @param deploymentId
* @param resourceName
*/
@GetMapping(value = "/getDefinitionXML")
public void getProcessDefineXML(HttpServletResponse response,
@RequestParam("deploymentId") String deploymentId,
@RequestParam("resourceName") String resourceName) throws IOException {
processDefinitionService.getProcessDefineXML(response, deploymentId, resourceName);
}
}