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

📄 actionent_plan_following.java

📁 公司CRM部分原代码,采用的是java技术.
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
package GDPE.follow.plan;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
import java.util.StringTokenizer;
import java.util.Vector;

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

import javax.servlet.http.*;

import first.*;

import portal.User;
import portal.sa.auditor.EnAuditor;
import portal.sa.auditorrole.EnAuditorRole;
import portal.sa.department.EnDepartment;

import GDPE.customer.enterprise.DAOCustomer;
import GDPE.customer.enterprise.EnEnt_Customer_Enterprise;
import GDPE.customer.linkman.EnENT_CUSTOMER_LINKMAN;
import GDPE.follow.*;

public class ActionEnt_Plan_Following extends Service
{

  public ActionEnt_Plan_Following()
  {
  }

  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
  {
	 // System.out.println("fid----------------"+request.getParameter("fid"));
	HttpSession session = request.getSession(false);
	UserInfo userInfor = (UserInfo) session.getAttribute("UserInfo_Object");
	String chCommitCode = userInfor.getId();
	//String chCommitName = request.getParameter("chCommitName");// 带上自己的工号
	boolean isAdmin = false;
	EnAuditorRole[] cEnAuditorRole = (EnAuditorRole[]) DAOBase
			.findByCondition(new DbAccess(), EnAuditorRole.class.getName(),
					"chAuditorCode='" + chCommitCode + "'", "");
	for (int i = 0; i < cEnAuditorRole.length; i++) {
		if (cEnAuditorRole[i].getChRoleCode().equals("0000"))
			isAdmin = true;
	}
	DbAccess db = new DbAccess();
	EnEnt_Plan_Following aEnEnt_Plan_Following[];
	String where = "chCommitCode ="+ chCommitCode+" and rownum<30";
	if(isAdmin) {
		aEnEnt_Plan_Following = (EnEnt_Plan_Following [])(DAOBase.findByCondition(db, EnEnt_Plan_Following.class.getName(), where, " dtPlanTrackingDate desc"));
		//aEnEnt_Plan_Following = (EnEnt_Plan_Following[])(DAOBase.findAll(db,EnEnt_Plan_Following.class.getName()));
		for (int i = 0; i < aEnEnt_Plan_Following.length; i++) {
           // System.out.println("--"+aEnEnt_Plan_Following[i].getDtPlanTrackingDate());
	    	if (!aEnEnt_Plan_Following[i].getDtTrackingDate().equals("")) {
	    		String year = aEnEnt_Plan_Following[i].getDtTrackingDate()
	    				.substring(0, 4);
	    		String month = aEnEnt_Plan_Following[i].getDtTrackingDate()
	    				.substring(5, 7);
	    		String day = aEnEnt_Plan_Following[i].getDtTrackingDate()
	    				.substring(8, 10);
	    		aEnEnt_Plan_Following[i].setDtTrackingDate(year + month + day);
	    	}
	    	if (!aEnEnt_Plan_Following[i].getDtPlanTrackingDate().equals("")) {
	    		String year = aEnEnt_Plan_Following[i].getDtPlanTrackingDate()
	    				.substring(0, 4);
	    		String month = aEnEnt_Plan_Following[i].getDtPlanTrackingDate()
	    				.substring(5, 7);
	    		String day = aEnEnt_Plan_Following[i].getDtPlanTrackingDate()
	    				.substring(8, 10);
	    		aEnEnt_Plan_Following[i].setDtPlanTrackingDate(year + month + day);
	    	}
	    }
	}else {
		aEnEnt_Plan_Following = (EnEnt_Plan_Following [])(DAOBase.findByCondition(db, EnEnt_Plan_Following.class.getName(), where, " dtPlanTrackingDate desc"));
		// System.out.println("-2-"+chCommitCode);
		for (int i = 0; i < aEnEnt_Plan_Following.length; i++) {

	    	if (!aEnEnt_Plan_Following[i].getDtTrackingDate().equals("")) {
	    		String year = aEnEnt_Plan_Following[i].getDtTrackingDate()
	    				.substring(0, 4);
	    		String month = aEnEnt_Plan_Following[i].getDtTrackingDate()
	    				.substring(5, 7);
	    		String day = aEnEnt_Plan_Following[i].getDtTrackingDate()
	    				.substring(8, 10);
	    		aEnEnt_Plan_Following[i].setDtTrackingDate(year + month + day);
	    	}
	    	if (!aEnEnt_Plan_Following[i].getDtPlanTrackingDate().equals("")) {
	    		String year = aEnEnt_Plan_Following[i].getDtPlanTrackingDate()
	    				.substring(0, 4);
	    		String month = aEnEnt_Plan_Following[i].getDtPlanTrackingDate()
	    				.substring(5, 7);
	    		String day = aEnEnt_Plan_Following[i].getDtPlanTrackingDate()
	    				.substring(8, 10);
	    		aEnEnt_Plan_Following[i].setDtPlanTrackingDate(year + month + day);
	    	}
	    }
	}
    if(aEnEnt_Plan_Following!=null) {
    for(int i=0; i<aEnEnt_Plan_Following.length;i++) {
    	aEnEnt_Plan_Following[i] = GDPE.follow.plan.ActionEnt_Plan_Following.viewInfo(aEnEnt_Plan_Following[i]);
    }}
    request.setAttribute("aEnEnt_Plan_Following", aEnEnt_Plan_Following);
    return this.getTargetPage("summary");
  }
  public String look(HttpServletRequest request, HttpServletResponse response)
	throws Exception {
String id = request.getParameter("id");
String where = " Ent_Plan_Following.iFollowid = '" + id+" '";
//System.out.println("-----yy--"+id);
EnEnt_Plan_Following[] aEnEnt_Plan_Following = (EnEnt_Plan_Following[]) (DAOBase
		.findByCondition(new DbAccess(), EnEnt_Plan_Following.class
				.getName(), where, ""));

for (int i = 0; i < aEnEnt_Plan_Following.length; i++) {

	if (!aEnEnt_Plan_Following[i].getDtTrackingDate().equals("")) {
		String year = aEnEnt_Plan_Following[i].getDtTrackingDate()
				.substring(0, 4);
		String month = aEnEnt_Plan_Following[i].getDtTrackingDate()
				.substring(5, 7);
		String day = aEnEnt_Plan_Following[i].getDtTrackingDate()
				.substring(8, 10);
		aEnEnt_Plan_Following[i].setDtTrackingDate(year + month + day);
	}
	if (!aEnEnt_Plan_Following[i].getDtPlanTrackingDate().equals("")) {
		String year = aEnEnt_Plan_Following[i].getDtPlanTrackingDate()
				.substring(0, 4);
		String month = aEnEnt_Plan_Following[i].getDtPlanTrackingDate()
				.substring(5, 7);
		String day = aEnEnt_Plan_Following[i].getDtPlanTrackingDate()
				.substring(8, 10);
		aEnEnt_Plan_Following[i].setDtPlanTrackingDate(year + month + day);
	}
}
if(aEnEnt_Plan_Following!=null) {
    for(int i=0; i<aEnEnt_Plan_Following.length;i++) {
    	aEnEnt_Plan_Following[i] = GDPE.follow.plan.ActionEnt_Plan_Following.viewInfo(aEnEnt_Plan_Following[i]);
    }}
request.setAttribute("aEnEnt_Plan_Following",aEnEnt_Plan_Following);
request.setAttribute("followId", id);
request.setAttribute("chooseType", "checkbox");
return this.getTargetPage("summary");

}

