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

📄 actionent_customer_personal.java

📁 公司CRM部分原代码,采用的是java技术.
💻 JAVA
字号:
package GDPE.customer.personal;

import java.util.StringTokenizer;

import levin.base.*;
import levin.util.*;
import levin.*;

import javax.servlet.http.*;

import portal.sa.auditor.EnAuditor;
import portal.sa.auditorrole.EnAuditorRole;

import GDPE.customer.enterprise.DAOCustomer;
import GDPE.customer.enterprise.EnEnt_Customer_Enterprise;
import GDPE.customer.linkman.DAOLinkMan;
import GDPE.customer.linkman.EnENT_CUSTOMER_LINKMAN;
import GDPE.market.activity.EnENT_MARKET_ACTIVITY;

public class ActionENT_CUSTOMER_PERSONAL extends Service
{    

  public ActionENT_CUSTOMER_PERSONAL()     
  {
  }  

  public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception
  {
    throw new Exception("Error on doType=" + request.getParameter("doType") + ".");
  }

  public String summary(HttpServletRequest request, HttpServletResponse response) throws Exception
  {
	 
	  HttpSession session = request.getSession(false);
		UserInfo userInfor = (UserInfo) session.getAttribute("UserInfo_Object");
		String idstr = userInfor.getId();
		String flag = "";
		String chStationCode;
		EnENT_CUSTOMER_PERSONAL aEnENT_CUSTOMER_PERSONAL[];

		flag = checkFlag(idstr);
		if (flag.equals("isAdmin")) {

			aEnENT_CUSTOMER_PERSONAL = (EnENT_CUSTOMER_PERSONAL[]) (DAOBase
					.findAll(new DbAccess(), EnENT_CUSTOMER_PERSONAL.class
							.getName()));
			
			aEnENT_CUSTOMER_PERSONAL = (EnENT_CUSTOMER_PERSONAL [])(DAOBase.findByCondition(new DbAccess(),
					EnENT_CUSTOMER_PERSONAL.class.getName(), " rownum < 120", "id"));
			if(aEnENT_CUSTOMER_PERSONAL!=null) {
			  for(int i=0;i<aEnENT_CUSTOMER_PERSONAL.length;i++){
			    	if(!aEnENT_CUSTOMER_PERSONAL[i].getDtBirthday().equals(""))
			          aEnENT_CUSTOMER_PERSONAL[i].setDtBirthday(aEnENT_CUSTOMER_PERSONAL[i].getDtBirthday().substring(0,10));    		
			    }
			}
		} else if (flag.equals("isStation")) {

			EnAuditor cEnAuditor = (EnAuditor) DAOBase.findByPK(new DbAccess(),
					EnAuditor.class.getName(), idstr);
			chStationCode = cEnAuditor.getChDeptCode();
			String where = "chCommit_Code =" + chStationCode+" and rownum < 120 ";
			String order = "id desc";
			//System.out.println("where -------"+where);
			aEnENT_CUSTOMER_PERSONAL = (EnENT_CUSTOMER_PERSONAL[]) (DAOBase
					.findByCondition(new DbAccess(),
							EnENT_CUSTOMER_PERSONAL.class.getName(), where,
							order));
			if(aEnENT_CUSTOMER_PERSONAL!=null) {
		     for(int i=0;i<aEnENT_CUSTOMER_PERSONAL.length;i++){
			    	if(!aEnENT_CUSTOMER_PERSONAL[i].getDtBirthday().equals(""))
			          aEnENT_CUSTOMER_PERSONAL[i].setDtBirthday(aEnENT_CUSTOMER_PERSONAL[i].getDtBirthday().substring(0,10));    		
			    }
			}
		} else {
			String where = "chCommit_Code =" + userInfor.getId();
			// System.out.println("+------------>"+userInfor.);
			String order = "id desc";
			aEnENT_CUSTOMER_PERSONAL = (EnENT_CUSTOMER_PERSONAL[]) (DAOBase
					.findByCondition(new DbAccess(),
							EnENT_CUSTOMER_PERSONAL.class.getName(), where,
							 order));
			if(aEnENT_CUSTOMER_PERSONAL!=null) {
            for(int i=0;i<aEnENT_CUSTOMER_PERSONAL.length;i++){
	    	if(!aEnENT_CUSTOMER_PERSONAL[i].getDtBirthday().equals(""))
	            aEnENT_CUSTOMER_PERSONAL[i].setDtBirthday(aEnENT_CUSTOMER_PERSONAL[i].getDtBirthday().substring(0,10));    		
	      }
			}
		}
//		for(int i=0; i<aEnEnt_Customer_Enterprise.length;i++) {
//			aEnEnt_Customer_Enterprise[i] = GDPE.customer.enterprise.ActionEnt_Customer_Enterprise.viewInfo(aEnEnt_Customer_Enterprise[i]);
//	    } 这里可以查出联系人里面的资料
		request.setAttribute("aEnENT_CUSTOMER_PERSONAL",
				aEnENT_CUSTOMER_PERSONAL);
		request.setAttribute("chooseType", "checkbox");
		return this.getTargetPage("summary");

  }

  public String addQuery(HttpServletRequest request, HttpServletResponse response) throws Exception
  {
    EnENT_CUSTOMER_PERSONAL cEnENT_CUSTOMER_PERSONAL = new EnENT_CUSTOMER_PERSONAL();
    request.setAttribute("cEnENT_CUSTOMER_PERSONAL", cEnENT_CUSTOMER_PERSONAL);
    request.setAttribute("doType","add");
    return this.getTargetPage("detail");
  }

  public String add(HttpServletRequest request, HttpServletResponse response) throws Exception
  {
    EnENT_CUSTOMER_PERSONAL cEnENT_CUSTOMER_PERSONAL = (EnENT_CUSTOMER_PERSONAL)request.getAttribute("cEnENT_CUSTOMER_PERSONAL");
    DbAccess db = new DbAccess();
    try
    {
      db.beginTransaction();
      DAOBase.insert(db,cEnENT_CUSTOMER_PERSONAL);
      db.commit();
    }
    catch(Exception ex)
    {
      db.rollback();
      throw ex;
    }
    levin.iMessage msg = levin.iMessage.getNewInstance("个人客户",
        "新增成功.",
        "openTop(\"GDPE.customer.personal.ActionENT_CUSTOMER_PERSONAL.do?doType=summary\");");
    msg.save(request);
    return this.getTargetPage("Message");
  }

  public String modifyQuery(HttpServletRequest request, HttpServletResponse response) throws Exception
  {
    String id = request.getParameter("id");
    EnENT_CUSTOMER_PERSONAL cEnENT_CUSTOMER_PERSONAL = (EnENT_CUSTOMER_PERSONAL)DAOBase.findByPK(new DbAccess(),EnENT_CUSTOMER_PERSONAL.class.getName(),id);
    if(!cEnENT_CUSTOMER_PERSONAL.getDtBirthday().equals("")){
    	String year= cEnENT_CUSTOMER_PERSONAL.getDtBirthday().substring(0,4);
        String month=cEnENT_CUSTOMER_PERSONAL.getDtBirthday().substring(5,7);
        String day=cEnENT_CUSTOMER_PERSONAL.getDtBirthday().substring(8,10);
        cEnENT_CUSTOMER_PERSONAL.setDtBirthday(year+month+day);	
    }
    //System.out.println("+++++++++++++++++"+cEnENT_CUSTOMER_PERSONAL.getChBusiness_TEL()+"&&\t"+cEnENT_CUSTOMER_PERSONAL.getChTrade_Type()+"&&\t"+cEnENT_CUSTOMER_PERSONAL.getChLogin_Station_Name());
    request.setAttribute("cEnENT_CUSTOMER_PERSONAL",cEnENT_CUSTOMER_PERSONAL);
    request.setAttribute("doType","modify");
    return this.getTargetPage("detail");
  }

  public String modify(HttpServletRequest request, HttpServletResponse response) throws Exception
  {
    EnENT_CUSTOMER_PERSONAL cEnENT_CUSTOMER_PERSONAL = (EnENT_CUSTOMER_PERSONAL)request.getAttribute("cEnENT_CUSTOMER_PERSONAL");
    DbAccess db = new DbAccess();
    try
    {
      db.beginTransaction();
      DAOBase.update(db,cEnENT_CUSTOMER_PERSONAL);
      //System.out.println("*************"+cEnENT_CUSTOMER_PERSONAL.getChBusiness_TEL()+"++\t"+cEnENT_CUSTOMER_PERSONAL.getChTrade_Type()+"++\t"+cEnENT_CUSTOMER_PERSONAL.getChLogin_Station_Name());
      db.commit();
    }
    catch(Exception ex)
    {
      db.rollback();
      throw ex;
    }
    levin.iMessage msg = levin.iMessage.getNewInstance("个人客户",
        "修改成功.",
        "openTop(\"GDPE.customer.personal.ActionENT_CUSTOMER_PERSONAL.do?doType=summary\");");
    msg.save(request);
    return this.getTargetPage("Message");
  }

  public String view(HttpServletRequest request, HttpServletResponse response) throws Exception
  {
    String id = request.getParameter("id");
    EnENT_CUSTOMER_PERSONAL cEnENT_CUSTOMER_PERSONAL = (EnENT_CUSTOMER_PERSONAL)DAOBase.findByPK(new DbAccess(),EnENT_CUSTOMER_PERSONAL.class.getName(),id);
    if(!cEnENT_CUSTOMER_PERSONAL.getDtBirthday().equals("")){
    	String year= cEnENT_CUSTOMER_PERSONAL.getDtBirthday().substring(0,4);
        String month=cEnENT_CUSTOMER_PERSONAL.getDtBirthday().substring(5,7);
        String day=cEnENT_CUSTOMER_PERSONAL.getDtBirthday().substring(8,10);
        cEnENT_CUSTOMER_PERSONAL.setDtBirthday(year+month+day);	
    }
    request.setAttribute("cEnENT_CUSTOMER_PERSONAL",cEnENT_CUSTOMER_PERSONAL);
    request.setAttribute("doType","view");
    return this.getTargetPage("detail");
  }

  public String delete(HttpServletRequest request, HttpServletResponse response) throws Exception
  {
    String id = request.getParameter("id");
    DbAccess db = new DbAccess();
    try
    {
      db.beginTransaction();
      StringTokenizer  st = new StringTokenizer(id,",");
      while(st.hasMoreElements()){
    	  String index =(String)st.nextElement();
    	  DAOBase.delete(db,EnENT_CUSTOMER_PERSONAL.class.getName(),index);
      }
      db.commit();
    }
    catch(Exception ex)
    {
      db.rollback();
      throw ex;
    }
    levin.iMessage msg = levin.iMessage.getNewInstance("个人客户",
        "删除成功.",
        "openTop(\"GDPE.customer.personal.ActionENT_CUSTOMER_PERSONAL.do?doType=summary\");");
    msg.save(request);
    return this.getTargetPage("Message");
  }
  
