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

📄 commodityinfo.java

📁 java阿里巴巴代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package com.saas.biz.commodityMgr;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import com.saas.biz.dao.commodityDAO.CommodityDAO;
import com.saas.biz.dao.commodityDAO.CommodityExt;
import com.saas.biz.dao.infoclassDAO.InfoClassExt;
import com.saas.sys.buffer.Buffers;
import com.saas.sys.dbm.Dbtable;
import com.saas.sys.exp.SaasApplicationException;
import com.saas.sys.log.Logger;


public class CommodityInfo {

	Dbtable tradeQuery;

	Logger log;

	Buffers inBuffer;

	Buffers outBuffer;

	ArrayList queryResult = new ArrayList();

	public CommodityInfo()
	{
		log = new Logger(this);
		tradeQuery = new Dbtable();
	}

	public void setTradeQuery(Dbtable tradeQuery)
	{
		this.tradeQuery = tradeQuery;
	}

	public Dbtable getTradeQuery()
	{
		return this.tradeQuery;
	}

	public void setOutBuffer(Buffers outBuffer)
	{
		this.outBuffer = outBuffer;
	}

	public Buffers getOutBuffer()
	{
		return this.outBuffer;
	}

	public ArrayList getQueryResult()
	{
		return this.queryResult;
	}

