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

📄 gbs_customerinquiryaction.java

📁 对日软件外包 为东芝做的一个全球商业管理系统
💻 JAVA
字号:

/** 
 * method GBS_CustomerInquiryAction.java
 * created on 08-11-2004
 * 
 * @author   GXK
 * @version  1.0
 */
package ACTION;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import COMMON.BaseDispatchAction;
import COMMON.MessageList;
import COMMON.ReturnValue;
import COMMON.SystemConstants;
import LOGIC.GBS_CustomerInquiryActionLogic;

public class GBS_CustomerInquiryAction extends BaseDispatchAction implements SystemConstants {

	/** 
	 * Method init
	 * @param ActionMapping mapping
	 * @param ActionForm form
	 * @param HttpServletRequest request
	 * @param HttpServletResponse response
	 * @return ActionForward
	 * @throws Exception
	 */
	public ActionForward init(
		ActionMapping mapping,
		ActionForm form,
		HttpServletRequest request,
		HttpServletResponse response)
		throws Exception {

		GBS_CustomerInquiryForm requestForm = (GBS_CustomerInquiryForm) form;
		//write session to form
		this.setUserInfoFromSession(request, requestForm);

		requestForm = getCombo(requestForm, request);

		return (mapping.findForward(nextview));
	}

	/** 
	 * Method search
	 * @param ActionMapping mapping
	 * @param ActionForm form
	 * @param HttpServletRequest request
	 * @param HttpServletResponse response
	 * @return ActionForward
	 * @throws Exception
	 */

	public ActionForward search(
		ActionMapping mapping,
		ActionForm form,
		HttpServletRequest request,
		HttpServletResponse response)
		throws Exception {

		GBS_CustomerInquiryForm requestForm = (GBS_CustomerInquiryForm) form;
		//write session to form
		this.setUserInfoFromSession(request, requestForm);

		//get the combo value from DB
		requestForm = getCombo(requestForm, request);

		//return the select value to page
		requestForm = returnSelect(requestForm);

		//input check
		MessageList errorMsg = inputCheck(requestForm, request);
		if (errorMsg.size() > 0) {
			//save error to request
			this.setMessage(errorMsg);
			return (mapping.findForward(nextview));
		}

		GBS_CustomerInquiryActionLogic logic =
			new GBS_CustomerInquiryActionLogic(this.getDataSource(request));

		ReturnValue returnValue =
			logic.getCustomer(
				requestForm.getExistingMA(),
				requestForm.getExistingGA(),
				requestForm.getProspectGA(),
				requestForm.getCustomerName(),
				requestForm.getCustomerAbbr(),
				requestForm.getStatusGA(),
				requestForm.getResultStatus(),
				requestForm.getSubsidiary(),
				requestForm.getIndustry(),
				requestForm.getRegion(),
				requestForm.getCountries(),
				requestForm.getLoginPlusHour(),
				requestForm.getLoginAdminAuthority());
		if (returnValue.isError()) {
			if (returnValue.isBussinessError()) {
				//this.setMessage(returnValue.getMessageList());
				this.setMessage("", "", "10000004", Integer.MIN_VALUE);
			}
			return (mapping.findForward(nextview));
		} else {
			ArrayList customerList = (ArrayList) returnValue.getDataValue();
			if (customerList.size() == 0) {
				/*
				//find forward to add customer page
				if (requestForm.getLoginAdminAuthority().equals("3")) {
					this.setMessage("", "", "10000004", Integer.MIN_VALUE);
					return (mapping.findForward(nextview));
				} else if (
					requestForm.getLoginAdminAuthority().equals("1")
						|| requestForm.getLoginAdminAuthority().equals("2")) {
					requestForm.setMethod("AddCustomer");
					return (mapping.findForward(nextview));
				}*/
			} else {
				requestForm.setCustomerList(customerList);
				return (mapping.findForward(searchresult));
			}
		}
		return (mapping.findForward(nextview));
	}

	/**
	 * get combo
	 * @param form GBS_CustomerInquiryForm
	 * @param request HttpServletRequest
	 * @return GBS_CustomerInquiryForm
	 * @throws Exception
	 */