  public String addQuery(HttpServletRequest request, HttpServletResponse response) throws Exception
  {
		HttpSession session = request.getSession(false);
		UserInfo userInfor = (UserInfo) session.getAttribute("UserInfo_Object");
		String cId = userInfor.getId();
		String cName = userInfor.getName();
				
		EnEnt_Plan_Following cEnEnt_Plan_Following = new EnEnt_Plan_Following();
		cEnEnt_Plan_Following.setChCommitCode(cId);
		cEnEnt_Plan_Following.setChCommitName(cName);
		
		EnAuditor cEnAuditor = (EnAuditor) DAOBase.findByPK(new DbAccess(),
				EnAuditor.class.getName(), cId);
		String chStationCode = cEnAuditor.getChDeptCode();
		EnDepartment cEnDepartment = (EnDepartment)DAOBase.findByPK(new DbAccess(),
				EnDepartment.class.getName(), chStationCode);
		
		String chStation = cEnDepartment.getChDeptName();
	    cEnEnt_Plan_Following.setChStationCode(chStationCode);
	    cEnEnt_Plan_Following.setChStation(chStation);
 
		String fid = request.getAttribute("followId").toString();
		
		//EnEnt_Record_Following eEnEnt_Record_Following =null;
		//eEnEnt_Record_Following=DAOBase.findByPK(new DbAccess(), className, pkValue)
		
		if (fid==null||fid.equals("null")) {
			levin.iMessage msg = levin.iMessage.getNewInstance("客户维护",
			        "请先选择客户再增加跟踪详细!",
			        "openTop(\"GDPE.follow.ActionEnt_Record_Following.do?doType=summary\");");
			    msg.save(request);
			return this.getTargetPage("Message");
		}else {
		int followId = new Integer(fid);
		cEnEnt_Plan_Following.setIFollowId(followId);
		request.setAttribute("cEnEnt_Plan_Following", cEnEnt_Plan_Following);
		request.setAttribute("followId", fid);
		request.setAttribute("doType", "add");
		return this.getTargetPage("plan");
		}
  }

