58927d655b5b78c75c5d39a5d024044f6a85a1f2.svn-base 17.4 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563
package com.espeed.action;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.List;
import java.util.Map;

import com.espeed.centre.pojo.YxyUserInfo;
import com.espeed.log.LogClass;
import com.espeed.service.YxyCustomerService;
import com.espeed.vo.PageBean;
import com.espeed.webmail.pojo.CrmCustomerIndustries;
import com.espeed.webmail.pojo.CrmProcess;
import com.espeed.webmail.pojo.CrmProduct;
import com.espeed.webmail.pojo.CrmSourcefrom;
import com.espeed.webmail.pojo.CrmStatus;
import com.espeed.webmail.pojo.YxyCustomerEmail;
import com.espeed.webmail.pojo.YxyCustomerType;
import com.opensymphony.xwork2.ActionContext;
 
/**
 * 程序名称:    	EspeedMail_时速邮箱
 * 程序版本:    	V1.0
 * 作    者:    	深圳市科飞时速网络技术有限公司(0755-88843776)
 * 版权所有:    	深圳市科飞时速网络技术有限公司
 * 技术支持:    	Tech@21gmail.com
 * 单元名称:    	客户管理Action
 * 开始时间:    	2015.04.04
 * 程 序 员:    	陈南巧
 * 最后修改:    
 * 备    注:		邮件处理(营销)    
 */
public class YxyCustomerAction extends BaseAction {
	private static final long serialVersionUID = 1L;

