📄 tradereg.java
字号:
package com.saas.sys.bpm;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;
import com.saas.sys.buffer.*;
import com.saas.sys.dbm.Dbcommit;
import com.saas.sys.dbm.Dbexecute;
import com.saas.sys.dbm.Dbtable;
import org.apache.commons.beanutils.PropertyUtils;
import com.saas.sys.log.Logger;
public class TradeReg implements TradeRegIntf {
Logger log = new Logger(this);
Dbcommit commit;
Dbexecute exec;
TradeInit tradeInit;
String check_trade_type_code = "1901";
String check_tag = "0";
public Buffers TradeRegInfo(Buffers inBuffer)
{
log.LOG_INFO("进入主控业务方法...");
if (inBuffer.getString("TRADE_TYPE_CODE") == "")
throw new RuntimeException("业务类型域字段未赋值!");
commit = new Dbcommit();
exec = new Dbexecute();
Buffers outBuffer = new Buffers();
log.LOG_INFO("********获取业务类型参数开始*********************");
TradeTypeDAO tradeType = new TradeTypeDAO();
if (check_tag.equals("1") || check_tag == "1")
{
tradeType.setParam(":VTRADETYPECODE", check_trade_type_code);
}
else
{
tradeType.setParam(":VTRADETYPECODE", inBuffer.getString("TRADE_TYPE_CODE"));
}
tradeType = tradeType.selByInfo("SEL_BY_PK");
if (tradeType == null) throw new RuntimeException("业务类型未定义【"+inBuffer.getString("TRADE_TYPE_CODE")+"】!");
log.LOG_INFO("********获取业务类型参数结束*********************");
BpmDefinitionDAO bpmdefini = new BpmDefinitionDAO();
ArrayList bpmdefinilist = new ArrayList();
log.LOG_INFO("********获取业务流程定义开始*********************");
if (check_tag.equals("1") || check_tag == "1")
{
bpmdefini.setParam(":VTRADETYPECODE", check_trade_type_code);
}
else
{
bpmdefini.setParam(":VTRADETYPECODE", inBuffer.getString("TRADE_TYPE_CODE"));
}
bpmdefini.setParam(":VRSRV_STR6", "0");
bpmdefinilist = bpmdefini.selByList("SEL_BY_TYPE");
if (bpmdefinilist == null) throw new RuntimeException("业务流程未定义【"+inBuffer.getString("TRADE_TYPE_CODE")+"】!");
log.LOG_INFO("********获取业务流程定义结束*********************");
commit.getConnect();
exec.setConnectionHandle(commit.getConnectionHandle());
try
{
String fieldName = "";
for(Iterator it = bpmdefinilist.iterator(); it.hasNext();)
{
HashMap bpm = (HashMap)it.next();
Class bpmClass = Class.forName(bpm.get("node_class").toString().trim());
Object objBpm = (Object)bpmClass.newInstance();
log.LOG_INFO("********输入参数开始*********************");
inBuffer.list();
log.LOG_INFO("********输入参数结束*********************");
Method bpmMethod = objBpm.getClass().getDeclaredMethod(bpm.get("node_method").toString().trim(),new Class[]{Buffers.class});
log.LOG_INFO("********[开始执行原子业务方法<"+bpmMethod.getName()+">]*********************");
bpmMethod.invoke(objBpm,new Object[]{inBuffer});
log.LOG_INFO("********原子业务方法执行完毕*********************");
fieldName = bpmClass.getDeclaredField(bpm.get("out_query").toString().trim()).getName();
Dbtable value = (Dbtable)PropertyUtils.getProperty(objBpm,fieldName);
log.LOG_INFO("********获取原子业务方法输出QUERY*********************");
exec.addTable(value);
exec.execBizQuery();
log.LOG_INFO("********获取原子业务方法输出BUFFER*********************");
fieldName = bpmClass.getDeclaredField(bpm.get("out_buffer").toString().trim()).getName();
outBuffer = (Buffers)PropertyUtils.getProperty(objBpm,fieldName);
log.LOG_INFO("********[结束执行原子业务方法<"+bpmMethod.getName()+">]*********************");
log.LOG_INFO("********输出参数开始*********************");
outBuffer.list();
log.LOG_INFO("********输出参数结束*********************");
if (outBuffer.getInt("RESULT_CODE") == -1) break;
inBuffer = outBuffer;
}
if (outBuffer.getInt("RESULT_CODE") != -1)
{
commit.tradeCommit();
outBuffer.setString("SUCCEED_FWD", tradeType.getSucceed_fwd());
}
else
{
outBuffer.setString("ERROR_FWD", tradeType.getError_fwd());
}
log.LOG_INFO("--------[全部业务流程处理完毕!]--------");
log.LOG_INFO("********输出参数开始*********************");
outBuffer.list();
log.LOG_INFO("********输出参数结束*********************");
}
catch (ClassNotFoundException e)
{
throw new RuntimeException("调用类未找到:"+e);
}
catch (InstantiationException e)
{
throw new RuntimeException(e);
}
catch (IllegalAccessException e)
{
throw new RuntimeException(e);
}
catch (InvocationTargetException e)
{
throw new RuntimeException(e.getTargetException());
}
catch (NoSuchMethodException e)
{
throw new RuntimeException("调用方法未找到:"+e);
}
catch (NoSuchFieldException e)
{
throw new RuntimeException(e);
}
log.LOG_INFO("退出主控业务方法...");
return outBuffer;
}
public String getCheck_tag() {
return check_tag;
}
public void setCheck_tag(String check_tag) {
this.check_tag = check_tag;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -