Browse Source

邮箱问题

chenkq 4 tuần trước cách đây
mục cha
commit
91b1895043

+ 1 - 0
storlead-framework/storlead-common/src/main/java/com/storlead/framework/common/properties/UrlChainDefinitionPorperties.java

@@ -88,6 +88,7 @@ public class UrlChainDefinitionPorperties {
 			"/wxapi/wxclientmenu/**",
 			"/wxapi/wxclientmenu/*",
 			"/wxapi/getauth",
+            "/mkt/dispatch_sent",
 			"/account/auth/system/login",
 			"/account/auth/tenant/login"
 	};

+ 14 - 0
storlead-mail-api/src/main/java/com/storlead/mail/mkt/MktMailApiController.java

@@ -205,10 +205,24 @@ public class MktMailApiController {
         if (Objects.isNull(userId)) {
             return Result.error("未登录");
         }
+
+
         MktMailMessageEntity entity = mktMailMessageService.send(dto, userId);
         return Result.result(entity);
     }
 
+    @PostMapping("/dispatch_sent")
+    @ApiOperation("发送营销邮件(单封;默认同步等待投递结果;async=true 异步投递+回调)")
+    public Result<?> dispatchSent(@RequestBody MktSendMailDTO dto) {
+        List<SmtpPopSettingsEntity> ds = mailAccountBizService.listAccounts(null,MailSceneEnum.MKT.getCode());
+        if (Objects.isNull(ds) || ds.isEmpty()) {
+            return Result.error("未配置账号");
+        }
+        dto.setAccountId(ds.get(0).getId());
+        MktMailMessageEntity entity = mktMailMessageService.send(dto,1L);
+        return Result.result(entity);
+    }
+
     @PostMapping("/edit_content")
     @ApiOperation("编辑营销邮件内容(仅更新正文,不发送、不改收件人/附件)")
     public Result<?> editContent(@RequestBody MktEditMailContentDTO dto) {

+ 4 - 8
storlead-mail/storlead-mail-common/src/main/java/com/storlead/sales/mail/common/service/impl/MailAccountBizServiceImpl.java

@@ -222,15 +222,11 @@ public class MailAccountBizServiceImpl implements MailAccountBizService {
     private LambdaQueryWrapper<SmtpPopSettingsEntity> buildSceneOwnerWrapper(Long userId, String scene) {
         String sceneCode = MailSceneEnum.of(scene).getCode();
         LambdaQueryWrapper<SmtpPopSettingsEntity> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(SmtpPopSettingsEntity::getOwnerBy, userId)
-                .eq(SmtpPopSettingsEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
-        if (MailSceneEnum.isCrm(sceneCode)) {
-            wrapper.and(w -> w.isNull(SmtpPopSettingsEntity::getScene)
-                    .or().eq(SmtpPopSettingsEntity::getScene, "")
-                    .or().eq(SmtpPopSettingsEntity::getScene, MailSceneEnum.CRM.getCode()));
-        } else {
-            wrapper.eq(SmtpPopSettingsEntity::getScene, sceneCode);
+        if (Objects.nonNull(userId)) {
+            wrapper.eq(SmtpPopSettingsEntity::getOwnerBy, userId);
         }
+        wrapper.eq(SmtpPopSettingsEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
+        wrapper.eq(SmtpPopSettingsEntity::getScene, sceneCode);
         return wrapper;
     }
 

+ 3 - 3
storlead-mail/storlead-mail-dispatch/src/main/java/com/storlead/sales/mail/dispatch/DelaySendEmailTaskJob.java

@@ -49,9 +49,9 @@ public class DelaySendEmailTaskJob {
 //        if ("dev".equals(active)) {
 //            return;
 //        }
-        log.info("定时发送邮件任务开始(CRM + MKT)");
-        sendCrmDelayEmails();
-        sendMktDelayEmails();
+//        log.info("定时发送邮件任务开始(CRM + MKT)");
+//        sendCrmDelayEmails();
+//        sendMktDelayEmails();
     }
 
     private void sendCrmDelayEmails() {

+ 3 - 0
storlead-mail/storlead-mail-mkt/src/main/java/com/storlead/sales/mail/mkt/pojo/MktSendMailDTO.java

@@ -28,6 +28,9 @@ public class MktSendMailDTO {
     @ApiModelProperty(value = "收件人", required = true)
     private String recipient;
 
+    @ApiModelProperty("收件人")
+    private List<String> recipientls;
+
     @ApiModelProperty("抄送")
     private List<String> recipientCcList;
 

+ 5 - 0
storlead-mail/storlead-mail-mkt/src/main/java/com/storlead/sales/mail/mkt/service/impl/MktMailMessageServiceImpl.java

@@ -139,12 +139,17 @@ public class MktMailMessageServiceImpl extends MyBaseServiceImpl<MktMailMessageM
         if (dto == null || dto.getAccountId() == null) {
             throw new WebException("发信账户不能为空");
         }
+        if (CollectionUtils.isEmpty(dto.getRecipientls())) {
+            throw new WebException("收件人不能为空");
+        }
+        dto.setRecipient(dto.getRecipientls().get(0));
         if (!StringUtils.hasText(dto.getRecipient())) {
             throw new WebException("收件人不能为空");
         }
         if (!StringUtils.hasText(dto.getSubject())) {
             throw new WebException("主题不能为空");
         }
+
         SmtpPopSettingsEntity account = mailAccountBizService.requireAccount(dto.getAccountId(), MailSceneEnum.MKT);
 
         MktMailMessageEntity entity = resolveWritableEntity(dto.getId(), operatorId);