泛微 E8 配置自定义触发流程

2023-10-08 15:59

本文主要是介绍泛微 E8 配置自定义触发流程,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

在新公司接了个配置泛微流程触发的活。因为泛微的官方文档并没有详细的操作指引,在测试环境配置之后、要触发的流程可以手工提交,但是触发一直不成功。经过修复,实现了触发推送。简单记录下业务场景和其他处理信息,以供参考。

应用版本

目前使用了泛微 E8 (8.100.0531)的版本。2018年上线的老系统了。

业务场景

目前使用的泛微 OA 启用了“会议”应用。我们需要定时抓取会议状态为“退回”和“取消”的会议、并将每一条记录自动转化为一个流程发送出去。我们选取了会议应用的 Meeting 表(会议管理表详细信息),并选择 “meetingstatus” 字段作为会议状态的来源。通过文档得知:当会议状态为“退回”,字段取值 3 ;当会议状态为“取消”,字段取值 4 。

 设置的自定义表单 / 流程如下图所示, 目前手工提交 / 流转均正常操作:

处理步骤

首先配置了回写部分,但是不成功。根据 2012 - 2016 年的资料,文档是这么记录的。

1:该流程自动触发时,将根据外部主表条件搜索外部主表,有多少条记录即触发多少条流程;
流程主字段的值来源于外部主表,而每条流程的各明细值将分别根据明细表条件搜索明细表
得到的结果进行赋值;主表中必须包含主键(默认为id)
2:条件以“where”开头,如:“where fieldname1=1 and fieldname2='value2'”;
回写设置以“set”开头,如:“set flag=1,isok=true”,FtriggerFlag和requestid字段
自动更新,不能在此设置;
3:流程触发时如果需要回写外部主表,需要设置是否回写、流程ID字段、标志字段、标志字段
需要回写的值(字符型),回写数据时,默认标志字段=1:表示已触发,
流程ID字段=0:表示流程创建人对应的外部字段值为空,
流程ID字段=-1:表示外部字段保存的人员信息在oa中不存在,流程ID
4:外部明细表数据如需与主表数据关联,可将外部明细表条件设置为
“where '明细表.字段'='主表.字段'”。

非常 ... 语焉不详。我怀疑当年这个屌茅甚至喝大了。:)

配置数次无果之后,泛微的工程师提醒我找下日志。根据操作日期,我分别在服务器下载了泛微应用目录下的   ecology/log/integration/integration.log ecology/log/ecologyResin/log/stderr.logResin/log/stdout.log 这几个文件。

打开 integration.log 文件。发现触发的过程报错、 提示 CREATER 在外部表不存在。

2023-08-18 00:00:14,812 INFO  [Thread:AutoWorlflowThread] weaver.general.AutoWorlflowThread.saveTrigLog() - saveTrigLog 记录日志 sql : update outerdatawfdetail set requestid=-1 where mainid=11 and workflowid=466 and outermaintable = 'Meeting' and keyfieldvalue='141'
2023-08-18 00:00:14,827 INFO  [Thread:AutoWorlflowThread] weaver.general.AutoWorlflowThread.doActiveOutDataWF() - 检查是否已触发 : select 1 from outerdatawfdetail where workflowid=466 and mainid=11 and keyfieldvalue='142' and outermaintable = 'Meeting' and requestid>0
2023-08-18 00:00:14,827 INFO  [Thread:AutoWorlflowThread] weaver.general.AutoWorlflowThread.doActiveOutDataWF() - ===================SQL:select * from outerdatawfsetdetail where (wffieldid=-1 or wffieldid=-2) and mainid=11 order by wffieldid
2023-08-18 00:00:14,827 ERROR [Thread:AutoWorlflowThread] weaver.general.AutoWorlflowThread.doActiveOutDataWF() - THE CREATER IN THE OUTER TABLE IS NOT EXIST!

于是找到应用的源代码。

