# demo39 **Repository Path**: FlowableDemo/demo39 ## Basic Information - **Project Name**: demo39 - **Description**: 解析自定义属性,并根据在服务节点根据自定义扩展属性动态指定分配人。 多实例任务执行完后定时发邮件 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2019-01-21 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ------ 环境: [jkd8+]() [mysql5.6+]() ## 一、根据自定义扩展属性,通过服务节点给下一个任务节点配置人 - 定义服务节点处理类 ```java public class AssignToAuditorDelegate implements JavaDelegate,HmXMLConstants { public void execute(DelegateExecution execution) { FlowElement flowElement = execution.getCurrentFlowElement(); FlowNode flowNode = (FlowNode) flowElement; List sequenceFlows = flowNode.getOutgoingFlows(); if (sequenceFlows.size() > 0) { SequenceFlow sequenceFlow = sequenceFlows.get(0); if (sequenceFlow !=null) { FlowElement targetFlowElement = sequenceFlow.getTargetFlowElement(); if( targetFlowElement instanceof UserTask) { String approval = targetFlowElement.getAttributeValue(NAMESPACE, APPROVAL); System.out.println("下一个审核节点: " + approval); if ("主管审2".equals(approval)) { execution.setVariable("assignees", Arrays.asList("manager1","manager2","manager3")); }else if ("总监审3-1".equals(approval)) { execution.setVariable("assignees", Arrays.asList("boss31","boss32","boss33")); }else if ("总监审3".equals(approval)) { execution.setVariable("assignees", Arrays.asList("boss")); }else { execution.setVariable("assignees", Arrays.asList("admin")); } } } } } } ``` ## 二、定时任务 三种方式指定定时执行: - **timeDate**方式 ``` 2019-01-21T12:13:14 ``` - **timeDuration**方式 ``` PT10D ``` - **timeCycle**方式 ``` R3/PT10H ``` ## 三、开启定时配置开关 - 在flowable-context.xml配置定时开关 ``` ``` ## 四、邮件配置 - 在flowable-context.xml配置邮件信息 ``` ``` ## 五、实践测试 - 运行demo - 完成所有任务后执行sleep方法