	/**获取所有客户分类*/
	public String findClassifyAll(){	
		try {
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();
			YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
			loginid=user.getLogin_id();//用户账号
			domain=user.getDomain();//用户所属域名
			classifylist=customerservice.findClassifyAll(user,iscounts);
		} catch (Exception e) {
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return "classify";
	}
	
	/**获取所有客户状态*/
	public String findStatusAll(){	
		try {
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();
			YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
			loginid=user.getLogin_id();//用户账号
			domain=user.getDomain();//用户所属域名
			statuslist=customerservice.findStatusAll(user,iscounts);
		} catch (Exception e) {
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return "status";
	}
	
	/**获取所有客户来源*/
	public String findFromAll(){	
		try {
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();
			YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
			loginid=user.getLogin_id();//用户账号
			domain=user.getDomain();//用户所属域名
			fromlist=customerservice.findFromAll(user,iscounts);
		} catch (Exception e) {
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return "from";
	}
	
	/**获取所有产品分类*/
	public String findProductAll(){	
		try {
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();
			YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
			loginid=user.getLogin_id();//用户账号
			domain=user.getDomain();//用户所属域名
			productlist=customerservice.findProductAll(user,iscounts);
		} catch (Exception e) {
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return "product";
	}
	
	/**获取所有销售进程*/
	public String findProcessAll(){	
		try {
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();
			YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
			loginid=user.getLogin_id();//用户账号
			domain=user.getDomain();//用户所属域名
			processlist=customerservice.findProcessAll(user);
		} catch (Exception e) {
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return "process";
	}
	
	/**获取客户分类下的客户集合*/
	public String findCustomersByClassify()
	{
		try {
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();
			YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
			loginid=user.getLogin_id();//用户账号
			domain=user.getDomain();//用户所属域名
			customerlist=customerservice.findCustomersByClassify(user.getUser_id(),classifyid);
		} catch (Exception e) {
			e.printStackTrace();
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return "customers";
	}
	
	/**获取客户状态下的客户集合*/
	public String findCustomersByStatus()
	{
		try {
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();
			YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
			loginid=user.getLogin_id();//用户账号
			domain=user.getDomain();//用户所属域名
			customerlist=customerservice.findCustomersByStatus(user.getUser_id(),statusid);
		} catch (Exception e) {
			e.printStackTrace();
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return "customers";
	}
	
	/**获取客户来源下的客户集合*/
	public String findCustomersByFrom()
	{
		try {
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();
			YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
			loginid=user.getLogin_id();//用户账号
			domain=user.getDomain();//用户所属域名
			customerlist=customerservice.findCustomersByFrom(user.getUser_id(),fromid);
		} catch (Exception e) {
			e.printStackTrace();
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return "customers";
	}
	
	/**获取意向产品下的客户集合*/
	public String findCustomersByProduct()
	{
		try {
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();
			YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
			loginid=user.getLogin_id();//用户账号
			domain=user.getDomain();//用户所属域名
			customerlist=customerservice.findCustomersByProduct(user.getUser_id(),productid);
		} catch (Exception e) {
			e.printStackTrace();
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return "customers";
	}
	
	/**获取销售进程下的客户集合*/
	public String findCustomersByProcess()
	{
		try {
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();
			YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
			loginid=user.getLogin_id();//用户账号
			domain=user.getDomain();//用户所属域名
			customerlist=customerservice.findCustomersByProcess(user.getUser_id(),processid);
		} catch (Exception e) {
			e.printStackTrace();
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return "customers";
	}
	
	/**获取公海条件下的客户集合*/
	public String findCustomersByPublic()
	{
		try {
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();
			YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
			loginid=user.getLogin_id();//用户账号
			domain=user.getDomain();//用户所属域名
			customerlist=customerservice.findCustomersByPublic(user.getCompany_id(),user.getUser_id(),public_id);
		} catch (Exception e) {
			e.printStackTrace();
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return "customers";
	}
	
	/**获取所有采购偏好*/
	public String findIndustriesAll()
	{
		try {
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();
			YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
			loginid=user.getLogin_id();//用户账号
			domain=user.getDomain();//用户所属域名
			pagebean.setCurrentPage(currpage);//当前页
			pagebean.setPageSize(10);//每页显示的数量
			industries=customerservice.findIndustriesAll(user.getUser_id(),condition,conditionValue,pagebean);
		} catch (Exception e) {
			e.printStackTrace();
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return "industries";
	}
	
	/**个性营销邮查询客户数*/
	public String findCustomerByPersonSaleCounts()
	{
		try {
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();
			YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
			loginid=user.getLogin_id();//用户账号
			domain=user.getDomain();//用户所属域名
			result=customerservice.findCustomerByPersonSaleCounts(user.getCompany_id(),user.getUser_id(),highSearchValue);
		} catch (Exception e) {
			result=0;
			e.printStackTrace();
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return SUCCESS;
	}
	
	/**个性营销邮查询客户列表*/
	public String findCustomerByPersonSaleList()
	{
		try {
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();
			YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
			loginid=user.getLogin_id();//用户账号
			domain=user.getDomain();//用户所属域名
			customerlist=customerservice.findCustomerByPersonSaleList(user.getCompany_id(),user.getUser_id(),highSearchValue);
		} catch (Exception e) {
			e.printStackTrace();
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return "customers";
	}
	
	/**获取采购偏好下的客户集合*/
	public String findCustomersByIndustries()
	{
		try {
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();
			YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
			loginid=user.getLogin_id();//用户账号
			domain=user.getDomain();//用户所属域名
			customerlist=customerservice.findCustomersByIndustries(user.getUser_id(),caigou);
		} catch (Exception e) {
			e.printStackTrace();
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return "customers";
	}
	
	/**获取私海客户数量*/
	public String getMyCustomerCounts()
	{
		try {
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();
			YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
			loginid=user.getLogin_id();//用户账号
			domain=user.getDomain();//用户所属域名
			result=customerservice.getMyCustomerCounts(user.getUser_id());
		} catch (Exception e) {
			result=0;
			e.printStackTrace();
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return SUCCESS;
	}
	
	/**获取公海客户数量*/
	public String getPubilcCustomerCounts()
	{
		try {
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();
			YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
			loginid=user.getLogin_id();//用户账号
			domain=user.getDomain();//用户所属域名
			result=customerservice.getPubilcCustomerCounts(user.getCompany_id());
		} catch (Exception e) {
			result=0;
			e.printStackTrace();
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return SUCCESS;
	}
	
	private YxyCustomerService customerservice;//客户service
	private List<YxyCustomerType> classifylist;//客户分类集合
	private List<CrmStatus> statuslist;//客户状态集合
	private List<CrmSourcefrom> fromlist;//客户来源集合
	private List<CrmProduct> productlist;//产品分类集合
	private List<CrmProcess> processlist;//销售进程集合
	private List<YxyCustomerEmail> customerlist;//客户集合
	private List<CrmCustomerIndustries> industries;//采购偏好集合
	private int iscounts;//是否统计数量,0不统计,1统计
	private int classifyid;//分类id
	private int statusid;//状态id
	private int fromid;//来源id
	private int productid;//产品分类id
	private int processid;//进程id
	private int public_id;//1:7天内未联系客户入公海库,2:7天内未成交客户入公海库,3:7天内成交未联系入公海库
	private int currpage=1;//当前页
	private int pagesize=10;//每页显示量 
	private PageBean pagebean=new PageBean();
	private String loginid="erro";
	private String domain="erro";
	private int condition;//查询条件
	private String conditionValue;//查询条件值
	private String highSearchValue;//个性营销的查询条件值
	private int result;
	private String caigou;//采购偏好名称
	public int getIscounts() {
		return iscounts;
	}
	public void setIscounts(int iscounts) {
		this.iscounts = iscounts;
	}
	public YxyCustomerService getCustomerservice() {
		return customerservice;
	}
	public void setCustomerservice(YxyCustomerService customerservice) {
		this.customerservice = customerservice;
	}
	public List<YxyCustomerType> getClassifylist() {
		return classifylist;
	}
	public void setClassifylist(List<YxyCustomerType> classifylist) {
		this.classifylist = classifylist;
	}
	public List<YxyCustomerEmail> getCustomerlist() {
		return customerlist;
	}
	public void setCustomerlist(List<YxyCustomerEmail> customerlist) {
		this.customerlist = customerlist;
	}
	public int getClassifyid() {
		return classifyid;
	}
	public void setClassifyid(int classifyid) {
		this.classifyid = classifyid;
	}
	public int getCurrpage() {
		return currpage;
	}
	public void setCurrpage(int currpage) {
		this.currpage = currpage;
	}
	public int getPagesize() {
		return pagesize;
	}
	public void setPagesize(int pagesize) {
		this.pagesize = pagesize;
	}
	public PageBean getPagebean() {
		return pagebean;
	}
	public void setPagebean(PageBean pagebean) {
		this.pagebean = pagebean;
	}
	public String getLoginid() {
		return loginid;
	}
	public void setLoginid(String loginid) {
		this.loginid = loginid;
	}
	public String getDomain() {
		return domain;
	}
	public void setDomain(String domain) {
		this.domain = domain;
	}
	public List<CrmStatus> getStatuslist() {
		return statuslist;
	}
	public void setStatuslist(List<CrmStatus> statuslist) {
		this.statuslist = statuslist;
	}
	public List<CrmSourcefrom> getFromlist() {
		return fromlist;
	}
	public void setFromlist(List<CrmSourcefrom> fromlist) {
		this.fromlist = fromlist;
	}
	public List<CrmProduct> getProductlist() {
		return productlist;
	}
	public void setProductlist(List<CrmProduct> productlist) {
		this.productlist = productlist;
	}
	public List<CrmProcess> getProcesslist() {
		return processlist;
	}
	public void setProcesslist(List<CrmProcess> processlist) {
		this.processlist = processlist;
	}
	public int getStatusid() {
		return statusid;
	}
	public void setStatusid(int statusid) {
		this.statusid = statusid;
	}
	public int getFromid() {
		return fromid;
	}
	public void setFromid(int fromid) {
		this.fromid = fromid;
	}
	public int getProductid() {
		return productid;
	}
	public void setProductid(int productid) {
		this.productid = productid;
	}
	public int getProcessid() {
		return processid;
	}
	public void setProcessid(int processid) {
		this.processid = processid;
	}
	public int getPublic_id() {
		return public_id;
	}
	public void setPublic_id(int public_id) {
		this.public_id = public_id;
	}
	public List<CrmCustomerIndustries> getIndustries() {
		return industries;
	}
	public void setIndustries(List<CrmCustomerIndustries> industries) {
		this.industries = industries;
	}
	public int getCondition() {
		return condition;
	}
	public void setCondition(int condition) {
		this.condition = condition;
	}
	public String getConditionValue() {
		return conditionValue;
	}
	public void setConditionValue(String conditionValue) {
		this.conditionValue = conditionValue;
	}
	public String getHighSearchValue() {
		return highSearchValue;
	}
	public void setHighSearchValue(String highSearchValue) {
		this.highSearchValue = highSearchValue;
	}
	public int getResult() {
		return result;
	}
	public void setResult(int result) {
		this.result = result;
	}
	public String getCaigou() {
		return caigou;
	}
	public void setCaigou(String caigou) {
		this.caigou = caigou;
	}
}