在新公司接了个配置泛微流程触发的活。因为泛微的官方文档并没有详细的操作指引,在测试环境配置之后、要触发的流程可以手工提交,但是触发一直不成功。简单记录下业务场景和其他处理信息,以供参考。
应用版本
目前使用了泛微 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/ecology 、Resin/log/stderr.log 、Resin/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 arrayList1 = new ArrayList();
ArrayList arrayList2 = new ArrayList();
ArrayList arrayList3 = new ArrayList();
ArrayList arrayList4 = new ArrayList();
ArrayList arrayList5 = new ArrayList();
ArrayList arrayList6 = new ArrayList();
ArrayList arrayList7 = new ArrayList();
ArrayList arrayList8 = new ArrayList();
ArrayList arrayList9 = new ArrayList();
ArrayList arrayList10 = new ArrayList();
ArrayList arrayList11 = new ArrayList();
ArrayList arrayList12 = new ArrayList();
ArrayList arrayList13 = new ArrayList();
ArrayList arrayList14 = new ArrayList();
ArrayList arrayList15 = new ArrayList();
ArrayList arrayList16 = new ArrayList();
ArrayList 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();
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 arrayList = new ArrayList();
Hashtable hashtable1 = new Hashtable();
Hashtable hashtable2 = new Hashtable();
Hashtable hashtable3 = new Hashtable();
Hashtable hashtable4 = new Hashtable();
Hashtable hashtable5 = new Hashtable();
Hashtable hashtable6 = new Hashtable();
Hashtable hashtable7 = new Hashtable();
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 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 hashMap = new HashMap();
WorkflowComInfo workflowComInfo = new WorkflowComInfo();
String str1 = Util.null2String(workflowComInfo.getIsBill(paramString5));
String str2 = Util.null2String(workflowComInfo.getFormId(paramString5));
ArrayList arrayList1 = new ArrayList();
ArrayList arrayList2 = new ArrayList();
String str3 = "mainid";
String str4 = "";
ArrayList arrayList3 = Util.TokenizerString(paramString8, ",");
String[] arrayOfString = paramString9.split("\\$@\\|@\\$");
ArrayList 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();
if (!paramString1.equals(""))
map = recordSetDataSource.getAllColumnWithTypes(paramString1, str6);
ArrayList arrayList = new ArrayList();
Hashtable hashtable1 = new Hashtable();
Hashtable hashtable2 = new Hashtable();
Hashtable hashtable3 = new Hashtable();
Hashtable hashtable4 = new Hashtable();
Hashtable hashtable5 = new Hashtable();
Hashtable hashtable6 = new Hashtable();
Hashtable hashtable7 = new Hashtable();
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 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 hashMap = new HashMap();
WorkflowComInfo workflowComInfo = new WorkflowComInfo();
String str1 = Util.null2String(workflowComInfo.getIsBill(paramString4));
String str2 = Util.null2String(workflowComInfo.getFormId(paramString4));
ArrayList arrayList1 = new ArrayList();
ArrayList arrayList2 = new ArrayList();
String str3 = "mainid";
String str4 = "";
ArrayList arrayList3 = Util.TokenizerString(paramString7, ",");
String[] arrayOfString = paramString8.split("\\$@\\|@\\$");
ArrayList 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 arrayList = new ArrayList();
Hashtable hashtable1 = new Hashtable();
Hashtable hashtable2 = new Hashtable();
Hashtable hashtable3 = new Hashtable();
Hashtable hashtable4 = new Hashtable();
Hashtable hashtable5 = new Hashtable();
Hashtable hashtable6 = new Hashtable();
Hashtable hashtable7 = new Hashtable();
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 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 和流程标题是必须提供外部表字段的。其他等泛微工程师进行解答。
总结
未完待续。。