一.流程定义定时激活
之前介绍流程定义的时候,流程都是定义好之后立马就激活了,其实在流程定义的这个过程中,我们还可以设置一个激活时间,也就是流程定义好之后,并不会立马激活(不激活就不能据此流程定义创建新流程),而是在延迟某一个固定时间之后,才会激活,代码如下:
@RestController
public class ProcessDeployController {
@Autowired
RepositoryService repositoryService;
@PostMapping("/deploy")
public RespBean deploy(MultipartFile file,String tenantId) throws IOException {
System.out.println(new Date());
DeploymentBuilder deploymentBuilder = repositoryService.createDeployment()
.category("javaboy的工作流分类")
.name("javaboy的工作流名称")
.addInputStream("fff.bpmn", file.getInputStream())
.tenantId(tenantId)
.activateProcessDefinitionsOn(new Date(System.currentTimeMillis() + 1000 * 60))
.key("javaboy的工作流key666");