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

📄 gbs_requestaction.java

📁 对日软件外包 为东芝做的一个全球商业管理系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
			returnValue = logic.getWideUse("SMTP");
			if (returnValue.isError()) {
			} else {
				ArrayList tmpList = (ArrayList) returnValue.getDataValue();
				String returnPath = "";
				for (int i = 0; tmpList != null && i < tmpList.size(); i++) {
					GBS_MWideUse_stBean stBean = (GBS_MWideUse_stBean) tmpList.get(i);
					if ("Return-Path".equals(stBean.getMainKey())) {
						returnPath = stBean.getString1();
						break;
					}
				}
				while (returnPath.lastIndexOf(",") > 0) {
					replyTo.add(returnPath.substring(returnPath.lastIndexOf(",") + 1));
					returnPath = returnPath.substring(0, returnPath.lastIndexOf(","));
				}
				replyTo.add(returnPath);
			}

			String subject = "GBS Alert Mail(\"Request\",\"" + requestForm.getCustomerName() + "\")";

			if (mailList != null && mailList.size() > 0 && !url.equals("") && !smtpServer.equals("")) {
				SendMail sendMail = new SendMail();
				sendMail.sendMailList(
					mailList,
					requestForm.getLoginEmail(),
					smtpServer,
					subject,
					url,
					mailUser,
					mailPasswd,
					replyTo);
			}
		}

		this.setSuccessInfo(
			request,
			"00000006",
			"./GBS_request.do?method=init" + "&customerID=" + requestForm.getCustomerID() + "&rfpNo=" + requestForm.getRfpNo());

		return (mapping.findForward(success));
	}

	public ActionForward insert(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
		throws Exception {
		//HttpSession session = request.getSession();
		GBS_RequestForm thisform = (GBS_RequestForm) form;
		//get login user info from session
		this.setUserInfoFromSession(request, thisform);
		ReturnValue returnValue = new ReturnValue();

		if (!thisform.getRfpNo().equals("")) {
			return update(mapping, form, request, response);
		}

		//InputCheck
		MessageList errorMsg = new MessageList();
		errorMsg = (MessageList) inputCheck(thisform, request);
		if (errorMsg.size() > 0) {
			//save error to request
			this.setMessage(errorMsg);
			//Add by Gxk 2004/08/23
			//update by Ym 20040824 start
			//thisform.setRfpAttachList((ArrayList)this.getFromSession(request,RFPATTACHLIST));
			if (this.getFromSession(request, RFPATTACHLIST) != null) {
				thisform.setRfpAttachList((ArrayList) this.getFromSession(request, RFPATTACHLIST));
			}
			//update by Ym 20040824 end
			return (mapping.findForward(nextview));
		}

		//String updateuser = thisform.getLoginMemberNameLast() + " " + thisform.getLoginMemberNameFirst();
		GBS_RequestActionLogic logic = new GBS_RequestActionLogic(this.getDataSource(request));

		//3乚2乚1.丂RFP偺忣曬傪捛壛
		returnValue =
			logic.addRfpInfo(
				thisform.getCustomerID(),
				thisform.getRfpNo(),
				BaseCommonCheck.convertDateToYYYYMMDD(thisform.getRepRcvDate()),
				BaseCommonCheck.convertDateToYYYYMMDD(thisform.getDueDate()),
				BaseCommonCheck.convertDateToYYYYMMDD(thisform.getInfoDueDate()),
				thisform.getInfoCountry(),
				thisform.getInfoHardCategory(),
				thisform.getInfoDelivery(),
				thisform.getQuantity(),
				thisform.getRemarks(),
				thisform.getComment(),
				thisform.getLoginUserId(),
				thisform.getLoginSubsidiaryCode2());
		if (returnValue.isError()) {
			if (returnValue.isBussinessError()) {
				this.setMessage(returnValue.getMessageList());
			}
			//getErrorCode, getErrorMessage proc
			//僨乕僞専嶕昁梫偱偡丠妋擣昁梫偱偡丅
			return (mapping.findForward(nextview));
		} else {
			int iRfpNo = ((Integer) returnValue.getDataValue()).intValue();
			thisform.setRfpNo(iRfpNo + "");
		}
		//3乚2乚2丏丂RFP娭楢崙偺忣曬傪捛壛
		String countriesCode = thisform.getCountrycode();
		ArrayList countryCodeList = new ArrayList();
		while (countriesCode.lastIndexOf(",") > 0) {
			countryCodeList.add(countriesCode.substring(countriesCode.lastIndexOf(",") + 1));
			countriesCode = countriesCode.substring(0, countriesCode.lastIndexOf(","));
		}
		countryCodeList.add(countriesCode);
		returnValue =
			logic.saveRfpCountryInfo(thisform.getCustomerID(), thisform.getRfpNo(), thisform.getLoginUserId(), countryCodeList);
		if (returnValue.isError()) {
			if (returnValue.isBussinessError()) {
				this.setMessage(returnValue.getMessageList());
			}
			//getErrorCode, getErrorMessage proc
			//僨乕僞専嶕昁梫偱偡丠妋擣昁梫偱偡丅
			return (mapping.findForward(nextview));
		}
		//3乚2乚3丏丂RFP揧晅帒椏偺忣曬傪捛壛
		//RFP揧晅帒椏偐傜RFP揧晅帒椏僨乕僞傪庢摼丏
		ArrayList RfpAttachList = new ArrayList();
		RfpAttachList = (ArrayList) this.getFromSession(request, RFPATTACHLIST);
		for (int i = 0; RfpAttachList != null && i < RfpAttachList.size(); i++) {
			GBS_RfpAttachList_stBean st = (GBS_RfpAttachList_stBean) RfpAttachList.get(i);
			st.setRfpNo(thisform.getRfpNo());
		}
		if (RfpAttachList != null) {
			returnValue = logic.saveRfpAttachment(RfpAttachList, thisform.getLoginUserId());
			if (returnValue.isError()) {
				if (returnValue.isBussinessError()) {
					this.setMessage(returnValue.getMessageList());
				}
				//getErrorCode, getErrorMessage proc
				//僨乕僞専嶕昁梫偱偡丠妋擣昁梫偱偡丅
				return (mapping.findForward(nextview));
			}
		}
		if (!BaseCommonCheck.isEmpty(thisform.getLoginEmail())) {
			ArrayList mailList = new ArrayList();
			returnValue = logic.getMail(thisform.getCustomerID(), thisform.getRfpNo());
			if (returnValue.isError()) {
				if (returnValue.isBussinessError()) {
					this.setMessage(returnValue.getMessageList());
				}
				return (mapping.findForward(nextview));
			} else {
				mailList = (ArrayList) returnValue.getDataValue();
			}

			//Get mail server
			String smtpServer = "";
			String mailUser = "";
			String mailPasswd = "";
			returnValue = logic.getWideUse("SMTP");
			if (returnValue.isError()) {
				if (returnValue.isBussinessError()) {
					this.setMessage(returnValue.getMessageList());
				}
				return (mapping.findForward(nextview));
			} else {
				ArrayList tmpList = (ArrayList) returnValue.getDataValue();
				for (int i = 0; tmpList != null && i < tmpList.size(); i++) {
					GBS_MWideUse_stBean stBean = (GBS_MWideUse_stBean) tmpList.get(i);
					if ("SMTP".equals(stBean.getMainKey())) {
						smtpServer = BaseCommonCheck.convertNullToSpace(stBean.getString1());
						mailUser = BaseCommonCheck.convertNullToSpace(stBean.getString2());
						mailPasswd = BaseCommonCheck.convertNullToSpace(stBean.getString3());
						break;
					}
				}
			}
			//Get mail content
			String url = "";
			returnValue = logic.getWideUse("URL");
			if (returnValue.isError()) {
				if (returnValue.isBussinessError()) {
					this.setMessage(returnValue.getMessageList());
				}
				return (mapping.findForward(nextview));
			} else {
				ArrayList tmpList = (ArrayList) returnValue.getDataValue();
				if (tmpList != null && tmpList.size() > 0) {
					GBS_MWideUse_stBean stBean = (GBS_MWideUse_stBean) tmpList.get(0);
					url = stBean.getString1();
				}
			}
			if (!url.equals("")) {
				//http://localhost:8080/gbs/GBS_login.do?method=init&customerId=marine&rfpNo=2&jumpTo=request
				url += "GBS_login.do?method=init&jumpTo=request&customerId=";
				url += thisform.getCustomerID();
				url += "&rfpNo=";
				url += thisform.getRfpNo();
			}

			//Get replyTo
		  	ArrayList replyTo = new ArrayList();
		  	returnValue = logic.getWideUse("SMTP");
		  	if (returnValue.isError()) {
		  	} else {
			  	ArrayList tmpList = (ArrayList) returnValue.getDataValue();
			  	String returnPath = "";
			  	for (int i = 0; tmpList != null && i < tmpList.size(); i++) {
				 	 GBS_MWideUse_stBean stBean = (GBS_MWideUse_stBean) tmpList.get(i);
				  	if ("Return-Path".equals(stBean.getMainKey())) {
					  	returnPath = stBean.getString1();
					  	break;
				  	}
			  	}
			  	while (returnPath.lastIndexOf(",") > 0) {
				  	replyTo.add(returnPath.substring(returnPath.lastIndexOf(",") + 1));
				  	returnPath = returnPath.substring(0, returnPath.lastIndexOf(","));
			  	}
			  	replyTo.add(returnPath);
		  	}

			String subject = "GBS Alert Mail(\"Request\",\"" + thisform.getCustomerName() + "\")";

			if (mailList != null && mailList.size() > 0 && !url.equals("") && !smtpServer.equals("")) {
				SendMail sendMail = new SendMail();
				sendMail.sendMailList(
					mailList,
					thisform.getLoginEmail(),
					smtpServer,
					subject,
					url,
					mailUser,
					mailPasswd,
					replyTo);
			}
		}

		this.setSuccessInfo(
			request,
			"00000005",
			"./GBS_request.do?method=init" + "&customerID=" + thisform.getCustomerID() + "&rfpNo=" + thisform.getRfpNo());

		return (mapping.findForward(success));
	}

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

		log.info("[location info]GBS_UsermasterAction.subPageSubmit method!");
		GBS_RequestForm requestForm = (GBS_RequestForm) form;
		//get login user info from session
		this.setUserInfoFromSession(request, requestForm);

		HttpSession session = request.getSession();
		//RFP揧晅帒椏偐傜RFP揧晅帒椏僨乕僞傪庢摼丏
		ArrayList RfpAttachList = new ArrayList();
		ArrayList RfpAttachFormlst = new ArrayList();
		RfpAttachList = (ArrayList) session.getAttribute(RFPATTACHLIST);
		for (int i = 0; RfpAttachList != null && i < RfpAttachList.size(); i++) {
			GBS_RfpAttachList_stBean st = (GBS_RfpAttachList_stBean) RfpAttachList.get(i);
			GBS_RfpAttachList_stBean stForm = new GBS_RfpAttachList_stBean();
			if (st.getRecordDeleteFlg()) {
				continue;
			}
			stForm.setAttachmentFileName(st.getAttachmentFileName());
			stForm.setFiletype(st.getFiletype());
			stForm.setRfpNo(st.getRfpNo());
			stForm.setCustomerID(st.getCustomerID());
			stForm.setLineNo(st.getLineNo());
			stForm.setSeqNo(st.getSeqNo());
			stForm.setTitle(st.getTitle());
			stForm.setUpdateDate(st.getUpdateDate());
			stForm.setUpdateUserName(st.getUpdateUserName());
			stForm.setCreateDate(st.getCreateDate());
			stForm.setCreateUserName(st.getCreateUserName());
			RfpAttachFormlst.add(stForm);
		}
		requestForm.setRfpAttachList(RfpAttachFormlst);
		requestForm.setMethod(requestForm.getOldMethod());
		return (mapping.findForward(nextview));
	}

	/**
	 * InputCheck
	 * @param requestForm GBS_MifEntryForm
	 * @param request HttpServletRequest
	 * @throws Exception
	 * @return ErrorMessages
	 */
	private MessageList inputCheck(GBS_RequestForm thisForm, HttpServletRequest request) throws Exception {

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

		//ProductCategory check
		//productId check 
		if (BaseCommonCheck.isEmpty(thisForm.getRepRcvDate())) {
			messages.setMessage(
				"repRcvDate",
				thisForm.getRepRcvDate(),
				"10000009",
				Integer.MIN_VALUE,
				new Object[] { "RFP Received on" });
		} else {
			if ((!BaseCommonCheck.isDateType(thisForm.getRepRcvDate()))) {
				messages.setMessage("repRcvDate", thisForm.getRepRcvDate(), "90000025", Integer.MIN_VALUE);
			}
		}
		//dispOrder check
		if (BaseCommonCheck.isEmpty(thisForm.getDueDate())) {
			messages.setMessage("dueDate", thisForm.getDueDate(), "10000009", Integer.MIN_VALUE, new Object[] { "Due Date" });
		} else {
			if ((!BaseCommonCheck.isDateType(thisForm.getDueDate()))) {
				messages.setMessage("dueDate", thisForm.getDueDate(), "90000025", Integer.MIN_VALUE);
			}
		}
		//getProductName check 
		if (BaseCommonCheck.isEmpty(thisForm.getInfoDueDate())) {
			messages.setMessage(
				"infoDueDate",
				thisForm.getInfoDueDate(),
				"10000009",
				Integer.MIN_VALUE,
				new Object[] { "Information Due Date" });
		} else {
			if ((!BaseCommonCheck.isDateType(thisForm.getInfoDueDate()))) {
				messages.setMessage("infoDueDate", thisForm.getInfoDueDate(), "90000025", Integer.MIN_VALUE);
			}
		}

		if (BaseCommonCheck.isEmpty(thisForm.getCountrycode())) {
			messages.setMessage(
				"countryCode",
				thisForm.getInfoDueDate(),
				"10000009",
				Integer.MIN_VALUE,
				new Object[] { "Countries" });
		}
		return messages;
	}
}

⌨️ 快捷键说明

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