⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tradequery.java

📁 java阿里巴巴代码
💻 JAVA
字号:
package com.saas.sys.bpm;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

import org.apache.commons.beanutils.PropertyUtils;

import com.saas.sys.buffer.Buffers;
import com.saas.sys.log.Logger;

public class TradeQuery implements TradeQueryIntf {
	Logger log  = new Logger(this);
	Buffers outBuffer = new Buffers();
	public ArrayList ExecTradeQuery(Buffers inBuffer)
	{
		log.LOG_INFO("进入主控业务方法...");
		
		if (inBuffer.getString("TRADE_TYPE_CODE") == "")
			throw new RuntimeException("业务类型域字段未赋值!");
		
		ArrayList outList = new ArrayList();
		outBuffer = inBuffer;
		log.LOG_INFO("********获取业务类型参数开始*********************");
		TradeTypeDAO tradeType = new TradeTypeDAO();
		tradeType.setParam(":VTRADETYPECODE", inBuffer.getString("TRADE_TYPE_CODE"));
		tradeType = tradeType.selByInfo("SEL_BY_PK");
		if (tradeType == null) throw new RuntimeException("业务类型未定义!");
		log.LOG_INFO("********获取业务类型参数结束*********************");
		log.LOG_INFO("********获取业务流程定义开始*********************");
		
		BpmDefinitionDAO bpmdefini = new  BpmDefinitionDAO();
		ArrayList bpmdefinilist = new ArrayList();
		bpmdefini.setParam(":VTRADETYPECODE", inBuffer.getString("TRADE_TYPE_CODE"));
		bpmdefinilist = bpmdefini.selByList("SEL_BY_PK");
		int iUnit = 0;
		if (bpmdefinilist == null) throw new RuntimeException("业务流程未定义!");
		log.LOG_INFO("********获取业务流程定义结束*********************");
		try
		{
			String fieldName = "";			
			for(Iterator it = bpmdefinilist.iterator(); it.hasNext();)
			{
				HashMap bpm = (HashMap)it.next();
				Class bpmClass = Class.forName(bpm.get("node_class").toString());
				ArrayList unitList = new ArrayList();
				Object objBpm = (Object)bpmClass.newInstance();					
				log.LOG_INFO("********输入参数开始*********************");
				inBuffer.list();
				log.LOG_INFO("********输入参数结束*********************");
				Method bpmMethod = objBpm.getClass().getDeclaredMethod(bpm.get("node_method").toString(),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()).getName();				
				log.LOG_INFO("********<"+bpm.get("out_query").toString()+">*********************");
				//单个和多个节点查询流程区别处理
				if (bpm.get("rsrv_str5").toString().equalsIgnoreCase("1"))
				{
					unitList = (ArrayList)PropertyUtils.getProperty(objBpm,fieldName);
					fieldName = bpmClass.getDeclaredField(bpm.get("out_buffer").toString().trim()).getName();					
					outBuffer = (Buffers)PropertyUtils.getProperty(objBpm,fieldName);
					outList.add(iUnit, unitList);
					inBuffer = outBuffer;
				}
				else
				{
					outList = (ArrayList)PropertyUtils.getProperty(objBpm,fieldName);
				}
				iUnit = iUnit +1;
				log.LOG_INFO("********获取原子业务方法输出ArrayList*********************");
				log.LOG_INFO("********[结束执行原子业务方法<"+bpmMethod.getName()+">]*********************");
			}
			if (outBuffer.getInt("RESULT_CODE") != -1)
			{				 
				outBuffer.setString("SUCCEED_FWD", tradeType.getSucceed_fwd());
			}
			else
			{
				outBuffer.setString("ERROR_FWD", tradeType.getError_fwd());
			}
			log.LOG_INFO("********输入参数开始*********************");
			outBuffer.list();
			log.LOG_INFO("********输入参数结束*********************");
			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 outList;
	}
	public Buffers getOutBuffer()
	{
	    return this.outBuffer;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -