瀏覽代碼

fix: 公司邮箱发送历史增加邮箱查询

chenjianhua 6 月之前
父節點
當前提交
72d75f6936

+ 1 - 15
service-base/src/main/java/com/simuwang/base/common/util/EmailUtil.java

@@ -271,21 +271,7 @@ public class EmailUtil {
     public static void senEmail(MailboxInfoDTO mailboxInfoDTO, String emails, File file, JavaMailSender javaMailSender,String htmlText) throws Exception {
         logger.info("send email begin .........");
         // 根据Session 构建邮件信息
-        //	创建一个配置文件,并保存
-        Properties props = new Properties();
-        //	SMTP服务器连接信息
-        props.put("mail.smtp.host", mailboxInfoDTO.getHost());
-        props.put("mail.smtp.port", mailboxInfoDTO.getPort());
-        props.put("mail.smtp.auth", "true");
-        props.put("mail.smtp.starttls.enale", "true");
-        Session session = Session.getInstance(props,new Authenticator() {
-            @Override
-            protected PasswordAuthentication getPasswordAuthentication() {
-                return new PasswordAuthentication(mailboxInfoDTO.getAccount(),mailboxInfoDTO.getPassword());
-            }
-        });
-        // 根据Session 构建邮件信息
-        MimeMessage message = new MimeMessage(session);;
+        MimeMessage message = javaMailSender.createMimeMessage();
         // 创建邮件发送者地址
         Address from = new InternetAddress(mailboxInfoDTO.getAccount());
         String[] emailArr = emails.split(";");

+ 12 - 0
service-base/src/main/java/com/simuwang/base/pojo/dto/query/CompanyEmailHistoryPageQuery.java

@@ -14,6 +14,10 @@ public class CompanyEmailHistoryPageQuery extends PageQuery {
      * 公司ID
      */
     private String companyId;
+    /**
+     * 邮箱地址
+     */
+    private String email;
 
     public String getCompanyId() {
         return companyId;
@@ -22,4 +26,12 @@ public class CompanyEmailHistoryPageQuery extends PageQuery {
     public void setCompanyId(String companyId) {
         this.companyId = companyId;
     }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
 }

+ 6 - 0
service-base/src/main/resources/mapper/CompanyEmailHistoryMapper.xml

@@ -139,6 +139,9 @@
         <if test="companyId != null and companyId !=''">
             and c.company_id=#{companyId}
         </if>
+        <if test="email != null and email !=''">
+            and cesh.email=#{email}
+        </if>
         order by cesh.send_time desc
         limit #{offset},#{pageSize}
     </select>
@@ -157,6 +160,9 @@
         <if test="companyId != null and companyId !=''">
             and c.company_id=#{companyId}
         </if>
+        <if test="email != null and email !=''">
+            and cesh.email=#{email}
+        </if>
     </select>
 
 </mapper>