master
wangning 7 years ago
parent 0933303468
commit 793f920e2b

@ -77,7 +77,12 @@ public class MailServiceImp implements MailService {
@Override @Override
public String sendEmailNotice(String notice_id, String title, List<JSONObject> mailTo, String content) throws URISyntaxException, IOException { public String sendEmailNotice(String notice_id, String title, List<JSONObject> mailTo, String content) throws URISyntaxException, IOException {
List<String> unsubAddress = mailUnsubMapper.getAllAddress(); List<String> unsubAddress = mailUnsubMapper.getAllAddress();
mailTo.removeAll(unsubAddress); List<JSONObject> mailToWithoutUnsub = new ArrayList<>();
mailTo.parallelStream().forEach(p->{
if(!unsubAddress.contains(p.getString("mailto"))){
mailToWithoutUnsub.add(p);
}
});
Document doc = Jsoup.parse(content); Document doc = Jsoup.parse(content);
Elements links = doc.select("a[href]"); Elements links = doc.select("a[href]");
List<JSONObject> files = new ArrayList<JSONObject>(); List<JSONObject> files = new ArrayList<JSONObject>();
@ -104,7 +109,7 @@ public class MailServiceImp implements MailService {
NoticeBean noticeBean = new NoticeBean(); NoticeBean noticeBean = new NoticeBean();
noticeBean.setTitle(title); noticeBean.setTitle(title);
noticeBean.setNotice_id(notice_id); noticeBean.setNotice_id(notice_id);
noticeBean.setMailClients(mailTo); noticeBean.setMailClients(mailToWithoutUnsub);
noticeBean.setContent(doc.outerHtml()); noticeBean.setContent(doc.outerHtml());
if (files.size() > 0) { if (files.size() > 0) {
noticeBean.setFiles(files.toString()); noticeBean.setFiles(files.toString());

Loading…
Cancel
Save