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

📄 actionent_customer_enterprise.java

📁 公司CRM部分原代码,采用的是java技术.
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
					"您无权修改其他人员的客户记录.", "closeSelf()");
			msg.save(request);
			
			return this.getTargetPage("Message");
		}

		MultiPage cMultiPage = MultiPage.getInstance(request);
		cMultiPage.updateObject("aEnEnt_Customer_Enterprise", "id", cEnEnt_Customer_Enterprise.getId()+"", cEnEnt_Customer_Enterprise);
		//String strOpen = "openTop(\"GDPE.customer.enterprise.ActionEnt_Customer_Enterprise.do?doType=summary&jspPageId="+cMultiPage.getJspPageId()+"\");";
		//String strOpen ="openTop(\"GDPE.customer.enterprise.ActionEnt_Customer_Enterprise.do?doType=summary\");";
		
		String strOpen = "openTop(\"page.do?targetPage=/GDPE/customer/enterprise/Ent_Customer_Enterprise_Summary.jsp&jspPageId="+cMultiPage.getJspPageId()+"\",true)";
		
		//System.out.println("---"+request.getParameter("jspPageId"));
		//strOpen = "openTop(\"page.do?targetPage=/SysAdmin/Auditor/SA_Auditor_Index.jsp&jspPageId="+cMultiPage.getJspPageId()+"&chAuditorCode="+cEnAuditor.getChAuditorCode()+"\",true)";
		//String strOpen="closeWindow()";
		//String strOpen="closeSelf()";
		levin.iMessage msg = levin.iMessage
				.getNewInstance(
						"客户管理",
						"修改成功!",
						strOpen);
						//"openTop(\"GDPE.customer.enterprise.ActionEnt_Customer_Enterprise.do?doType=summary\");");

		msg.save(request);
		logger.info("修改时使用的帐号:"+operatorId);
		return this.getTargetPage("Message");
	}

	public String view(HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		String id = request.getParameter("id");
		EnEnt_Customer_Enterprise cEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise) DAOBase
				.findByPK(new DbAccess(), EnEnt_Customer_Enterprise.class
						.getName(), id);
		request.setAttribute("cEnEnt_Customer_Enterprise",
				cEnEnt_Customer_Enterprise);
		request.setAttribute("doType", "view");
		return this.getTargetPage("detail");
	}

	public String delete(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		HttpSession session = request.getSession(false);
		UserInfo userInfor = (UserInfo) session.getAttribute("UserInfo_Object");
		String operatorId = userInfor.getId();// 当前操作员ID
//		boolean IsAdmin = false;
//		// 判断当前操作员角色是否为管理员
//		EnAuditorRole[] cEnAuditorRole = (EnAuditorRole[]) DAOBase
//				.findByCondition(new DbAccess(), EnAuditorRole.class.getName(),
//						"chAuditorCode='" + operatorId + "'", "");
//		for (int i = 0; i < cEnAuditorRole.length; i++) {
//			if (cEnAuditorRole[i].getChRoleCode().equals("0000"))
//				IsAdmin = true;
//		}
		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();
//
//				EnEnt_Customer_Enterprise cEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise) DAOBase
//						.findByPK(new DbAccess(),
//								EnEnt_Customer_Enterprise.class.getName(),
//								index);
//				String collectUserId = cEnEnt_Customer_Enterprise
//						.getChCommitCode();// 记录收藏者ID
//				if (!IsAdmin && !collectUserId.equals(operatorId))
//					continue;
				DAOBase.delete(db, EnEnt_Customer_Enterprise.class.getName(),
						index);
			}

			db.commit();
		} catch (Exception ex) {
			db.rollback();
			throw ex;
		}

		levin.iMessage msg = levin.iMessage
				.getNewInstance(
						"客户管理",
						"删除成功.",
						"openTop(\"GDPE.customer.enterprise.ActionEnt_Customer_Enterprise.do?doType=summary\");");
		msg.save(request);
		logger.info("查询时使用的帐号:"+operatorId);
		//request.setAttribute("doType", "summary");
		return this.getTargetPage("Message");
	}

	public String search(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		levin.util.DbAccess db = new levin.util.DbAccess();
		String chEnterpriseLinkman = request.getParameter("chEnterpriseLinkman");
		String chEnterpriseFullName = request
		.getParameter("chEnterpriseFullName");
        String chSeatCode = request.getParameter("chSeatCode");
		String chStation = request.getParameter("chStation");
		String chEnterpriseCategory = request.getParameter("chEnterpriseCategory");
		String chProduct = request.getParameter("chProduct");
		String startTime = request.getParameter("startTime");
		String endTime = request.getParameter("endTime");
		String chEnterpriseProvinceCode = request.getParameter("chEnterpriseProvinceCode");
		//
		String chArea = request.getParameter("chArea");
		String chEnterpriseGrade = request.getParameter("chEnterpriseGrade");
	
		String LinkmanTel = request.getParameter("LinkmanTel");
		String chEnterprisePhone = request.getParameter("chEnterprisePhone");
		String chEnterpriseFax = request.getParameter("chEnterpriseFax");
		

		String chEnterpriseCityName = request.getParameter("chEnterpriseCityName");
		//在省不补齐的情况下要求修改成模糊查询城市或者区域,

		HttpSession session = request.getSession(false);
		UserInfo userInfor = (UserInfo) session.getAttribute("UserInfo_Object");
		String chCommitCode = userInfor.getId();
		String chCommitName = request.getParameter("chCommitName");// 客户负责人
				
		
		String idstr = userInfor.getId();
		String flag = checkFlag(idstr);
		
		EnEnt_Customer_Enterprise aEnEnt_Customer_Enterprise[];
		EnEnt_Customer_Enterprise searchContract = new EnEnt_Customer_Enterprise();
		searchContract.setChEnterpriseLinkman(chEnterpriseLinkman);
		searchContract.setChEnterpriseFullName(chEnterpriseFullName);
		searchContract.setChSeatCode(chSeatCode);
		searchContract.setChCommitName(chCommitName);
		searchContract.setChStation(chStation);
		searchContract.setChArea(chArea);
		searchContract.setChEnterpriseGrade(chEnterpriseGrade);
		searchContract.setChEnterpriseProvinceCode(chEnterpriseProvinceCode);
		searchContract.setChEnterpriseCityName(chEnterpriseCityName);
		
		searchContract.setLinkmanTel(LinkmanTel);
		searchContract.setChEnterpriseFax(chEnterpriseFax);
		searchContract.setChEnterprisePhone(chEnterprisePhone);
		
		//System.out.println("---CITY-------"+chEnterpriseCityName);
		
		searchContract.setChEnterpriseCategory(chEnterpriseCategory);
		searchContract.setChProduct(chProduct);
		//System.out.println("---1-------"+idstr);
		if (flag.equals("isAdmin")) {
			aEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise[]) (DAOCustomer
					.searcheEnContract(db,  searchContract,startTime,endTime));
		} else if (flag.equals("isStation")) {
			EnAuditor cEnAuditor = (EnAuditor) DAOBase.findByPK(new DbAccess(),
					EnAuditor.class.getName(), idstr);
			String chStationCode = cEnAuditor.getChDeptCode();
			
//			searchContract.setChStationCode(chStationCode);
//			searchContract.setChAreacode(chStationCode);
//			searchContract.setChCommitCode(idstr);
			
			aEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise[]) (DAOCustomer
					.searcheEnContract2(db, searchContract,startTime,endTime,chStationCode,idstr));
			//System.out.println("---2-------"+idstr);
		} else {
			searchContract.setChCommitCode(chCommitCode);// 如果不是系统管理员只能查自己的客户
			searchContract.setChCommitName(chCommitName);
			aEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise[]) (DAOCustomer
					.searcheEnContract(db,  searchContract,startTime,endTime));
		}
		request.setAttribute("aEnEnt_Customer_Enterprise",
				aEnEnt_Customer_Enterprise);

		request.setAttribute("doType", "search");
		//logger.info("查询时使用的帐号:"+chCommitCode);
		return this.getTargetPage("summary");

	}

