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

📄 actionent_record_following.java.svn-base

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

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
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 first.page.*;
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.plan.EnEnt_Plan_Following;
/**
 *@author:willan
 **/
public class ActionEnt_Record_Following extends Service
{

  public ActionEnt_Record_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
  {
    HttpSession session = request.getSession(false);
	UserInfo userInfor = (UserInfo) session.getAttribute("UserInfo_Object");
	String idstr = userInfor.getId();
	String flag = checkFlag(idstr);
	
	java.util.Calendar test = Calendar.getInstance(java.util.Locale.CHINA);
    
    java.sql.Date  now = new java.sql.Date(System.currentTimeMillis());
    test.setTime(now);
    now.getTime();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd",
			Locale.SIMPLIFIED_CHINESE);
	String timestamp = sdf.format(now);
    
    test.add(Calendar.DATE, -30);
   // now = test.getTime();
   
    java.sql.Date testDate2 = new java.sql.Date(test.getTimeInMillis());
    String timestamp2 = sdf.format(testDate2);

	EnEnt_Record_Following aEnEnt_Record_Following[]=null;
	if (flag.equals("isAdmin")) {
	  //aEnEnt_Record_Following = (EnEnt_Record_Following[])(DAOBase.findAll(new DbAccess(),EnEnt_Record_Following.class.getName()));
		String where3=" dtTrackingDate between to_date('"+timestamp2+"','yyyyMMdd') and to_date('"+timestamp+"','yyyyMMdd') and rownum<300";//and rownum<120
		
		String order = "dtTrackingDate desc";
		aEnEnt_Record_Following = (EnEnt_Record_Following[]) (DAOBase
				.findByCondition(new DbAccess(),
						EnEnt_Record_Following.class.getName(), where3,
						order));
		//System.out.println("-------"+EnEnt_Record_Following.);
	} else if (flag.equals("isStation")) {
		//EnAuditor cEnAuditor = (EnAuditor) DAOBase.findByPK(new DbAccess(),
		//		EnAuditor.class.getName(), idstr);
		//String chStationCode = cEnAuditor.getChDeptCode();
		//System.out.println("-------"+chStationCode);
		String where2=" dtTrackingDate between to_date(\'"+timestamp2+"\',\'yyyyMMdd\') and to_date(\'"+timestamp+"\',\'yyyyMMdd\') and rownum<300";
		
		String where1 = where2+" and  chCommitCode = '"+idstr+"' ";
		String order = "dtTrackingDate desc";
		aEnEnt_Record_Following = (EnEnt_Record_Following[]) (DAOBase
				.findByCondition(new DbAccess(),
						EnEnt_Record_Following.class.getName(), where1,
						order));
	}else {
		String where4=" dtTrackingDate between to_date(\'"+timestamp2+"\',\'yyyyMMdd\') and to_date(\'"+timestamp+"\',\'yyyyMMdd\') and rownum<300";
		String  where =where4+" and chCommitCode = '"+idstr+"' ";
		String order = "dtTrackingDate desc";
	    aEnEnt_Record_Following = (EnEnt_Record_Following[]) (DAOBase
					.findByCondition(new DbAccess(),
							EnEnt_Record_Following.class.getName(), where,
							order));
	}
	//System.out.println("----1---"+aEnEnt_Record_Following.length);
if(aEnEnt_Record_Following.length!=0) {
    for(int i=0;i<aEnEnt_Record_Following.length ;i++) {
    	//System.out.println("----1---"+aEnEnt_Record_Following[i].getDtTrackingDate());
    	//String st = aEnEnt_Record_Following[i].getDtTrackingDate();
    	//java.text.DateFormat df = java.text.DateFormat.getInstance();
		// Date date=df.parse(st);
		// System.out.println("----1---"+date.toString());
    	   if (!aEnEnt_Record_Following[i].getDtTrackingDate().equals("")) {
    			if (aEnEnt_Record_Following[i].getDtTrackingDate().startsWith("1900")) {
    				aEnEnt_Record_Following[i].setDtTrackingDate("");
    			} else {
    				String year = aEnEnt_Record_Following[i].getDtTrackingDate()
    						.substring(0, 4);
    				String month = aEnEnt_Record_Following[i].getDtTrackingDate()
    						.substring(5, 7);
    				String day = aEnEnt_Record_Following[i].getDtTrackingDate()
    						.substring(8, 10);
    				aEnEnt_Record_Following[i].setDtTrackingDate(year+ month+ day);
    			}
    	   }
    	   if (!aEnEnt_Record_Following[i].getDtPlanTrackingDate().equals("")) {
   			if (aEnEnt_Record_Following[i].getDtPlanTrackingDate().startsWith("1900")) {
   				aEnEnt_Record_Following[i].setDtPlanTrackingDate("");
   			} else {
   				String year = aEnEnt_Record_Following[i].getDtPlanTrackingDate()
   						.substring(0, 4);
   				String month = aEnEnt_Record_Following[i].getDtPlanTrackingDate()
   						.substring(5, 7);
   				String day = aEnEnt_Record_Following[i].getDtPlanTrackingDate()
   						.substring(8, 10);
   				aEnEnt_Record_Following[i].setDtPlanTrackingDate(year+ month+ day);
   			}
   	   }
    	   aEnEnt_Record_Following[i] = GDPE.follow.ActionEnt_Record_Following.viewInfo(aEnEnt_Record_Following[i]);
    }  
    
}
    request.setAttribute("aEnEnt_Record_Following", aEnEnt_Record_Following);
    return this.getTargetPage("summary");
  }
  public String viewFollow(HttpServletRequest request, HttpServletResponse response) throws Exception
  {
	String iEnterpriseId=request.getParameter("iEnterpriseId");
	EnEnt_Record_Following aEnEnt_Record_Following[]=null;
    String  where ="iEnterpriseId = '"+iEnterpriseId+"' ";
    aEnEnt_Record_Following = (EnEnt_Record_Following[]) (DAOBase
					.findByCondition(new DbAccess(),
							EnEnt_Record_Following.class.getName(), where,
							""));
    for(int i=0;i<aEnEnt_Record_Following.length ;i++) {
    	   if (!aEnEnt_Record_Following[i].getDtTrackingDate().equals("")) {
    			if (aEnEnt_Record_Following[i].getDtTrackingDate().startsWith("1900")) {
    				aEnEnt_Record_Following[i].setDtTrackingDate("");
    			} else {
    				String year = aEnEnt_Record_Following[i].getDtTrackingDate()
    						.substring(0, 4);
    				String month = aEnEnt_Record_Following[i].getDtTrackingDate()
    						.substring(5, 7);
    				String day = aEnEnt_Record_Following[i].getDtTrackingDate()
    						.substring(8, 10);
    				aEnEnt_Record_Following[i].setDtTrackingDate(year+"-" + month+"-" + day);
    			}
    	   }
    }  
    for(int i=0; i<aEnEnt_Record_Following.length;i++) {
    	aEnEnt_Record_Following[i] = GDPE.follow.ActionEnt_Record_Following.viewInfo(aEnEnt_Record_Following[i]);
    }//////////
    request.setAttribute("aEnEnt_Record_Following", aEnEnt_Record_Following);
    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();
	
	//System.out.println("cId-------->"+cId);
	
	EnAuditor cEnAuditor = (EnAuditor) DAOBase.findByPK(new DbAccess(),
			EnAuditor.class.getName(), cId);
	String chStationCode = cEnAuditor.getChDeptCode();
	//System.out.println("DeptCode-------->"+chStationCode);
	//String sql = "chDeptCode like '%"+chStationCode+"%'";
	//EnDepartment cEnDepartment = (EnDepartment)DAOBase.findByCondition(new DbAccess(), EnAuditor.class.getName(),sql,"");
	
	EnDepartment cEnDepartment = (EnDepartment)DAOBase.findByPK(new DbAccess(),
			EnDepartment.class.getName(), chStationCode);
	
	String chStation = cEnDepartment.getChDeptName();
	//System.out.println("chStation-------->"+chStation);
	
    EnEnt_Record_Following cEnEnt_Record_Following = new EnEnt_Record_Following();
    cEnEnt_Record_Following.setChStationCode(chStationCode);
    cEnEnt_Record_Following.setChStation(chStation);
    cEnEnt_Record_Following.setChCommitCode(cId);
    cEnEnt_Record_Following.setChCommitName(cName);
    request.setAttribute("cEnEnt_Record_Following", cEnEnt_Record_Following);
    request.setAttribute("doType","add");
    return this.getTargetPage("detail");
  }

  public String add(HttpServletRequest request, HttpServletResponse response) throws Exception
  {
    EnEnt_Record_Following cEnEnt_Record_Following = (EnEnt_Record_Following)request.getAttribute("cEnEnt_Record_Following");
    //dtTrackingDate
    Date now = new Date(System.currentTimeMillis());
	SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd",
			Locale.SIMPLIFIED_CHINESE);
	String timestamp = sdf.format(now);
	cEnEnt_Record_Following.setDtTrackingDate(timestamp);
	DbAccess db = new DbAccess();
	try {
	 EnEnt_Record_Following aEnEnt_Record_Following []=null;
	 String  where3 = " iEnterpriseId = '"+cEnEnt_Record_Following.getIEnterpriseId()+"'";
 	 aEnEnt_Record_Following = (EnEnt_Record_Following[]) (DAOBase
			.findByCondition(new DbAccess(),
					EnEnt_Record_Following.class.getName(), where3,
					"")); 
 	  if(aEnEnt_Record_Following.length>0) {
 		String str = "openTop(\"GDPE.follow.ActionEnt_Record_Following.do?doType=summary\");";		  		
 		levin.iMessage msg = levin.iMessage
				.getNewInstance("客户管理", "你现在立项的企业已经立项过了!", str);
		msg.save(request);
		return this.getTargetPage("Message");
 	  }else {
 		 try
 	    {
 	      db.beginTransaction();
 	      DAOBase.insert(db,cEnEnt_Record_Following);
 	      db.commit();
 	    }
 	    catch(Exception ex)
 	    {
 	      db.rollback();
 	      throw ex;
 	    }
 	    levin.iMessage msg = levin.iMessage.getNewInstance("客户维护",
 	        "新增成功.",
 	        "openTop(\"GDPE.follow.ActionEnt_Record_Following.do?doType=summary\");");
 	    msg.save(request);
 	    return this.getTargetPage("Message");
 		  
 	  }  
 	  }catch(Exception ex) {
 		 throw ex;
 	  }
    
   
  }

  public String modifyQuery(HttpServletRequest request, HttpServletResponse response) throws Exception
  {
    String id = request.getParameter("id");
    EnEnt_Record_Following cEnEnt_Record_Following = (EnEnt_Record_Following)DAOBase.findByPK(new DbAccess(),EnEnt_Record_Following.class.getName(),id);
    if (!cEnEnt_Record_Following.getDtTrackingDate().equals("")) {
		if (cEnEnt_Record_Following.getDtTrackingDate().startsWith("1900")) {
			cEnEnt_Record_Following.setDtTrackingDate("");
		} else {
			String year = cEnEnt_Record_Following.getDtTrackingDate()
					.substring(0, 4);
			String month = cEnEnt_Record_Following.getDtTrackingDate()
					.substring(5, 7);
			String day = cEnEnt_Record_Following.getDtTrackingDate()
					.substring(8, 10);
			cEnEnt_Record_Following.setDtTrackingDate(year + month + day);
		}
	}
    
    request.setAttribute("cEnEnt_Record_Following",cEnEnt_Record_Following);
    request.setAttribute("doType","modify");
    return this.getTargetPage("detail");
  }

  public String modify(HttpServletRequest request, HttpServletResponse response) throws Exception
  {
    EnEnt_Record_Following cEnEnt_Record_Following = (EnEnt_Record_Following)request.getAttribute("cEnEnt_Record_Following");
    DbAccess db = new DbAccess();
    try

⌨️ 快捷键说明

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