	private GBS_CustomerInquiryForm getCombo(
		GBS_CustomerInquiryForm form,
		HttpServletRequest request)
		throws Exception {

		GBS_CustomerInquiryActionLogic logic =
			new GBS_CustomerInquiryActionLogic(this.getDataSource(request));
		//wxf modified at 2004.08.20 Start
		//form.setCountriesList((ArrayList) logic.getCountryList().getDataValue());
		ReturnValue ret = logic.getCountryList();
		if(ret.isError()){
			if(ret.isBussinessError()){
				this.setMessage(ret.getMessageList());
			}
		}else{
			form.setCountriesList((ArrayList) ret.getDataValue());
		}
		//form.setIndustryList((ArrayList) logic.getIndustryList().getDataValue());
		ret = logic.getIndustryList();
		if(ret.isError()){
			if(ret.isBussinessError()){
				this.setMessage(ret.getMessageList());
			}
		}else{
			form.setIndustryList((ArrayList) ret.getDataValue());
		}
		//form.setRegionList((ArrayList) logic.getRegionList().getDataValue());
		ret = logic.getRegionList();
		if(ret.isError()){
			if(ret.isBussinessError()){
				this.setMessage(ret.getMessageList());
			}
		}else{
			form.setRegionList((ArrayList) ret.getDataValue());
		}
		//form.setSubsidiaryList((ArrayList) logic.getSubsidiaryList().getDataValue());
		ret = logic.getSubsidiaryList();
		if(ret.isError()){
			if(ret.isBussinessError()){
				this.setMessage(ret.getMessageList());
			}
		}else{
			form.setSubsidiaryList((ArrayList) ret.getDataValue());
		}
		//wxf modified at 2004.08.20 end
		ArrayList statusGALabelList = new ArrayList();

		statusGALabelList.add("");
		//0: (blank)   1: RFP  2: NDA  3: Reply  4: Result							
		statusGALabelList.add("RFP");
		statusGALabelList.add("NDA");
		statusGALabelList.add("Reply");
		statusGALabelList.add("Result");

		form.setStatusGALabelList(statusGALabelList);

		ArrayList statusGAValueList = new ArrayList();

		statusGAValueList.add("0");
		statusGAValueList.add("1");
		statusGAValueList.add("2");
		statusGAValueList.add("3");
		statusGAValueList.add("4");
		
		form.setStatusGAValueList(statusGAValueList);

		ArrayList resultStatusLabelList = new ArrayList();

		resultStatusLabelList.add("");
		//wxf modified at 2004.08.20 Start
		//resultStatusLabelList.add("WON");
		//resultStatusLabelList.add("LOST")
		resultStatusLabelList.add("Won");
		resultStatusLabelList.add("Lost");
		//wxf modified at 2004.08.20 end
		form.setResultStatusLabelList(resultStatusLabelList);

		ArrayList resultStatusValueList = new ArrayList();

		resultStatusValueList.add("0");
		resultStatusValueList.add("W");
		resultStatusValueList.add("L");

		form.setResultStatusValueList(resultStatusValueList);
		return form;
	}

	/**
	 * returnSelect info to page
	 * @param form GBS_CustomerInquiryForm
	 * @return GBS_CustomerInquiryForm
	 * @throws Exception
	 */

	private GBS_CustomerInquiryForm returnSelect(GBS_CustomerInquiryForm form) throws Exception {

		//return select subsidiary
		if (form.getSubsidiary() != null) {
			ArrayList tmpList = new ArrayList();
			String[] tmpStr = form.getSubsidiary();
			for (int i = 0; i < tmpStr.length; i++) {
				tmpList.add(tmpStr[i]);
			}
			form.setSelectSubsidiary(tmpList);
		}

		//return select country
		if (form.getCountries() != null) {
			ArrayList tmpList = new ArrayList();
			String[] tmpStr = form.getCountries();
			for (int i = 0; i < tmpStr.length; i++) {
				tmpList.add(tmpStr[i]);
			}
			form.setSelectCountries(tmpList);
		}

		//return select Industry
		if (form.getIndustry() != null) {
			ArrayList tmpList = new ArrayList();
			String[] tmpStr = form.getIndustry();
			for (int i = 0; i < tmpStr.length; i++) {
				tmpList.add(tmpStr[i]);
			}
			form.setSelectIndustry(tmpList);
		}

		//return select region
		if (form.getRegion() != null) {
			ArrayList tmpList = new ArrayList();
			String[] tmpStr = form.getRegion();
			for (int i = 0; i < tmpStr.length; i++) {
				tmpList.add(tmpStr[i]);
			}
			form.setSelectRegion(tmpList);
		}

		return form;
	}

	/**
	 * inputCheck
	 * @param thisForm GBS_LoginForm
	 * @param request HttpServletRequest
	 * @throws Exception
	 * @return ErrorMessages
	 */
	private MessageList inputCheck(GBS_CustomerInquiryForm thisForm, HttpServletRequest request)
		throws Exception {

		//create ErrorMessages to display error message
		MessageList messages = new MessageList();
		
		return messages;
	}
}

⌨️ 快捷键说明

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