//	public String check(HttpServletRequest request, HttpServletResponse response)
//			throws Exception {
//		//String chEnterpriseFullName = request.getParameter("chEnterpriseFullName");
//		String chEnterpriseFullName = new String(request.getParameter("chEnterpriseFullName").getBytes("ISO8859_1"),"GBK");
//		//String sqlCondition = "chEnterpriseFullName = '" + chEnterpriseFullName
//			//	+ "'";
//		//System.out.println("----"+chEnterpriseFullName);
//		//String order = "chEnterpriseFullName desc";
//		String sql = "select * from Ent_Customer_Enterprise where chEnterpriseFullName like '%"+chEnterpriseFullName+"%'" ;
//		DbAccess db = new DbAccess();
//		EnEnt_Customer_Enterprise[] aEnEnt_Customer_Enterprise;
//		try {
//			db.beginTransaction();
//			DataSet ds = db.executeQuery(sql);
//			aEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise[]) DAOBase.resumeFromDataSet(ds, EnEnt_Customer_Enterprise.class.getName());
//			db.commit();
//		}catch(Exception ex){
//			db.rollback();
//		    throw ex;
//		}
//				
////		EnEnt_Customer_Enterprise[] aEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise[]) (DAOBase
////				.findByCondition(new DbAccess(),
////						EnEnt_Customer_Enterprise.class.getName(),
////						sqlCondition, order));
//		
//		if (aEnEnt_Customer_Enterprise.length == 0) {
//			levin.iMessage msg = levin.iMessage.getNewInstance("企业客户管理|企业信息",
//					"没有相同名称,该企业没有被收藏.", "closeSelf();");
//			msg.save(request);
//			return this.getTargetPage("Message");
//
//		} else {
//			int i;
//			boolean b=true;
//			StringBuffer sb = new StringBuffer();
//			for(i=0;i<aEnEnt_Customer_Enterprise.length;i++) {
//				if(aEnEnt_Customer_Enterprise[i].getChIsAudited().equals("1")) {
//					b=true;
//					//sb.append(aEnEnt_Customer_Enterprise[i].getChCommitName());
//				}else {
//					b=false;
//					sb.append(aEnEnt_Customer_Enterprise[i].getChCommitName());
//				}
//			}
//			if(b) {
//				levin.iMessage msg = levin.iMessage.getNewInstance("企业信息",
//						"该企业已经签约.", "closeSelf()");
//				msg.save(request);
//				return this.getTargetPage("Message");
//				
//			}else {	
//				
//			    levin.iMessage msg = levin.iMessage.getNewInstance("企业信息",
//					"该企业未签约但已经被"+sb.toString()+"收藏!", "closeSelf()");
//			    msg.save(request);
//			    return this.getTargetPage("Message");
//			}
//		}
//		
//		
//
//	}
	public String check(HttpServletRequest request, HttpServletResponse response)
	throws Exception {
//String chEnterpriseFullName = request.getParameter("chEnterpriseFullName");
String chEnterpriseFullName = new String(request.getParameter("chEnterpriseFullName").getBytes("ISO8859_1"),"GBK");
//String sqlCondition = "chEnterpriseFullName = '" + chEnterpriseFullName
	//	+ "'";
//System.out.println("----"+chEnterpriseFullName);
//String order = "chEnterpriseFullName desc";
String sql = "select * from Ent_Customer_Enterprise where chEnterpriseFullName like '%"+chEnterpriseFullName+"%'" ;
DbAccess db = new DbAccess();
EnEnt_Customer_Enterprise[] aEnEnt_Customer_Enterprise;
try {
	db.beginTransaction();
	DataSet ds = db.executeQuery(sql);
	aEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise[]) DAOBase.resumeFromDataSet(ds, EnEnt_Customer_Enterprise.class.getName());
	db.commit();
}catch(Exception ex){
	db.rollback();
    throw ex;
}
		