  public String add(HttpServletRequest request, HttpServletResponse response) throws Exception
  {
	String id = (String)request.getParameter("followId");
	//System.out.println("----id----"+id);
	EnEnt_Record_Following cEnEnt_Record_Following = (EnEnt_Record_Following) (DAOBase.findByPK(new DbAccess(), EnEnt_Record_Following.class.getName(), id+""));
    EnEnt_Plan_Following cEnEnt_Plan_Following = (EnEnt_Plan_Following)request.getAttribute("cEnEnt_Plan_Following");
    cEnEnt_Plan_Following.setChLinkMan(cEnEnt_Record_Following.getChCustomerName());
    cEnEnt_Plan_Following.setChEnterpriseName(cEnEnt_Record_Following.getChEnterpriseName());
    cEnEnt_Plan_Following.setChSeatCode(cEnEnt_Record_Following.getChSeatCode());
    
    DbAccess db = new DbAccess();
    try
    {
      db.beginTransaction();
      DAOBase.insert(db,cEnEnt_Plan_Following);
      db.commit();
    }
    catch(Exception ex)
    {
      db.rollback();
      throw ex;
    }
    levin.iMessage msg = levin.iMessage.getNewInstance("客户维护",
        "成功计划.",
        "openDown(\"GDPE.follow.plan.ActionEnt_Plan_Following.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_Plan_Following cEnEnt_Plan_Following = (EnEnt_Plan_Following)DAOBase.findByPK(new DbAccess(),EnEnt_Plan_Following.class.getName(),id);
   

    	if (!cEnEnt_Plan_Following.getDtTrackingDate().equals("")) {
    		String year = cEnEnt_Plan_Following.getDtTrackingDate()
    				.substring(0, 4);
    		String month = cEnEnt_Plan_Following.getDtTrackingDate()
    				.substring(5, 7);
    		String day = cEnEnt_Plan_Following.getDtTrackingDate()
    				.substring(8, 10);
    		cEnEnt_Plan_Following.setDtTrackingDate(year + month + day);
    	}
    	if (!cEnEnt_Plan_Following.getDtPlanTrackingDate().equals("")) {
    		String year = cEnEnt_Plan_Following.getDtPlanTrackingDate()
    				.substring(0, 4);
    		String month = cEnEnt_Plan_Following.getDtPlanTrackingDate()
    				.substring(5, 7);
    		String day = cEnEnt_Plan_Following.getDtPlanTrackingDate()
    				.substring(8, 10);
    		cEnEnt_Plan_Following.setDtPlanTrackingDate(year + month + day);
    	}
    request.setAttribute("cEnEnt_Plan_Following",cEnEnt_Plan_Following);
    request.setAttribute("fid", id);

⌨️ 快捷键说明

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