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

📄 custclass.java

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

import java.util.ArrayList;
import java.util.HashMap;

import com.saas.biz.commen.ParamethodMgr;
import com.saas.biz.commen.commMethodMgr;
import com.saas.biz.dao.custDAO.CustLevelExt;
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 CustClass {
	Dbtable tradeQuery;

	Logger log;

	Buffers inBuffer;

	Buffers outBuffer;

	ArrayList queryResult = new ArrayList();

	commMethodMgr comm;

	public CustClass() {
		log = new Logger(this);
		tradeQuery = new Dbtable();
		comm = new commMethodMgr();
	}

	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 addCustClass(Buffers inbuffer) {
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		log.LOG_INFO("进入addCustClass方法...");
		int iResult = -1;
		try {
			String cust_id = inbuffer.getString("CUST_ID");
			String oper_cust_id = inbuffer.getString("SESSION_USER_ID");
			String start_date = inbuffer.getString("START_DATE");
			String end_date = inbuffer.getString("END_DATE");
			String remark = inbuffer.getString("REMARK");
			String cust_class = inbuffer.getString("CUST_CLASS");
			iResult = addCustClass(cust_id, oper_cust_id, start_date, end_date, remark, cust_class);
		} 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("退出addCustClass方法...");
	}

	public int addCustClass(String cust_id, String oper_cust_id, String start_date, String end_date, String remark, String cust_class) throws SaasApplicationException {
		CustLevelExt custlevelExt = new CustLevelExt();
		rightoutdate(cust_id);
		custlevelExt.setParam(":VCUST_ID", cust_id);
		custlevelExt.setParam(":VCUST_OPER_PERSON", oper_cust_id);
		custlevelExt.setParam(":VSTART_DATE", start_date);
		custlevelExt.setParam(":VEND_DATE", end_date);
		custlevelExt.setParam(":VCUST_CLASS", cust_class);
		custlevelExt.setParam(":VREMARK", remark);
		tradeQuery.executeBy(custlevelExt.insBy("INS_BY_ALL"));
		return 0;
	}

	// 修改客户级别
	public void updateCustClass(Buffers inbuffer) {
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		log.LOG_INFO("进入addCustClass方法...");
		int iResult = -1;
		try {
			String cust_id = inbuffer.getString("CUST_ID");
			String cust_class = inbuffer.getString("CUST_CLASS");
			iResult = addCustClass(cust_id, cust_class);
		} 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("退出addCustClass方法...");
	}

	public int addCustClass(String cust_id, String cust_class) throws SaasApplicationException {
		CustLevelExt custlevelExt = new CustLevelExt();
		rightoutdate(cust_id);
		custlevelExt.setParam(":VCUST_ID", cust_id);
		custlevelExt.setParam(":VCUST_CLASS", cust_class);
		tradeQuery.executeBy(custlevelExt.insBy("UPDATE_CUST_CLASS"));
		return 0;
	}

	// 查询客户级别信息 add by sjp date:2007-06-07
	public void genOneright(Buffers inbuffer) {
		log.LOG_INFO("进入genOneright方法...");
		this.outBuffer = inbuffer;
		String cust_id = inbuffer.getString("CUST_ID");
		try {
			this.queryResult = genOneright(cust_id);
		} catch (SaasApplicationException e) {
			log.LOG_INFO(e.getMessage());
		}
		log.LOG_INFO("退出genOneright方法...");
	}

	/**
	 * 
	 * @param cust_id
	 * @return 取出结束时间最大的记录
	 * @throws SaasApplicationException
	 */
	public ArrayList genOneright(String cust_id) throws SaasApplicationException {
		ArrayList itemsList = new ArrayList();
		CustLevelExt custlevelExt = new CustLevelExt();
		custlevelExt.setParam(":VCUST_ID", cust_id);
		itemsList = custlevelExt.selByList("SEL_BY_ONE");
		return itemsList;
	}

	// 设置以前权限的过期
	public int rightoutdate(String cust_id) throws SaasApplicationException {
		CustLevelExt custupdateExt = new CustLevelExt();
		custupdateExt.setParam(":VCUST_ID", cust_id);
		tradeQuery.executeBy(custupdateExt.insBy("UPDATE_BY_CUST"));
		return 0;
	}

	/**
	 * 
	 * @param cust_id
	 * @return 取出客户级别名称
	 * @throws SaasApplicationException
	 */
	public String cust_Class_Name(String cust_id) throws SaasApplicationException {
		log.LOG_DEBUG("进入cust_Class_Name方法");
		String class_name = "未知(请与管理员联系)";
		ArrayList list = genOneright(cust_id);
		if (list != null && list.size() > 0) {
			HashMap map = (HashMap) list.get(0);
			String cust_class = "";
			if (map.get("cust_class") != null) {
				ParamethodMgr param = new ParamethodMgr();
				cust_class = map.get("cust_class").toString();
				class_name = param.getParamNameByValue("14", cust_class);
			}
		}
		log.LOG_DEBUG("退出cust_Class_Name方法"+class_name);
		return class_name;
	}

	/**
	 * 
	 * @param cust_id
	 * @return 取出客户级别
	 * @throws SaasApplicationException
	 */
	public String getCustClassById(String cust_id) throws SaasApplicationException {
		String cust_class = "1";
		ArrayList list = genOneright(cust_id);
		if (list != null && list.size() > 0) {
			HashMap map = (HashMap) list.get(0);
			if (map.get("cust_class") != null) {
				cust_class = map.get("cust_class").toString();
			}
		}
		return cust_class;
	}
}

⌨️ 快捷键说明

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