亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? customeraction.java

?? 基于Sturts+Spring+Hibernate的一個高級銷售管理系統。內容豐富
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
package com.yuanchung.sales.struts.customer.action;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

import com.yuanchung.sales.config.ClassCodeMgr;
import com.yuanchung.sales.config.ConfigMgr;
import com.yuanchung.sales.constants.CorrelationConstant;
import com.yuanchung.sales.constants.SystemConstant;
import com.yuanchung.sales.exception.ApplicationException;
import com.yuanchung.sales.exception.IllegalParameterException;
import com.yuanchung.sales.exception.PersistentObjException;
import com.yuanchung.sales.model.admin.Rights;
import com.yuanchung.sales.model.customer.Customer;
import com.yuanchung.sales.model.user.User;
import com.yuanchung.sales.model.userDefined.UserDefined;
import com.yuanchung.sales.model.userDefined.UserField;
import com.yuanchung.sales.model.userDefined.UserFilter;
import com.yuanchung.sales.service.RelationManage;
import com.yuanchung.sales.service.admin.authorization.AuthorizationMgr;
import com.yuanchung.sales.service.customer.CustomerMgr;
import com.yuanchung.sales.struts.customer.form.CustomerForm;
import com.yuanchung.sales.util.Constants;
import com.yuanchung.sales.util.DateTimeTool;
import com.yuanchung.sales.util.SessionMgr;
import com.yuanchung.sales.util.StringTool;
import com.yuanchung.sales.util.XPage;
import com.yuanchung.sales.vo.CustomerDefinedVo;
import com.yuanchung.sales.vo.CustomerVo;
import com.yuanchung.sales.vo.busiOpport.BusinessOpportunityVo;
import com.yuanchung.sales.vo.contact.ContactVo;
import com.yuanchung.sales.vo.right.WebRightsView;
import com.yuanchung.sales.vo.taskEvent.ActivityTaskVo;
import com.yuanchung.sales.vo.taskEvent.CorrelationVo;
import com.yuanchung.sales.vo.taskEvent.EventVo;
import com.yuanchung.sales.vo.user.UserVo;

public class CustomerAction extends DispatchAction {
	private static Logger logger = Logger.getLogger(CustomerAction.class);
	private CustomerMgr customerMgr;
	private AuthorizationMgr authorizationMgr;

	public void setAuthorizationMgr(AuthorizationMgr authorizationMgr) {
		this.authorizationMgr = authorizationMgr;
	}

	public void setCustomerMgr(CustomerMgr customerMgr) {
		this.customerMgr = customerMgr;
	}

	private RelationManage relationManage;

	public RelationManage getRelationManage() {
		return relationManage;
	}

	public void setRelationManage(RelationManage relationManage) {
		this.relationManage = relationManage;
	}

