Browse Source

--add orgMailService config;

zzy.zhiyuan.foxmail 8 years ago
parent
commit
8e5e8195d5
1 changed files with 42 additions and 5 deletions
  1. 42 5
      src/main/java/com/ekexiu/portal/service/SysService.java

+ 42 - 5
src/main/java/com/ekexiu/portal/service/SysService.java

@ -66,6 +66,11 @@ public class SysService {
66 66
	private String regMailReplaceKey;
67 67
	private String regMailReplaceContentTempalte;
68 68
	private long timeLimitWithRegMail = 10 * 60 * 1000;
69
	
70
	private String orgRegMailSubject = "注册[科袖网]企业用户";
71
	private String orgRegMailReplaceKey;
72
	private String orgRegMailReplaceContentTempalte;
73
	private long timeLimitWithOrgRegMail = 10 * 60 * 1000;
69 74
70 75
	private String bindMobilePhoneReplaceKey;
71 76
	private String bindMobilePhoneContentTemplate;
@ -364,6 +369,38 @@ public class SysService {
364 369
		this.regMailSubject = regMailSubject;
365 370
	}
366 371
372
	public String getOrgRegMailSubject() {
373
		return orgRegMailSubject;
374
	}
375
376
	public void setOrgRegMailSubject(String orgRegMailSubject) {
377
		this.orgRegMailSubject = orgRegMailSubject;
378
	}
379
380
	public String getOrgRegMailReplaceKey() {
381
		return orgRegMailReplaceKey;
382
	}
383
384
	public void setOrgRegMailReplaceKey(String orgRegMailReplaceKey) {
385
		this.orgRegMailReplaceKey = orgRegMailReplaceKey;
386
	}
387
388
	public String getOrgRegMailReplaceContentTempalte() {
389
		return orgRegMailReplaceContentTempalte;
390
	}
391
392
	public void setOrgRegMailReplaceContentTempalte(String orgRegMailReplaceContentTempalte) {
393
		this.orgRegMailReplaceContentTempalte = orgRegMailReplaceContentTempalte;
394
	}
395
396
	public long getTimeLimitWithOrgRegMail() {
397
		return timeLimitWithOrgRegMail;
398
	}
399
400
	public void setTimeLimitWithOrgRegMail(long timeLimitWithOrgRegMail) {
401
		this.timeLimitWithOrgRegMail = timeLimitWithOrgRegMail;
402
	}
403
367 404
	/**
368 405
	 * 验证注册时填写的手机号和邮箱是否已经注册过
369 406
	 * 
@ -582,7 +619,7 @@ public class SysService {
582 619
			user.setUserType("1");
583 620
			user.setActiveTime(DATE.format(new Date()));
584 621
			this.userDao.insert(con, user);
585
			this.orgDao.updateJoin(con, user.getId(), "1");
622
			this.orgDao.updateIsJoin(con, user.getId(), "1");
586 623
			con.commit();
587 624
		} catch (SQLException e) {
588 625
			try {
@ -618,9 +655,9 @@ public class SysService {
618 655
			StateCode<String, String> sc = new StateCode<String, String>();
619 656
			final String key = JfwAppContext.cacheObjectAndGenKey(sc);
620 657
			Map<String, String> map = new HashMap<>();
621
			map.put(this.regMailReplaceKey, key);
658
			map.put(this.orgRegMailReplaceKey, key);
622 659
			try {
623
				this.mailservice.sendSimpleMail(mail, this.regMailReplaceContentTempalte, map, this.regMailSubject);
660
				this.mailservice.sendSimpleMail(mail, this.orgRegMailReplaceContentTempalte, map, this.orgRegMailSubject);
624 661
			} catch (MessagingException e) {
625 662
				JfwAppContext.removeCachedObject(key);
626 663
				throw new JfwBaseException(-2, "给邮箱[" + mail + "]发邮件错误", e);
@ -629,13 +666,13 @@ public class SysService {
629 666
			sc.setKey(password);
630 667
			sc.setValue(orgName);
631 668
			sc.setBuildTime(System.currentTimeMillis());
632
			sc.setExpiredTime(sc.getBuildTime() + this.timeLimitWithRegMail);
669
			sc.setExpiredTime(sc.getBuildTime() + this.timeLimitWithOrgRegMail);
633 670
			JfwAppContext.getScheduledExecutorService().schedule(new Runnable() {
634 671
				@Override
635 672
				public void run() {
636 673
					JfwAppContext.removeCachedObject(key);
637 674
				}
638
			}, this.timeLimitWithRegMail, TimeUnit.MILLISECONDS);
675
			}, this.timeLimitWithOrgRegMail, TimeUnit.MILLISECONDS);
639 676
		}
640 677
	}
641 678