|
楼主 |
发表于 2018-3-1 11:39:43
|
显示全部楼层
本帖最后由 boolean 于 2018-3-1 11:48 编辑
做了个3环节的流程,速度还是一样的。
是接管了流程事件,advanceProcessQueryListener事件如下
public static void advanceProcessQueryListener() {
System.out.println("advanceProcessQueryListener开始:"+new Date().getTime());
ProcessControl control = ProcessUtils.getProcessContext().getProcessControl();
String sData1 = ProcessUtils.getProcessData1();//业务数据fid
String sFlowID = ProcessUtils.getProcessContext().getTask().getFlow();//流程实例ID 避免相同数据走多次流程用 2016-07-01
control.setSaveHistory(false);
control.setDialogEnabled(false);
for (ProcessControlItem to : control.getFlowTos()){
if(!to.isEnd()) {
List<List<String>> list = new ArrayList<List<String>>();
String activityLabel = to.getTask().getActivityName();//环节名称
String sExecutorFIDS = (String) BizUtils.getRelationValue("OA_FLOW_CONFIG", null, "(OA_FLOW_CONFIG.ActivityLabel = '" + activityLabel + "') AND (OA_FLOW_CONFIG.DataID = '" + sData1 + "') AND (OA_FLOW_CONFIG.FlowID = '"+sFlowID+"' or OA_FLOW_CONFIG.FlowID is null)", null, "sExecutorFID", "/ProjectManager/DataDicMgr/data");
String[] arrIDS = sExecutorFIDS.split(",");
String project_code="";
for(String id : arrIDS) {
List<String> list2 = new ArrayList<String>();
String fids = id.substring(id.lastIndexOf("/")+1,id.lastIndexOf("."));
list2.add(fids.split("@")[1]);list2.add(fids.split("@")[0]);list.add(list2);
String person_id = ContextHelper.getPerson().getID();
project_code = (String) BizUtils.getRelationValue("SA_Task", null, "(SA_Task.sFlowID = '" + sFlowID + "')", null, "sESField04", "/system/data");
if(project_code!=null&&!"".equals(project_code)){
String user_project = (String) BizUtils.getRelationValue("USER_PROJECT", null, "(USER_PROJECT.PROJECT_CODE = '" + project_code + "') AND (USER_PROJECT.MasterID = '" + person_id + "')", null, "MasterID", "/ProjectManager/DataDicMgr/data");
if(user_project==null||"".equals(user_project)){
String instersql = "insert into USER_PROJECT (fid,project_code,MasterID,version) values ('"+CommonUtils.createGUID()+"','"+project_code+"','"+person_id+"',0)";
HashMap<String,String> sqlMap = new HashMap<String,String>();
sqlMap.put(DatabaseProduct.ORACLE.name(),instersql);
SQL.executeUpdate(sqlMap,null,DataModel);
String upsql = "update SA_OPPerson t set t.sEnglishName = '合同列表' where t = '" + person_id + "'";
KSQL.executeUpdate(upsql, null, "/system/data", null);
}
}
}
List<OrgUnit> listOrg = OrgUtils.findPersonMembersByIDList(list);
//修改默认执行者
to.clearExecutors();
to.addExecutors(listOrg);
to.setTaskAssignMode("together");//设置任务分配模式共同
to.addTaskRelation("sExecuteMode", TaskExecuteMode.SIMULTANEOUS);//设置执行模式同时
}
}
System.out.println("advanceProcessQueryListener结束:"+new Date().getMinutes());
}
从tomcat控制台信息看,是在走这个事件之前就慢。
|
|