	/**
	 * 快速添加客戶;
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @throws ApplicationException
	 */
	public ActionForward addCustomer(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws ApplicationException {
		PrintWriter out = null;
		try {
			out = response.getWriter();// 設置out輸出流;
		} catch (IOException e1) {
			e1.printStackTrace();
		}
		User user = SessionMgr.getCustSession(request);// 當前正在操作的用戶;
		CustomerForm customerForm = (CustomerForm) form;
		Customer customer = new Customer();
		// 拷貝值;
		customer.setCustomerName(customerForm.getCustomerName());
		customer.setEmail(customerForm.getEmail());
		customer.setFax(customerForm.getFax());
		customer.setPhone(customerForm.getPhone());
		customer.setCommunAddr(customerForm.getCommunAddr());
		customer.setUser(user);

		customer.setModifyManId(user.getId());
		// 插入記錄的時間
		customer.setInDate(DateTimeTool.dateToStrFormat("yyyy-MM-dd HH:mm:ss",
				new Date()));
		// 上次修改的時間
		customer.setModifyManId(user.getId());

		customer.setLastModifyTime(DateTimeTool.dateToStrFormat(
				"yyyy-MM-dd HH:mm:ss", new Date()));
		customer.setFlag(Constants.ACTIVEFLAG);// 設置激活狀態;

		try {
			// 保存客戶
			customerMgr.addCustomer(customer);
		} catch (Exception e) {
			e.printStackTrace();
			logger.error(Constants.UNABLESAVEUSER);
			request.setAttribute(Constants.ERRMSG, Constants.UNABLESAVEUSER);
			throw new PersistentObjException(Constants.PERSISTENT_OBJEXCEPTION);
		}

		out
				.print("<script>window.opener.document.getElementById('recordId').value ='"
						+ customer.getId()
						+ "';window.opener.document.getElementById('recordName').value ='"
						+ customer.getCustomerName()
						+ "';window.close();</script>");// 關閉被打開的頁面;

		return null;
	}

	/**
	 * 新建客戶
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @throws ApplicationException
	 */
	public ActionForward newCreate(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws ApplicationException {
		CustomerForm customerForm = (CustomerForm) form;
		Customer customer = new Customer();
		String id = customerForm.getId();
		if (StringTool.isNotBlank(id)) {// 修改客戶資料
			customer = customerMgr.getCustomerById(Integer.parseInt(id));
		}
		customer.setCustomerName(customerForm.getCustomerName());// 客戶名稱
		customer.setCreateTime(customerForm.getCreateTime());// 客戶公司成立時間
		customer.setLegalRepresent(customerForm.getLegalRepresent());// 法人代表
		customer.setBizType(customerForm.getBizType());// 企業類型

		String registerCapital = customerForm.getRegisterCapital();
		if (registerCapital != null) {// 判斷注冊的地方是否是為空;
			String[] registerCapitals = registerCapital.split(",");
			StringBuffer formatCapital = new StringBuffer();
			for (int i = 0; i < registerCapitals.length; i++) {
				formatCapital.append(registerCapitals[i]);
			}
			if (StringTool.isNotBlank(formatCapital.toString())) {
				customer.setRegisterCapital(Integer.parseInt(formatCapital
						.toString()));// 注冊資金
			}
		}

		String industryType = customerForm.getIndustryType();
		String industryOf = customerForm.getIndustryOf();
		if (StringTool.isNotBlank(industryType)) {// 如果所屬行業不為空
			customer.setIndustryOf(industryOf);// 所屬行業
			customer.setIndustryType(industryType + "/" + industryOf);// 行業類別
		}

		logger.debug("行業類別:" + customerForm.getIndustryType());

		// 職員數
		String employeeNum = customerForm.getEmployeeNum();
		customer.setEmployeeNum(employeeNum);
		if (employeeNum != null && employeeNum.equals(Constants.MINEMPLOYEE)) {
			customer.setEmployeeMinNum(0);
			customer.setEmployeeMaxNum(8);
		} else if (employeeNum != null
				&& employeeNum.equals(Constants.MAXEMPLOYEE)) {
			customer.setEmployeeMinNum(2000);
			customer.setEmployeeMaxNum(Constants.MAXINT);
		} else if (employeeNum != null && !employeeNum.equals("")) {
			String[] nums = employeeNum.split("-");
			customer.setEmployeeMinNum(Integer.parseInt(nums[0]));
			customer.setEmployeeMaxNum(Integer.parseInt(nums[1]));
		}
		// 區域
		StringBuffer regionOf = new StringBuffer();
		String s1 = customerForm.getS1();
		String s2 = customerForm.getS2();
		String s3 = customerForm.getS3();
		if (s1 != null && !s1.equals(Constants.PROVINCE)) {
			regionOf.append(s1);
			customer.setProvince(s1);
		}
		if (s2 != null && !s2.equals(Constants.CITY)) {
			regionOf.append(s2);
			customer.setCity(s2);
		}
		if (s3 != null && !s3.equals(Constants.COUNTY)) {
			regionOf.append(s3);
			customer.setCounty(s3);
		}
		customer.setRegionOf(regionOf.toString());

		customer.setCommunAddr(customerForm.getCommunAddr());// 通信地址
		customer.setPhone(customerForm.getPhone());// 聯系電話
		customer.setFax(customerForm.getFax());// 傳真
		customer.setZipCode(customerForm.getZipCode());// 郵政編碼
		customer.setWebSite(customerForm.getWebSite());// 網址
		customer.setEmail(customerForm.getEmail());// 電子郵件
		customer.setHonestGrade(customerForm.getHonestGrade());// 誠信等級
		customer.setManagerLevel(customerForm.getManagerLevel());// 管理水平
		customer.setBreedVisualize(customerForm.getBreedVisualize());// 品牌形象
		customer.setCustomerState(customerForm.getCustomerState());// 客戶狀態
		customer.setCustomerSource(customerForm.getCustomerSource());// 客戶來源
		customer.setRemark(customerForm.getRemark());// 備注
		customer.setFlag(Constants.ACTIVEFLAG);// 默認為激活
		// 插入記錄的時間
		customer.setInDate(DateTimeTool.dateToStrFormat("yyyy-MM-dd HH:mm:ss",
				new Date()));
		// 上次修改的時間
		customer.setLastModifyTime(DateTimeTool.dateToStrFormat(
				"yyyy-MM-dd HH:mm:ss", new Date()));
		User user = SessionMgr.getCustSession(request);// 會話用戶默認為客戶所屬用戶
		customer.setUser(user);// 所屬用戶
		customer.setModifyManId(user.getId());// 做修改的用戶ID
		try {
			// 保存客戶
			customerMgr.addCustomer(customer);
		} catch (Exception e) {
			e.printStackTrace();
			logger.error(Constants.UNABLESAVEUSER);
			request.setAttribute(Constants.ERRMSG, Constants.UNABLESAVEUSER);
			throw new PersistentObjException("can not persistent obj!");
		}

		String forward = "customerCorrelation";
		String param = request.getParameter("param");
		if (param != null && param.equals("newAgain")) {// 若是保存并新建
			forward = "newCustomer";
		} else {
			try {
				CustomerVo customerVo = new CustomerVo();
				if (StringTool.isNotBlank(id)) {// 若客戶ID不為空
					// 根據ID查找所要的客戶

					// 跳轉到客戶相關action
					return new ActionForward("/customer.do?method=correlation");

				} else {
					// 查找最新保存的客戶
					Customer customerLastest = customerMgr.getCustomerDao()
							.getCustomerLastest();
					BeanUtils.copyProperties(customerVo, customerLastest);
				}
				request.setAttribute("customerVo", customerVo);
			} catch (Exception e) {
				e.printStackTrace();
				request.setAttribute(Constants.ERRMSG, Constants.ERRORSYSTEM);
				throw new ApplicationException("no find data");
			}

		}
		return mapping.findForward(forward);
	}

	/**
	 * 根據用戶取得所有的客戶
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @throws ApplicationException
	 */
	@SuppressWarnings("unchecked")
	public ActionForward customerAll(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws ApplicationException {
		User user = SessionMgr.getCustSession(request);
		// 2009-02-05 add 數據范圍
		Rights rights = SessionMgr.getJspRightsControl(request).get("1")
				.getRightsMap().get("104");
		String style = rights.getStyle();
		String userIds = authorizationMgr.findUserDataRange(rights.getId(),
				user);
		// if(!"".equals(userIds)){
		// userIds = userIds + "," + user.getId();
		// }else{
		// userIds = user.getId().toString();
		// }
		logger.debug("userIds : " + userIds);
		// 刪除(數據范圍)
		Rights delRights = SessionMgr.getJspRightsControl(request).get("1")
				.getRightsMap().get("103");
		String delUserIds = authorizationMgr.findUserDataRange(delRights
				.getId(), user);
		logger.debug("delUserIds : " + delUserIds);
		// 修改(數據范圍)
		Rights modifyRights = SessionMgr.getJspRightsControl(request).get("1")
				.getRightsMap().get("102");
		String modifyUserIds = authorizationMgr.findUserDataRange(modifyRights
				.getId(), user);

		// end
		List<UserDefined> options = new ArrayList<UserDefined>();
		if (Constants.STYLE_BLOCK.equals(style)) {// 2009-02-05 add 數據范圍
			options = customerMgr.getOptionsByUserAndType(user,
					Constants.ALLCUSTOMER_INT);// 根據用戶獲取所有用戶自定義選項
		}
		request.setAttribute("options", options);
		String forward = "customerList";
		List<Customer> customers = null;
		if (user != null) {
			// 根據用戶搜索所屬客戶
			// 2009-02-06 modify
			// customers = customerMgr.getCustomerByUser(user,
			// Constants.ACTIVEFLAG);
			customers = customerMgr.getCustomerByUser(userIds,
					Constants.ACTIVEFLAG);
			for (int i = 0; i < customers.size(); i++) {
				if (authorizationMgr.isRights(customers.get(i).getUser()
						.getId(), delUserIds)) {
					customers.get(i).setDelRights("y");
				}
				if (authorizationMgr.isRights(customers.get(i).getUser()
						.getId(), modifyUserIds)) {
					customers.get(i).setModifyRights("y");
				}
			}
			// end modify
			String currentPage = request.getParameter("currentPage");
			XPage xpage = new XPage(request.getContextPath()
					+ "/customer.do?method=customerAll", customers.size(), 1,
					10, customers);
			if (currentPage != null && !currentPage.equals("")) {
				xpage.setCurrentItems(Integer.parseInt(currentPage));
			} else {
				xpage.setCurrentItems(1);
			}
			xpage.setPageBar();
			request.setAttribute("xpage", xpage);

		} else {
			request.setAttribute("loginerror", Constants.MESSAGE);
			forward = "userLogin";
		}
		return mapping.findForward(forward);
	}

	/**
	 * 創建一個新選項
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线播放欧美女士性生活| 欧美另类高清zo欧美| 午夜久久久久久久久久一区二区| 久久亚洲精精品中文字幕早川悠里| 日本精品免费观看高清观看| 久久精品国产99国产| 一区二区成人在线视频 | 欧美日韩一区二区三区视频| 国产在线视频一区二区| 亚洲电影你懂得| 国产精品久久久久影院色老大| 91麻豆精品国产91久久久更新时间| 成人精品国产免费网站| 麻豆一区二区99久久久久| 亚洲蜜臀av乱码久久精品蜜桃| 精品88久久久久88久久久| 777亚洲妇女| 在线影视一区二区三区| 成人va在线观看| 国产一区二区三区香蕉| 日韩av网站免费在线| 伊人性伊人情综合网| 国产精品麻豆一区二区| 久久久综合视频| 欧美mv日韩mv| 717成人午夜免费福利电影| 欧美午夜精品电影| 日本韩国一区二区三区| 91影院在线观看| 91色porny在线视频| 成人av午夜影院| 成人动漫视频在线| 成人午夜激情影院| 成人av网站大全| 成人国产电影网| 99久久综合色| 91一区二区三区在线观看| 成人免费高清视频| 99久久精品费精品国产一区二区 | 日本二三区不卡| 日本韩国欧美三级| 欧洲日韩一区二区三区| 色88888久久久久久影院野外 | 99视频一区二区三区| 成人av一区二区三区| bt欧美亚洲午夜电影天堂| 不卡av电影在线播放| 99re视频这里只有精品| 91网上在线视频| 91福利在线免费观看| 欧美视频自拍偷拍| 欧美老肥妇做.爰bbww| 欧美电影在哪看比较好| 日韩一级二级三级| 久久综合久久鬼色中文字| 久久久精品蜜桃| 亚洲欧洲三级电影| 亚洲最新视频在线播放| 视频在线观看91| 国产呦精品一区二区三区网站| 国产九色sp调教91| 成人av电影免费观看| 在线观看国产一区二区| 欧美放荡的少妇| 国产亚洲综合色| 国产精品美女久久福利网站| 亚洲欧美日韩国产手机在线| 亚洲图片欧美色图| 经典一区二区三区| 色婷婷av一区二区三区之一色屋| 欧美日韩国产综合久久| 精品国产乱码久久久久久牛牛| 国产精品午夜免费| 亚洲国产精品人人做人人爽| 精品影院一区二区久久久| 成人深夜视频在线观看| 欧美中文字幕一二三区视频| 日韩欧美一二三区| 亚洲色图一区二区| 麻豆国产欧美一区二区三区| 91一区二区三区在线观看| 日韩欧美一级片| 亚洲欧美日韩系列| 国产一区二区精品久久| 欧美在线免费视屏| 久久只精品国产| 亚洲一区二区三区四区不卡| 国产精品久久久久久久裸模| 亚洲成av人片观看| 国产一区二区日韩精品| 91免费视频网址| 4438x成人网最大色成网站| 久久这里只有精品首页| 亚洲欧美综合另类在线卡通| 亚洲免费资源在线播放| 免费高清成人在线| 成人18视频日本| 欧美另类videos死尸| 精品国产网站在线观看| 一级女性全黄久久生活片免费| 日韩电影一区二区三区四区| 国产精品资源站在线| 99久久伊人精品| 91精品综合久久久久久| 日韩午夜av电影| 国产精品动漫网站| 蜜桃视频第一区免费观看| 99re这里只有精品视频首页| 欧美午夜影院一区| 久久精品亚洲精品国产欧美kt∨ | 欧美亚洲免费在线一区| 欧美一级高清大全免费观看| 综合在线观看色| 国模冰冰炮一区二区| 欧美无乱码久久久免费午夜一区| 久久久青草青青国产亚洲免观| 亚洲无线码一区二区三区| 成人午夜激情在线| 久久精品亚洲乱码伦伦中文| 午夜不卡av在线| 99久久精品一区二区| 91精品国产一区二区| 国产亚洲美州欧州综合国| 亚洲精品国产视频| 色香蕉成人二区免费| 国产亚洲女人久久久久毛片| 免费在线观看日韩欧美| 在线观看不卡一区| 国产精品色哟哟| 免费久久精品视频| 欧美mv日韩mv| 日韩在线一二三区| 欧美午夜精品理论片a级按摩| 国产欧美精品一区| 国产九九视频一区二区三区| 欧美日韩一级片在线观看| 久久一区二区视频| 免费久久精品视频| 欧美一区二区三区在线观看 | 午夜精品免费在线| 国产乱码精品一区二区三 | 中文字幕亚洲一区二区av在线 | 另类小说色综合网站| 欧美在线一区二区三区| 一区二区三区欧美视频| 99久久久免费精品国产一区二区 | 国产清纯白嫩初高生在线观看91 | 久久精品亚洲精品国产欧美| 蜜乳av一区二区| 在线免费亚洲电影| 1区2区3区国产精品| 成人一区二区三区在线观看| 欧美成人vr18sexvr| 美女爽到高潮91| 日韩一区二区三区四区五区六区 | 一区二区不卡在线播放 | 久久综合五月天婷婷伊人| 激情五月婷婷综合| 久久综合九色综合久久久精品综合| 视频在线观看一区| 欧美日产在线观看| 国产精品一区在线观看你懂的| 欧美精品一区视频| 国产激情一区二区三区四区 | 亚洲婷婷在线视频| 91高清视频免费看| 亚洲国产精品久久一线不卡| 欧美日韩成人激情| 久久精品久久精品| 久久久久亚洲蜜桃| www.av精品| 亚洲自拍欧美精品| 欧美一级一区二区| 国内成+人亚洲+欧美+综合在线| 久久蜜桃一区二区| 色婷婷综合五月| 日韩电影免费在线观看网站| 日韩视频不卡中文| 成人黄色综合网站| 亚洲人成伊人成综合网小说| 欧美日韩一区高清| 国模无码大尺度一区二区三区| 中文字幕欧美国产| 欧美四级电影在线观看| 性欧美疯狂xxxxbbbb| 精品国产sm最大网站| 成人网页在线观看| 亚洲成人一区二区| 中文字幕的久久| 91国在线观看| 激情综合色播激情啊| 亚洲美女区一区| 欧美三级电影在线观看| 成人免费福利片| 亚洲成人先锋电影| 国产欧美一区视频| 欧美三片在线视频观看| 成人app网站| 蜜臀va亚洲va欧美va天堂| 国产精品国产三级国产专播品爱网|