1、演示

03.flowable 流程模板部署_后缀名

2、代码

public ReturnVo<String> deploy(String modelId) {
ReturnVo<String> returnVo = new ReturnVo<>(ReturnCode.FAIL, "部署流程失败!");
if (StringUtils.isBlank(modelId)) {
returnVo.setMsg("模板ID不能为空!");
return returnVo;
}
try {
Model model = modelService.getModel(modelId.trim());
//到时候需要添加分类
String categoryCode = "1000";
BpmnModel bpmnModel = modelService.getBpmnModel(model);
//添加隔离信息
String tenantId = "flow";
//必须指定文件后缀名否则部署不成功
Deployment deploy = repositoryService.createDeployment()
.name(model.getName())
.key(model.getKey())
.category(categoryCode)
.tenantId(tenantId)
.addBpmnModel(model.getKey() + ".bpmn", bpmnModel)
.deploy();
returnVo.setData(deploy.getId());
returnVo.setMsg("部署流程成功!");
returnVo.setCode(ReturnCode.SUCCESS);
} catch (Exception e) {
e.printStackTrace();
returnVo.setMsg(String.format("部署流程异常!- %s", e.getMessage()));
}
return returnVo;
}