From 27996f9136eeabc1fc1b43b22030ef924a5daf62 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Tue, 12 Jun 2018 12:01:51 +0800 Subject: [PATCH] send notify filter address --- .../mappers/system/MailUnsubMapper.java | 6 ++++++ .../manage/notice/core/MailService.java | 2 +- .../notice/core/impls/MailServiceImp.java | 7 +++++-- .../notice/core/impls/NoticeManageImpl.java | 2 +- .../manage/mappers/system/MailUnsubMapper.xml | 19 +++++++++++++++++++ 5 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/MailUnsubMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/MailUnsubMapper.java index 971ed5e02..7a512f7c5 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/MailUnsubMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/MailUnsubMapper.java @@ -1,5 +1,7 @@ package au.com.royalpay.payment.manage.mappers.system; +import java.util.List; + import org.apache.ibatis.annotations.Param; import com.alibaba.fastjson.JSONObject; @@ -26,4 +28,8 @@ public interface MailUnsubMapper { JSONObject getOne(@Param("id") Long id,@Param("address") String address); PageList queryPageable(JSONObject params, PageBounds pagination); + + List query(JSONObject params); + + List getAllAddress(); } diff --git a/src/main/java/au/com/royalpay/payment/manage/notice/core/MailService.java b/src/main/java/au/com/royalpay/payment/manage/notice/core/MailService.java index b3a9acb51..3044b09fc 100644 --- a/src/main/java/au/com/royalpay/payment/manage/notice/core/MailService.java +++ b/src/main/java/au/com/royalpay/payment/manage/notice/core/MailService.java @@ -11,7 +11,7 @@ import java.util.List; */ public interface MailService { - String sendEmail(String notice_id, String title, List mailTo, String content) throws URISyntaxException, IOException; + String sendEmailNotice(String notice_id, String title, List mailTo, String content) throws URISyntaxException, IOException; String sendEmail(String title, String mailTos, String mailCcs, String content) throws URISyntaxException, IOException; diff --git a/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java index 1a817fc43..966e38130 100644 --- a/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/MailServiceImp.java @@ -75,8 +75,11 @@ public class MailServiceImp implements MailService { @Override - public String sendEmail(String notice_id, String title, List mailTo, String content) throws URISyntaxException, IOException { - + public String sendEmailNotice(String notice_id, String title, List mailTo, String content) throws URISyntaxException, IOException { + List unsubAddress = mailUnsubMapper.getAllAddress(); + unsubAddress.parallelStream().forEach(p->{ + mailTo.remove(p); + }); Document doc = Jsoup.parse(content); Elements links = doc.select("a[href]"); List files = new ArrayList(); diff --git a/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/NoticeManageImpl.java b/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/NoticeManageImpl.java index 40db237ee..866ed4db9 100644 --- a/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/NoticeManageImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/notice/core/impls/NoticeManageImpl.java @@ -192,7 +192,7 @@ public class NoticeManageImpl implements NoticeManage { try { logger.info(noticeId+"|"+info.getTitle()+"|"+mailto); - String mail_id = mailService.sendEmail(noticeId,info.getTitle(),mailto,info.getContent()); + String mail_id = mailService.sendEmailNotice(noticeId,info.getTitle(),mailto,info.getContent()); notice.put("mail_id",mail_id); noticeManageMapper.updateNotice(notice); } catch (URISyntaxException | IOException e) { diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/MailUnsubMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/MailUnsubMapper.xml index bf6144c17..0e0f6daff 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/MailUnsubMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/MailUnsubMapper.xml @@ -27,4 +27,23 @@ + + + + \ No newline at end of file