/**
* @Des: 获取流程定义列表
* @Author: liut
* @Date: 2020/11/23 15:50
*/
@GetMapping("/getDefinitions")
public AjaxResponse getDefinitions(){
try {
List<HashMap<String,Object>> listMap = new ArrayList<>();
List<ProcessDefinition> list =
repositoryService.createProcessDefinitionQuery().list();
for (ProcessDefinition pd : list) {
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("processDefinitionID", pd.getId());
hashMap.put("name", pd.getName());
hashMap.put("key", pd.getKey());
hashMap.put("resourceName", pd.getResourceName());
hashMap.put("deploymentID", pd.getDeploymentId());
hashMap.put("version", pd.getVersion());
listMap.add(hashMap);
}
return AjaxResponse.AjaxData(GlobalConfig.ResponseCode.SUCCESS.getCode(),GlobalConfig.ResponseCode.SUCCESS.getDes(),listMap);
}catch (Exception e){
return AjaxResponse.AjaxData(GlobalConfig.ResponseCode.ERROR.getCode(),"获取流程定义失败",
e.toString());
}
}
/**
* @Des: 获取流程定义XML
* @Author: liut
* @Date: 2020/11/23 16:33
*/
@GetMapping("/getDefinitionXML")
public void getDefinitionXML(HttpServletResponse response,
@RequestParam("deploymentId") String deploymentId,
@RequestParam("resourceName") String resourceName){
try {
InputStream inputStream = repositoryService.getResourceAsStream(deploymentId, resourceName);
int count = inputStream.available();
byte[] bytes = new byte[count];
response.setContentType("text/xml");
ServletOutputStream outputStream = response.getOutputStream();
while (inputStream.read(bytes) != -1){
outputStream.write(bytes);
}
inputStream.close();
}catch (Exception e){
e.printStackTrace();
}
}
/**
* @Des: 获取部署列表
* @Author: liut
* @Date: 2020/11/23 16:43
*/
@GetMapping("/getDeployments")
public AjaxResponse getDeployments(){
List<HashMap<String,Object>> listMap = new ArrayList<>();
List<Deployment> list = repositoryService.createDeploymentQuery().list();
for (Deployment dep : list) {
HashMap<String, Object> map = new HashMap<>();
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("id", dep.getId());
hashMap.put("name", dep.getName());
hashMap.put("deploymentTime", dep.getDeploymentTime());
listMap.add(map);
}
return AjaxResponse.AjaxData(GlobalConfig.ResponseCode.SUCCESS.getCode(),
GlobalConfig.ResponseCode.SUCCESS.getDes(),listMap);
}
/**
* @Des: 删除流程定义
* @Author: liut
* @Date: 2020/11/23 15:50
*/
@GetMapping("/delDefinition")
public AjaxResponse delDefinition(@RequestParam("depID") String deploymentID,
@RequestParam("pdID") String pdID){
try {
activitiMapper.DeleteFormData(pdID);
repositoryService.deleteDeployment(deploymentID,true);
return AjaxResponse.AjaxData(GlobalConfig.ResponseCode.SUCCESS.getCode(),"删除成功",null);
}catch (Exception e){
return AjaxResponse.AjaxData(GlobalConfig.ResponseCode.ERROR.getCode(),"删除失败",
e.toString());
}
}
activity7 获取流程列表及部署列表
最新推荐文章于 2022-12-24 11:25:46 发布