工作流实战_03_flowable 流程模板部署
转载
由于群里有些朋友对这个flowable还不是 很熟悉,在群里的小伙伴的建议下,师傅(小学生05101)制作一个开源的项目源码,一共大家学习和交流,希望对有帮助,少走弯路 如果有不懂的问题可以入群:633168411 里面都是一些热心肠的人。

用户名
| 密码
|
0000001
| test
|
0000002
| test
|
0000003
| test
|
0000004
| test
|
文章目录
1. 演示

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;
}