?? gbs_mifentryaction.java
字號(hào):
/*
* Created on 2004/08/10
*
*/
package ACTION;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
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_MMifDetail_stBean;
import DataBean.GBS_MMif_stBean;
import DataBean.GBS_MifEntryList_stBean;
import LOGIC.GBS_MifEntryActionLogic;
/**
* <p>Title: MIF ENTRY </p>
* <p>Description: process page action<br>
* </p>
* <p> Copyright (c) 2004</p>
* @author xjl
* @version 1.0
*/
public class GBS_MifEntryAction extends BaseDispatchAction implements SystemConstants {
/**
* init page
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws Exception
*/
public ActionForward init(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws Exception {
log.info("[location info]GBS_MifEntryAction.init method!");
GBS_MifEntryForm thisForm = (GBS_MifEntryForm) form;
this.setUserInfoFromSession(request, thisForm);
// getComboxValue
this.getComboxValueAndName(thisForm, request);
GBS_MifEntryActionLogic logic = new GBS_MifEntryActionLogic(this.getDataSource(request));
//init method
thisForm.setMethod("add");
Map getData = new HashMap();
if (!thisForm.getCountryCode().trim().equals("")) {
GBS_MMif_stBean mif_st = new GBS_MMif_stBean();
ArrayList lstDetail = new ArrayList();
mif_st.setCountryCode(thisForm.getCountryCode().trim());
mif_st.setCustomerId(thisForm.getCustomerId().trim());
mif_st.setProductCategory(thisForm.getProductCategory().trim());
mif_st.setSubsidiaryCode(thisForm.getSubsidiaryCode().trim());
ReturnValue returnValue = (ReturnValue) logic.getMifDetail(mif_st);
if (returnValue.isError()) {
//僄儔乕帪
if (returnValue.isBussinessError()) {
this.setMessage(returnValue.getMessageList());
}
return (mapping.findForward(nextview));
}
getData = (Map) returnValue.getDataValue();
mif_st = (GBS_MMif_stBean) getData.get(MIF);
lstDetail = (ArrayList) getData.get(MIF_DETAIL);
thisForm.setCustomerName(mif_st.getCustomerName());
thisForm.setSubsidiaryCode(mif_st.getSubsidiaryCode());
thisForm.setProductCategory(mif_st.getProductCategory());
thisForm.setCountryCode(mif_st.getCountryCode());
thisForm.setMifDetail(lstDetail);
thisForm.setAttachmentName(mif_st.getAtchFileName());
thisForm.setRemarks(mif_st.getRemarks());
//set method
thisForm.setMethod("update");
} else {
//add mode
//get customerName
ReturnValue returnValue = (ReturnValue) logic.getCustomerName(thisForm.getCustomerId());
if (returnValue.isError()) {
//僄儔乕帪
if (returnValue.isBussinessError()) {
this.setMessage(returnValue.getMessageList());
}
return (mapping.findForward(nextview));
}
if (returnValue.getDataValue() != null) {
thisForm.setCustomerName((String) returnValue.getDataValue());
}
//Get country and subs List
returnValue = logic.getCountrySubsList();
if (returnValue.isError()) {
} else {
thisForm.setCountrySubsList((ArrayList) returnValue.getDataValue());
}
}
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 requestform,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
GBS_MifEntryForm form = (GBS_MifEntryForm) requestform;
//get login user info from session
this.setUserInfoFromSession(request, form);
// getComboxValue
this.getComboxValueAndName(form, request);
GBS_MifEntryActionLogic logic = new GBS_MifEntryActionLogic(this.getDataSource(request));
GBS_MifEntryList_stBean mifentryList_st = new GBS_MifEntryList_stBean();
ReturnValue returnValue = new ReturnValue();
ArrayList lstDetail = new ArrayList();
//InputCheck
MessageList errorMsg = new MessageList();
errorMsg = inputCheck(form, request);
if (errorMsg.size() > 0) {
form = returnFormData(form, request);
//save error to request
this.setMessage(errorMsg);
return (mapping.findForward(nextview));
}
//LogicCheck
errorMsg = logicCheck(form, request);
if (errorMsg.size() > 0) {
//save error to request
this.setMessage(errorMsg);
form = returnFormData(form, request);
return (mapping.findForward(nextview));
}
//GBS_MifEntryList_stBean
mifentryList_st.setCountryCode(form.getCountryCode());
mifentryList_st.setCustomerId(form.getCustomerId());
mifentryList_st.setProductCategory(form.getProductCategory());
mifentryList_st.setRemarks(form.getRemarks());
mifentryList_st.setSubsidiaryCode(form.getSubsidiaryCode());
mifentryList_st.setUser(form.getLoginUserId());
String[] modelOld = form.getModelOld();
String[] model = form.getModel();
String[] qty = form.getQty();
String[] currency = form.getCurrency();
String[] hardPrice = form.getHardPrice();
String[] cpcPrice = form.getCpcPrice();
String[] mcv = form.getMcv();
String[] installDate = form.getInstallDate();
String[] rfpDate = form.getRfpDate();
if (model != null) {
for (int i = 0; i < model.length; i++) {
if (model[i].trim().equals("") && modelOld[i].trim().equals("")) {
continue;
}
GBS_MMifDetail_stBean mifdetail_st = new GBS_MMifDetail_stBean();
String strInstallDate = installDate[i];
mifdetail_st.setInstallDate(BaseCommonCheck.convertDateToYYYYMMDD(strInstallDate));
String strRfpDate = rfpDate[i];
mifdetail_st.setRfpDate(BaseCommonCheck.convertDateToYYYYMMDD(strRfpDate));
mifdetail_st.setModel(model[i]);
mifdetail_st.setQty(remove(qty[i], ','));
mifdetail_st.setCurrency(currency[i]);
mifdetail_st.setHardPrice(remove(hardPrice[i], ','));
mifdetail_st.setCpcPrice(remove(cpcPrice[i], ','));
mifdetail_st.setMcv(remove(mcv[i], ','));
mifdetail_st.setUserId(form.getLoginUserId());
mifdetail_st.setModelOld(modelOld[i]);
lstDetail.add(mifdetail_st);
}
}
mifentryList_st.setGBSMMifDetail_st(lstDetail);
//insert
//僷儔儊乕僞丗mifentryList_st丄thisForm.getAttachmentFile()
returnValue = (ReturnValue) logic.addMifDetail(mifentryList_st, form.getSeqNo(), form.getFileStatus());
if (returnValue.isError()) {
//僄儔乕帪
if (returnValue.isBussinessError()) {
this.setMessage(returnValue.getMessageList());
}
form = returnFormData(form, request);
return (mapping.findForward(nextview));
}
form.reset(mapping, request);
form.setMethod("close");
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 requestform,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
GBS_MifEntryForm form = (GBS_MifEntryForm) requestform;
//get login user info from session
this.setUserInfoFromSession(request, form);
// getComboxValue
this.getComboxValueAndName(form, request);
GBS_MifEntryActionLogic logic = new GBS_MifEntryActionLogic(this.getDataSource(request));
GBS_MifEntryList_stBean mifentryList_st = new GBS_MifEntryList_stBean();
ReturnValue returnValue = new ReturnValue();
//InputCheck
MessageList errorMsg = new MessageList();
errorMsg = (MessageList) inputCheck(form, request);
if (errorMsg.size() > 0) {
//save error to request
this.setMessage(errorMsg);
form = returnFormData(form, request);
return (mapping.findForward(nextview));
}
//LogicCheck
errorMsg = (MessageList) logicCheck(form, request);
if (errorMsg.size() > 0) {
//save error to request
this.setMessage(errorMsg);
form = returnFormData(form, request);
return (mapping.findForward(nextview));
}
mifentryList_st.setCountryCode(form.getCountryCode().trim());
mifentryList_st.setCustomerId(form.getCustomerId().trim());
mifentryList_st.setProductCategory(form.getProductCategory().trim());
mifentryList_st.setRemarks(form.getRemarks());
mifentryList_st.setSubsidiaryCode(form.getSubsidiaryCode().trim());
mifentryList_st.setUser(form.getLoginUserId());
if (form.getDeleteFile().equals(on)) {
mifentryList_st.setDeleteFile(true);
}
String[] modelOld = form.getModelOld();
String[] model = form.getModel();
String[] qty = form.getQty();
String[] currency = form.getCurrency();
String[] hardPrice = form.getHardPrice();
String[] cpcPrice = form.getCpcPrice();
String[] mcv = form.getMcv();
String[] installDate = form.getInstallDate();
String[] rfpDate = form.getRfpDate();
String[] userId = form.getUserId();
ArrayList lstDetail = new ArrayList();
for (int i = 0; i < model.length; i++) {
if (model[i].trim().equals("") && modelOld[i].trim().equals("")) {
continue;
}
GBS_MMifDetail_stBean mifdetail_st = new GBS_MMifDetail_stBean();
mifdetail_st.setModelOld(modelOld[i]);
mifdetail_st.setModel(model[i]);
mifdetail_st.setInstallDate(BaseCommonCheck.convertDateToYYYYMMDD(installDate[i]));
mifdetail_st.setRfpDate(BaseCommonCheck.convertDateToYYYYMMDD(rfpDate[i]));
mifdetail_st.setQty(remove(qty[i], ','));
mifdetail_st.setCurrency(currency[i]);
mifdetail_st.setHardPrice(remove(hardPrice[i], ','));
mifdetail_st.setCpcPrice(remove(cpcPrice[i], ','));
mifdetail_st.setMcv(remove(mcv[i], ','));
mifdetail_st.setUserId(form.getLoginUserId());
mifdetail_st.setUserId(form.getLoginUserId());
lstDetail.add(mifdetail_st);
}
mifentryList_st.setGBSMMifDetail_st(lstDetail);
//update
//僷儔儊乕僞丗mifentryList_st丄thisForm.getAttachmentFile
returnValue = (ReturnValue) logic.updMifDetail(mifentryList_st, form.getSeqNo(), form.getFileStatus());
if (returnValue.isError()) {
//僄儔乕帪
if (returnValue.isBussinessError()) {
this.setMessage(returnValue.getMessageList());
}
form = returnFormData(form, request);
return (mapping.findForward(nextview));
}
form.reset(mapping, request);
form.setMethod("close");
return (mapping.findForward(nextview));
}
/**
* Method delete
* @param ActionMapping mapping
* @param ActionForm form
* @param HttpServletRequest request
* @param HttpServletResponse response
* @return ActionForward
* @throws Exception
*/
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =