process中的通知规则可以设置通知时机为结束时
但是目前的版本在onAfterFinish事件中获取不到此通知的任务ID,要获取任务ID需要如下处理
1.在process的onBeforeAdvance事件中SA_Task中扩展字段上设置一个随机值,并把这个随机值放到当前的RequestContext
public static void noticeFlowProcessBeforeAdvance() { ProcessControl control = (ProcessControl) ContextHelper.getActionContext().getParameter("control"); String uuid = UUID.randomUUID().toString().toUpperCase().replaceAll("-", ""); for (ProcessControlItem item : control.getNotices()) { item.getTask().setRelationValue("sESField08", uuid); } ContextHelper.getRequestContext().put("notice", uuid); }
2.在process的onAfterAdvance事件中获取当前的RequestContext中存储的值,然后写KSQL到SA_Task中过滤数据获取任务ID
public static void noticeFlowProcessAfterAdvance() { String sESField08 = (String) ContextHelper.getRequestContext().get("notice"); String task = ""; String ksql = "Select task from SA_Task task where task.sESField08='" + sESField08 + "'"; Table table = KSQL.select(ksql, null, "/system/data", null); if (table.size() > 0) { Row row = table.iterator().next(); task = row.getString("task"); } System.out.println("==========task=========" + task); }
评一波