首页 > 代码库 > 流向过滤
流向过滤
1.通过配置数据字典进行流向的过滤
(1)字典表中增加【bpm_transition_rule】
字典项表中增加净值总额字典项【total_money】
(2)流程图中在流向上(通常是两个以上流向)配置逻辑运算
表示当净值总额大于100时候显示该流向,如果配置两个维度则不用写值了,两个维度如果都配置值表示两个维度进行比较来进行逻辑运算
该值在页面隐藏域中进行传递,隐藏域中传值 就是拿定义好的数据字典项的CODE值 作为隐藏域的 name属性 ,例如:
<div id="bizArgs"> <input type="hidden" id="TOTAL_MONEY" name="TOTAL_MONEY" value="http://www.mamicode.com/${BaseForm.money}" /><!-- 净值总额 --></div>
2. 通过自定类进行流向过滤
(1)增加过滤器继承TransitionFilter 并覆盖filter方法,在该方法中获得业务id,通过业务id判断应该返回下一节点的名字,参考代码
public class SupTrans implements TransitionFilter { @Override public String[] filter(TransitionFilterInfo arg0) { FASWorkflowlService fasWorkflowlService =(FASWorkflowlService) SpringBeanFactory.getBean("fasWorkflowlService"); SupplierService supplierService = (SupplierService) SpringBeanFactory.getBean("supplierService"); String businessId = ""; String orderType = ""; try { JbpmWorkflowHistory his = WorkflowServiceUtil.getJbpmWorkflowHistory(arg0.getProcessInstanceId(), arg0.getTaskInstanceId()); businessId = his.getBusinessId(); orderType = his.getOrderType(); } catch (Exception e) { e.printStackTrace(); } WorkOrder oper = fasWorkflowlService.getWorkOrderByWoNo(orderType,businessId); String impDeg = supplierService.findByPrimaryKey(oper.getBusinessId()).getImportanceDegree(); if("1".equals(impDeg)){ return new String[]{"采购部审批"}; } return new String[]{"财务部审批"}; }}
(2)数据字典配置过滤器
字典表中增加字典【bpm_transition_class】
字典项表中增加
insert into arch_dic_item (RID, KIND, CODE, PARENT_ID, DETAIL, SPELL, WHOLE_SPELL, REMARK, SORT, FLAG, CREATED_BY, LAST_UPDATED_BY, CREATED_DATE, LAST_UPDATED_DATE, CUST_TEXT01, CUST_TEXT02, CUST_TEXT03, CUST_TEXT04, CUST_TEXT05, CUST_TEXT06, CUST_TEXT07, CUST_TEXT08, CUST_TEXT09, CUST_NUMBER01, CUST_NUMBER02, CUST_DATE01, CUST_DATE02)
values (‘402886ef449521a30144969d7d99000d‘, ‘bpm_transition_class‘, ‘com.pccw.business.fas.supplier.filter.SupTrans‘, ‘‘, ‘供应商重要程度判断‘, ‘‘, ‘‘, ‘‘, 0, ‘Y‘, ‘1‘, ‘2c9082c2454ebaab01454ecbcbfe031c‘, ‘06-3月 -14 04.58.27.609000 下午‘, ‘28-4月 -14 05.57.41.968000 下午‘, ‘‘, ‘‘, ‘‘, ‘‘, ‘‘, ‘‘, ‘‘, ‘‘, ‘‘, null, null, ‘‘, ‘‘);
(3)流程图中配置数据字典