//EnEnt_Customer_Enterprise[] aEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise[]) (DAOBase
//		.findByCondition(new DbAccess(),
//				EnEnt_Customer_Enterprise.class.getName(),
//				sqlCondition, order));

if (aEnEnt_Customer_Enterprise.length == 0) {
	levin.iMessage msg = levin.iMessage.getNewInstance("企业客户管理|企业信息",
			"没有相同名称,该企业没有被收藏.", "closeSelf();");
	msg.save(request);
	return this.getTargetPage("Message");

} else {
	int i;
	boolean b=true;
	StringBuffer sb = new StringBuffer();
	for(i=0;i<aEnEnt_Customer_Enterprise.length;i++) {
		if(aEnEnt_Customer_Enterprise[i].getChIsAudited().equals("1")) {
			b=true;
			//sb.append(aEnEnt_Customer_Enterprise[i].getChCommitName());
		}else {
			b=false;
			sb.append(aEnEnt_Customer_Enterprise[i].getChCommitName());
		}
	}
	if(b) {
		levin.iMessage msg = levin.iMessage.getNewInstance("企业信息",
				"该企业已经签约.", "closeSelf()");
		msg.save(request);
		return this.getTargetPage("Message");
		
	}else {	
		
	    levin.iMessage msg = levin.iMessage.getNewInstance("企业信息",
			"该企业未签约但已经被"+sb.toString()+"收藏!", "closeSelf()");
	    msg.save(request);
	    return this.getTargetPage("Message");
	}
}



}

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

⌨️ 快捷键说明

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