package weaver.general;import java.io.Writer;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import oracle.sql.CLOB;
import weaver.conn.ConnStatement;
import weaver.conn.RecordSet;
import weaver.conn.RecordSetDataSource;
import weaver.hrm.resource.ResourceComInfo;
import weaver.integration.logging.Logger;
import weaver.integration.logging.LoggerFactory;
import weaver.system.SysCreateWF;
import weaver.system.SysUpdateWF;
import weaver.system.ThreadWork;
import weaver.workflow.automatic.automaticconnect;
import weaver.workflow.dmlaction.DBTypeUtil;
import weaver.workflow.request.RequestManager;
import weaver.workflow.workflow.WorkflowComInfo;
import weaver.workflow.workflow.WorkflowVersion;public class AutoWorlflowThread extends BaseBean implements ThreadWork {private Logger newlog = LoggerFactory.getLogger(AutoWorlflowThread.class);public void doThreadWork() {Thread.currentThread().setUncaughtExceptionHandler(new AutoWorkFlowThreadExceptionHandler());doActiveOutDataWF();}public void doActiveOutDataWF() {automaticconnect automaticconnect = new automaticconnect();Connection connection = null;String str = "";try {WorkflowComInfo workflowComInfo = new WorkflowComInfo();ResourceComInfo resourceComInfo = new ResourceComInfo();SysCreateWF sysCreateWF = new SysCreateWF();RecordSet recordSet1 = new RecordSet();RecordSet recordSet2 = new RecordSet();ArrayList<String> arrayList1 = new ArrayList();ArrayList<String> arrayList2 = new ArrayList();ArrayList<String> arrayList3 = new ArrayList();ArrayList<String> arrayList4 = new ArrayList();ArrayList<String> arrayList5 = new ArrayList();ArrayList<String> arrayList6 = new ArrayList();ArrayList<String> arrayList7 = new ArrayList();ArrayList<String> arrayList8 = new ArrayList();ArrayList<String> arrayList9 = new ArrayList();ArrayList<String> arrayList10 = new ArrayList();ArrayList<String> arrayList11 = new ArrayList();ArrayList<String> arrayList12 = new ArrayList();ArrayList<String> arrayList13 = new ArrayList();ArrayList<String> arrayList14 = new ArrayList();ArrayList<String> arrayList15 = new ArrayList();ArrayList<String> arrayList16 = new ArrayList();ArrayList<String> arrayList17 = new ArrayList();WorkflowVersion workflowVersion = new WorkflowVersion();recordSet1.executeSql("select * from outerdatawfset");while (recordSet1.next()) {String str1 = Util.null2String(recordSet1.getString("id"));String str2 = Util.null2String(recordSet1.getString("workflowid"));String str3 = Util.null2String(recordSet1.getString("datasourceid"));String str4 = Util.null2String(recordSet1.getString("outermaintable"));String str5 = Util.null2String(recordSet1.getString("keyfield"));String str6 = Util.null2String(recordSet1.getString("datarecordtype"));String str7 = Util.null2String(recordSet1.getString("requestid"));String str8 = Util.null2String(recordSet1.getString("FTriggerFlag"));String str9 = Util.null2String(recordSet1.getString("FTriggerFlagValue"));String str10 = Util.null2String(recordSet1.getString("outermainwhere"));String str11 = Util.null2String(recordSet1.getString("successback"));String str12 = Util.null2String(recordSet1.getString("failback"));String str13 = Util.null2String(recordSet1.getString("outerdetailtables"));String str14 = Util.null2String(recordSet1.getString("outerdetailwheres"));String str15 = Util.null2String(recordSet1.getString("isnextnode"));String str16 = Util.null2String(recordSet1.getString("isupdatewfdata"));String str17 = Util.null2String(recordSet1.getString("isupdatewfdataField"));arrayList1.add(str1);arrayList2.add(str2);arrayList3.add(str3);arrayList4.add(str4);arrayList15.add(str15);arrayList16.add(str16);arrayList17.add(str17);arrayList5.add(str5);arrayList6.add(str6);arrayList7.add(str7);arrayList8.add(str8);arrayList9.add(str9);arrayList10.add(str10);arrayList11.add(str11);arrayList12.add(str12);arrayList13.add(str13);arrayList14.add(str14);} RecordSet recordSet3 = new RecordSet();for (byte b = 0; b < arrayList1.size(); b++) {try {String str1 = arrayList1.get(b);recordSet3.executeSql("select mainid from outerdatawfsetdetail where mainid=" + str1);if (!recordSet3.next()) {this.newlog.error("+ str1 + ");} else {String str2 = arrayList2.get(b);String str3 = WorkflowVersion.getActiveVersionWFID(str2);String str4 = arrayList3.get(b);if (!str4.equals("")) {connection = automaticconnect.getConnection("datasource." + str4);if (connection != null && !connection.isClosed()) {str = automaticconnect.getDBType();Statement statement1 = connection.createStatement();Statement statement2 = connection.createStatement();ResultSet resultSet = null;String str5 = arrayList4.get(b);String str6 = arrayList5.get(b);String str7 = arrayList6.get(b);String str8 = arrayList7.get(b);String str9 = arrayList8.get(b);String str10 = arrayList9.get(b);String str11 = arrayList15.get(b);String str12 = arrayList16.get(b);String str13 = arrayList17.get(b);if ("".equals(str10))str10 = "1"; String str14 = arrayList10.get(b);String str15 = arrayList11.get(b);String str16 = arrayList12.get(b);String str17 = arrayList13.get(b);String str18 = arrayList14.get(b);RecordSetDataSource recordSetDataSource = new RecordSetDataSource();Map map = new HashMap<Object, Object>();if (!str4.equals(""))map = recordSetDataSource.getAllColumnWithTypes(str4, str5); String str19 = "";if (str.toLowerCase().indexOf("oracle") > -1) {str19 = "select 1 from user_tables a where a.TABLE_NAME = upper('" + str5 + "') union ALL select 1 from user_views b where  b.VIEW_NAME = upper('" + str5 + "')";} else if (str.toLowerCase().indexOf("sqlserver") > -1 || str.toLowerCase().indexOf("sybase") > -1) {str19 = "select 1 from sysobjects where name = '" + str5 + "' ";} else if (str.toLowerCase().indexOf("informix") > -1) {str19 = "select 1 from systables where lower(tabname) = lower('" + str5 + "') ";} else if (str.toLowerCase().indexOf("mysql") > -1) {str19 = "select 1 from information_schema.Tables where LOWER(Table_Name)=LOWER('" + str5 + "') ";} else if (str.toLowerCase().indexOf("db2") > -1) {str19 = "select 1 from SYSIBM.SYSTABLES where lower(name)= lower('" + str5 + "') ";} else {str19 = "select 1 from " + str5;} resultSet = statement1.executeQuery(str19);if (!resultSet.next()) {this.newlog.error("TABLE " + str5 + " IS NOT EXIST!");} else {ArrayList<String> arrayList = new ArrayList();Hashtable<Object, Object> hashtable1 = new Hashtable<Object, Object>();Hashtable<Object, Object> hashtable2 = new Hashtable<Object, Object>();Hashtable<Object, Object> hashtable3 = new Hashtable<Object, Object>();Hashtable<Object, Object> hashtable4 = new Hashtable<Object, Object>();Hashtable<Object, Object> hashtable5 = new Hashtable<Object, Object>();Hashtable<Object, Object> hashtable6 = new Hashtable<Object, Object>();Hashtable<Object, Object> hashtable7 = new Hashtable<Object, Object>();String str20 = "";int i = Util.getIntValue(Util.null2String(workflowComInfo.getIsBill(str2)), -1);String str21 = Util.null2String(workflowComInfo.getFormId(str2));if (i == 0) {str20 = "select workflow_formfield.fieldid as id,fieldname as name,workflow_fieldlable.fieldlable as label,workflow_formdict.fieldhtmltype as htmltype,workflow_formdict.type as type,workflow_formdict.fielddbtype from workflow_formfield,workflow_formdict,workflow_fieldlable where workflow_fieldlable.formid = workflow_formfield.formid and workflow_fieldlable.isdefault = 1 and workflow_fieldlable.fieldid =workflow_formfield.fieldid and workflow_formdict.id = workflow_formfield.fieldid and workflow_formfield.formid=" + str21;} else if (i == 1) {str20 = "select id as id,fieldname as name,fieldlabel as label,fieldhtmltype as htmltype,type as type,fielddbtype from workflow_billfield where viewtype=0 and billid = " + str21 + " order by dsporder ";} recordSet1.executeSql(str20);while (recordSet1.next()) {String str23 = recordSet1.getString("id");String str24 = recordSet1.getString("name");String str25 = recordSet1.getString("htmltype");String str26 = recordSet1.getString("type");String str27 = recordSet1.getString("fielddbtype");String str28 = "";String str29 = "";String str30 = "";recordSet2.executeSql("select outerfieldname,changetype,customsql from outerdatawfsetdetail where wffieldid=" + str23 + " and mainid=" + str1);if (recordSet2.next()) {str28 = recordSet2.getString("outerfieldname");str29 = recordSet2.getString("changetype");str30 = recordSet2.getString("customsql");} arrayList.add(str23);hashtable1.put(str23, str24);hashtable2.put(str23, str25);hashtable3.put(str23, str26);hashtable4.put(str23, str27);hashtable5.put(str23, str28);hashtable6.put(str23, str29);hashtable7.put(str23, str30);} if (str14.equals(""))str14 = " where 1=1  "; if ("2".equals(str7) || "".equals(str7)) {str14 = str14 + " and ((1=1 ";if (str.toLowerCase().indexOf("oracle") > -1) {if (!"".equals(str8))str14 = str14 + " and nvl(" + str8 + ",'0')='0' "; if (!"".equals(str9) && !"".equals(str10))str14 = str14 + " and nvl(" + str9 + ",'0')!='" + str10 + "' "; } else if (str.toLowerCase().indexOf("sqlserver") > -1 || str.toLowerCase().indexOf("sybase") > -1) {if (!"".equals(str8))str14 = str14 + " and isnull(" + str8 + ",'0')='0' "; if (!"".equals(str9) && !"".equals(str10))str14 = str14 + " and isnull(" + str9 + ",'0')!='" + str10 + "' "; } else if (str.toLowerCase().indexOf("informix") > -1) {if (!"".equals(str8))str14 = str14 + " and " + str8 + " is null "; if (!"".equals(str9) && !"".equals(str10))str14 = str14 + " and " + str9 + "!='" + str10 + "' "; } else if (str.toLowerCase().indexOf("mysql") > -1) {if (!"".equals(str8))str14 = str14 + " and IFNULL(" + str8 + ",'0')='0' "; if (!"".equals(str9) && !"".equals(str10))str14 = str14 + " and IFNULL(" + str9 + ",'0')!='" + str10 + "' "; } else if (str.toLowerCase().indexOf("db2") > -1) {if (!"".equals(str8))str14 = str14 + " and coalesce(" + str8 + ",'0')='0' "; if (!"".equals(str9) && !"".equals(str10))str14 = str14 + " and coalesce(" + str9 + ",'0')!='" + str10 + "' "; } else {if (!"".equals(str8))str14 = str14 + " and " + str8 + " is null "; if (!"".equals(str9) && !"".equals(str10))str14 = str14 + " and " + str9 + "!='" + str10 + "' "; } str14 = str14 + " ) ";if (str12.equals("2") && !str13.equals(""))str14 = str14 + " or " + str13 + "='1' "; str14 = str14 + " ) ";} this.newlog.info("select * from " + str5 + " " + str14);ResultSet resultSet1 = statement1.executeQuery("select * from " + str5 + " " + str14);String str22 = "";while (resultSet1.next()) {try {if ("2".equals(str7) || "".equals(str7)) {if (str6.equals(""))str6 = "id"; if (str9.equals(""))str9 = "FTriggerFlag"; if (str8.equals(""))str8 = "requestid"; } String str23 = resultSet1.getString(str6).replace("'", "''");boolean bool1 = false;if (str12.equals("2") && !str13.equals("")) {String str27 = Util.null2String(resultSet1.getString(str13));if (str27.equals("1"))bool1 = true; } if (bool1)this.newlog.info("." + str13 + "=" + Util.null2String(resultSet1.getString(str13))); boolean bool2 = false;str22 = "select 1 from outerdatawfdetail where workflowid=" + str2 + " and mainid=" + str1 + " and keyfieldvalue='" + str23 + "' and outermaintable = '" + str5 + "' and requestid>0";this.newlog.info(": " + str22);recordSet1.executeSql(str22);if (recordSet1.next()) {this.newlog.info("keyid : " + str23 + " );bool2 = true;} if (!bool1 && bool2)continue; String str24 = "";String str25 = "";ArrayList<Integer> arrayList18 = new ArrayList();boolean bool3 = false;recordSet1.executeSql("select * from outerdatawfsetdetail where (wffieldid=-1 or wffieldid=-2) and mainid=" + str1 + " order by wffieldid");this.newlog.info("===================SQL:select * from outerdatawfsetdetail where (wffieldid=-1 or wffieldid=-2) and mainid=" + str1 + " order by wffieldid");while (recordSet1.next()) {String str27 = Util.null2String(recordSet1.getString("wffieldid"));if (str27.equals("-2")) {String str28 = Util.null2String(recordSet1.getString("outerfieldname"));String str29 = Util.null2String(recordSet1.getString("changetype"));String str30 = Util.null2String(recordSet1.getString("customsql"));if (str29.equals("5")) {str25 = Util.null2String(getCreater(str28, "5"));if (str25.equals("")) {this.newlog.error("THE CREATER IN THE OUTER TABLE IS NOT EXIST!");if ("2".equals(str7) || "".equals(str7))saveOutTrigLog(statement2, str5, str16, str6, str9, str8, str23, str10, "-1"); if (str12.equals("2") && !str13.equals(""))saveUpdateWfFlag(statement2, str5, str6, str23, str12, str13); saveTrigLog(str3, "-1", str1, str23, str5);bool3 = true;break;} continue;} if (str29.equals("6")) {if (str28.indexOf(".") > -1)str28 = str28.substring(str28.indexOf(".") + 1); String str32 = Util.null2String(resultSet1.getString(str28));if (!"".equals(str30)) {str30 = str30 + " and status<4  and (loginid !='' Or  loginid is not  null) ";str25 = getTranSqlValue(str30, str32);} else {str25 = str32;} if (str25.equals("")) {this.newlog.error("THE CREATER IN THE OUTER TABLE IS NOT EXIST!");if ("2".equals(str7) || "".equals(str7))saveOutTrigLog(statement2, str5, str16, str6, str9, str8, str23, str10, "-1"); if (str12.equals("2") && !str13.equals(""))saveUpdateWfFlag(statement2, str5, str6, str23, str12, str13); saveTrigLog(str3, "-1", str1, str23, str5);bool3 = true;break;} continue;} if (str28.equals("")) {this.newlog.error(");str25 = "1";continue;} str28 = str28.substring(str28.indexOf(".") + 1);String str31 = Util.null2String(resultSet1.getString(str28));if (str31.equals("")) {this.newlog.error("VALUE OF THE FIELD IN THE OUTER TABLE IS NULL!");if ("2".equals(str7) || "".equals(str7))saveOutTrigLog(statement2, str5, str16, str6, str9, str8, str23, str10, "0"); if (str12.equals("2") && !str13.equals(""))saveUpdateWfFlag(statement2, str5, str6, str23, str12, str13); saveTrigLog(str3, "0", str1, str23, str5);bool3 = true;break;} str25 = Util.null2String(getCreater(str31, str29));if (str25.equals("")) {this.newlog.error("THE CREATER IN THE OUTER TABLE IS NOT EXIST!");if ("2".equals(str7) || "".equals(str7))saveOutTrigLog(statement2, str5, str16, str6, str9, str8, str23, str10, "-1"); if (str12.equals("2") && !str13.equals(""))saveUpdateWfFlag(statement2, str5, str6, str23, str12, str13); saveTrigLog(str3, "-1", str1, str23, str5);bool3 = true;break;} continue;} if (str27.equals("-1")) {String str28 = Util.null2String(recordSet1.getString("outerfieldname"));String str29 = Util.null2String(workflowComInfo.getWorkflowname(str3));String str30 = Util.toScreen(resourceComInfo.getResourcename(str25), 7);String str31 = "";Calendar calendar = Calendar.getInstance();str31 = Util.add0(calendar.get(1), 4) + "-" + Util.add0(calendar.get(2) + 1, 2) + "-" + Util.add0(calendar.get(5), 2);DateUtil dateUtil = new DateUtil();if (str28.equals("")) {str24 = Util.null2String(dateUtil.getWFTitleNew("" + str3, "" + str25, "" + str30, "1"));if (str24.equals(""))str24 = str29 + "-" + str30 + "-" + str31; continue;} str28 = str28.substring(str28.indexOf(".") + 1);String str32 = Util.null2String(resultSet1.getString(str28));if (!str32.equals("")) {str24 = str32;continue;} str24 = Util.null2String(dateUtil.getWFTitleNew("" + str3, "" + str25, "" + str30, "1"));if (str24.equals(""))str24 = str29 + "-" + str30 + "-" + str31; } } if (bool3)continue; for (byte b1 = 0; b1 < arrayList.size(); b1++) {String str27 = Util.null2String(arrayList.get(b1));String str28 = Util.null2String((String)hashtable1.get(str27));if (!str28.equals("")) {String str29 = Util.null2String((String)hashtable2.get(str27));String str30 = Util.null2String((String)hashtable3.get(str27));String str31 = Util.null2String((String)hashtable4.get(str27));String str32 = Util.null2String((String)hashtable5.get(str27));String str33 = Util.null2String((String)hashtable6.get(str27));String str34 = Util.null2String((String)hashtable7.get(str27));String str35 = "";if (!str32.equals("")) {str32 = str32.substring(str32.indexOf(".") + 1);String str36 = (String)map.get(str32.toLowerCase());if (str36.contains("("))str36 = str36.substring(0, str36.indexOf("(")); if (str36.equals("number") || str36.equals("NUMBER") || str36.equals("float") || str36.equals("Real") || str36.equals("real")) {str35 = Util.null2String(resultSet1.getString(str32));if (str35.startsWith("."))str35 = "0" + str35; if (str35.startsWith("-."))str35 = str35.replaceFirst("-.", "-0."); } else {str35 = Util.null2String(resultSet1.getString(str32));} if (!"6".equals(str33)) {if (str29.equals("3"))if (str30.equals("1")) {str35 = getCreater(str35, str33);} else if (str30.equals("4")) {str35 = getDept(str35, str33);} else if (str30.equals("164")) {str35 = getSubCom(str35, str33);}  } else if (!"".equals(str34)) {str35 = getTranSqlValue(str34, str35);} } if (str35.equals("")) {if (str29.equals("4")) {arrayList18.add(Integer.valueOf(0));} else if (!str29.equals("6") && !str29.equals("2") && (!str29.equals("1") || (!str30.equals("1") && !str30.equals("5"))) && (!str29.equals("3") || (!str30.equals("2") && !str30.equals("19") && !str30.equals("161") && !str30.equals("162")))) {arrayList18.add(null);} else {arrayList18.add("");} } else {if (str31.startsWith("text") || str31.startsWith("char") || str31.startsWith("varchar") || str31.indexOf(".") > -1 || str31.startsWith("clob")) {if (str31.startsWith("char") || str31.startsWith("varchar")) {int k = Util.getIntValue(str31.substring(str31.indexOf("(") + 1, str31.indexOf(")")), 0);if (Util.length2(str35) > k)do {str35 = str35.substring(0, str35.length() - 1);} while (Util.length2(str35) > k); } str35 = str35.replace("'", "''");} else if (str31.equals("int") || str31.equals("integer")) {str35 = Util.getIntValue(str35, 0) + "";} else if (str31.indexOf("decimal") == 0 || str31.indexOf("number") == 0) {str35 = str35.replace(",", "");str35 = Util.getDoubleValue(str35, 0.0D) + "";} else if (str31.indexOf("text") == 0) {str35 = str35.replaceAll("'", "''");} arrayList18.add(str35);} } } if (bool1 && bool2) {String str27 = "";str22 = "select requestid from outerdatawfdetail where workflowid=" + str2 + " and mainid=" + str1 + " and keyfieldvalue='" + str23 + "' and outermaintable = '" + str5 + "' and requestid>0";this.newlog.info(": " + str22);RecordSet recordSet = new RecordSet();recordSet.executeSql(str22);if (recordSet.next())str27 = Util.null2String(recordSet.getString("requestid")); if (str27.equals("")) {this.newlog.info(");continue;} SysUpdateWF sysUpdateWF = new SysUpdateWF();if (sysUpdateWF.updateWorkflowInfo(Util.getIntValue(str3, 0), str24, Util.getIntValue(str25, 1), arrayList18, Util.getIntValue(str27, 0))) {String str28 = str15;if ("2".equals(str7) || "".equals(str7))saveOutTrigLog(statement2, str5, str28, str6, str9, str8, str23, str10, "" + str27); if (str12.equals("2") && !str13.equals(""))saveUpdateWfFlag(statement2, str5, str6, str23, str12, str13); saveTrigLog(str3, "" + str27, str1, str23, str5);saveRequestLog(str1, str23, str3, Util.getIntValue(str27, 0));UpdateIntoDetailTable(statement2, str5, str, str1, str2, Util.getIntValue(str27, 0), str6, str23, str17, str18, str8, str7);continue;} if ("2".equals(str7) || "".equals(str7))saveOutTrigLog(statement2, str5, str16, str6, str9, str8, str23, str10, "0"); if (str12.equals("2") && !str13.equals(""))saveUpdateWfFlag(statement2, str5, str6, str23, str12, str13); saveRequestLog(str1, str23, str3, Util.getIntValue(str27, 0));continue;} this.newlog.info("=======+ str24);sysCreateWF = new SysCreateWF();RequestManager requestManager = sysCreateWF.setWorkflowInfo(Util.getIntValue(str3, 0), str24, 0, Util.getIntValue(str25, 1), arrayList18, false, str11);int j = requestManager.getRequestid();String str26 = str15;if (j > 0) {if ("2".equals(str7) || "".equals(str7))saveOutTrigLog(statement2, str5, str26, str6, str9, str8, str23, str10, "" + j); if (str12.equals("2") && !str13.equals(""))saveUpdateWfFlag(statement2, str5, str6, str23, str12, str13); saveTrigLog(str3, "" + j, str1, str23, str5);saveRequestLog(str1, str23, str3, j);this.newlog.info("****insertIntoDetailTable = " + str + "^^^^^^^^^^^^^:requestid = " + j);insertIntoDetailTable(str4, statement2, str5, str, str1, str2, j, str6, str23, str17, str18, str8, str7);this.newlog.info("+ str11 + ",workflowid=" + str2);if (str11.equals("1"))requestManager.flowNextNode(); continue;} if ("2".equals(str7) || "".equals(str7))saveOutTrigLog(statement2, str5, str16, str6, str9, str8, str23, str10, "0"); if (str12.equals("2") && !str13.equals(""))saveUpdateWfFlag(statement2, str5, str6, str23, str12, str13); saveTrigLog(str3, "-2", str1, str23, str5);saveRequestLog(str1, str23, str3, j);} catch (Exception exception) {this.newlog.error(", exception);} } resultSet1.close();resultSet.close();statement1.close();statement2.close();automaticconnect.closeConnection(connection);} } } } } catch (Exception exception) {this.newlog.error(", exception);} } } catch (Exception exception) {this.newlog.error(", exception);} }public String getTranSqlValue(String paramString1, String paramString2) {paramString2 = paramString2.replace("'", "''");paramString1 = DBTypeUtil.replaceString(paramString1, "{?currentvalue}", paramString2);RecordSet recordSet = new RecordSet();recordSet.executeSql(paramString1);if (recordSet.next())return recordSet.getString(1); return "";}public void insertIntoDetailTable(String paramString1, Statement paramStatement, String paramString2, String paramString3, String paramString4, String paramString5, int paramInt, String paramString6, String paramString7, String paramString8, String paramString9, String paramString10, String paramString11) throws Exception {ResultSet resultSet = null;HashMap<Object, Object> hashMap = new HashMap<Object, Object>();WorkflowComInfo workflowComInfo = new WorkflowComInfo();String str1 = Util.null2String(workflowComInfo.getIsBill(paramString5));String str2 = Util.null2String(workflowComInfo.getFormId(paramString5));ArrayList<String> arrayList1 = new ArrayList();ArrayList<String> arrayList2 = new ArrayList();String str3 = "mainid";String str4 = "";ArrayList<String> arrayList3 = Util.TokenizerString(paramString8, ",");String[] arrayOfString = paramString9.split("\\$@\\|@\\$");ArrayList<String> arrayList4 = new ArrayList();for (byte b1 = 0; b1 < arrayOfString.length; b1++)arrayList4.add(arrayOfString[b1]); RecordSet recordSet = new RecordSet();boolean bool = recordSet.getDBType().equals("oracle");RecordSetDataSource recordSetDataSource = new RecordSetDataSource();boolean bool1 = false;if (!str2.equals(""))if (str1.equals("0")) {recordSet.executeSql("select distinct groupId from Workflow_formfield where formid=" + str2 + " and isdetail='1' order by groupid");while (recordSet.next()) {arrayList1.add("workflow_formdetail");arrayList2.add(recordSet.getString(1));} } else if (str1.equals("1")) {recordSet.executeSql("select tablename from Workflow_billdetailtable where billid=" + str2 + " order by orderid");while (recordSet.next()) {String str = Util.null2String(recordSet.getString(1));if (!str.equals(""))arrayList1.add(recordSet.getString(1)); } recordSet.executeSql("select tablename,detailtablename,detailkeyfield from workflow_bill where id=" + str2);if (recordSet.next()) {str3 = Util.null2String(recordSet.getString("detailkeyfield"));if (arrayList1.size() == 0) {String str5 = Util.null2String(recordSet.getString("detailtablename"));if (!str5.equals(""))arrayList1.add(str5); } String str = recordSet.getString("tablename");recordSet.executeSql("select id from " + str + " where requestid=" + paramInt);if (recordSet.next())str4 = recordSet.getString("id"); } }  if (arrayList1.size() != arrayList3.size()) {writeLog(");return;} for (byte b2 = 0; b2 < arrayList1.size(); b2++) {String str5 = arrayList1.get(b2);String str6 = arrayList3.get(b2);String str7 = "";if (paramString3.toLowerCase().indexOf("oracle") > -1) {str7 = "select 1 from user_tables a where a.TABLE_NAME = upper('" + str6 + "') union ALL select 1 from user_views b where  b.VIEW_NAME = upper('" + str6 + "')";} else if (paramString3.toLowerCase().indexOf("sqlserver") > -1 || paramString3.toLowerCase().indexOf("sybase") > -1) {str7 = "select 1 from sysobjects where name = '" + str6 + "' ";} else if (paramString3.toLowerCase().indexOf("informix") > -1) {str7 = "select 1 from systables where lower(tabname) = lower('" + str6 + "') ";} else if (paramString3.toLowerCase().indexOf("mysql") > -1) {str7 = "select 1 from information_schema.Tables where LOWER(Table_Name)=LOWER('" + str6 + "') ";} else if (paramString3.toLowerCase().indexOf("db2") > -1) {str7 = "select 1 from SYSIBM.SYSTABLES where lower(name)= lower('" + str6 + "') ";} else {str7 = "select 1 from " + str6;} resultSet = paramStatement.executeQuery(str7);if (!resultSet.next()) {this.newlog.error("TABLE " + str6 + " IS NOT EXIST!");} else {Map map = new HashMap<Object, Object>();if (!paramString1.equals(""))map = recordSetDataSource.getAllColumnWithTypes(paramString1, str6); ArrayList<String> arrayList = new ArrayList();Hashtable<Object, Object> hashtable1 = new Hashtable<Object, Object>();Hashtable<Object, Object> hashtable2 = new Hashtable<Object, Object>();Hashtable<Object, Object> hashtable3 = new Hashtable<Object, Object>();Hashtable<Object, Object> hashtable4 = new Hashtable<Object, Object>();Hashtable<Object, Object> hashtable5 = new Hashtable<Object, Object>();Hashtable<Object, Object> hashtable6 = new Hashtable<Object, Object>();Hashtable<Object, Object> hashtable7 = new Hashtable<Object, Object>();String str = Util.null2String(arrayList4.get(b2));if (str.equals("-"))str = ""; recordSet.executeSql("select * from outerdatawfsetdetail where outerfieldname like '" + str6 + ".%' and mainid=" + paramString4);while (recordSet.next()) {String str8 = recordSet.getString("wffieldid");String str9 = recordSet.getString("wffieldname");String str10 = recordSet.getString("wffieldhtmltype");String str11 = recordSet.getString("wffieldtype");String str12 = recordSet.getString("wffielddbtype");String str13 = recordSet.getString("outerfieldname");String str14 = recordSet.getString("changetype");String str15 = recordSet.getString("customsql");arrayList.add(str8);hashtable1.put(str8, str9);hashtable2.put(str8, str10);hashtable3.put(str8, str11);hashtable4.put(str8, str12);hashtable5.put(str8, str13);hashtable6.put(str8, str14);hashtable7.put(str8, str15);} Pattern pattern = Pattern.compile("where");Matcher matcher = pattern.matcher(str);str = matcher.replaceFirst(" and ");if (!paramString11.equals("1") && !paramString10.equals("")) {str7 = "select * from " + str6 + " ," + paramString2 + " " + " where 1=1" + " and " + paramString2 + "." + paramString10 + " = " + paramInt + str;} else {str7 = "select * from " + str6 + " ," + paramString2 + " " + " where 1=1" + " and " + paramString2 + "." + paramString6 + " = '" + paramString7 + "'" + str;} this.newlog.info("querysql:" + str7);resultSet = paramStatement.executeQuery(str7);while (resultSet.next()) {String str8 = "";String str9 = "";if (str1.equals("0")) {str8 = "insert into " + str5 + "(requestid,groupId";str9 = " values(" + paramInt + "," + (String)arrayList2.get(b2);} else if (str1.equals("1")) {str8 = "insert into " + str5 + "(" + str3;str9 = " values(" + str4;} for (byte b = 0; b < arrayList.size(); b++) {String str10 = Util.null2String(arrayList.get(b));String str11 = Util.null2String((String)hashtable1.get(str10));if (!str11.equals("")) {String str12 = Util.null2String((String)hashtable2.get(str10));String str13 = Util.null2String((String)hashtable3.get(str10));String str14 = Util.null2String((String)hashtable4.get(str10));String str15 = Util.null2String((String)hashtable5.get(str10));String str16 = Util.null2String((String)hashtable6.get(str10));String str17 = Util.null2String((String)hashtable7.get(str10));String str18 = "";if (!str15.equals("")) {str15 = str15.substring(str15.indexOf(".") + 1);String str19 = (String)map.get(str15.toLowerCase());if (str19.contains("("))str19 = str19.substring(0, str19.indexOf("(")); if (str19.equals("number") || str19.equals("NUMBER") || str19.equals("float") || str19.equals("real") || str19.equals("Real")) {str18 = Util.null2String(resultSet.getString(str15));if (str18.startsWith("."))str18 = "0" + str18; if (str18.startsWith("-."))str18 = str18.replaceFirst("-.", "-0."); } else {str18 = Util.null2String(resultSet.getString(str15));} if (!"6".equals(str16)) {if (str12.equals("3"))if (str13.equals("1")) {str18 = getCreater(str18, str16);} else if (str13.equals("4")) {str18 = getDept(str18, str16);} else if (str13.equals("164")) {str18 = getSubCom(str18, str16);}  } else if (!"".equals(str17)) {str18 = getTranSqlValue(str17, str18);} else {str18 = str18;} } if (str18.equals("")) {if (!str12.equals("2") && (!str12.equals("1") || (!str13.equals("1") && !str13.equals("5"))) && (!str12.equals("3") || (!str13.equals("2") && !str13.equals("19") && !str13.equals("161") && !str13.equals("162"))))str18 = "NULL"; if (str12.equals("5")) {str18 = "-1";} else if (str12.equals("4")) {str18 = "0";} } else if (str14.indexOf("varchar") == 0 || str14.indexOf("char") == 0) {int i = Util.getIntValue(str14.substring(str14.indexOf("(") + 1, str14.indexOf(")")), 0);if (Util.length2(str18) > i)do {str18 = str18.substring(0, str18.length() - 1);} while (Util.length2(str18) > i); str18 = str18.replace("'", "''");} else if (str14.equals("int") || str14.equals("integer")) {str18 = Util.getIntValue(str18, -1) + "";} else if (str14.indexOf("decimal") == 0 || str14.indexOf("number") == 0) {str18 = str18.replace(",", "");str18 = Util.getDoubleValue(str18, -1.0D) + "";} else if (str12.equals("3") && str13.equals("17") && bool) {hashMap.put(str11, str18);str18 = " empty_clob() ";} str8 = str8 + "," + str11;if (str14.startsWith("text") || str14.startsWith("char") || str14.startsWith("varchar") || str14.indexOf(".") > -1) {str9 = str9 + ",'" + str18 + "'";} else if (str12.equals("3") && (str13.equals("256") || str13.equals("257"))) {str9 = str9 + ",'" + str18 + "'";} else if (str14.startsWith("clob")) {str9 = str9 + "," + str18;} else {str9 = str9 + "," + str18;} } } str8 = str8 + ") ";str9 = str9 + ") ";this.newlog.info("detail sql:" + str8 + str9);recordSet.executeSql(str8 + str9);if (bool)try {String str10 = "";if (str1.equals("0")) {str10 = "select max(id) dtid from " + str5 + " where requestid =" + paramInt + " and groupId = " + (String)arrayList2.get(b2);} else if (str1.equals("1")) {str10 = "select max(id) dtid from " + str5 + " where " + str3 + " =" + str4;} recordSet.executeSql(str10);if (recordSet.next()) {String str11 = Util.null2String(recordSet.getString("dtid"));if (!"".equals(str11)) {String str12 = "";str12 = " select ";byte b3 = 0;String str13 = " ";Iterator<Map.Entry> iterator = hashMap.entrySet().iterator();while (iterator.hasNext()) {b3++;Map.Entry entry = iterator.next();String str14 = entry.getKey().toString();String str15 = "";if (entry.getValue() != null)if (String.valueOf(entry.getValue()).equals(" ")) {str15 = "";} else {str15 = String.valueOf(entry.getValue());}  if (b3 > 1) {str12 = str12 + str13 + " , " + str14;continue;} str12 = str12 + str13 + " " + str14;} str12 = str12 + " from " + str5;if (str1.equals("0")) {str12 = str12 + " where requestid = " + paramInt + " and groupId = " + (String)arrayList2.get(b2) + " and id = " + str11 + " for update";} else if (str1.equals("1")) {str12 = str12 + " where " + str3 + " = " + str4 + "and id = " + str11 + " for update";} if (b3 > 0) {ConnStatement connStatement = null;try {connStatement = new ConnStatement();connStatement.setStatementSql(str12, false);connStatement.executeQuery();if (connStatement.next()) {iterator = hashMap.entrySet().iterator();b3 = 0;while (iterator.hasNext()) {b3++;Map.Entry entry = iterator.next();String str14 = entry.getKey().toString();String str15 = "";if (entry.getValue() != null)if (String.valueOf(entry.getValue()).equals(" ")) {str15 = "";} else {str15 = String.valueOf(entry.getValue());}  CLOB cLOB = connStatement.getClob(b3);char[] arrayOfChar = str15.toCharArray();Writer writer = cLOB.getCharacterOutputStream();writer.write(arrayOfChar);writer.flush();writer.close();} } } catch (Exception exception) {this.newlog.error(", exception);} finally {if (connStatement != null)connStatement.close(); } } } } hashMap.clear();} catch (Exception exception) {this.newlog.error(", exception);}  } } } }public void UpdateIntoDetailTable(Statement paramStatement, String paramString1, String paramString2, String paramString3, String paramString4, int paramInt, String paramString5, String paramString6, String paramString7, String paramString8, String paramString9, String paramString10) throws Exception {ResultSet resultSet = null;HashMap<Object, Object> hashMap = new HashMap<Object, Object>();WorkflowComInfo workflowComInfo = new WorkflowComInfo();String str1 = Util.null2String(workflowComInfo.getIsBill(paramString4));String str2 = Util.null2String(workflowComInfo.getFormId(paramString4));ArrayList<String> arrayList1 = new ArrayList();ArrayList<String> arrayList2 = new ArrayList();String str3 = "mainid";String str4 = "";ArrayList<String> arrayList3 = Util.TokenizerString(paramString7, ",");String[] arrayOfString = paramString8.split("\\$@\\|@\\$");ArrayList<String> arrayList4 = new ArrayList();for (byte b1 = 0; b1 < arrayOfString.length; b1++)arrayList4.add(arrayOfString[b1]); RecordSet recordSet = new RecordSet();boolean bool = recordSet.getDBType().equals("oracle");boolean bool1 = false;if (!str2.equals(""))if (str1.equals("0")) {recordSet.executeSql("select distinct groupId from Workflow_formfield where formid=" + str2 + " and isdetail='1' order by groupid");while (recordSet.next()) {arrayList1.add("workflow_formdetail");arrayList2.add(recordSet.getString(1));} } else if (str1.equals("1")) {recordSet.executeSql("select tablename from Workflow_billdetailtable where billid=" + str2 + " order by orderid");while (recordSet.next()) {String str = Util.null2String(recordSet.getString(1));if (!str.equals(""))arrayList1.add(recordSet.getString(1)); } recordSet.executeSql("select tablename,detailtablename,detailkeyfield from workflow_bill where id=" + str2);if (recordSet.next()) {str3 = Util.null2String(recordSet.getString("detailkeyfield"));if (arrayList1.size() == 0) {String str5 = Util.null2String(recordSet.getString("detailtablename"));if (!str5.equals(""))arrayList1.add(str5); } String str = recordSet.getString("tablename");recordSet.executeSql("select id from " + str + " where requestid=" + paramInt);if (recordSet.next())str4 = recordSet.getString("id"); } }  if (arrayList1.size() != arrayList3.size()) {writeLog(");return;} for (byte b2 = 0; b2 < arrayList1.size(); b2++) {String str5 = arrayList1.get(b2);String str6 = arrayList3.get(b2);String str7 = "";if (paramString2.toLowerCase().indexOf("oracle") > -1) {str7 = "select 1 from user_tables a where a.TABLE_NAME = upper('" + str6 + "') union ALL select 1 from user_views b where  b.VIEW_NAME = upper('" + str6 + "')";} else if (paramString2.toLowerCase().indexOf("sqlserver") > -1 || paramString2.toLowerCase().indexOf("sybase") > -1) {str7 = "select 1 from sysobjects where name = '" + str6 + "' ";} else if (paramString2.toLowerCase().indexOf("informix") > -1) {str7 = "select 1 from systables where lower(tabname) = lower('" + str6 + "') ";} else if (paramString2.toLowerCase().indexOf("mysql") > -1) {str7 = "select 1 from information_schema.Tables where LOWER(Table_Name)=LOWER('" + str6 + "') ";} else if (paramString2.toLowerCase().indexOf("db2") > -1) {str7 = "select 1 from SYSIBM.SYSTABLES where lower(name)= lower('" + str6 + "') ";} else {str7 = "select 1 from " + str6;} resultSet = paramStatement.executeQuery(str7);if (!resultSet.next()) {this.newlog.error("TABLE " + str6 + " IS NOT EXIST!");} else {String str8 = "";RecordSet recordSet1 = new RecordSet();if (str1.equals("0")) {str8 = "delete " + str5 + " where requestid='" + paramInt + "' and groupId='" + (String)arrayList2.get(b2) + "' ";} else if (str1.equals("1")) {str8 = "delete " + str5 + " where " + str3 + "='" + str4 + "'  ";} recordSet1.executeSql(str8);ArrayList<String> arrayList = new ArrayList();Hashtable<Object, Object> hashtable1 = new Hashtable<Object, Object>();Hashtable<Object, Object> hashtable2 = new Hashtable<Object, Object>();Hashtable<Object, Object> hashtable3 = new Hashtable<Object, Object>();Hashtable<Object, Object> hashtable4 = new Hashtable<Object, Object>();Hashtable<Object, Object> hashtable5 = new Hashtable<Object, Object>();Hashtable<Object, Object> hashtable6 = new Hashtable<Object, Object>();Hashtable<Object, Object> hashtable7 = new Hashtable<Object, Object>();String str9 = Util.null2String(arrayList4.get(b2));if (str9.equals("-"))str9 = ""; recordSet.executeSql("select * from outerdatawfsetdetail where outerfieldname like '" + str6 + ".%' and mainid=" + paramString3);while (recordSet.next()) {String str10 = recordSet.getString("wffieldid");String str11 = recordSet.getString("wffieldname");String str12 = recordSet.getString("wffieldhtmltype");String str13 = recordSet.getString("wffieldtype");String str14 = recordSet.getString("wffielddbtype");String str15 = recordSet.getString("outerfieldname");String str16 = recordSet.getString("changetype");String str17 = recordSet.getString("customsql");arrayList.add(str10);hashtable1.put(str10, str11);hashtable2.put(str10, str12);hashtable3.put(str10, str13);hashtable4.put(str10, str14);hashtable5.put(str10, str15);hashtable6.put(str10, str16);hashtable7.put(str10, str17);} Pattern pattern = Pattern.compile("where");Matcher matcher = pattern.matcher(str9);str9 = matcher.replaceFirst(" and ");if (!paramString10.equals("1") && !paramString9.equals("")) {str7 = "select * from " + str6 + " ," + paramString1 + " " + " where 1=1" + " and " + paramString1 + "." + paramString9 + " = " + paramInt + str9;} else {str7 = "select * from " + str6 + " ," + paramString1 + " " + " where 1=1" + " and " + paramString1 + "." + paramString5 + " = '" + paramString6 + "'" + str9;} this.newlog.info("querysql:" + str7);resultSet = paramStatement.executeQuery(str7);while (resultSet.next()) {String str10 = "";String str11 = "";if (str1.equals("0")) {str10 = "insert into " + str5 + "(requestid,groupId";str11 = " values(" + paramInt + "," + (String)arrayList2.get(b2);} else if (str1.equals("1")) {str10 = "insert into " + str5 + "(" + str3;str11 = " values(" + str4;} for (byte b = 0; b < arrayList.size(); b++) {String str12 = Util.null2String(arrayList.get(b));String str13 = Util.null2String((String)hashtable1.get(str12));if (!str13.equals("")) {String str14 = Util.null2String((String)hashtable2.get(str12));String str15 = Util.null2String((String)hashtable3.get(str12));String str16 = Util.null2String((String)hashtable4.get(str12));String str17 = Util.null2String((String)hashtable5.get(str12));String str18 = Util.null2String((String)hashtable6.get(str12));String str19 = Util.null2String((String)hashtable7.get(str12));String str20 = "";if (!str17.equals("")) {str17 = str17.substring(str17.indexOf(".") + 1);str20 = Util.null2String(resultSet.getString(str17));if (!"6".equals(str18)) {if (str14.equals("3"))if (str15.equals("1")) {str20 = getCreater(str20, str18);} else if (str15.equals("4")) {str20 = getDept(str20, str18);} else if (str15.equals("164")) {str20 = getSubCom(str20, str18);}  } else if (!"".equals(str19)) {str20 = getTranSqlValue(str19, str20);} else {str20 = str20;} } if (str20.equals("")) {if (!str14.equals("2") && (!str14.equals("1") || (!str15.equals("1") && !str15.equals("5"))) && (!str14.equals("3") || (!str15.equals("2") && !str15.equals("19") && !str15.equals("161") && !str15.equals("162"))))str20 = "NULL"; if (str14.equals("5")) {str20 = "-1";} else if (str14.equals("4")) {str20 = "0";} } else if (str16.indexOf("varchar") == 0 || str16.indexOf("char") == 0) {int i = Util.getIntValue(str16.substring(str16.indexOf("(") + 1, str16.indexOf(")")), 0);if (Util.length2(str20) > i)do {str20 = str20.substring(0, str20.length() - 1);} while (Util.length2(str20) > i); str20 = str20.replace("'", "''");} else if (str16.equals("int") || str16.equals("integer")) {str20 = Util.getIntValue(str20, -1) + "";} else if (str16.indexOf("decimal") == 0 || str16.indexOf("number") == 0) {str20 = str20.replace(",", "");str20 = Util.getDoubleValue(str20, -1.0D) + "";} else if (str14.equals("3") && str15.equals("17") && bool) {hashMap.put(str13, str20);str20 = " empty_clob() ";} str10 = str10 + "," + str13;if (str16.startsWith("text") || str16.startsWith("char") || str16.startsWith("varchar") || str16.indexOf(".") > -1 || str16.startsWith("clob")) {str11 = str11 + ",'" + str20 + "'";} else if (str14.equals("3") && (str15.equals("256") || str15.equals("257"))) {str11 = str11 + ",'" + str20 + "'";} else {str11 = str11 + "," + str20;} } } str10 = str10 + ") ";str11 = str11 + ") ";this.newlog.info("detail sql:" + str10 + str11);recordSet.executeSql(str10 + str11);if (bool)try {String str = "";if (str1.equals("0")) {str = "select max(id) dtid from " + str5 + " where requestid =" + paramInt + " and groupId = " + (String)arrayList2.get(b2);} else if (str1.equals("1")) {str = "select max(id) dtid from " + str5 + " where " + str3 + " =" + str4;} recordSet.executeSql(str);if (recordSet.next()) {String str12 = Util.null2String(recordSet.getString("dtid"));if (!"".equals(str12)) {String str13 = "";str13 = " select ";byte b3 = 0;String str14 = " ";Iterator<Map.Entry> iterator = hashMap.entrySet().iterator();while (iterator.hasNext()) {b3++;Map.Entry entry = iterator.next();String str15 = entry.getKey().toString();String str16 = "";if (entry.getValue() != null)if (String.valueOf(entry.getValue()).equals(" ")) {str16 = "";} else {str16 = String.valueOf(entry.getValue());}  if (b3 > 1) {str13 = str13 + str14 + " , " + str15;continue;} str13 = str13 + str14 + " " + str15;} str13 = str13 + " from " + str5;if (str1.equals("0")) {str13 = str13 + " where requestid = " + paramInt + " and groupId = " + (String)arrayList2.get(b2) + " and id = " + str12 + " for update";} else if (str1.equals("1")) {str13 = str13 + " where " + str3 + " = " + str4 + "and id = " + str12 + " for update";} if (b3 > 0) {ConnStatement connStatement = null;try {connStatement = new ConnStatement();connStatement.setStatementSql(str13, false);connStatement.executeQuery();if (connStatement.next()) {iterator = hashMap.entrySet().iterator();b3 = 0;while (iterator.hasNext()) {b3++;Map.Entry entry = iterator.next();String str15 = entry.getKey().toString();String str16 = "";if (entry.getValue() != null)if (String.valueOf(entry.getValue()).equals(" ")) {str16 = "";} else {str16 = String.valueOf(entry.getValue());}  CLOB cLOB = connStatement.getClob(b3);char[] arrayOfChar = str16.toCharArray();Writer writer = cLOB.getCharacterOutputStream();writer.write(arrayOfChar);writer.flush();writer.close();} } } catch (Exception exception) {this.newlog.error(", exception);} finally {if (connStatement != null)connStatement.close(); } } } } hashMap.clear();} catch (Exception exception) {this.newlog.error(", exception);}  } } } }public String getCreater(String paramString1, String paramString2) {paramString1 = paramString1.replace("'", "''");RecordSet recordSet = new RecordSet();String str = "";if (paramString2.equals("0")) {recordSet.executeSql("select id from HrmResource where id='" + paramString1 + "' and status<4  and (loginid !='' Or  loginid is not  null) ");if (recordSet.next())str = recordSet.getString("id"); } else if (paramString2.equals("1")) {recordSet.executeSql("select id from HrmResource where workcode='" + paramString1 + "' and  status<4 and (loginid !='' Or  loginid is not  null) ");if (recordSet.next())str = recordSet.getString("id"); } else if (paramString2.equals("2")) {recordSet.executeSql("select id from HrmResource where loginid='" + paramString1 + "' and  status<4 and (loginid !='' Or  loginid is not  null) ");if (recordSet.next())str = recordSet.getString("id"); } else if (paramString2.equals("3")) {recordSet.executeSql("select id from HrmResource where mobile='" + paramString1 + "' and  status<4  and (loginid !='' Or  loginid is not  null) ");if (recordSet.next())str = recordSet.getString("id"); } else if (paramString2.equals("4")) {recordSet.executeSql("select id from HrmResource where email='" + paramString1 + "' and  status<4  and (loginid !='' Or  loginid is not  null) ");if (recordSet.next())str = recordSet.getString("id"); } else if (paramString2.equals("5")) {recordSet.executeSql("select id from HrmResource where id='" + paramString1 + "' and  status<4  and (loginid !='' Or  loginid is not  null) ");if (recordSet.next())str = recordSet.getString("id"); } return str;}public String getDept(String paramString1, String paramString2) {paramString1 = paramString1.replace("'", "''");RecordSet recordSet = new RecordSet();String str = "";if (paramString2.equals("0")) {recordSet.executeSql("select id from HrmDepartment where id='" + paramString1 + "'");if (recordSet.next())str = recordSet.getString("id"); } else if (paramString2.equals("1")) {recordSet.executeSql("select id from HrmDepartment where departmentcode='" + paramString1 + "'");if (recordSet.next())str = recordSet.getString("id"); } return str;}public String getSubCom(String paramString1, String paramString2) {paramString1 = paramString1.replace("'", "''");RecordSet recordSet = new RecordSet();String str = "";if (paramString2.equals("0")) {recordSet.executeSql("select id from HrmSubCompany where id='" + paramString1 + "'");if (recordSet.next())str = recordSet.getString("id"); } else if (paramString2.equals("1")) {recordSet.executeSql("select id from HrmSubCompany where subcompanycode='" + paramString1 + "'");if (recordSet.next())str = recordSet.getString("id"); } return str;}private boolean saveOutTrigLog(Statement paramStatement, String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6, String paramString7, String paramString8) {try {String str = "";if (!"".equals(paramString4))str = str + paramString4 + "='" + paramString7 + "'"; if (!"".equals(paramString4))str = str + ("".equals(str) ? (paramString5 + "='" + paramString8 + "'") : ("," + paramString5 + "='" + paramString8 + "'")); if (!"".equals(paramString2)) {paramString2 = paramString2.trim();if (paramString2.indexOf("set") == 0)paramString2 = paramString2.substring(4); str = str + ("".equals(str) ? paramString2 : ("," + paramString2));} if (!"".equals(str)) {String str1 = "update " + paramString1 + " set " + str + " where " + paramString3 + "='" + paramString6 + "'";this.newlog.info("saveOutTrigLog sql : " + str1);paramStatement.executeUpdate(str1);} } catch (Exception exception) {this.newlog.error(", exception);return false;} return true;}private boolean saveUpdateWfFlag(Statement paramStatement, String paramString1, String paramString2, String paramString3, String paramString4, String paramString5) {try {String str1 = "";String str2 = "";if (paramString4.equals("2") && !"".equals(paramString5))str2 = str2 + ("".equals(str2) ? (paramString5 + "='0'") : ("," + paramString5 + "='0'")); if (!"".equals(str1)) {str1 = str1.trim();if (str1.indexOf("set") == 0)str1 = str1.substring(4); str2 = str2 + ("".equals(str2) ? str1 : ("," + str1));} if (!"".equals(str2)) {String str = "update " + paramString1 + " set " + str2 + " where " + paramString2 + "='" + paramString3 + "'";paramStatement.executeUpdate(str);this.newlog.info("saveUpdateWfFlag sql : " + str);} } catch (Exception exception) {this.newlog.error(", exception);return false;} return true;}private boolean saveTrigLog(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5) {try {boolean bool = false;RecordSet recordSet = new RecordSet();String str = "select requestid from outerdatawfdetail where keyfieldvalue='" + paramString4 + "' and outermaintable = '" + paramString5 + "' and workflowid=" + paramString1 + " and mainid=" + paramString3;recordSet.executeSql(str);if (recordSet.next())bool = true; if (bool) {str = "update outerdatawfdetail set requestid=" + paramString2 + " where mainid=" + paramString3 + " and workflowid=" + paramString1 + " and outermaintable = '" + paramString5 + "' and keyfieldvalue='" + paramString4 + "'";} else {str = "insert into outerdatawfdetail(mainid,workflowid,requestid,keyfieldvalue,outermaintable) values(" + paramString3 + "," + paramString1 + "," + paramString2 + ",'" + paramString4 + "','" + paramString5 + "')";} this.newlog.info("saveTrigLog sql : " + str);recordSet.executeSql(str);} catch (Exception exception) {this.newlog.error(", exception);return false;} return true;}private void saveRequestLog(String paramString1, String paramString2, String paramString3, int paramInt) {SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd");SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("HH:mm:ss");Date date = new Date();String str1 = simpleDateFormat1.format(date);String str2 = simpleDateFormat2.format(date);String str3 = "";if (paramInt > -1) {str3 = "1";} else {str3 = "0";} RecordSet recordSet = new RecordSet();String str4 = "insert into outerdatawflog(Outerdatawfid,Outkey,Workflowid,RequestId,Triggerflag,CreateDate,CreateTime) values('" + paramString1 + "','" + paramString2 + "','" + paramString3 + "','" + paramInt + "','" + str3 + "','" + str1 + "','" + str2 + "')";recordSet.executeSql(str4);this.newlog.info("saveRequestLog sql : " + str4);}
}

很长一段,核心检查逻辑在 public void doActiveOutDataWF() 这里。下面的参数除了 “FTriggerFlag” 属性必须在触发的外部主表中有一个同名字段、且类型为整数;其他属性可以按具体场景配置自己喜欢的名字的字段。

而且需要注意:外部表主表如果为视图,则无法实现成功 / 失败时回写内容的配置。因此,如果外部表(主表 / 明细表)需要不重复推送,可以设置形如 where 外部表.[流程requestid对应的字段] not in (select id from formtable_main_xxx)  等的条件。

一个常用的技巧是:如果需要把一个普通的表转为“明细表” 并输出到对应流程(ps. 只有一个源表、且原本就没有可用的主-子表关系时)、可以写一个 MASTER_VIEW 视图。具体步骤如下:

  • 在 MASTER_VIEW 视图中用 where exists() 限定“明细表” 的条件,并指定一个固定值的字段【A】。
  • 再写一个 DETAIL_VIEW 视图、实现流程明细表要查询的真正逻辑;同时返回一列和【A】同样名字和值的固定列。
  • 最后,在触发配置的 “外部明细表1条件” 处填写  where MASTER_VIEW.【A】 = DETAIL_VIEW.【A】。

完成上述配置之后,可以在系统的 workflow_requestbase 表 / 流程监控中查看、是否正常触发了流程。

泛微E8自定义触发流程检查参数
参数名含义用途
id
外部表的主键项,可以是任何名字
workflowid
需要被触发创建的流程id
datasourceid
数据源id、即使是泛微自己的表作为外部表、也需要创建数据源
outermaintable
外部表(主表)的名字
keyfield
datarecordtype
requestid
外部表触发成功后、回写产生的流程请求id的列的名字
FTriggerFlag
默认不可更名:触发成功的回写列,不能在其他条件中进行数据修改。
FTriggerFlagValue
outermainwhere
外部表的数据筛选条件,必须以 where 开头。
successback
failback
outerdetailtables
外部表的明细表(可选)
outerdetailwheres
外部表的明细表筛选条件、用作判断和主表关联(可选)
isnextnode
isupdatewfdata
isupdatewfdataField

目前看来、在最简单的配置方法下:CREATER 和流程标题是必须提供外部表字段的。转换配置规则如下:

  • 当外部表 / 视图的 “流程创建人”  字段和 泛微E8 的 Hrmresource 表 - id 字段完全对应时、 其 “转换规则” 不需要选择任何内容
  • 当 “流程创建人” 字段对应人员工号、即泛微E8的 Hrmresource 表 - workcode 字段完全对应时、其 “转换规则” 需要选择 “登录名” 。如下图所示。

否则待触发的流程会一直无法创建。

除此以外,在测试环境进行流程触发后、如需再次实现触发:需要清除 outerdatawfdetail 表中对应 mainid (代表触发配置项)和 workflowid (对应流程路径) 的记录。outerdatawfdetail 表和其他流程相关的表结构如下图所示:

总结

综上所述,泛微E8 的流程触发可选表 / 视图两种外部数据表。触发成功的记录保存在系统的 outerdatawfdetail 表中。其他注意事项包括:

  • 如果触发失败,请调取 /ecology/log/integration/integration.log 查看具体的报错原因。
  • 如果要单独设置每个流程触发的周期、请使用更高版本的 泛微E9。

(完)

这篇关于泛微 E8 配置自定义触发流程的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/166419

相关文章

VScode连接远程Linux服务器环境配置图文教程

《VScode连接远程Linux服务器环境配置图文教程》:本文主要介绍如何安装和配置VSCode,包括安装步骤、环境配置(如汉化包、远程SSH连接)、语言包安装(如C/C++插件)等,文中给出了详... 目录一、安装vscode二、环境配置1.中文汉化包2.安装remote-ssh,用于远程连接2.1安装2

C#提取PDF表单数据的实现流程

《C#提取PDF表单数据的实现流程》PDF表单是一种常见的数据收集工具,广泛应用于调查问卷、业务合同等场景,凭借出色的跨平台兼容性和标准化特点,PDF表单在各行各业中得到了广泛应用,本文将探讨如何使用... 目录引言使用工具C# 提取多个PDF表单域的数据C# 提取特定PDF表单域的数据引言PDF表单是一

PyCharm接入DeepSeek实现AI编程的操作流程

《PyCharm接入DeepSeek实现AI编程的操作流程》DeepSeek是一家专注于人工智能技术研发的公司,致力于开发高性能、低成本的AI模型,接下来,我们把DeepSeek接入到PyCharm中... 目录引言效果演示创建API key在PyCharm中下载Continue插件配置Continue引言

Redis多种内存淘汰策略及配置技巧分享

《Redis多种内存淘汰策略及配置技巧分享》本文介绍了Redis内存满时的淘汰机制,包括内存淘汰机制的概念,Redis提供的8种淘汰策略(如noeviction、volatile-lru等)及其适用场... 目录前言一、什么是 Redis 的内存淘汰机制?二、Redis 内存淘汰策略1. pythonnoe

使用MongoDB进行数据存储的操作流程

《使用MongoDB进行数据存储的操作流程》在现代应用开发中,数据存储是一个至关重要的部分,随着数据量的增大和复杂性的增加,传统的关系型数据库有时难以应对高并发和大数据量的处理需求,MongoDB作为... 目录什么是MongoDB?MongoDB的优势使用MongoDB进行数据存储1. 安装MongoDB

windos server2022的配置故障转移服务的图文教程

《windosserver2022的配置故障转移服务的图文教程》本文主要介绍了windosserver2022的配置故障转移服务的图文教程,以确保服务和应用程序的连续性和可用性,文中通过图文介绍的非... 目录准备环境:步骤故障转移群集是 Windows Server 2022 中提供的一种功能,用于在多个

windos server2022里的DFS配置的实现

《windosserver2022里的DFS配置的实现》DFS是WindowsServer操作系统提供的一种功能,用于在多台服务器上集中管理共享文件夹和文件的分布式存储解决方案,本文就来介绍一下wi... 目录什么是DFS?优势:应用场景:DFS配置步骤什么是DFS?DFS指的是分布式文件系统(Distr

关于Maven中pom.xml文件配置详解

《关于Maven中pom.xml文件配置详解》pom.xml是Maven项目的核心配置文件,它描述了项目的结构、依赖关系、构建配置等信息,通过合理配置pom.xml,可以提高项目的可维护性和构建效率... 目录1. POM文件的基本结构1.1 项目基本信息2. 项目属性2.1 引用属性3. 项目依赖4. 构

龙蜥操作系统Anolis OS-23.x安装配置图解教程(保姆级)

《龙蜥操作系统AnolisOS-23.x安装配置图解教程(保姆级)》:本文主要介绍了安装和配置AnolisOS23.2系统,包括分区、软件选择、设置root密码、网络配置、主机名设置和禁用SELinux的步骤,详细内容请阅读本文,希望能对你有所帮助... ‌AnolisOS‌是由阿里云推出的开源操作系统,旨

mysql-8.0.30压缩包版安装和配置MySQL环境过程

《mysql-8.0.30压缩包版安装和配置MySQL环境过程》该文章介绍了如何在Windows系统中下载、安装和配置MySQL数据库,包括下载地址、解压文件、创建和配置my.ini文件、设置环境变量... 目录压缩包安装配置下载配置环境变量下载和初始化总结压缩包安装配置下载下载地址:https://d