泛微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() 这里。

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

目前看来、在最简单的配置方法下:CREATER 和流程标题是必须提供外部表字段的。其他等泛微工程师进行解答。

 

总结

未完待续。。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/79798.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Spring Clould 注册中心 - Eureka,Nacos

视频地址&#xff1a;微服务&#xff08;SpringCloudRabbitMQDockerRedis搜索分布式&#xff09; Eureka 微服务技术栈导学&#xff08;P1、P2&#xff09; 微服务涉及的的知识 认识微服务-服务架构演变&#xff08;P3、P4&#xff09; 总结&#xff1a; 认识微服务-微服务技…

探索Python中的数据可视化利器:Plotly Express

一、引言 在数据分析和可视化领域&#xff0c;数据的有效呈现是至关重要的。Python作为一种强大的编程语言&#xff0c;提供了多种数据可视化工具和库。其中&#xff0c;Plotly Express是一款受欢迎的数据可视化库&#xff0c;它提供了简单易用的接口和丰富的图表类型&#xf…

keepalived集群

keepalived概述 keepalived软件就是通过vrrp协议来实现高可用功能。 VRRP通信原理 VRRP就是虚拟路由冗余协议&#xff0c;它的出现就是为了解决静态路由的单点故障。 VRRP是通过一种竞选一种协议机制来将路由交个某台VRRP路由器。 VRRP 用IP多播的方式&#xff08;多播地…

【.net】本地调试运行只能用localhost的问题

【.net】本地调试运行只能用localhost的问题 解决方案 找到到项目目录下 隐藏文件夹 .vs /项目名称/config/applicationhost.config <bindings><binding protocol"http" bindingInformation"*:1738:localhost" /></bindings> 再加一条你…

visual studio 2022配置

前提&#xff1a;我linux c 开发 一直在使用vscode 更新了个版本突然代码中的查找所用引用和变量修改名称不能用了&#xff0c;尝试了重新配置clang vc都不行&#xff0c;估计是插件问题&#xff0c;一怒之下改用visual studio 2022 为了同步2个IDE之间的差别&#xff0c;目前…

【计算机视觉|生成对抗】逐步增长的生成对抗网络(GAN)以提升质量、稳定性和变化

本系列博文为深度学习/计算机视觉论文笔记&#xff0c;转载请注明出处 标题&#xff1a;Progressive Growing of GANs for Improved Quality, Stability, and Variation 链接&#xff1a;[1710.10196] Progressive Growing of GANs for Improved Quality, Stability, and Vari…

musl libc ldso 动态加载研究笔记:01

前言 musl 是一个轻量级的标准C库&#xff0c;建立在系统调用之上&#xff0c;可以认为是【用户态】的C 库&#xff0c;与 glibc 或者 uClibc 属于同一类。 基于 musl 的 gcc 工具链包括交叉编译工具链&#xff0c;可以用于编译 Linux 或者其他的操作系统&#xff0c;如当前 L…

JVM——类加载器

回顾一下类加载过程 类加载过程&#xff1a;加载->连接->初始化。连接过程又可分为三步:验证->准备->解析。 一个非数组类的加载阶段&#xff08;加载阶段获取类的二进制字节流的动作&#xff09;是可控性最强的阶段&#xff0c;这一步我们可以去完成还可以自定义…

STM32 cubemx CAN

接收用到的结构体如下&#xff1a;CAN概念&#xff1a; 全称Controller Area Network&#xff0c;是一种半双工&#xff0c;异步通讯。 物理层&#xff1a; 闭环&#xff1a;允许总线最长40m&#xff0c;最高速1Mbps&#xff0c;规定总线两端各有一个120Ω电阻&#xff0c;闭环…

IC流程中 DFT 学习笔记(2)

引言 DFT是ASIC芯片设计流程中不可或缺的环节。其主要目的是在芯片前端设计验证完成后插入一些诸如寄存器链等可供测试的逻辑&#xff0c;算是IC后端设计的范畴&#xff0c;属于结构测试而非功能测试。主要是在ASIC芯片流片完成后&#xff0c;通过这些已插入的逻辑&#xff0c…

国家一带一路和万众创业创新的方针政策指引下,Live Market探索跨境产业的创新发展

现代社会&#xff0c;全球经济互联互通&#xff0c;跨境产业也因此而崛起。为了推动跨境产业的创新发展&#xff0c;中国政府提出了“一带一路”和“万众创业、万众创新”的方针政策&#xff0c;旨在促进全球经济的互联互通和创新发展。在这个大环境下&#xff0c;Live Market积…

华为PPPOE配置实验

华为PPPOE配置实验 网络拓扑图拓扑说明电信ISP设备配置用户拨号路由器配置查看是否拨上号是否看不懂&#xff1f; 看不懂就对了&#xff0c;只是记录一下命令。至于所有原理&#xff0c;等想写了再写 网络拓扑图 拓扑说明 用户路由器用于模拟家用拨号路由器&#xff0c;该设备…

github以及上传代码处理

最近在github上传代码的时候出现了&#xff1a; /video_parser# git push -u origin main Username for https://github.com: gtnyxxx Password for https://gtny2010github.com: remote: Support for password authentication was removed on August 13, 2021. remote: Plea…

STM32——SPI外设总线

SPI外设简介 STM32内部集成了硬件SPI收发电路&#xff0c;可以由硬件自动执行时钟生成、数据收发等功能&#xff0c;减轻CPU的负担 可配置8位/16位数据帧、高位先行/低位先行 时钟频率&#xff1a; fPCLK / (2, 4, 8, 16, 32, 64, 128, 256) 支持多主机模型、主或从操作 可…

HTTP与HTTPS的区别

面试常见问题&#xff0c;HTTPS优化总结易记版&#xff1a; 1、HSTS重定向技术&#xff1a;将http自动转换为https&#xff0c;减少301重定向 2、TLS握手优化&#xff1a;在TLS握手完成前客户端就提前向服务器发送数据 3、会话标识符&#xff1a;服务器记录下与某客户端的会…

C#语音播报问题之 无法嵌入互操作类型SpVoiceClass,请改用适用的窗口

C#语音播报问题之 无法嵌入互操作类型SpVoiceClass&#xff0c;请改用适用的窗口 解决办法如下&#xff1a; 只需要将引入的Interop.SpeechLib的属性嵌入互操作类型改为false 改为false 即可解决&#xff01;

微服务最佳实践,零改造实现 Spring Cloud Apache Dubbo 互通

作者&#xff1a;孙彩荣 很遗憾&#xff0c;这不是一篇关于中间件理论或原理讲解的文章&#xff0c;没有高深晦涩的工作原理分析&#xff0c;文后也没有令人惊叹的工程数字统计。本文以实际项目和代码为示例&#xff0c;一步一步演示如何以最低成本实现 Apache Dubbo 体系与 S…

面试之ReentrantLock

一&#xff0c;ReentrantLock 1.ReentrantLock是什么&#xff1f; ReentrantLock实现了Lock接口&#xff0c;是一个可重入且独占式的锁&#xff0c;和Synchronized关键字类似&#xff0c;不过ReentrantLock更灵活&#xff0c;更强大&#xff0c;增加了轮询、超时、中断、公平锁…

k8s v1.27.4二进制部署记录

记录二进制部署过程 #!/bin/bash#升级内核 update_kernel() {rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.orgyum -y install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpmyum --disablerepo"*" --enablerepo"elrepo-kernel&q…