deps: 移除hsweb框架依赖

This commit is contained in:
椰子 2021-07-02 20:24:23 +08:00
parent 2c880a5f05
commit 8340b9bd34
2 changed files with 7 additions and 20 deletions

View File

@ -42,11 +42,7 @@
<artifactId>spring-web</artifactId> <artifactId>spring-web</artifactId>
<version>5.2.10.RELEASE</version> <version>5.2.10.RELEASE</version>
</dependency> </dependency>
<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-core</artifactId>
<version>4.0.11-SNAPSHOT</version>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId> <artifactId>spring-boot</artifactId>

View File

@ -6,11 +6,6 @@ import com.cicdi.notify.template.TemplateManager;
import com.simaek.notify.email.EmailProvider; import com.simaek.notify.email.EmailProvider;
import com.simaek.notify.email.EmailTemplate; import com.simaek.notify.email.EmailTemplate;
import com.simaek.notify.email.EmailTemplateParsed; import com.simaek.notify.email.EmailTemplateParsed;
import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.MimeUtility;
import org.hswebframework.web.exception.BusinessException;
import org.hswebframework.web.id.IDGenerator;
import org.hswebframework.web.utils.ExpressionUtils;
import org.hswebframework.web.validator.ValidatorUtils;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Document; import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;
@ -23,20 +18,15 @@ import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.reactive.function.client.WebClient; import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;
import javax.mail.MessagingException; import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeUtility;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
/** /**
* 使用javax.mail进行邮件发送 * 使用javax.mail进行邮件发送
@ -167,7 +157,7 @@ public class DefaultEmailNotifier extends AbstractNotifier<EmailTemplate> {
String subject = template.getSubject(); String subject = template.getSubject();
String text = template.getText(); String text = template.getText();
if (StringUtils.isEmpty(subject) || StringUtils.isEmpty(text)) { if (StringUtils.isEmpty(subject) || StringUtils.isEmpty(text)) {
throw new BusinessException("模板内容错误text 或者 subject 不能为空."); // throw new BusinessException("模板内容错误text 或者 subject 不能为空.");
} }
String sendText = render(text, context); String sendText = render(text, context);
List<EmailTemplate.Attachment> tempAttachments = template.getAttachments(); List<EmailTemplate.Attachment> tempAttachments = template.getAttachments();
@ -194,7 +184,7 @@ public class DefaultEmailNotifier extends AbstractNotifier<EmailTemplate> {
if (s.startsWith("http")) { if (s.startsWith("http")) {
continue; continue;
} }
String tempKey = IDGenerator.MD5.generate(); String tempKey = UUID.randomUUID().toString();
src.attr("src", "cid:".concat(tempKey)); src.attr("src", "cid:".concat(tempKey));
images.put(tempKey, s); images.put(tempKey, s);
} }
@ -202,7 +192,8 @@ public class DefaultEmailNotifier extends AbstractNotifier<EmailTemplate> {
} }
private String render(String str, Map<String, Object> context) { private String render(String str, Map<String, Object> context) {
return ExpressionUtils.analytical(str, context, "spel"); return str;
// return ExpressionUtils.analytical(str, context, "spel");
} }
} }