|
发表于 2016-9-19 14:54:27
|
显示全部楼层
目前没有完整的例子
可以在流转查询后事件中通过ProcessControl获取到task设置扩展字段的值,Task中提供的有setRelationValue(String name, Object value) 设置任务关系的值要先理解了
在/BIZ/system/logic/code/dsrc/ProcessPushEngine.java中加一个获取ProcessControl获取扩展字段的值如下:
List<ProcessControlItem> items = ProcessUtils.getProcessContext().getProcessControl().getNotices();
for (ProcessControlItem item : items){
item.getTask().getRelationValue("XX");
}
获取PI如下:
Set<Task> notices = new HashSet<Task>();
ProcessInstance pi = ProcessUtils.getPI();
for (Task t : pi.getTask().getChildren()){
if ("xxx".equals(t.getRelationValue("sExxxx1")) && TaskKind.NOTICE.equals(t.getKind())){
notices.add(t);
}
}
把红色的改为PI中task的中扩展字段的值给ProcessControl中扩展字段的值做比较,如果相等就把task的值放到Set中
然后自己遍历Set发通知,可以参考
- for (Task t : next.getTask().getExecutorTasks()){
- sendMessage(t);
- String status = t.getStatus();
- if (TaskStatus.READY.equals(status) || TaskStatus.EXECUTING.equals(status)){
- String name = t.getName();
- String url = t.getEURL();
- if (SystemUtils.isNotEmptyString(url)){
- url += (url.contains("?") ? "&" : "?");
- url = url + "task=" + t.getId() + "&process=" + t.getProcess() + "&activity=" + t.getActivity();
-
- if (url.startsWith("/")){
- url = JustepConfig.getUIServer() + url;
- }
- logger.info("message: " + name + ", url: " + url + ", person: " + t.getExecutorFID() + ", " + t.getExecutorFName());
- Message msg = new Message(name, url, null);
- Set<String> personIDs = new HashSet<String>();
- personIDs.add(t.getExecutorFID());
- MessageDispatcherFactory.createMessageDispatcher(JustepConfig.getMqttServer()).sendMessage(msg, personIDs);
- }
- }
- }
复制代码
|
|