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

📄 gbs_cusprofileaction.java

📁 对日软件外包 为东芝做的一个全球商业管理系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:

/** 
 * method GBS_CusProfileAction.java
 * created on 08-11-2004
 * 
 * @author   GXK
 * @version  1.0
 */

package ACTION;

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

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.BaseCommonCheck;
import COMMON.BaseDispatchAction;
import COMMON.MessageList;
import COMMON.ReturnValue;
import COMMON.SystemConstants;
import DataBean.GBS_CodeName_stBean;
import DataBean.GBS_Customer_stBean;
import LOGIC.GBS_CusProfileActionLogic;

public class GBS_CusProfileAction 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_CusProfileForm requestForm = (GBS_CusProfileForm) form;

		String customerId = requestForm.getCustomerID();
		String name = requestForm.getName();
		requestForm.reset(mapping, request);
		//write session to form
		this.setUserInfoFromSession(request, requestForm);

		requestForm = getCombo(requestForm, request);

		requestForm.setMethod("add");
		requestForm.setDisplayOrder("0");
		GBS_CusProfileActionLogic logic = new GBS_CusProfileActionLogic(this.getDataSource(request));

		if (customerId != null && !customerId.equals("")) {
			ReturnValue returnValue = logic.getCustomer(customerId);
			if (returnValue.isError()) {
				if (returnValue.isBussinessError()) {
					this.setMessage(returnValue.getMessageList());
				}
				return (mapping.findForward(nextview));
			} else {
				GBS_Customer_stBean stBean = (GBS_Customer_stBean) returnValue.getDataValue();
				requestForm.setCustomerID(stBean.getCustomerID());
				requestForm.setDisplayOrder(stBean.getDispOrder());
				requestForm.setCategory(stBean.getCustomerCategory());
				requestForm.setCode(stBean.getCustomerCode());
				requestForm.setName(stBean.getCustomerName());
				requestForm.setAbbreviation(stBean.getCustomerAbbr());
				requestForm.setIndustry(stBean.getIndustry());
				requestForm.setCityState(stBean.getAddr1());
				requestForm.setStreet(stBean.getAddr2());
				requestForm.setZipCode(stBean.getZipCode());
				requestForm.setCountry(stBean.getCountryCode());
				requestForm.setTel(stBean.getTelephone());
				requestForm.setFax(stBean.getFax());
				requestForm.setEmail(stBean.getEmail());
				requestForm.setContactPerson(stBean.getContactPerson());
				requestForm.setUrl(stBean.getUrl());
				requestForm.setDeleteFlag(stBean.getDeleteFlg());
				requestForm.setNumberOfEmployees(stBean.getNumberOfEmployee());

				//屭媞偺RFT忣曬傪専嶕偡傞
				returnValue = logic.getRfpInfo(customerId, requestForm.getLoginPlusHour());
				if (returnValue.isError()) {
					if (returnValue.isBussinessError()) {
						this.setMessage(returnValue.getMessageList());
					}
					return (mapping.findForward(nextview));
				} else {
					requestForm.setRfpList((ArrayList) returnValue.getDataValue());
				}

				requestForm.setMethod("update");
			}
		} else if (customerId.equals("") && name.equals("findNone")) {
			MessageList messages = new MessageList();
			messages.setMessage("", "", "10000004", Integer.MIN_VALUE);
			this.setMessage(messages);
		}
		return (mapping.findForward(nextview));

	}

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

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

		requestForm = getCombo(requestForm, request);

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

		//屭媞偺RFT忣曬傪専嶕偡傞
		ReturnValue returnValue = logic.getRfpInfo(requestForm.getCustomerID(), requestForm.getLoginPlusHour());
		if (returnValue.isError()) {
			if (returnValue.isBussinessError()) {
				this.setMessage(returnValue.getMessageList());
			}
			return (mapping.findForward(nextview));
		} else {
			requestForm.setRfpList((ArrayList) returnValue.getDataValue());
		}

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

		GBS_Customer_stBean stBean = new GBS_Customer_stBean();

		stBean.setCustomerID(requestForm.getCustomerID());
		if(!requestForm.getDisplayOrder().trim().equals("")){
			stBean.setDispOrder(requestForm.getDisplayOrder());
		}else{
			stBean.setDispOrder("0");
		}
		stBean.setCustomerCategory(requestForm.getCategory());
		stBean.setCustomerCode(requestForm.getCode());
		stBean.setCustomerName(requestForm.getName());
		stBean.setCustomerAbbr(requestForm.getAbbreviation());
		stBean.setIndustry(requestForm.getIndustry());
		stBean.setAddr1(requestForm.getCityState());
		stBean.setAddr2(requestForm.getStreet());
		stBean.setZipCode(requestForm.getZipCode());
		stBean.setCountryCode(requestForm.getCountry());
		stBean.setTelephone(requestForm.getTel());
		stBean.setFax(requestForm.getFax());
		stBean.setEmail(requestForm.getEmail());
		stBean.setContactPerson(requestForm.getContactPerson());
		stBean.setUrl(requestForm.getUrl());
		//			stBean.setDeleteFlg(requestForm.getDeleteFlg());
		// wxf modified at 2004.08.20 Start
		//stBean.setNumberOfEmployee(requestForm.getNumberOfEmployees());
		stBean.setNumberOfEmployee(remove(requestForm.getNumberOfEmployees(), ','));
		// wxf modified at 2004.08.20 End
		stBean.setCreateUser(requestForm.getLoginUserId());
		//			stBean.setCreateDate(requestForm.getCreateDate());
		//			stBean.setUpdateUser(requestForm.getUpdateUser());
		//			stBean.setUpdateDate(requestForm.getUpdateDate());

		returnValue = logic.insertCustomer(stBean);
		if (returnValue.isError()) {
			if (returnValue.isBussinessError()) {
				this.setMessage(returnValue.getMessageList());
			}
			return (mapping.findForward(nextview));
		}
		requestForm.setMethod("AddOk");
		return (mapping.findForward(nextview));
	}

	/** 
	* Method update
	* @param ActionMapping mapping
	* @param ActionForm form
	* @param HttpServletRequest request
	* @param HttpServletResponse response
	* @return ActionForward
	* @throws Exception
	*/
	public ActionForward update(
		ActionMapping mapping,
		ActionForm form,
		HttpServletRequest request,
		HttpServletResponse response)
		throws Exception {
		GBS_CusProfileForm requestForm = (GBS_CusProfileForm) form;
		//write session to form
		this.setUserInfoFromSession(request, requestForm);

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

		requestForm = getCombo(requestForm, request);

		//屭媞偺RFT忣曬傪専嶕偡傞
		ReturnValue returnValue = logic.getRfpInfo(requestForm.getCustomerID(), requestForm.getLoginPlusHour());
		if (returnValue.isError()) {
			if (returnValue.isBussinessError()) {
				this.setMessage(returnValue.getMessageList());
			}
			return (mapping.findForward(nextview));
		} else {
			requestForm.setRfpList((ArrayList) returnValue.getDataValue());
		}

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

⌨️ 快捷键说明

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