95a15115d121337bd0f45de4057d9d471c7d51af.svn-base 27.7 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 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930
package com.espeed.action;
   
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;

import com.espeed.centre.pojo.YxyUserInfo;
import com.espeed.log.LogClass;
import com.espeed.pojo.YxyCompanyWebInfo;
import com.espeed.pojo.YxyParamValue;
import com.espeed.pojo.YxySysParamatersValue;
import com.espeed.service.YxyCustomerService;
import com.espeed.service.YxySysParamaterService;
import com.espeed.service.YxyUserInfoService;
import com.espeed.tool.ConfigPath;
import com.espeed.tool.DateFormat;
import com.espeed.tool.Md5Code;
import com.espeed.vo.PageBean;
import com.espeed.webmail.pojo.XLicenceFun;
import com.espeed.webmail.pojo.XMailAccount;
import com.espeed.webmail.pojo.YxyCustomerEmail;
import com.opensymphony.xwork2.ActionContext;
 
/***
 *用户信息action
 */
public class YxyUserInfoAction extends BaseAction{
	private static final long serialVersionUID = 1L;

	/**验证用户信息(只验证)*/
	public String verificationLogin(){
		try {	
			//查询用户信息
			List<YxyUserInfo> resultInfo=yxyuserinfoservice.findVerificationUser(loginid,domain);
			if(resultInfo.size()>0){				
				result=1;
			}else{
				result=0;
			}
		} catch (Exception e) {
			result=0;
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return SUCCESS;
	}
	
	/**查询用户控制信息*/
	public String findUserParamater(){
		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();//用户所属域名
			//查询控制参数(用户级)
			usergraph=yxysysparamaterservice.findParamaterByLevel(4, loginid,domain);
			//查询控制参数(企业级)
			domaingraph=yxysysparamaterservice.findParamaterByLevel(1, loginid,domain);	
			
			//保存该session后续用到
			sess.put("usergraph", usergraph);
			sess.put("domaingraph",domaingraph);
			
			//更新该用户登录时间
			SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			String nowDate=df.format(new Date());
			yxyuserinfoservice.updateUserLoginDate(nowDate,loginid,domain);
		} catch (Exception e) {
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return "param";
	}
	
	/**域条件查询用户*/
	public String findDomainUser(){
		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(pagesize);
			userlist=yxyuserinfoservice.findDomainUser(user,pagebean);
		} catch (Exception e) {
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return "list";
	}
	
	/**查找该域所有用户不分页*/
	public String findDomainAllUser(){
		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();//用户所属域名
			//userlist=yxyuserinfoservice.findDomainUser(domain);
			userlist=yxyuserinfoservice.findDomainUser(user);
		} catch (Exception e) {
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return "list";
	}
	
	/**判断该用户的角色*/
	public String findUserRole(){
		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();//用户所属域名
			userrole=user.getUser_role();//用户角色
		} catch (Exception e) {
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return "pojo";
	}
	
	/**webmail邮件群发*/
	public String WebmailSend(){
		try {
			response.setHeader("Access-Control-Allow-Origin", "*");
			System.out.println("客户管理邮件营销进来了!");
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();			
//			YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
//			if(user!=null){//已经登录
//				loginid=user.getLogin_id();//用户账号
//				domain=user.getDomain();//用户所属域名
//				//获取客户地址
//				List<Object> alllist=customerservice.findEmailByid(customerid);
//				if(alllist!=null){
//					for(int i=0;i<alllist.size();i++){
//						customeremaillist+=alllist.get(i).toString()+";";
//					}	
//				}
//				iscrmsend=1;
//				return SUCCESS;
//			}else{//未登录
				Claims claims = Jwts.parser().setSigningKey(secretKey).parseClaimsJws(token).getBody();
				if(null == claims.getId() || !claims.getId().trim().equals(tokenId)){
					return "erro";
				}
				if(null == claims.getSubject() || !claims.getSubject().trim().equals(tokenSubject)){
					return "erro";
				}
				loginid = claims.get("loginid", String.class);
				domain = claims.get("domain", String.class);
				//判断用户是否存在
				List<YxyUserInfo> userlist=yxyuserinfoservice.findVerificationUser(loginid, domain);
				if(userlist.size()>0){
					userlist.get(0).setDomain(domain);
		            sess.put("yxyuser", userlist.get(0));
		            //获取客户地址
					List<YxyCustomerEmail> alllist=customerservice.findEmailByCusid(customerid);
					for(int i=0;i<alllist.size();i++){
						customeremaillist+=alllist.get(i).getEmail()+";";
					}	
		            iscrmsend=1;
					return SUCCESS;
				}else{
					return "erro";
				}
//			}
		} catch (Exception e) {
			System.out.println("客户管理邮件营销出错了!");
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
	        return "erro";
		}
	}

	/**获取用户信息*/
	public String getUserInfo()
	{
		try {	
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();			
			user=(YxyUserInfo) sess.get("yxyuser");
			loginid=user.getLogin_id();//用户账号
			domain=user.getDomain();//用户所属域名
			//获取企业授权信息
			String hql = "from XLicenceFun where domain = '"+domain+"' and function_code = 'customer_manager'";
			List<XLicenceFun> funs = yxyuserinfoservice.getCompanyLicences(hql);
			if(funs.size() > 0){//开通了客户管理
				user.setUser_type(0);//易外销用户
				hql = "from XMailAccount where user_id = "+user.getUser_id()+" and is_default = 0";
				List<XMailAccount> accounts = yxyuserinfoservice.findUserAccountByHql(hql);
				if(accounts.size() > 0){
					user.setMain_account(accounts.get(0).getMail_account());//主邮箱
				}
			}else{//未开通客户管理
				user.setUser_type(1);//营销邮用户
			}
		} catch (Exception e) {
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return "user";
	}
	
	/**个人版登录验证*/
	public String yxyLogin()
	{
		try {	
			if(null!=account&&null!=password)
			{
				account=account.toLowerCase();
				if(password.length()!=32){
					password=Md5Code.createMd5(password);
				}
				if(account.split("@").length==2){
					String loginid2 = account.split("@")[0];
					String domain2 = account.split("@")[1];
					//if(domain2.equals("waimaoyou.cn")){
						result = yxyuserinfoservice.findLoginInfo(loginid2,domain2,password);
						if(result==1){//登录成功
							List<YxyUserInfo> userlist=yxyuserinfoservice.findVerificationUser(loginid2,domain2);
							YxyUserInfo userinfo = userlist.get(0);
							userinfo.setDomain(domain2);
							if(null!=userinfo.getService_end_date()&&!"".equals(userinfo.getService_end_date()))
							{
								String nowdate = DateFormat.getNowDate().split(" ")[0];//当前日期
								int diff_day = DateFormat.nDaysBetweenTwoDate(nowdate,userinfo.getService_end_date());
								if(diff_day<0){
									result=-6;//服务时间已失效
									return SUCCESS;
								}
							}
							if(userinfo.getDelete_flag()==1){
								result=-7;//已删除
								return SUCCESS;
							}
							if(userinfo.getStatus()==2){
								result=-8;//已锁定
								return SUCCESS;
							}
							//保存session
							ActionContext ac = ActionContext.getContext();
				            Map<String, Object> sess = ac.getSession();
				            sess.put("yxyuser", userinfo);
						}
					//}else{//域名不是waimaoyou.cn
					//	result=-3;
					//}
				}else{//帐号格式不正确
					result=-2;
				}
			}
			else
			{
				result=-1;//帐号或密码没填写
			}
		} catch (Exception e) {
			result=0;
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return SUCCESS;
	}
	
	/**个人版退出*/
	public String userlogout()
	{
		try {
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();
			sess.remove("yxyuser");
		} catch (Exception e) {
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return SUCCESS;
	}
	
	/**添加用户*/
	public String addUser(){
		try {	
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();			
			YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
			domain=user.getDomain();//用户所属域名
			JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
			
			String webmailurl = ConfigPath.getWebmailInterfaceUrl();
			
			//获取访问webmail路径,若有参数表没有则取配置文件中的
			List<YxySysParamatersValue> values = yxysysparamaterservice.findCompanyParam(domain, 43);
			
			if(values.size()>0)
			{
				String hql = "from YxyCompanyWebInfo where yxy_web_classify = 2 and yxy_web_tag = '"+values.get(0).getPara_value()+"'";
				
				List<YxyCompanyWebInfo> infos = yxyuserinfoservice.findWebmailInfo(hql);
				
				if(infos.size() > 0)
				{
					webmailurl = infos.get(0).getYxy_web_url();//webmail访问路径
				}
			}
			
			String url = webmailurl + "/webmailWebservice/yxyupdateuserwebservice?wsdl";
			
			Client client = dcf.createClient(url);
			
			Object[] response = client.invoke("addUser",loginid,domain,password,new_tol_num,new_month_num,new_day_num);
			
			if(response[0].toString().indexOf("###")>0)//说明添加用户成功
			{
				int dept_id = Integer.parseInt(response[0].toString().split("###")[0]);
				
				int p_dept_id = Integer.parseInt(response[0].toString().split("###")[1]);
				
				//添加本地用户信息
				yxyuserinfoservice.updateOpenYxy(loginid, domain, loginid, 3, dept_id, p_dept_id, 
						new_tol_num, new_month_num, new_day_num);
				
				result = 1;
			}
			else//说明添加用户失败
			{
				result = Integer.parseInt(response[0].toString());
			}
		} catch (Exception e) {
			result=0;
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return SUCCESS;
	}
	
	/**编辑用户*/
	public String updateUser(){
		try {	
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();			
			YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
			domain=user.getDomain();//用户所属域名
			JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
			
			String webmailurl = ConfigPath.getWebmailInterfaceUrl();
			
			String url = webmailurl + "/webmailWebservice/yxyupdateuserwebservice?wsdl";
			
			//获取访问webmail路径,若有参数表没有则取配置文件中的
			List<YxySysParamatersValue> values = yxysysparamaterservice.findCompanyParam(domain, 43);
			
			if(values.size()>0)
			{
				String hql = "from YxyCompanyWebInfo where yxy_web_classify = 2 and yxy_web_tag = '"+values.get(0).getPara_value()+"'";
				
				List<YxyCompanyWebInfo> infos = yxyuserinfoservice.findWebmailInfo(hql);
				
				if(infos.size() > 0)
				{
					webmailurl = infos.get(0).getYxy_web_url();//webmail访问路径
				}
			}
			
			Client client = dcf.createClient(url);
			
			Object[] response = client.invoke("updateUser",loginid,domain,new_tol_num,new_month_num,
					new_day_num,old_tol_num,old_month_num,old_day_num);
			
			result = Integer.parseInt(response[0].toString());
			
			if(result==1)//编辑成功
			{
				String valuestr = "1,"+new_day_num+"#2,"+new_month_num+"#3,"+new_tol_num;
				
				yxysysparamaterservice.updateParamaters(loginid, domain, valuestr);
			}
		} catch (Exception e) {
			result=0;
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return SUCCESS;
	}
	
	/**更改用户删除标识*/
	public String updateUserStatus(){
		try {	
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();			
			YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
			yxyuserinfoservice.updateUserStatus(loginid, user.getCompany_id(), delete_flag);
			result=1;
		} catch (Exception e) {
			result=0;
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,user.getLogin_id()+"@"+user.getDomain());
		}
		return SUCCESS;
	}
	
	/**添加用户时查询控制参数信息*/
	public String checkParamValue(){
		try {	
			//获取用户session
			ActionContext ac = ActionContext.getContext();
			Map<String,Object> sess = ac.getSession();			
			YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
			domain=user.getDomain();//用户所属域名
			JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
			
			String webmailurl = ConfigPath.getWebmailInterfaceUrl();
			
			//获取访问webmail路径,若有参数表没有则取配置文件中的
			List<YxySysParamatersValue> values = yxysysparamaterservice.findCompanyParam(domain, 43);
			
			if(values.size()>0)
			{
				String hql = "from YxyCompanyWebInfo where yxy_web_classify = 2 and yxy_web_tag = '"+values.get(0).getPara_value()+"'";
				
				List<YxyCompanyWebInfo> infos = yxyuserinfoservice.findWebmailInfo(hql);
				
				if(infos.size() > 0)
				{
					webmailurl = infos.get(0).getYxy_web_url();//webmail访问路径
				}
			}
			
			String url = webmailurl + "/webmailWebservice/yxyupdateuserwebservice?wsdl";
			
			Client client = dcf.createClient(url);
			
			Object[] response = client.invoke("findYxyParam",loginid,domain,check_tag);
			
			if(response.length > 0)//调用接口成功
			{
				String[] res_result = response[0].toString().split("#");
				
				value = new YxyParamValue();
				value.setLoginid(loginid);
				value.setDomain(domain);
				value.setMax_user(Integer.parseInt(res_result[0]));
				value.setMax_day_send(Integer.parseInt(res_result[3]));
				value.setMax_month_send(Integer.parseInt(res_result[2]));
				value.setMax_tol_send(Integer.parseInt(res_result[1]));
				//查询当前用户的信息
				if(check_tag==1)//编辑时才查询
				{
					//日发量
					YxySysParamatersValue day_value = yxysysparamaterservice.findUserParam(loginid, domain, 1);
					if(day_value!=null)
					{
						value.setDay_send(Integer.parseInt(day_value.getPara_value()));
					}
					else
					{
						value.setDay_send(0);
					}
					//月发量
					YxySysParamatersValue month_value = yxysysparamaterservice.findUserParam(loginid, domain, 2);
					if(month_value!=null)
					{
						value.setMonth_send(Integer.parseInt(month_value.getPara_value()));
					}
					else
					{
						value.setMonth_send(0);
					}
					//总发量
					YxySysParamatersValue tol_value = yxysysparamaterservice.findUserParam(loginid, domain, 34);
					if(tol_value!=null)
					{
						value.setTol_send(Integer.parseInt(tol_value.getPara_value()));
					}
					else
					{
						value.setTol_send(0);
					}
				}
			}
			else//调用接口失败
			{
				value = new YxyParamValue();
				value.setLoginid(loginid);
				value.setDomain(domain);
				value.setMax_user(0);
				if(check_tag == 0)//添加
				{
					value.setMax_day_send(0);
					value.setMax_month_send(0);
					value.setMax_tol_send(0);
				}
				else//编辑
				{
					//查询当前用户的信息
					//日发量
					YxySysParamatersValue day_value = yxysysparamaterservice.findUserParam(loginid, domain, 1);
					if(day_value!=null)
					{
						value.setMax_day_send(Integer.parseInt(day_value.getPara_value()));
						value.setDay_send(Integer.parseInt(day_value.getPara_value()));
					}
					else
					{
						value.setMax_day_send(0);
						value.setDay_send(0);
					}
					//月发量
					YxySysParamatersValue month_value = yxysysparamaterservice.findUserParam(loginid, domain, 2);
					if(month_value!=null)
					{
						value.setMax_month_send(Integer.parseInt(month_value.getPara_value()));
						value.setMonth_send(Integer.parseInt(month_value.getPara_value()));
					}
					else
					{
						value.setMax_month_send(0);
						value.setMonth_send(0);
					}
					//总发量
					YxySysParamatersValue tol_value = yxysysparamaterservice.findUserParam(loginid, domain, 34);
					if(tol_value!=null)
					{
						value.setMax_tol_send(Integer.parseInt(tol_value.getPara_value()));
						value.setTol_send(Integer.parseInt(tol_value.getPara_value()));
					}
					else
					{
						value.setMax_tol_send(0);
						value.setTol_send(0);
					}
				}
			}
		} catch (Exception e) {
			value = new YxyParamValue();
			value.setLoginid(loginid);
			value.setDomain(domain);
			value.setMax_user(0);
			if(check_tag == 0)//添加
			{
				value.setMax_day_send(0);
				value.setMax_month_send(0);
				value.setMax_tol_send(0);
			}
			else//编辑
			{
				//查询当前用户的信息
				//日发量
				try{
					YxySysParamatersValue day_value = yxysysparamaterservice.findUserParam(loginid, domain, 1);
					if(day_value!=null)
					{
						value.setMax_day_send(Integer.parseInt(day_value.getPara_value()));
						value.setDay_send(Integer.parseInt(day_value.getPara_value()));
					}
					else
					{
						value.setMax_day_send(0);
						value.setDay_send(0);
					}
				}catch (Exception e2) {
					value.setMax_day_send(0);
					value.setDay_send(0);
				}
				try {
					//月发量
					YxySysParamatersValue month_value = yxysysparamaterservice
							.findUserParam(loginid, domain, 2);
					if (month_value != null) {
						value.setMax_month_send(Integer.parseInt(month_value
								.getPara_value()));
						value.setMonth_send(Integer.parseInt(month_value.getPara_value()));
					} else {
						value.setMax_month_send(0);
						value.setMonth_send(0);
					}
				} catch (Exception e2) {
					value.setMax_month_send(0);
					value.setMonth_send(0);
				}
				try {
					//总发量
					YxySysParamatersValue tol_value = yxysysparamaterservice
							.findUserParam(loginid, domain, 34);
					if (tol_value != null) {
						value.setMax_tol_send(Integer.parseInt(tol_value
								.getPara_value()));
						value.setTol_send(Integer.parseInt(tol_value
								.getPara_value()));
					} else {
						value.setMax_tol_send(0);
						value.setTol_send(0);
					}
				} catch (Exception e2) {
					value.setMax_tol_send(0);
					value.setTol_send(0);
				}
			}
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,loginid+"@"+domain);
		}
		return "value";
	}
	
	/**修改用户密码*/
	public String updateUserPassword(){
		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();
			yxyuserinfoservice.updateUserPassword(up_userid,up_password);
			result=1;
		} catch (Exception e) {
			result=0;
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,user.getLogin_id()+"@"+user.getDomain());
		}
		return SUCCESS;
	}
	
	/**验证用户密码*/
	public String verifyUserPassword(){
		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=yxyuserinfoservice.verifyUserPassword(up_userid,up_password);
		} catch (Exception e) {
			result=0;
			StringWriter sw = new StringWriter();
			e.printStackTrace(new PrintWriter(sw, true));
	        String str = sw.toString();
	        LogClass.errolog(str,user.getLogin_id()+"@"+user.getDomain());
		}
		return SUCCESS;
	}
	
	private YxyUserInfoService yxyuserinfoservice;//用户信息service 
	private YxySysParamaterService yxysysparamaterservice;//控制参数serviec
	private YxyCustomerService customerservice;//客户service
	private int result;//返回结果
	private String loginid="erro";
	private String domain="erro";
	private String customerid;
	private int userrole;//用户角色
	private String ip;//服务IP
	private Map usergraph;//用户级
	private Map domaingraph;//域级
	private PageBean pagebean;
	private int currpage;
	private int pagesize=10;//每页显示量
	private int jinchengid;//进程id
	private int iscrmsend;//是否crm营销
	private String customeremaillist="";
	private String account;//登录帐号
	private String password;//登录密码
	private int new_tol_num;//总发量
	private int new_month_num;//月发量
	private int new_day_num;//日发量
	private int old_tol_num;//总发量(旧)
	private int old_month_num;//月发量(旧)
	private int old_day_num;//日发量(旧)
	private int delete_flag;//0正常,1删除
	private int check_tag;//0添加,1编辑
	private YxyParamValue value;
	private YxyUserInfo user;//用户实体
	private List<YxyUserInfo> userlist=new ArrayList<YxyUserInfo>();//用户信息
	private String secretKey=ConfigPath.getSecretKey();
	private String tokenId=ConfigPath.getTokenId();
	private String tokenSubject=ConfigPath.getTokenSubject();
	private int up_userid;//前端传递的用户id
	private String up_password;//密码
	private String token;//webmail跳转过来带的token
	public YxyUserInfoService getYxyuserinfoservice() {
		return yxyuserinfoservice;
	}
	public void setYxyuserinfoservice(YxyUserInfoService yxyuserinfoservice) {
		this.yxyuserinfoservice = yxyuserinfoservice;
	}
	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 int getResult() {
		return result;
	}
	public void setResult(int result) {
		this.result = result;
	}
	public String getIp() {
		return ip;
	}
	public void setIp(String ip) {
		this.ip = ip;
	}
	public YxySysParamaterService getYxysysparamaterservice() {
		return yxysysparamaterservice;
	}
	public void setYxysysparamaterservice(
			YxySysParamaterService yxysysparamaterservice) {
		this.yxysysparamaterservice = yxysysparamaterservice;
	}
	public Map getUsergraph() {
		return usergraph;
	}
	public void setUsergraph(Map usergraph) {
		this.usergraph = usergraph;
	}
	public Map getDomaingraph() {
		return domaingraph;
	}
	public void setDomaingraph(Map domaingraph) {
		this.domaingraph = domaingraph;
	}
	public PageBean getPagebean() {
		return pagebean;
	}
	public void setPagebean(PageBean pagebean) {
		this.pagebean = pagebean;
	}
	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 List<YxyUserInfo> getUserlist() {
		return userlist;
	}
	public void setUserlist(List<YxyUserInfo> userlist) {
		this.userlist = userlist;
	}
	public int getUserrole() {
		return userrole;
	}
	public void setUserrole(int userrole) {
		this.userrole = userrole;
	}
	public String getCustomerid() {
		return customerid;
	}
	public void setCustomerid(String customerid) {
		this.customerid = customerid;
	}
	public int getJinchengid() {
		return jinchengid;
	}
	public void setJinchengid(int jinchengid) {
		this.jinchengid = jinchengid;
	}
	public YxyCustomerService getCustomerservice() {
		return customerservice;
	}
	public void setCustomerservice(YxyCustomerService customerservice) {
		this.customerservice = customerservice;
	}
	public int getIscrmsend() {
		return iscrmsend;
	}
	public void setIscrmsend(int iscrmsend) {
		this.iscrmsend = iscrmsend;
	}
	public String getCustomeremaillist() {
		return customeremaillist;
	}
	public void setCustomeremaillist(String customeremaillist) {
		this.customeremaillist = customeremaillist;
	}
	public String getAccount() {
		return account;
	}
	public void setAccount(String account) {
		this.account = account;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public int getNew_tol_num() {
		return new_tol_num;
	}
	public void setNew_tol_num(int new_tol_num) {
		this.new_tol_num = new_tol_num;
	}
	public int getNew_month_num() {
		return new_month_num;
	}
	public void setNew_month_num(int new_month_num) {
		this.new_month_num = new_month_num;
	}
	public int getNew_day_num() {
		return new_day_num;
	}
	public void setNew_day_num(int new_day_num) {
		this.new_day_num = new_day_num;
	}
	public int getOld_tol_num() {
		return old_tol_num;
	}
	public void setOld_tol_num(int old_tol_num) {
		this.old_tol_num = old_tol_num;
	}
	public int getOld_month_num() {
		return old_month_num;
	}
	public void setOld_month_num(int old_month_num) {
		this.old_month_num = old_month_num;
	}
	public int getOld_day_num() {
		return old_day_num;
	}
	public void setOld_day_num(int old_day_num) {
		this.old_day_num = old_day_num;
	}
	public int getDelete_flag() {
		return delete_flag;
	}
	public void setDelete_flag(int delete_flag) {
		this.delete_flag = delete_flag;
	}
	public int getCheck_tag() {
		return check_tag;
	}
	public void setCheck_tag(int check_tag) {
		this.check_tag = check_tag;
	}
	public YxyParamValue getValue() {
		return value;
	}
	public void setValue(YxyParamValue value) {
		this.value = value;
	}
	public YxyUserInfo getUser() {
		return user;
	}
	public void setUser(YxyUserInfo user) {
		this.user = user;
	}
	public int getUp_userid() {
		return up_userid;
	}
	public void setUp_userid(int up_userid) {
		this.up_userid = up_userid;
	}
	public String getUp_password() {
		return up_password;
	}
	public void setUp_password(String up_password) {
		this.up_password = up_password;
	}
	public String getToken() {
		return token;
	}
	public void setToken(String token) {
		this.token = token;
	}
}