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

📄 formstateinfo.java

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

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;

import com.saas.biz.commen.commMethodMgr;
import com.saas.biz.dao.formStateDAO.FormStateDAO;
import com.saas.biz.dao.formStateDAO.FormStateExt;
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 FormStateInfo {
	
	
	Dbtable tradeQuery;
	
	
	commMethodMgr comm;
	
	
	Logger log;
	
	
	Buffers inBuffer;
	
	
	Buffers outBuffer;
	
	
	ArrayList queryResult = new ArrayList();
	
	
	
	public FormStateInfo() {

		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;
	}
	
	
	
	/**
	 * 新增订单状态信息
	 * 
	 * @param inbuffer
	 */
	public void addFormStateInfo(Buffers inbuffer) {

		log.LOG_INFO("进入addFormStateInfo方法...");
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		int iResult = -1;
		String cust_id = inbuffer.getString("SESSION_CUST_ID");
		String server_id = inbuffer.getString("QUO_ID");
		String staff_id = inbuffer.getString("SESSION_USER_ID");
		String end_date = inbuffer.getString("GIVE_DATE");
		String state_code = inbuffer.getString("STATE_CODE");
		try {
			FormStateDAO stateDao = new FormStateDAO();
			stateDao.setCust_id(cust_id);
			stateDao.setServer_id(server_id);
			stateDao.setState_code(state_code);
			stateDao.setEnd_date(end_date);
			stateDao.setStaff_id(staff_id);
			iResult = addFormStateInfo(stateDao);
		}
		catch (Exception 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("退出addFormStateInfo方法...");
	}
	
	
	public int addFormStateInfo(FormStateDAO stateDao) throws SaasApplicationException {

		FormStateExt stateExt = new FormStateExt();
		stateExt.setParam(":VCUST_ID", stateDao.getCust_id());
		stateExt.setParam(":VQUO_ID", stateDao.getServer_id());
		stateExt.setParam(":VUSER_ID", stateDao.getStaff_id());
		stateExt.setParam(":VSTATE_CODE", stateDao.getState_code());
		stateExt.setParam(":VSTATE_RESEAN", "");
		stateExt.setParam(":VEND_DATE", stateDao.getEnd_date());
		stateExt.setParam(":VSTART_DATE", new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
		stateExt.setParam(":VSTATE_CODE_DATE", new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
		stateExt.setParam(":VREMARK", "");
		tradeQuery.executeBy(stateExt.insBy("INS_BY_ALL"));
		return 0;
	}
	
	
	
	/**
	 * 更改订单状太
	 * 
	 * @param inbuffer
	 */
	public void updateFormStateInfo(Buffers inbuffer) {

		log.LOG_INFO("进入updateFormStateInfo方法...");
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		int iResult = -1;
		String sale_quo_id = inbuffer.getString("SALE_QUO_ID");
		String staff_id = inbuffer.getString("SESSION_USER_ID");
		String cust_id = inbuffer.getString("SESSION_CUST_ID");
		String code = inbuffer.getString("STATE_CODE");
		String state_resean = inbuffer.getString("BACK_TYPE");
		String end_date = inbuffer.getString("GIVE_DATE");
		try {
			state_resean = state_resean.equals("0") ? "退货" : "换货";
			FormStateDAO stateDao = new FormStateDAO();
			stateDao.setServer_id(sale_quo_id);
			stateDao.setState_code(code);
			stateDao.setStaff_id(staff_id);
			stateDao.setEnd_date(end_date);
			stateDao.setCust_id(cust_id);
			stateDao.setState_resean(state_resean);
			iResult = updateFormStateInfo(stateDao);
		}
		catch (Exception 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("退出addFormStateInfo方法...");
	}
	
	
	public int updateFormStateInfo(FormStateDAO stateDao) throws SaasApplicationException {

		FormStateExt upExt = new FormStateExt();
		String id = getStateId(stateDao.getServer_id(), stateDao.getCust_id());
		upExt.setParam(":VQUO_ID", stateDao.getServer_id());
		upExt.setParam(":VCUST_ID", stateDao.getCust_id());
		upExt.setParam(":VID", id);
		tradeQuery.executeBy(upExt.insBy("UPDATE_BY_ALL"));
		FormStateExt stateExt = new FormStateExt();
		stateExt.setParam(":VCUST_ID", stateDao.getCust_id());
		stateExt.setParam(":VQUO_ID", stateDao.getServer_id());
		stateExt.setParam(":VUSER_ID", stateDao.getStaff_id());
		stateExt.setParam(":VSTATE_CODE", stateDao.getState_code());
		stateExt.setParam(":VSTATE_RESEAN", stateDao.getState_resean());
		stateExt.setParam(":VEND_DATE", stateDao.getEnd_date());
		stateExt.setParam(":VSTART_DATE", new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
		stateExt.setParam(":VSTATE_CODE_DATE", new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
		stateExt.setParam(":VREMARK", "");
		tradeQuery.executeBy(stateExt.insBy("INS_BY_ALL"));
		return 0;
	}
	
	
	
	// 取出最新的状态
	public String getStateId(String quo_id, String cust_id) throws SaasApplicationException {

		String id = "1";
		FormStateExt upExt = new FormStateExt();
		upExt.setParam(":VQUO_ID", quo_id);
		upExt.setParam(":VCUST_ID", cust_id);
		ArrayList list = upExt.selByList("SEL_BY_MAX");
		if (list != null && list.size() > 0) {
			HashMap map = (HashMap) list.get(0);
			if (map.get("id") != null) {
				id = map.get("id").toString();
			}
		}
		return id;
	}
	
	
	
	// 更改状态
	public void updateStateInfo(Buffers inbuffer) {

		log.LOG_INFO("进入updateStateInfo方法...");
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		int iResult = -1;
		String sale_quo_id = inbuffer.getString("SALE_QUO_ID");
		String staff_id = inbuffer.getString("SESSION_USER_ID");
		String cust_id = inbuffer.getString("SESSION_CUST_ID");
		String code = inbuffer.getString("STATE_CODE");
		String state_resean = inbuffer.getString("STATE_RESEAN");
		String end_date = inbuffer.getString("END_DATE");
		try {
			FormStateDAO stateDao = new FormStateDAO();
			stateDao.setServer_id(sale_quo_id);
			stateDao.setState_code(code);
			stateDao.setStaff_id(staff_id);
			stateDao.setEnd_date(end_date);
			stateDao.setCust_id(cust_id);
			stateDao.setState_resean(state_resean);
			iResult = updateFormStateInfo(stateDao);
		}
		catch (Exception 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("退出updateStateInfo方法...");
	}
	
	
	
	// 取出订单状态列表
	public ArrayList getOrderFormStateList(int iStart, String cust_id) throws SaasApplicationException {

		if (iStart == 0) {
			iStart = 0;
		}
		else {
			iStart = (iStart - 1) * 20;
		}
		ArrayList list = new ArrayList();
		FormStateExt stateExt = new FormStateExt();
		stateExt.setParam(":VCUST_ID", cust_id);
		list = stateExt.selByList("SEL_BY_CUST", iStart, 20);
		return list;
	}
	
	
	
	// 统计出订单状态
	public int getOrderFormStateCount(String cust_id) throws SaasApplicationException {

		int size = 0;
		ArrayList list = new ArrayList();
		FormStateExt stateExt = new FormStateExt();
		stateExt.setParam(":VCUST_ID", cust_id);
		list = stateExt.selByList("SEL_BY_CUST_CT");
		if (list != null && list.size() > 0) {
			HashMap map = (HashMap) list.get(0);
			size = Integer.parseInt(map.get("ct").toString());
		}
		return size;
	}
	
	
	public void updateBeforeProcur(Buffers inbuffer) {

		log.LOG_INFO("进入updateBeforeProcur方法...");
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		int iResult = -1;
		String cust_id = inbuffer.getString("SESSION_CUST_ID");
		String quo_id = inbuffer.getString("LINK_QUO_ID");
		try {
			iResult = updateBeforeProcur(cust_id, quo_id);
		}
		catch (Exception 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("退出updateBeforeProcur方法...");
	}
	
	
	public int updateBeforeProcur(String cust_id, String quo_id) throws SaasApplicationException {

		FormStateExt stateExt = new FormStateExt();
		stateExt.setParam(":VCUST_ID", cust_id);
		stateExt.setParam(":VQUO_ID", quo_id);
		tradeQuery.executeBy(stateExt.insBy("UPDATE_BEFORE_PROCUR"));
		return 0;
	}
	
	
	
	// 取出订单流程
	public ArrayList getOrderListById(String cust_id, String quo_id) throws SaasApplicationException {

		ArrayList list = new ArrayList();
		FormStateExt stateExt = new FormStateExt();
		stateExt.setParam(":VCUST_ID", cust_id);
		stateExt.setParam(":VQUO_ID", quo_id);
		list = stateExt.selByList("SEL_BY_LIST");
		return list;
	}
	
	public void delSomeState(Buffers inbuffer) {

		log.LOG_INFO("进入delSomeState方法...");
		this.outBuffer = inbuffer;
		this.inBuffer = inbuffer;
		int iResult = -1;
		String cust_id = inbuffer.getString("SESSION_CUST_ID");
		String quo_id = inbuffer.getString("QUO_ID");
		try {
			iResult = delSomeState(cust_id,quo_id);
		}
		catch (Exception 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("退出delSomeState方法...");
	}
	
	
	public int delSomeState(String cust_id,String quo_id) throws SaasApplicationException {

		FormStateExt stateExt = new FormStateExt();
		stateExt.setParam(":VCUST_ID", cust_id);
		stateExt.setParam(":VQUO_ID", quo_id);
		tradeQuery.executeBy(stateExt.insBy("DEL_SOME_STATE"));
		return 0;
	}
}

⌨️ 快捷键说明

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