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

📄 busiopportaction.java

📁 基于Sturts+Spring+Hibernate的一个高级销售管理系统。内容丰富
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
	public ActionForward setContactRole(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws ApplicationException {
		// 主要联系人
		String principal = request.getParameter("principal");
		logger.debug("选中哪一个" + principal);

		// 业务机会
		String busiOpportId = request.getParameter("busiOpportId");
		logger.debug("业务机会..." + busiOpportId);

		String length = request.getParameter("length");
		logger.debug("联系人的长度..." + length);
		try {
			if (StringTool.isNotBlank(length)) {
				for (int i = 1; i <= Integer.parseInt(length); i++) {
					// 角色ID
					String roleId = request.getParameter("roleId" + i);
					logger.debug("角色ID..." + roleId);
					// 联系人ID
					String contactId = request.getParameter("contactId" + i);
					logger.debug("联系人ID..." + contactId);
					// 如果二者都设置,则必须保存
					if (StringTool.isNotBlank(roleId)
							&& StringTool.isNotBlank(contactId)) {
						String conBusiId = request
								.getParameter("conBusiId" + i);// 联系人--业务机会主键

						if (StringTool.isNotBlank(conBusiId)) {// 如果联系人--业务机会主键不为空,则只做修改

							if (contactId.equals(principal)) {// 若选中的是该联系人
								busiOpportMgr.updateContactBusiOpport(Integer
										.parseInt(conBusiId), Integer
										.parseInt(contactId), Integer
										.parseInt(roleId), true);
							} else {// 没有选中该联系人
								busiOpportMgr.updateContactBusiOpport(Integer
										.parseInt(conBusiId), Integer
										.parseInt(contactId), Integer
										.parseInt(roleId), false);
							}

						} else {// 联系人--业务机会主键空, 则做保存

							if (contactId.equals(principal)) {// 若选中的是该联系人
								busiOpportMgr.addContactBusiOpport(Integer
										.parseInt(contactId), Integer
										.parseInt(busiOpportId), Integer
										.parseInt(roleId), true);
							} else {// 没有选中该联系人
								busiOpportMgr.addContactBusiOpport(Integer
										.parseInt(contactId), Integer
										.parseInt(busiOpportId), Integer
										.parseInt(roleId), false);
							}

						}
					}
				}
			}
			// 新增的联系人
			for (int i = 1; i <= 3; i++) {
				// 角色ID
				String conRoleElseId = request.getParameter("roleElseId" + i);
				// 联系人ID
				String contactElseId = request
						.getParameter("contactElseId" + i);
				// 若二者都不为空,才保存
				if (StringTool.isNotBlank(conRoleElseId)
						&& StringTool.isNotBlank(contactElseId)) {
					// 只做保存
					if (contactElseId.equals(principal)) {// 若选中的是该联系人
						busiOpportMgr.addContactBusiOpport(Integer
								.parseInt(contactElseId), Integer
								.parseInt(busiOpportId), Integer
								.parseInt(conRoleElseId), true);
					} else {
						busiOpportMgr.addContactBusiOpport(Integer
								.parseInt(contactElseId), Integer
								.parseInt(busiOpportId), Integer
								.parseInt(conRoleElseId), false);
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("no find data...");
			throw new ApplicationException("no find data!");
		}
		return new ActionForward("/busiOpport.do?method=busiOpportCorrelation");
	}

	/**
	 * 查找所有的联系人
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @throws ApplicationException
	 */
	public ActionForward allContact(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws ApplicationException {
		String forward = "contactList";
		logger.debug("打开联系人...");
		try {
			User user = SessionMgr.getCustSession(request);

			// 查找用户的所有没有被删除的联系人
			List<ContactVo> contacts = busiOpportMgr.getContactByUser(user,
					Constants.ACTIVEFLAG);
			logger.debug("几个联系人..." + contacts);
			String currentPage = request.getParameter("currentPage");
			XPage xpage = new XPage(request.getContextPath()
					+ "/busiOpport.do?method=allContact", contacts.size(), 1,
					10, contacts);
			if (currentPage != null && !currentPage.equals("")) {
				xpage.setCurrentItems(Integer.parseInt(currentPage));
			} else {
				xpage.setCurrentItems(1);
			}
			xpage.setPageBar();
			request.setAttribute("xpage", xpage);
		} catch (Exception e) {
			e.printStackTrace();
			request.setAttribute(Constants.ERRMSG, Constants.FNINNOCONTACT);
		}
		return mapping.findForward(forward);
	}

	/**
	 * 新建任务
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @throws ApplicationException
	 *             2008-11-07 by 张明强 copied liu's
	 */
	public ActionForward createNewTask(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws ApplicationException {
		String busiOpportId = request.getParameter("busiOpportId");
		logger.error("参数为。。。" + busiOpportId);
		if (!StringTool.isNotBlank(busiOpportId)) {
			logger.debug("the param you input is illegal");
			request.setAttribute(Constants.ERRMSG, Constants.INPUTBANK);
			throw new IllegalParameterException(
					"the param you input is illegal");
		}
		try {
			BusinessOpportunity busiOpport = busiOpportMgr
					.getBusiOpportById(Integer.parseInt(busiOpportId));
			logger.error("有到这里吗。。。" + busiOpport);
			request.setAttribute("CorrelationVo", new CorrelationVo(busiOpport
					.getId(), busiOpport.getBusiOpportName()));

			// 保存客户相关项编码
			request.setAttribute("customerRelation",
					CorrelationConstant.BUSIOPPORTRELATION);

			ConfigMgr configMgr = ConfigMgr.getInstance();// 取出相关项类;
			Map<String, String> correlationsMap = configMgr
					.getAllCorrelations();// 获取相关项对应的键值对;
			if (correlationsMap != null && correlationsMap.size() > 0) {

				request.setAttribute("correlationsMap", correlationsMap);// 把键值对存放到request范围内;
			}
		} catch (Exception e) {
			request.setAttribute(Constants.ERRMSG, Constants.WITHOUTDATA);
			throw new IllegalParameterException(
					"the param you input is illegal");
		}
		return mapping.findForward("toAddTask");// 转发到添加任务活动的页面;
	}

	/**
	 * 新建事件
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @throws ApplicationException
	 *             2008-11-07 by 张明强 copied liu's
	 */
	public ActionForward createNewEvent(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws ApplicationException {
		String busiOpportId = request.getParameter("busiOpportId");
		logger.error("参数为。。。" + busiOpportId);
		if (!StringTool.isNotBlank(busiOpportId)) {
			logger.debug("the param you input is illegal");
			request.setAttribute(Constants.ERRMSG, Constants.INPUTBANK);
			throw new IllegalParameterException(
					"the param you input is illegal");
		}
		try {
			BusinessOpportunity busiOpport = busiOpportMgr
					.getBusiOpportById(Integer.parseInt(busiOpportId));
			logger.error("有到这里吗。。。" + busiOpport);
			request.setAttribute("CorrelationVo", new CorrelationVo(busiOpport
					.getId(), busiOpport.getBusiOpportName()));

			// 保存客户相关项编码
			request.setAttribute("customerRelation",
					CorrelationConstant.BUSIOPPORTRELATION);

			ConfigMgr configMgr = ConfigMgr.getInstance();// 取出相关项类;
			Map<String, String> correlationsMap = configMgr
					.getAllCorrelations();// 获取相关项对应的键值对;
			if (correlationsMap != null && correlationsMap.size() > 0) {

				request.setAttribute("correlationsMap", correlationsMap);// 把键值对存放到request范围内;
			}
		} catch (Exception e) {
			request.setAttribute(Constants.ERRMSG, Constants.WITHOUTDATA);
			throw new IllegalParameterException(
					"the param you input is illegal");
		}
		return mapping.findForward("toAddEvent");// 转发到添加任务活动的页面;
	}

	/**
	 * 删除业务机会
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @throws ApplicationException
	 */
	public ActionForward deleteBusiOpport(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws ApplicationException {
		String id = request.getParameter("id");
		// 前置条件
		if (!StringTool.isNotBlank(id)) {
			request.setAttribute(Constants.ERRMSG, Constants.INPUTBANK);
			throw new ApplicationException("the param you input is illegal");
		}
		User user = SessionMgr.getCustSession(request);

		// 删除业务机会
		relationManage.updateEntitysStates(user.getId(), DateTimeTool
				.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
				ClassCodeMgr.BUSINESS_OPPORTINT, Integer.parseInt(id),
				Constants.DELETESELF, Constants.PASSIVITY);
		return mapping.findForward("allBusiOpport");
	}

	/**
	 * 查找回收站的业务机会
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @throws ApplicationException
	 */
	public ActionForward listDeteleBusiOpprt(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws ApplicationException {
		User user = SessionMgr.getCustSession(request);
		String forward = "listDeleteData";
		List<CustomerVo> customers = null;

		System.out.println("一共有几个选项:" + customers.size());
		String currentPage = request.getParameter("currentPage");
		XPage xpage = new XPage(request.getContextPath()
				+ "/customer.do?method=listDeleteData", customers.size(), 1, 8,
				customers);
		if (currentPage != null && !currentPage.equals("")) {
			xpage.setCurrentItems(Integer.parseInt(currentPage));
		} else {
			xpage.setCurrentItems(1);
		}
		xpage.setPageBar();
		request.setAttribute("xpage", xpage);
		return mapping.findForward(forward);
	}

	/**
	 * @return the boshMgr
	 */
	public BoStageHistoryMgr getBoshMgr() {
		return boshMgr;
	}

	/**
	 * @param boshMgr
	 *            the boshMgr to set
	 */
	public void setBoshMgr(BoStageHistoryMgr boshMgr) {
		this.boshMgr = boshMgr;
	}
}

⌨️ 快捷键说明

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