linkmanaction.java

来自「通过这个系统完成对客户基本信息、联系人信息、交往信息、客户服务信息的充分共享和规」· Java 代码 · 共 132 行

JAVA
132
字号
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.t53.crm4.customer.web.action;

import java.util.Iterator;
import java.util.List;

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 org.apache.struts.actions.DispatchAction;

import com.sun.org.apache.bcel.internal.generic.LNEG;
import com.t53.crm4.common.entity.CstCustomer;
import com.t53.crm4.common.entity.CstLinkman;
import com.t53.crm4.customer.biz.CustInfManageBizIface;
import com.t53.crm4.customer.web.form.CustForm;
import com.t53.crm4.customer.web.form.LinkmanForm;

/**
 * MyEclipse Struts Creation date: 12-28-2008
 * 
 * XDoclet definition:
 * 
 * @struts.action path="/linkman_add" name="linkman_addForm"
 *                input="/pages/customer/cust/linkman_add.jsp" scope="request"
 *                validate="true"
 */
public class LinkmanAction extends DispatchAction {
	private CustInfManageBizIface custInfManageBiz;

	/*
	 * Generated Methods
	 */

	/**
	 * @param custInfManageBiz
	 *            要设置的 custInfManageBiz
	 */
	public void setCustInfManageBiz(CustInfManageBizIface custInfManageBiz) {
		this.custInfManageBiz = custInfManageBiz;
	}

	/**
	 * Method execute 查找相匹配的联系人并显示到联系人页面
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	public ActionForward show(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {

		show(request);

		return mapping.findForward("show");
	}

	public ActionForward edit(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {

		request.setAttribute("linkmanEdit", custInfManageBiz.findLinkman(
				"lkmId", request.getParameter("lkmId")));

		return mapping.findForward("edit");
	}

	public ActionForward del(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {

		Long id = Long.valueOf(request.getParameter("lkmId"));
		custInfManageBiz.delLinkman(id);
		String custNo = request.getParameter("custNo").trim().toString();
		show(request);
		return mapping.findForward("show");
	}

	public ActionForward linkmanSava(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		LinkmanForm linkmanForm = (LinkmanForm) form;
		CstLinkman linkman = linkmanForm.getLinkman();

		if (linkman.getLkmId() != null && linkman.getLkmId() != 0) {
			custInfManageBiz.modify(linkman);
		} else {
			custInfManageBiz.sava(linkman);
		}
		request.setAttribute("linkmanList", custInfManageBiz.findLinkman(
				"custNo", linkman.getCstCustomer().getCustNo()));
		String custNo = linkman.getCstCustomer().getCustNo();
		request.setAttribute("custNo", custNo);
		
		CstCustomer customer = (CstCustomer) custInfManageBiz.findCust(custNo)
		.get(0);


request.setAttribute("custName", customer.getCustName());

		return mapping.findForward("show");

	}

	public ActionForward create(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		LinkmanForm linkmanForm = (LinkmanForm) form;

		request.setAttribute("lkmCustNo", linkmanForm.getLinkman()
				.getCstCustomer().getCustNo());
		request.setAttribute("lkmCustName", linkmanForm.getLinkman()
				.getCstCustomer().getCustName());
		
		return mapping.findForward("create");

	}
	
	public void show(HttpServletRequest request) {
		String custNo = request.getParameter("custNo").trim().toString();
		CstCustomer customer = (CstCustomer) custInfManageBiz.findCust(custNo)
				.get(0);
		request.setAttribute("custNo", custNo);
		request.setAttribute("custName", customer.getCustName());
		request.setAttribute("linkmanList", custInfManageBiz.findLinkman(
				"custNo", custNo));
	}
}

⌨️ 快捷键说明

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