Kaynağa Gözat

增加同步邮箱账号及回复id

18118724055@163.com 1 gün önce
ebeveyn
işleme
d9fcfe825c

+ 16 - 0
java/storlead-mail/storlead-mail-core/src/main/java/com/storlead/mail/pojo/entity/MktMailStatusEntity.java

@@ -94,4 +94,20 @@ public class MktMailStatusEntity extends SysBaseField {
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @TableField("synced_at")
     private Date syncedAt;
+
+    @ApiModelProperty(value = "全部回复邮件id,逗号隔开")
+    @TableField("reply_email_ids")
+    private String replyEmailIds;
+
+    @ApiModelProperty(value = "发件箱id")
+    @TableField("outbox_id")
+    private Integer outboxId;
+
+    @ApiModelProperty(value = "发件箱")
+    @TableField("outbox")
+    private String outbox;
+
+    @ApiModelProperty(value = "是否拒收(0没有、1拒收)")
+    @TableField("has_refuse")
+    private Integer hasRefuse;
 }

+ 22 - 0
java/storlead-sasa/storlead-trade/src/main/java/com/storlead/trade/service/impl/MarketEmailsStatusSyncServiceImpl.java

@@ -13,6 +13,7 @@ import com.storlead.trade.service.MarketEmailsStatusSyncService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
@@ -161,6 +162,27 @@ public class MarketEmailsStatusSyncServiceImpl implements MarketEmailsStatusSync
             update.set(MarketEmailsEntity::getFirstReplyTheme, change.getFirstReplyTheme());
             changed = true;
         }
+        // 全部回复邮件 id(逗号隔开):邮件侧是全量列表,有变化则覆盖
+        if (StringUtils.hasText(change.getReplyEmailIds())
+                && !change.getReplyEmailIds().equals(existing.getReplyEmailIds())) {
+            update.set(MarketEmailsEntity::getReplyEmailIds, change.getReplyEmailIds());
+            changed = true;
+        }
+        // 发件箱:空才补
+        if (existing.getOutboxId() == null && change.getOutboxId() != null) {
+            update.set(MarketEmailsEntity::getOutboxId, change.getOutboxId());
+            changed = true;
+        }
+        if (!StringUtils.hasText(existing.getOutbox()) && StringUtils.hasText(change.getOutbox())) {
+            update.set(MarketEmailsEntity::getOutbox, change.getOutbox());
+            changed = true;
+        }
+        // 拒收:只升 1,不回退
+        if (Integer.valueOf(1).equals(change.getHasRefuse())
+                && !Integer.valueOf(1).equals(existing.getHasRefuse())) {
+            update.set(MarketEmailsEntity::getHasRefuse, 1);
+            changed = true;
+        }
         if (!changed) {
             return ApplyResult.MATCHED_NO_CHANGE;
         }