	public void setQueryResult(ArrayList queryResult)
	{
		this.queryResult = queryResult;
	}
    //查找单条 商品 
	public void genCommodityList(Buffers inbuffer)
	{
		log.LOG_INFO("进入genCommodityList方法...");
		String commodity_id = inbuffer.getString("COMMODITY_ID");
		try
			{
				this.queryResult = genCommodityList(commodity_id);
			} catch (SaasApplicationException e)
			{
				log.LOG_INFO(e.getMessage());

			}
		log.LOG_INFO("退出genCommodityList方法...");
	}
	public ArrayList genCommodityList(String commodity_id) throws SaasApplicationException
	{
		ArrayList itemsList = new ArrayList();
		CommodityExt commodityExt = new CommodityExt();
		commodityExt.setParam(":VCOMMODITY_ID", commodity_id);
		itemsList = commodityExt.selByList("SEL_BY_PK");
		if (itemsList == null)			return null;
		return itemsList;
	}
    //查找全部
	public void genAllCommodityList(Buffers inbuffer)
	{
		log.LOG_INFO("进入genAllCommodityList方法...");
		String commodity_id = inbuffer.getString("COMMODITY_ID");
		try
			{
				this.queryResult = genAllCommodityList();
			} catch (SaasApplicationException e)
			{
				log.LOG_INFO(e.getMessage());

			}
		log.LOG_INFO("退出genAllCommodityList方法...");
	}
	public ArrayList genAllCommodityList() throws SaasApplicationException
	{
		ArrayList	CommodityList = new ArrayList();
		ArrayList itemsList = new ArrayList();
		CommodityExt commodityExt = new CommodityExt();
		CommodityList = commodityExt.selByList("SEL_BY_ALL");
		if (CommodityList == null)			return null;
		for (Iterator it = CommodityList.iterator(); it.hasNext();)
			{
				HashMap commodityListMap = (HashMap) it.next();
				String commodity_name = "";
				String commodityId = "";
				String publish_date="";
				HashMap commodityMap = new HashMap();
				if (commodityListMap.get("commodity_id") != null)
					commodityId = commodityListMap.get("commodity_id").toString();
				if (commodityListMap.get("commodity_name") != null)
					commodity_name = commodityListMap.get("commodity_name").toString();
				if (commodityListMap.get("publish_date") != null)
					publish_date = commodityListMap.get("publish_date").toString();
				try
					{
					commodity_name = new String(commodity_name.getBytes("GB2312"),"ISO8859_1");
					} catch (Exception e)
					{
						throw new RuntimeException(e);
					}
					commodityMap.put("commodity_name", commodity_name);
					commodityMap.put("commodity_id", commodityId);
					commodityMap.put("publish_date", publish_date);
				itemsList.add(commodityMap);
			}
		return itemsList;
	}
	//查找指定客户的记录
	public void genCustgoodsList(Buffers inbuffer)
	{
		log.LOG_INFO("进入genCustgoodsList方法...");
		String cust_id = inbuffer.getString("SESSION_CUST_ID");
		String  query_param = inbuffer.getString("QUERY_PARAM");
		try
			{
				if(query_param.equals(""))
					this.queryResult = genCustgoodsList(cust_id);
				else this.queryResult =searchCommodity(query_param,cust_id);
			} catch (SaasApplicationException e)
			{
				log.LOG_INFO(e.getMessage());

			}
		log.LOG_INFO("退出genCustgoodsList方法...");
	}
	public ArrayList genCustgoodsList(String cust_id) throws SaasApplicationException
	{
		
		ArrayList itemsList = new ArrayList();
		CommodityExt commodityExt = new CommodityExt();
		commodityExt.setParam(":VCUST_ID", cust_id);
		commodityExt.setParam(":VVALIDITY", "0");
		itemsList = commodityExt.selByList("SEL_BY_CUSTID");
		if(itemsList == null) return null;	
		return itemsList;
	}
	//新增商品信息
	public void addCommodityInfo(Buffers inbuffer)
	{
		log.LOG_INFO("进入addCommodityInfo方法...");
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		int iResult = -1;
		String  product_id =inbuffer.getString("PRODUCT_ID");
        CommodityDAO commodityDAO = new CommodityDAO();
        commodityDAO.setCommodity_id(inbuffer.getString("COMMODITY_ID"));
        commodityDAO.setCust_id(inbuffer.getString("CUST_ID"));
        commodityDAO.setCommodity_type(inbuffer.getString("COMMODITY_TYPE"));
        commodityDAO.setCommodity_name(inbuffer.getString("COMMODITY_NAME"));            
        commodityDAO.setContent(inbuffer.getString("CONTENT"));
        commodityDAO.setCommodity_brand(inbuffer.getString("COMMODITY_BRAND"));          
        commodityDAO.setCommodity_price(inbuffer.getString("COMMODITY_PRICE"));          
        commodityDAO.setPrice_type(inbuffer.getString("PRICE_TYPE"));                    
        commodityDAO.setSale_price(inbuffer.getString("SALE_PRICE"));                    
        commodityDAO.setCommodity_unit(inbuffer.getString("COMMODITY_UNIT"));            
        commodityDAO.setSale_market(inbuffer.getString("SALE_MARKET"));                  
        commodityDAO.setPublish_user_id(inbuffer.getString("SESSION_USER_ID"));    
        commodityDAO.setAudit_user_id(inbuffer.getString("SESSION_USER_ID")); 	
		try
		{                                               
			iResult = addCommodityInfo(commodityDAO,product_id);
		} 
		catch (SaasApplicationException e)
		{
			log.LOG_INFO(e.getMessage());
		}
		if (iResult != 0) {
			this.outBuffer.setInt("RESULT_CODE", -1);
			this.outBuffer.setString("RESULT_INFO", "业务处理失败!");

		} else {
			this.outBuffer.setInt("RESULT_CODE", 0);
			this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
		}
		log.LOG_INFO("退出addCommodityInfo方法...");
	}
	public int addCommodityInfo(CommodityDAO commodityDAO,String product_id) throws SaasApplicationException
	{
	    CommodityExt commodityExt = new CommodityExt();
	    commodityExt.setParam(":VCUST_ID",commodityDAO.getCust_id());
        commodityExt.setParam(":VCOMMODITY_ID",commodityDAO.getCommodity_id());
        commodityExt.setParam(":VCOMMODITY_TYPE",commodityDAO.getCommodity_type());
        commodityExt.setParam(":VCOMMODITY_NAME",commodityDAO.getCommodity_name());
        commodityExt.setParam(":VCONTENT",commodityDAO.getContent());
        commodityExt.setParam(":VCOMMODITY_CLASS","0");
        commodityExt.setParam(":VCOMMODITY_BRAND",commodityDAO.getCommodity_brand());
        commodityExt.setParam(":VCOMMODITY_PRICE",commodityDAO.getCommodity_price());
        commodityExt.setParam(":VPRICE_TYPE",commodityDAO.getPrice_type());
        commodityExt.setParam(":VSALE_PRICE",commodityDAO.getSale_price());
        commodityExt.setParam(":VCOMMODITY_UNIT",commodityDAO.getCommodity_unit());
        commodityExt.setParam(":VSALE_MARKET",commodityDAO.getSale_market());
        commodityExt.setParam(":VATTACH_TAG","0");
        commodityExt.setParam(":VPUBLISH_USER_ID",commodityDAO.getPublish_user_id());   
        commodityExt.setParam(":VVALIDITY","0");
        commodityExt.setParam(":VAUDIT_USER_ID",commodityDAO.getAudit_user_id());
        commodityExt.setParam(":VREMARK","");
        commodityExt.setParam(":VPRODUCT_ID",product_id);
        log.LOG_INFO("数据初始化赋值完成...................");
        tradeQuery.executeBy(commodityExt.insBy("INS_BY_ALL"));
        ArrayList itlist = genRootId(product_id);
        this.outBuffer.setString("SPEC_ROOT_ID",commodityDAO.getCommodity_id());
        if(itlist != null && itlist.size()>0)
        {
            HashMap  infoMap = (HashMap)itlist.get(0);
            if(infoMap.get("web_id")!=null)
            {
            	this.outBuffer.setString("WEB_ID",infoMap.get("web_id").toString());
            }
             if(infoMap.get("class_id")!=null)
            {
            	 this.outBuffer.setString("SPEC_CLASS_ID", infoMap.get("class_id").toString());
            }
            if(infoMap.get("class_name")!=null)
            {
            	   this.outBuffer.setString("SPEC_CLASS_NAME", infoMap.get("class_name").toString());
            }
             if(infoMap.get("class_id_grp")!=null)
            {
	         this.outBuffer.setString("SPEC_CLASS_ID_GRP", infoMap.get("class_id_grp").toString());
	        }
	        if(infoMap.get("class_name_grp")!=null)
            {

⌨️ 快捷键说明

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