  public String search(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		levin.util.DbAccess db = new levin.util.DbAccess();
		String chTrade_Type = request.getParameter("chTrade_Type");
		String chEnterpriseCityName = request.getParameter("chEnterpriseCityName");
		String chBusiness_TEL = request.getParameter("chBusiness_TEL");
		String chCommit_Name = request.getParameter("chCommit_Name");
		String chSeat_Code = request.getParameter("chSeat_Code");
		String chName = request.getParameter("chName");

		EnENT_CUSTOMER_PERSONAL searchPersonal = new EnENT_CUSTOMER_PERSONAL();

		searchPersonal.setChBusiness_TEL(chBusiness_TEL);
		searchPersonal.setChTrade_Type(chTrade_Type);
		searchPersonal.setChEnterpriseCityName(chEnterpriseCityName);
		searchPersonal.setChSeat_Code(chSeat_Code);
		searchPersonal.setChCommit_Name(chCommit_Name);
		searchPersonal.setChName(chName);

		EnENT_CUSTOMER_PERSONAL aEnENT_CUSTOMER_PERSONAL[] = (EnENT_CUSTOMER_PERSONAL[]) (DAOPersonal
				.searcheEnPersonal(db, searchPersonal));
		for(int i = 0;i<aEnENT_CUSTOMER_PERSONAL.length;i++){
			if(!aEnENT_CUSTOMER_PERSONAL[i].getDtBirthday().equals(""))
		    {
		        String year=aEnENT_CUSTOMER_PERSONAL[i].getDtBirthday().substring(0,4);
		        String month=aEnENT_CUSTOMER_PERSONAL[i].getDtBirthday().substring(5,7);
		        String day=aEnENT_CUSTOMER_PERSONAL[i].getDtBirthday().substring(8,10);
		        aEnENT_CUSTOMER_PERSONAL[i].setDtBirthday(year+month+day);
		    }}

		request.setAttribute("aEnENT_CUSTOMER_PERSONAL",aEnENT_CUSTOMER_PERSONAL);
		request.setAttribute("chooseType","checkBox");
		request.setAttribute("doType", "search");
		return this.getTargetPage("summary");

	}
	public String lookUp(HttpServletRequest request,HttpServletResponse response) throws Exception {
		
		levin.util.DbAccess db = new levin.util.DbAccess();
		//String chCorporateName = request.getParameter("chCorporateName");
		String chName = request
				.getParameter("chName");
		//String chSeatCode = request.getParameter("chSeatCode");

		HttpSession session = request.getSession(false);
		UserInfo userInfor = (UserInfo) session.getAttribute("UserInfo_Object");
		String chCommitCode = userInfor.getId();
		String chCommitName = userInfor.getName();// 带上自己的工号

		String idstr = userInfor.getId();
		boolean isAdmin = false;

		EnAuditorRole[] cEnAuditorRole = (EnAuditorRole[]) DAOBase
				.findByCondition(new DbAccess(), EnAuditorRole.class.getName(),
						"chAuditorCode='" + idstr + "'", "");
		for (int i = 0; i < cEnAuditorRole.length; i++) {
			if (cEnAuditorRole[i].getChRoleCode().equals("0000"))
				isAdmin = true;
		}
		if(isAdmin) {
			EnENT_CUSTOMER_PERSONAL searchContract = new EnENT_CUSTOMER_PERSONAL();
			searchContract.setChName(chName);
			
			EnENT_CUSTOMER_PERSONAL aEnENT_CUSTOMER_PERSONAL[] = (EnENT_CUSTOMER_PERSONAL[]) (DAOPersonal
					.searcheEnPersonal(db, searchContract));

			request.setAttribute("aEnENT_CUSTOMER_PERSONAL",
					aEnENT_CUSTOMER_PERSONAL);
			request.setAttribute("doType", "choose");
			return this.getTargetPage("choose");

		}
		
		
		EnENT_CUSTOMER_PERSONAL searchContract = new EnENT_CUSTOMER_PERSONAL();

		//searchContract.setChCorporateName(chCorporateName);
		searchContract.setChName(chName);
		//searchContract.setChSeatCode(chSeatCode);
		searchContract.setChCommit_Code(chCommitCode);//如果不是系统管理员只能查自己的客户
		searchContract.setChCommit_Name(chCommitName);
		EnENT_CUSTOMER_PERSONAL aEnENT_CUSTOMER_PERSONAL[] = (EnENT_CUSTOMER_PERSONAL[]) (DAOPersonal
				.searcheEnPersonal(db, searchContract));

		request.setAttribute("aEnENT_CUSTOMER_PERSONAL",
				aEnENT_CUSTOMER_PERSONAL);

		request.setAttribute("doType", "choose");
		return this.getTargetPage("choose");
	}
  
	public String choose(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String chooseType = request.getParameter("chooseType");
		// 判断参数是否合法
		if (chooseType == null)
			chooseType = "radio";

		EnENT_CUSTOMER_PERSONAL[] aEnENT_CUSTOMER_PERSONAL = (EnENT_CUSTOMER_PERSONAL[]) (DAOBase
				.findAll(new DbAccess(), EnENT_CUSTOMER_PERSONAL.class
						.getName()));
		request.setAttribute("doType", "choose");
		request.setAttribute("chooseType", chooseType);
		request.setAttribute("aEnENT_CUSTOMER_PERSONAL",aEnENT_CUSTOMER_PERSONAL);
		return this.getTargetPage("choose");
	}
	

	public String checkFlag(String chAuditorcode) throws Exception {
		String flag = "";

		EnAuditorRole[] cEnAuditorRole = (EnAuditorRole[]) DAOBase
				.findByCondition(new DbAccess(), EnAuditorRole.class.getName(),
						"chAuditorCode='" + chAuditorcode + "'", "");
		
		for (int i = 0; i < cEnAuditorRole.length; i++) {
			String src = cEnAuditorRole[i].getChRoleCode();
			if (src.equals("0000")//系统管理员
					||src.equals("0004")||src.equals("0006")//客户服务
					) {//发展部主管
				flag = "isAdmin";
				break;
			} else if (cEnAuditorRole[i].getChRoleCode().equals("0002")) {//登陆站长
				flag = "isStation";
			}
		}
		return flag;
	}
}

⌨️ 快捷键说明

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