From 3bff0e783f5933e823be2e774f5422ae18a696e6 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Fri, 8 Jun 2018 13:21:35 +0800 Subject: [PATCH] update --- .../impls/SimpleClientApplyServiceImpl.java | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java index abdc2fa9d..51068c008 100644 --- a/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java @@ -2,6 +2,7 @@ package au.com.royalpay.payment.manage.application.core.impls; import au.com.royalpay.payment.channels.wechat.config.WeChatPayConfig; import au.com.royalpay.payment.channels.wechat.runtime.MpPaymentApi; +import au.com.royalpay.payment.core.exceptions.EmailException; import au.com.royalpay.payment.manage.application.core.SimpleClientApplyService; import au.com.royalpay.payment.manage.mappers.preapply.SysClientPreMapperMapper; import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper; @@ -11,6 +12,7 @@ import au.com.royalpay.payment.manage.mappers.system.ClientMapper; import au.com.royalpay.payment.manage.mappers.system.ClientRateMapper; import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean; import au.com.royalpay.payment.manage.merchants.core.ClientManager; +import au.com.royalpay.payment.manage.notice.core.MailService; import au.com.royalpay.payment.manage.signin.beans.LoginInfo; import au.com.royalpay.payment.manage.signin.core.SignInAccountService; import au.com.royalpay.payment.manage.system.core.MailGunService; @@ -20,7 +22,6 @@ import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.exceptions.ServerErrorException; import au.com.royalpay.payment.tools.locale.LocaleSupport; -import au.com.royalpay.payment.tools.mail.SendMail; import au.com.royalpay.payment.tools.utils.PasswordUtils; import com.alibaba.fastjson.JSONObject; @@ -43,10 +44,8 @@ import java.io.IOException; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Date; -import java.util.HashSet; import java.util.List; import java.util.Random; -import java.util.Set; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; @@ -71,6 +70,8 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { @Resource private MailGunService mailGunService; @Resource + private MailService mailService; + @Resource private SpringTemplateEngine thymeleaf; @Resource private ClientManager clientManager; @@ -162,15 +163,22 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { Context ctx = new Context(); ctx.setVariable("url", PlatformEnvironment.getEnv().concatUrl("/register/account/mail/" + address + "/verify/" + key + "/jump?username=" + username)); final String content = thymeleaf.process("mail/register_application", ctx); - SendMail sendMail = new SendMail(); - Set to = new HashSet<>(); - to.add(address); - sendMail.setMailTos(to); - sendMail.setFrom("info@mail.royalpay.com.au"); - sendMail.setTitle("Royalpay"); - sendMail.setContent(content); - sendMail.setTags(tags); - mailGunService.sendMail(sendMail); +// SendMail sendMail = new SendMail(); +// Set to = new HashSet<>(); +// to.add(address); +// sendMail.setMailTos(to); +// sendMail.setFrom("info@mail.royalpay.com.au"); +// sendMail.setTitle("Royalpay"); +// sendMail.setContent(content); +// sendMail.setTags(tags); +// mailGunService.sendMail(sendMail); + + try { + String emailId = mailService.sendEmail("Your RoyalPay Cross-border Payment has been set up", address, + "", content); + } catch (Exception e) { + throw new EmailException("Email Sending Failed", e); + } }