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

📄 actionent_customer_enterprise.java

📁 公司CRM部分原代码,采用的是java技术.
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
		UserInfo userInfor = (UserInfo) session.getAttribute("UserInfo_Object");
		String operatorId = userInfor.getId();// 当前操作员ID

		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_Enterprise.class.getName(),
						index);
			}

			db.commit();
		} catch (Exception ex) {
			db.rollback();
			throw ex;
		}
		String str = "openTop(\"GDPE.customer.latent.ActionEnt_Customer_Enterprise.do?doType=summary\");";
		levin.iMessage msg = levin.iMessage
				.getNewInstance("客户管理", "删除成功.", str);
		msg.save(request);
		// 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 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.setChEnterpriseProvinceCode(chEnterpriseProvinceCode);
		searchContract.setChEnterpriseCityName(chEnterpriseCityName);
		// 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[]) (GDPE.customer.latent.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);
			aEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise[]) (GDPE.customer.latent.DAOCustomer
					.searcheEnContract2(db, searchContract, startTime, endTime,
							chStationCode, idstr));
		} else {
			searchContract.setChCommitCode(chCommitCode);// 如果不是系统管理员只能查自己的客户
			searchContract.setChCommitName(chCommitName);
			aEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise[]) (GDPE.customer.latent.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 anDiyu = new String(request.getParameter(
		// "anDiyu").getBytes("ISO8859_1"), "GBK");
		String anDiyu = request.getParameter("anDiyu");
		String anMingchen = request.getParameter("anMingchen");
		String anGongsi = request.getParameter("anGongsi");
		String sql = "select * from Ent_Customer_Enterprise where chEnterpriseFullName like '%"
				+ anDiyu
				+ "%' and chEnterpriseFullName like '%"
				+ anMingchen
				+ "%' and chEnterpriseFullName like '%" + anGongsi + "%'";
		// System.out.println("---ss---"+sql);
		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;
		}

		if (aEnEnt_Customer_Enterprise.length == 0) {
			levin.iMessage msg = levin.iMessage
					.getNewInstance(
							"企业客户管理|企业信息",
							"没有相同名称,该企业没有被收藏.",
							"openTop(\"GDPE.customer.latent.ActionEnt_Customer_Enterprise.do?doType=summary\");");
			msg.save(request);
			return this.getTargetPage("Message");

		} else {
			int i;
			boolean b = true;
			StringBuffer sb = new StringBuffer();
			StringBuffer name = new StringBuffer();

			if (aEnEnt_Customer_Enterprise.length > 6) {
				levin.iMessage msg = levin.iMessage
						.getNewInstance(
								"企业信息",
								"请输入必要关键字.",
								"openTop(\"GDPE.customer.latent.ActionEnt_Customer_Enterprise.do?doType=summary\");");
				msg.save(request);
				return this.getTargetPage("Message");
			} else {
				for (i = 0; i < aEnEnt_Customer_Enterprise.length; i++) {
					if (aEnEnt_Customer_Enterprise[i].getChIsAudited().equals(
							"1")) {
						b = true;
					} else {
						b = false;
						name.append(aEnEnt_Customer_Enterprise[i]
								.getChEnterpriseFullName());
						name.append(",");
						sb.append(aEnEnt_Customer_Enterprise[i]
								.getChCommitName());
						sb.append(",");
					}
				}
				if (b) {
					levin.iMessage msg = levin.iMessage
							.getNewInstance(
									"企业信息",
									"该企业已经签约.",
									"openTop(\"GDPE.customer.latent.ActionEnt_Customer_Enterprise.do?doType=summary\");");
					msg.save(request);
					return this.getTargetPage("Message");

				} else {

					levin.iMessage msg = levin.iMessage
							.getNewInstance(
									"企业信息",
									"类似企业" + name + "未签约但分别被" + sb.toString()
											+ "收藏!",
									"openTop(\"GDPE.customer.latent.ActionEnt_Customer_Enterprise.do?doType=summary\");");
					msg.save(request);
					return this.getTargetPage("Message");
				}
			}
		}
	}

	public String mailSend(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String title = request.getParameter("subject");
		String content = request.getParameter("content");
		String enterpriseid = request.getParameter("enterpriseid");

		String head;
		javax.mail.Address toAddrs;
		javax.mail.internet.MimeMessage message;
		head = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=GBK'><title>"
				+ title + "</title></head><body>";
		// String sql = "select * from mailConfig";
		// DataSet ds = new DbAccess().executeQuery(sql);
		Properties pro = System.getProperties();
		// pro.put("mail.host",ds.getString(0, 0));
		pro.put("mail.host", "mail.gdpe.cn");
		pro.put("mail.port", "25");
		pro.put("mail.transport.protocol", "smtp");
		pro.put("mail.smtp.auth", "true");
		// String user = ds.getString(0, 1);
		// String password = ds.getString(0, 2);
		// String fromEmail = ds.getString(0, 3);
		String userAdd = request.getParameter("mailAddress");
		String user = userAdd.substring(0, userAdd.indexOf("@gdpe.cn"));
		// System.out.println("user-----"+user);
		String password = request.getParameter("password");
		String fromEmail = userAdd;
		// System.out.println("-----"+user+password+fromEmail);
		// System.out.println("fromEmail-----"+fromEmail);
		javax.mail.Session session = Session.getInstance(pro,
				new SmtpAuthentication(user, password));
		message = new MimeMessage(session);

		// MimeBodyPart bodypart = new MimeBodyPart();
		// FileDataSource datasource= new FileDataSource ("E:\\工作职责.doc");
		// bodypart.setDataHandler(new DataHandler(datasource));
		// bodypart.setFileName(MimeUtility.encodeWord("工作职责.doc","gb2312",
		// null));
		// bodypart.setText("看看是不是内容");
		// Multipart mp = new MimeMultipart();

		try {
			message.setFrom(new InternetAddress(fromEmail));
			message.setSubject(title, "GBK");
			message.setContent(head + content + "</body></html>",
					"text/html;charset=GBK");
			// mp.addBodyPart(bodypart);
			// message.setContent(mp);
			// message.setText(content);
			// System.out.println("1次---1-------"+message.toString());

			StringTokenizer st = new StringTokenizer(enterpriseid, ",");
			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);
				if (!cEnEnt_Customer_Enterprise.getChEnterpriseEmail().equals(
						"")) {
					toAddrs = new InternetAddress(cEnEnt_Customer_Enterprise
							.getChEnterpriseEmail());
					// toAddrs = new InternetAddress("yym1202000@yahoo.com.cn");

					// System.out.println("1次----------"+cEnEnt_Customer_Enterprise
					// .getChEnterpriseEmail());
					message.addRecipient(javax.mail.Message.RecipientType.TO,
							toAddrs);
				}
			}
			Transport.send(message);
		} catch (MessagingException ex) {
			ex.printStackTrace();
			levin.iMessage msg = levin.iMessage.getNewInstance("邮件群发",
					"邮件因网络连接故障发送失败.", "closeWindow()");
			msg.save(request);
			return this.getTargetPage("Message");
		}
		levin.iMessage msg = levin.iMessage.getNewInstance("邮件群发", "邮件已发送.",
				"closeWindow()");
		msg.save(request);
		return this.getTargetPage("Message");
	}

	public String mailContent(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String enterpriseid = request.getParameter("enterpriseid");
		request.setAttribute("enterpriseid", enterpriseid);
		return this.getTargetPage("mailContent");
	}

	public String lookUp(HttpServletRequest request,
			HttpServletResponse response) throws Exception {

		levin.util.DbAccess db = new levin.util.DbAccess();
		// String chCorporateName = request.getParameter("chCorporateName");
		String chEnterpriseFullName = request
				.getParameter("chEnterpriseFullName");
		// String chSeatCode = request.getParameter("chSeatCode");

		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[];

		if (flag.equals("isAdmin")) {
			EnEnt_Customer_Enterprise searchContract = new EnEnt_Customer_Enterprise();
			// searchContract.setChCorporateName(chCorporateName);
			searchContract.setChEnterpriseFullName(chEnterpriseFullName);
			// searchContract.setChSeatCode(chSeatCode);
			searchContract.setChCommitName(chCommitName);
			aEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise[]) (DAOCustomer
					.searcheEnContract(db, searchContract));

		} else if (flag.equals("isStation")) {
			EnAuditor cEnAuditor = (EnAuditor) DAOBase.findByPK(new DbAccess(),
					EnAuditor.class.getName(), idstr);
			String chStationCode = cEnAuditor.getChDeptCode();
			String where = "chStationCode = '" + chStationCode + "'";
			// System.out.println("+------------>"+userInfor.);
			String order = "id desc";
			aEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise[]) (DAOBase
					.findByCondition(new DbAccess(),
							EnEnt_Customer_Enterprise.class.getName(), where,
							order));

			for (int i = 0; i < aEnEnt_Customer_Enterprise.length; i++) {
				if (!aEnEnt_Customer_Enterprise[i].getDtCommitTime().equals(""))
					aEnEnt_Customer_Enterprise[i]
							.setDtCommitTime(aEnEnt_Customer_Enterprise[i]
									.getDtCommitTime().substring(0, 10));
				if (!aEnEnt_Customer_Enterprise[i].getDtFoundTime().equals(""))
					aEnEnt_Customer_Enterprise[i]
							.setDtFoundTime(aEnEnt_Customer_Enterprise[i]
									.getDtFoundTime().substring(0, 10));
			}
		} else {
			EnEnt_Customer_Enterprise searchContract = new EnEnt_Customer_Enterprise();

			// searchContract.setChCorporateName(chCorporateName);
			searchContract.setChEnterpriseFullName(chEnterpriseFullName);
			// searchContract.setChSeatCode(chSeatCode);
			searchContract.setChCommitCode(chCommitCode);// 如果不是系统管理员只能查自己的客户
			searchContract.setChCommitName(chCommitName);
			aEnEnt_Customer_Enterprise = (EnEnt_Customer_Enterprise[]) (DAOCustomer
					.searcheEnContract(db, searchContract));
		}
		request.setAttribute("aEnEnt_Customer_Enterprise",
				aEnEnt_Customer_Enterprise);

		request.setAttribute("doType", "choose");
		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;
	}

	public static EnEnt_Customer_Enterprise viewInfo(
			EnEnt_Customer_Enterprise cEnEnt_Customer_Enterprise)
			throws Exception {
		int enid = cEnEnt_Customer_Enterprise.getId();
		String where = " Ent_Customer_Linkman.iCustomer_id = '" + enid + " '";

		EnENT_CUSTOMER_LINKMAN[] aEnENT_CUSTOMER_LINKMAN = (EnENT_CUSTOMER_LINKMAN[]) (DAOBase

⌨️ 快捷键说明

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