Browse Source

Merge branch 'cpq-dev' of wangfan/adweb3-server into master

chenpeiqing 2 months ago
parent
commit
0cc360cf63

+ 108 - 130
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/common/service/FeishuService.java

@@ -1,15 +1,18 @@
 package org.jeecg.modules.adweb.common.service;
 
 import cn.hutool.http.HttpRequest;
-
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.xkcoding.http.util.StringUtil;
-
 import jakarta.annotation.Resource;
-
+import java.nio.charset.StandardCharsets;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
 import lombok.extern.slf4j.Slf4j;
-
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.lang3.StringUtils;
 import org.jeecg.modules.adweb.common.constant.RobotMsgTemplate;
@@ -20,147 +23,122 @@ import org.jeecg.modules.system.service.ISysDictService;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
-import java.nio.charset.StandardCharsets;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import javax.crypto.Mac;
-import javax.crypto.spec.SecretKeySpec;
-
 /**
- * @Description:
- * @Author: wrk
+ * @Description: @Author: wrk
+ *
  * @date 2022/7/18 16:30
  */
 @Slf4j
 @Service
 public class FeishuService {
 
-    @Resource
-    private ISysDictService sysDictService;
-
-    @Resource
-    private IAdwebSiteService adwebSiteService;
-
-    /**
-     * url
-     */
-    @Value("${robot.enquiry-url}")
-    private String enquiryUrl;
-    @Value("${robot.market-plan-missing-url}")
-    private String marketPlanMissingUrl;
-    @Value("${robot.flow-abnormal-url}")
-    private String flowAbnormalUrl;
-
-    @Value("${robot.keyword-preOrSuffix-url}")
-    private String keywordPreOrSuffixUrl;
-
-    @Value("${robot.site-url}")
-    private String siteUrl;
-
-
-    /**
-     * 本地属性
-     */
-    public static String PROFILES_ACTIVE;
-
-    @Value("${spring.profiles.active}")
-    public void setCustomName(String customName) {
-        PROFILES_ACTIVE = customName;
-    }
-
-    // 飞书签名校验
-    private static String genSign(String secret, int timestamp) throws NoSuchAlgorithmException, InvalidKeyException {
-        //把timestamp+"\n"+密钥当做签名字符串
-        String stringToSign = timestamp + "\n" + secret;
-        //使用HmacSHA256算法计算签名
-        Mac mac = Mac.getInstance("HmacSHA256");
-        mac.init(new SecretKeySpec(stringToSign.getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
-        byte[] signData = mac.doFinal(new byte[]{});
-        return new String(Base64.encodeBase64(signData));
+  @Resource private ISysDictService sysDictService;
+
+  @Resource private IAdwebSiteService adwebSiteService;
+
+  /** url */
+  @Value("${robot.enquiry-url}")
+  private String enquiryUrl;
+
+  @Value("${robot.site-url}")
+  private String siteUrl;
+
+  /** 本地属性 */
+  public static String PROFILES_ACTIVE;
+
+  @Value("${spring.profiles.active}")
+  public void setCustomName(String customName) {
+    PROFILES_ACTIVE = customName;
+  }
+
+  // 飞书签名校验
+  private static String genSign(String secret, int timestamp)
+      throws NoSuchAlgorithmException, InvalidKeyException {
+    // 把timestamp+"\n"+密钥当做签名字符串
+    String stringToSign = timestamp + "\n" + secret;
+    // 使用HmacSHA256算法计算签名
+    Mac mac = Mac.getInstance("HmacSHA256");
+    mac.init(new SecretKeySpec(stringToSign.getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
+    byte[] signData = mac.doFinal(new byte[] {});
+    return new String(Base64.encodeBase64(signData));
+  }
+
+  /**
+   * 异常栈发送机器人消息
+   *
+   * @param consumeTime
+   * @param title
+   * @param errorMsg
+   */
+  public void sendEnquiryRobot(
+      float consumeTime,
+      String title,
+      String classNameInit,
+      String methodNameInit,
+      String errorMsg) {
+
+    String className = classNameInit == null ? "未知类名" : classNameInit;
+    String methodName = methodNameInit == null ? "未知方法名" : methodNameInit;
+
+    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+    String timeStr = simpleDateFormat.format(new Date());
+    String text = RobotMsgTemplate.EXCEPTION_MSG;
+    text = text.replaceAll("\\{environment\\}", PROFILES_ACTIVE);
+    text = text.replaceAll("\\{consumeTime\\}", consumeTime + "秒");
+    text = text.replaceAll("\\{time\\}", timeStr);
+
+    text = text.replaceAll("\\{title\\}", title);
+    text = text.replaceAll("\\{methodName\\}", className + "." + methodName + "()");
+    text = text.replaceAll("\\{errorMsg\\}", errorMsg);
+    RobotDto robotDto = new RobotDto();
+    robotDto.setMsg_type("interactive");
+    robotDto.setCard(JSON.parseObject(text, RobotDto.CardBean.class));
+    String json = JSON.toJSONString(robotDto);
+
+    HttpRequest.post(enquiryUrl).body(json).execute(true);
+  }
+
+  /** 邮件发送失败通知 */
+  public void sendEnquiryEmailFailMsg(
+      Long enquiryId, String siteCode, String email, String content) {
+    SysDictItem dictItem =
+        sysDictService.getDictItemByCodeAndText("feishu_msg_template", "enquiry_email_fail_msg");
+    if (dictItem == null || StringUtil.isEmpty(dictItem.getItemValue())) {
+      return;
     }
 
-    /**
-     * 异常栈发送机器人消息
-     *
-     * @param consumeTime
-     * @param title
-     * @param errorMsg
-     */
-    public void sendRobot(float consumeTime, String title, String classNameInit, String methodNameInit, String errorMsg) {
-        //HttpServletRequest request = ContextHolderUtils.getRequest();
-        String requestIp = "";
-        String className = classNameInit == null ? "未知类名" : classNameInit;
-        String methodName = methodNameInit == null ? "未知方法名" : methodNameInit;
-        /*if (request != null){
-            requestIp = IpUtil.getIpAddr(request);
-            //className = request.getClass().getName();
-            //methodName = request.getMethod();
-        }*/
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        String timeStr = simpleDateFormat.format(new Date());
-        String text = RobotMsgTemplate.EXCEPTION_MSG;
-        text = text.replaceAll("\\{environment\\}", PROFILES_ACTIVE);
-        text = text.replaceAll("\\{consumeTime\\}", consumeTime + "秒");
-        text = text.replaceAll("\\{time\\}", timeStr);
-        //text = text.replaceAll("\\{requestIp\\}", "".equals(requestIp) ? "0:0:0:0:0:0:0:1" : requestIp);
-        text = text.replaceAll("\\{title\\}", title);
-        text = text.replaceAll("\\{methodName\\}", className + "." + methodName + "()");
-        text = text.replaceAll("\\{errorMsg\\}", errorMsg);
-        RobotDto robotDto = new RobotDto();
-        robotDto.setMsg_type("interactive");
-        robotDto.setCard(JSON.parseObject(text, RobotDto.CardBean.class));
-        String json = JSON.toJSONString(robotDto);
-
-        HttpRequest.post(enquiryUrl).body(json).execute(true);
-    }
+    String siteName = adwebSiteService.getSiteByCode(siteCode).getName();
 
-    /**
-     * 邮件发送失败通知
-     */
-    public void sendEnquiryEmailFailMsg(Long enquiryId, String siteCode, String email, String content) {
-        SysDictItem dictItem = sysDictService.getDictItemByCodeAndText("feishu_msg_template", "enquiry_email_fail_msg");
-        if (dictItem == null || StringUtil.isEmpty(dictItem.getItemValue())) {
-            return;
-        }
+    String template = dictItem.getItemValue();
+    template = template.replace("{{siteName}}", siteName);
+    template = template.replace("{{enquiryId}}", Long.toString(enquiryId));
+    template = template.replace("{{email}}", email);
+    template = template.replace("{{content}}", content);
 
-        String siteName = adwebSiteService.getSiteByCode(siteCode).getName();
+    JSONObject object = new JSONObject();
+    object.put("msg_type", "interactive");
+    object.put("card", template);
 
-        String template = dictItem.getItemValue();
-        template = template.replace("{{siteName}}", siteName);
-        template = template.replace("{{enquiryId}}", Long.toString(enquiryId));
-        template = template.replace("{{email}}", email);
-        template = template.replace("{{content}}", content);
+    HttpRequest.post(enquiryUrl).body(object.toJSONString()).execute(true);
+  }
 
-        JSONObject object = new JSONObject();
-        object.put("msg_type", "interactive");
-        object.put("card", template);
+  /**
+   * @return
+   */
+  public void sendAdWebV3FeiShuMsg(String msgTitle, String message)
+      throws NoSuchAlgorithmException, InvalidKeyException {
 
-        HttpRequest.post(enquiryUrl).body(object.toJSONString()).execute(true);
+    String param =
+        "{\"msg_type\":\"interactive\",\"card\":{\"header\":{\"title\":{\"tag\":\"plain_text\",\"content\":\"msgTitle\"},\"template\":\"blue\"},\"elements\":[{\"tag\":\"div\",\"text\":{\"tag\":\"lark_md\",\"content\":\"message\"}}]}}";
+    if (StringUtils.isNotBlank(message)) {
+      param = param.replace("message", message);
     }
-
-    /**
-     * @return
-     */
-    public void sendAdWebV3FeiShuMsg(String msgTitle, String message) throws NoSuchAlgorithmException, InvalidKeyException {
-
-//        String secretSign = "HHfe6aeaWskgFthPGFlYhe";
-//        int timestamp = Integer.parseInt(String.valueOf(System.currentTimeMillis()).substring(0, 10));
-//        log.info("timestamp:{}", timestamp);
-        String param = "{\"msg_type\":\"interactive\",\"card\":{\"header\":{\"title\":{\"tag\":\"plain_text\",\"content\":\"msgTitle\"},\"template\":\"blue\"},\"elements\":[{\"tag\":\"div\",\"text\":{\"tag\":\"lark_md\",\"content\":\"message\"}}]}}";
-        if (StringUtils.isNotBlank(message)) {
-            param = param.replace("message", message);
-        }
-        if (StringUtils.isNotBlank(msgTitle)) {
-            param = param.replace("msgTitle", msgTitle);
-        }
-
-        JSONObject object = JSONObject.parseObject(param);
-//        object.replace("timestamp", timestamp);
-//        object.replace("sign", genSign(secretSign, timestamp));
-        HttpRequest.post(siteUrl).body(object.toJSONString()).execute(true);
+    if (StringUtils.isNotBlank(msgTitle)) {
+      param = param.replace("msgTitle", msgTitle);
     }
 
+    JSONObject object = JSONObject.parseObject(param);
+
+    HttpRequest.post(siteUrl).body(object.toJSONString()).execute(true);
+  }
 }

+ 2111 - 2198
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/service/impl/AdwebEnquiryServiceImpl.java

@@ -9,12 +9,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.xkcoding.http.util.StringUtil;
-
 import jakarta.annotation.PostConstruct;
 import jakarta.annotation.Resource;
-
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
 import lombok.extern.slf4j.Slf4j;
-
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.constant.CacheConstant;
@@ -55,2336 +56,2248 @@ import org.springframework.http.HttpMethod;
 import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestTemplate;
 
-import java.util.*;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-
 /**
- * @Description: 询盘信息存储表单
- * @Author: jeecg-boot
- * @Date: 2024-10-12
- * @Version: V1.0
+ * @Description: 询盘信息存储表单 @Author: jeecg-boot @Date: 2024-10-12 @Version: V1.0
  */
 @Slf4j
 @Service
 public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, AdwebEnquiry>
-        implements IAdwebEnquiryService {
-
-    @Resource private AdwebEnquiryMapper adwebEnquiryMapper;
+    implements IAdwebEnquiryService {
 
-    @Resource @Lazy private ISysUserService sysUserService;
+  @Resource private AdwebEnquiryMapper adwebEnquiryMapper;
 
-    @Resource private IMasterSubAccountRelationService masterSubAccountRelationService;
+  @Resource @Lazy private ISysUserService sysUserService;
 
-    @Resource private GeoIpUtil geoIpUtil;
+  @Resource private IMasterSubAccountRelationService masterSubAccountRelationService;
 
-    @Resource private IAdwebPublicEnquiryRuleService AdwebPublicEnquiryRuleService;
+  @Resource private GeoIpUtil geoIpUtil;
 
-    @Resource private ISysDictService dictService;
+  @Resource private IAdwebPublicEnquiryRuleService AdwebPublicEnquiryRuleService;
 
-    @Resource private SnowflakeIdUtil snowflakeIdUtil;
+  @Resource private ISysDictService dictService;
 
-    @Resource private AdwebRedisUtil adwebRedisUtil;
+  @Resource private SnowflakeIdUtil snowflakeIdUtil;
 
-    @Resource private ISysExceptionService sysExceptionService;
+  @Resource private AdwebRedisUtil adwebRedisUtil;
 
-    @Resource private FeishuService feishuService;
+  @Resource private ISysExceptionService sysExceptionService;
 
-    @Resource private IAdwebEnquiryBlacklistService adwebEnquiryBlacklistService;
+  @Resource private FeishuService feishuService;
 
-    @Resource private IAdwebSiteBlackEmailService enquirySiteBlackEmailService;
+  @Resource private IAdwebEnquiryBlacklistService adwebEnquiryBlacklistService;
 
-    @Resource private IAdwebPublicBlackEmailService adwebPublicBlackEmailService;
+  @Resource private IAdwebSiteBlackEmailService enquirySiteBlackEmailService;
 
-    @Resource private IAdwebPublicBlackIpService adwebPublicBlackIpService;
+  @Resource private IAdwebPublicBlackEmailService adwebPublicBlackEmailService;
 
-    @Resource private IAdwebSiteBlackIpService adwebSiteBlackIpService;
+  @Resource private IAdwebPublicBlackIpService adwebPublicBlackIpService;
 
-    @Resource private IAdwebSiteEnquiryRuleService adwebSiteEnquiryRuleService;
+  @Resource private IAdwebSiteBlackIpService adwebSiteBlackIpService;
 
-    @Resource private IEnquiryEmailMessageService enquiryEmailMessageService;
+  @Resource private IAdwebSiteEnquiryRuleService adwebSiteEnquiryRuleService;
 
-    @Resource private IAdwebSiteService adwebSiteService;
+  @Resource private IEnquiryEmailMessageService enquiryEmailMessageService;
 
-    @Resource private AdwebOpenApiService adwebOpenApiService;
+  @Resource private IAdwebSiteService adwebSiteService;
 
-    @Resource private IAdwebEnquiryFormService adwebEnquiryFormService;
+  @Resource private AdwebOpenApiService adwebOpenApiService;
 
-    @Resource private SysAdwebApiImpl sysAdwebApiImpl;
+  @Resource private IAdwebEnquiryFormService adwebEnquiryFormService;
 
-    @Resource private WebSocket webSocket;
+  @Resource private SysAdwebApiImpl sysAdwebApiImpl;
 
-    @Resource private WebSocketService webSocketService;
+  @Resource private WebSocket webSocket;
 
-    @Resource private EnquiryRedisService enquiryRedisService;
+  @Resource private WebSocketService webSocketService;
 
-    @Resource private ISubUserEmailService subUserEmailService;
+  @Resource private EnquiryRedisService enquiryRedisService;
 
-    private static final byte[] redisKey = EnquiryConstants.ENQUIRY_EMAIL.getBytes();
+  @Resource private ISubUserEmailService subUserEmailService;
 
-    private static final byte[] siteRedisKey = EnquiryConstants.ENQUIRY_SITE.getBytes();
+  private static final byte[] redisKey = EnquiryConstants.ENQUIRY_EMAIL.getBytes();
 
-    // 询盘唯一键 redis key
-    public static final String EnquiryUniqueKey = "ENQUIRY_UNIQUE_KEY::";
+  private static final byte[] siteRedisKey = EnquiryConstants.ENQUIRY_SITE.getBytes();
 
-    // Email Redis key
-    private static final String EmailTenMinKey = "JUDGE_WASTE_ENQUIRY_EMAIL_BY_10_MIN::";
-    private static final String EmailOneDayKey = "JUDGE_WASTE_ENQUIRY_EMAIL_BY_ONE_DAY::";
-    private static final String BlackEmailKey = "BLACK_EMAIL_LIST";
-    private static final String WhiteEmailListKey = "WHITE_EMAIL_LIST";
-    private static final String NotBlackEmailWasteEnquiryKey =
-            "NOT_BLACK_EMAIL_WASTE_ENQUIRY_MAP::";
+  // 询盘唯一键 redis key
+  public static final String EnquiryUniqueKey = "ENQUIRY_UNIQUE_KEY::";
 
-    // site Email Redis key
-    private static final String SiteEmailTenMinKey = "JUDGE_WASTE_SITE_ENQUIRY_EMAIL_BY_10_MIN::";
-    private static final String SiteEmailOneDayKey = "JUDGE_WASTE_SITE_ENQUIRY_EMAIL_BY_ONE_DAY::";
-    private static final String SiteBlackEmailKey = "SITE_BLACK_EMAIL_LIST";
-    private static final String SiteWhiteEmailListKey = "SITE_WHITE_EMAIL_LIST";
-    private static final String NotBlackEmailWasteSiteEnquiryKey =
-            "NOT_BLACK_EMAIL_WASTE_SITE_ENQUIRY_MAP::";
+  // Email Redis key
+  private static final String EmailTenMinKey = "JUDGE_WASTE_ENQUIRY_EMAIL_BY_10_MIN::";
+  private static final String EmailOneDayKey = "JUDGE_WASTE_ENQUIRY_EMAIL_BY_ONE_DAY::";
+  private static final String BlackEmailKey = "BLACK_EMAIL_LIST";
+  private static final String WhiteEmailListKey = "WHITE_EMAIL_LIST";
+  private static final String NotBlackEmailWasteEnquiryKey = "NOT_BLACK_EMAIL_WASTE_ENQUIRY_MAP::";
 
-    // ip Reids Key
-    private static final String IpTenMinKey = "JUDGE_WASTE_ENQUIRY_IP_BY_10_MIN::";
-    private static final String IpOneDayKey = "JUDGE_WASTE_ENQUIRY_IP_BY_ONE_DAY::";
-    private static final String BlackIpKey = "BLACK_IP_LIST";
-    private static final String WhiteIpListKey = "WHITE_IP_LIST";
-    private static final String NotBlackIpWasteEnquiryKey = "NOT_BLACK_IP_WASTE_ENQUIRY_MAP::";
+  // site Email Redis key
+  private static final String SiteEmailTenMinKey = "JUDGE_WASTE_SITE_ENQUIRY_EMAIL_BY_10_MIN::";
+  private static final String SiteEmailOneDayKey = "JUDGE_WASTE_SITE_ENQUIRY_EMAIL_BY_ONE_DAY::";
+  private static final String SiteBlackEmailKey = "SITE_BLACK_EMAIL_LIST";
+  private static final String SiteWhiteEmailListKey = "SITE_WHITE_EMAIL_LIST";
+  private static final String NotBlackEmailWasteSiteEnquiryKey =
+      "NOT_BLACK_EMAIL_WASTE_SITE_ENQUIRY_MAP::";
 
-    // site ip Reids Key
-    private static final String SiteIpTenMinKey = "JUDGE_WASTE_ENQUIRY_SITE_IP_BY_10_MIN::";
-    private static final String SiteIpOneDayKey = "JUDGE_WASTE_ENQUIRY_SITE_IP_BY_ONE_DAY::";
-    private static final String NotSiteBlackIpWasteEnquiryKey =
-            "NOT_SITE_BLACK_IP_WASTE_ENQUIRY_MAP::";
-    private static final String SiteBlackIpKey = "SITE_BLACK_IP_LIST";
-    private static final String SiteWhiteIpListKey = "SITE_WHITE_IP_LIST";
+  // ip Reids Key
+  private static final String IpTenMinKey = "JUDGE_WASTE_ENQUIRY_IP_BY_10_MIN::";
+  private static final String IpOneDayKey = "JUDGE_WASTE_ENQUIRY_IP_BY_ONE_DAY::";
+  private static final String BlackIpKey = "BLACK_IP_LIST";
+  private static final String WhiteIpListKey = "WHITE_IP_LIST";
+  private static final String NotBlackIpWasteEnquiryKey = "NOT_BLACK_IP_WASTE_ENQUIRY_MAP::";
 
-    @Value("${judge_waste_enquiry.email.tenMinNum}")
-    private Integer emailTenMinNum;
+  // site ip Reids Key
+  private static final String SiteIpTenMinKey = "JUDGE_WASTE_ENQUIRY_SITE_IP_BY_10_MIN::";
+  private static final String SiteIpOneDayKey = "JUDGE_WASTE_ENQUIRY_SITE_IP_BY_ONE_DAY::";
+  private static final String NotSiteBlackIpWasteEnquiryKey =
+      "NOT_SITE_BLACK_IP_WASTE_ENQUIRY_MAP::";
+  private static final String SiteBlackIpKey = "SITE_BLACK_IP_LIST";
+  private static final String SiteWhiteIpListKey = "SITE_WHITE_IP_LIST";
 
-    @Value("${judge_waste_enquiry.email.oneDayNum}")
-    private Integer emailOneDayNum;
+  @Value("${judge_waste_enquiry.email.tenMinNum}")
+  private Integer emailTenMinNum;
 
-    @Value("${judge_waste_enquiry.ip.tenMinNum}")
-    private Integer ipTenMinNum;
+  @Value("${judge_waste_enquiry.email.oneDayNum}")
+  private Integer emailOneDayNum;
 
-    @Value("${judge_waste_enquiry.ip.oneDayNum}")
-    private Integer ipOneDayNum;
+  @Value("${judge_waste_enquiry.ip.tenMinNum}")
+  private Integer ipTenMinNum;
 
-    @Value("${judge_waste_enquiry.email.notBlackListNum}")
-    private Integer emailNotBlackListNum;
+  @Value("${judge_waste_enquiry.ip.oneDayNum}")
+  private Integer ipOneDayNum;
 
-    @Value("${judge_waste_enquiry.ip.notBlackListNum}")
-    private Integer ipNotBlackListNum;
+  @Value("${judge_waste_enquiry.email.notBlackListNum}")
+  private Integer emailNotBlackListNum;
 
-    @Value("${judge_waste_enquiry.email.notBlackListDate}")
-    private Integer emailNotBlackListDate;
+  @Value("${judge_waste_enquiry.ip.notBlackListNum}")
+  private Integer ipNotBlackListNum;
 
-    @Value("${judge_waste_enquiry.ip.notBlackListDate}")
-    private Integer ipNotBlackListDate;
+  @Value("${judge_waste_enquiry.email.notBlackListDate}")
+  private Integer emailNotBlackListDate;
 
-    private static final int USER_EFFECTIVE_ACTIVE = 1;
-    private static final int USER_EFFECTIVE_WAIT_ACTIVE = 2;
+  @Value("${judge_waste_enquiry.ip.notBlackListDate}")
+  private Integer ipNotBlackListDate;
 
-    @PostConstruct
-    public void startEnquiryRedisListener() {
-        enquiryRedisService.init();
-        enquiryRedisService.startEnquiryEmailMessageListener(
-                EnquiryConstants.ENQUIRY_EMAIL_CHANNEL, enquiryEmailMessageService);
-    }
+  private static final int USER_EFFECTIVE_ACTIVE = 1;
+  private static final int USER_EFFECTIVE_WAIT_ACTIVE = 2;
 
-    // 获取有效公共询盘规则
-    private List<String> getPublicEnquiryRules(int blackOrWhite, int useStatus) {
+  @PostConstruct
+  public void startEnquiryRedisListener() {
+    enquiryRedisService.init();
+    enquiryRedisService.startEnquiryEmailMessageListener(
+        EnquiryConstants.ENQUIRY_EMAIL_CHANNEL, enquiryEmailMessageService);
+  }
 
-        List<String> blackWordList = null;
-        try {
-            List<AdwebPublicEnquiryRule> AdwebPublicEnquiryRuleList =
-                    AdwebPublicEnquiryRuleService.list(
-                            new LambdaQueryWrapper<AdwebPublicEnquiryRule>()
-                                    .eq(AdwebPublicEnquiryRule::getStatus, 1)
-                                    .eq(AdwebPublicEnquiryRule::getIsEnable, 1)
-                                    .eq(AdwebPublicEnquiryRule::getBlackOrWhiteList, blackOrWhite)
-                                    .eq(AdwebPublicEnquiryRule::getUseStatus, useStatus));
-            if (CollectionUtils.isNotEmpty(AdwebPublicEnquiryRuleList)) {
-                blackWordList =
-                        AdwebPublicEnquiryRuleList.stream()
-                                .map(AdwebPublicEnquiryRule::getWord)
-                                .toList();
-            }
-        } catch (Exception e) {
-            log.error("读取询盘黑名单关键词失败", e);
-        }
+  // 获取有效公共询盘规则
+  private List<String> getPublicEnquiryRules(int blackOrWhite, int useStatus) {
 
-        return blackWordList;
+    List<String> blackWordList = null;
+    try {
+      List<AdwebPublicEnquiryRule> AdwebPublicEnquiryRuleList =
+          AdwebPublicEnquiryRuleService.list(
+              new LambdaQueryWrapper<AdwebPublicEnquiryRule>()
+                  .eq(AdwebPublicEnquiryRule::getStatus, 1)
+                  .eq(AdwebPublicEnquiryRule::getIsEnable, 1)
+                  .eq(AdwebPublicEnquiryRule::getBlackOrWhiteList, blackOrWhite)
+                  .eq(AdwebPublicEnquiryRule::getUseStatus, useStatus));
+      if (CollectionUtils.isNotEmpty(AdwebPublicEnquiryRuleList)) {
+        blackWordList =
+            AdwebPublicEnquiryRuleList.stream().map(AdwebPublicEnquiryRule::getWord).toList();
+      }
+    } catch (Exception e) {
+      log.error("读取询盘黑名单关键词失败", e);
     }
 
-    /**
-     * 添加询盘
-     *
-     * @param enquiryDto 询盘对象
-     * @return
-     */
-    public void addEnquiry(EnquiryDTO enquiryDto, String plugin, List<AdwebSite> adwebSites) {
-
-        // 获取公共黑名单关键词
-        List<String> blackWordList = getPublicEnquiryRules(0, 0);
-
-        AdwebSite adwebSite = adwebSites.get(0);
-
-        // 获取子账户
-        Map<String, String> principalEmailMap = new HashMap<>();
-        List<String> subAccountIdList =
-                masterSubAccountRelationService.getSubAccountIdByMaster(
-                        String.valueOf(adwebSite.getUid()));
-        log.info("获取的子账户id:{}", FastJsonUtil.toJSONString(subAccountIdList));
-        if (CollectionUtils.isNotEmpty(subAccountIdList)) {
-            subAccountIdList.add(String.valueOf(adwebSite.getUid()));
-            List<SysUser> principalEmailList =
-                    sysUserService.list(
-                            new LambdaQueryWrapper<SysUser>()
-                                    .in(SysUser::getId, subAccountIdList)
-                                    .eq(SysUser::getDelFlag, 0)
-                                    .isNotNull(SysUser::getEmail)
-                                    .ne(SysUser::getEmail, "")
-                                    .select(SysUser::getId, SysUser::getEmail));
-            if (CollectionUtils.isNotEmpty(principalEmailList)) {
-                principalEmailMap =
-                        principalEmailList.stream()
-                                .collect(Collectors.toMap(SysUser::getId, SysUser::getEmail));
-            }
-        }
-
-        List<AdwebEnquiry> adwebEnquiryList = new ArrayList<>();
-        AdwebEnquiryForm form = new AdwebEnquiryForm();
-
-        try {
-            AdwebEnquiry adwebEnquiry = createEnquiry(enquiryDto, adwebSite);
+    return blackWordList;
+  }
+
+  /**
+   * 添加询盘
+   *
+   * @param enquiryDto 询盘对象
+   * @return
+   */
+  public void addEnquiry(EnquiryDTO enquiryDto, String plugin, List<AdwebSite> adwebSites) {
+    log.info("=============开始进行询盘处理==============:{}", enquiryDto.getSiteHost());
+    // 获取公共黑名单关键词
+    List<String> blackWordList = getPublicEnquiryRules(0, 0);
+
+    AdwebSite adwebSite = adwebSites.get(0);
+
+    // 获取子账户
+    Map<String, String> principalEmailMap = new HashMap<>();
+    List<String> subAccountIdList =
+        masterSubAccountRelationService.getSubAccountIdByMaster(String.valueOf(adwebSite.getUid()));
+    log.info("获取的子账户id:{}", FastJsonUtil.toJSONString(subAccountIdList));
+    if (CollectionUtils.isNotEmpty(subAccountIdList)) {
+      subAccountIdList.add(String.valueOf(adwebSite.getUid()));
+      List<SysUser> principalEmailList =
+          sysUserService.list(
+              new LambdaQueryWrapper<SysUser>()
+                  .in(SysUser::getId, subAccountIdList)
+                  .eq(SysUser::getDelFlag, 0)
+                  .isNotNull(SysUser::getEmail)
+                  .ne(SysUser::getEmail, "")
+                  .select(SysUser::getId, SysUser::getEmail));
+      if (CollectionUtils.isNotEmpty(principalEmailList)) {
+        principalEmailMap =
+            principalEmailList.stream()
+                .collect(Collectors.toMap(SysUser::getId, SysUser::getEmail));
+      }
+    }
 
-            String forms = FastJsonUtil.toJSONString(enquiryDto.getForms());
-            parseFormAndSetFields(adwebEnquiry, forms, adwebSite);
-            setCountryByIp(adwebEnquiry);
+    List<AdwebEnquiry> adwebEnquiryList = new ArrayList<>();
+    AdwebEnquiryForm form = new AdwebEnquiryForm();
 
-            adwebEnquiryList.add(adwebEnquiry);
+    try {
+      AdwebEnquiry adwebEnquiry = createEnquiry(enquiryDto, adwebSite);
 
-            form.setEnquiryId(adwebEnquiry.getId());
-            form.setForm(forms);
-            form.setCountry(adwebEnquiry.getCountry());
-            form.setPluginName(plugin);
+      String forms = FastJsonUtil.toJSONString(enquiryDto.getForms());
+      parseFormAndSetFields(adwebEnquiry, forms, adwebSite);
+      setCountryByIp(adwebEnquiry);
 
-        } catch (Exception e) {
-            log.error(
-                    "消费站点为:{}, recordId为:{} 的询盘出现问题",
-                    adwebSite.getName(),
-                    enquiryDto.getRecordId(),
-                    e);
-        }
+      adwebEnquiryList.add(adwebEnquiry);
 
-        // 公共黑名单,站点黑名单过滤
-        judgeWasteEnquiryBySiteId(adwebEnquiryList, adwebSite, blackWordList);
+      form.setEnquiryId(adwebEnquiry.getId());
+      form.setForm(forms);
+      form.setCountry(adwebEnquiry.getCountry());
+      form.setPluginName(plugin);
 
-        // 客户黑名单过滤
-        judgeBlacklist(adwebEnquiryList);
+    } catch (Exception e) {
+      log.error("消费站点为:{}, recordId为:{} 的询盘出现问题", adwebSite.getName(), enquiryDto.getRecordId(), e);
+    }
 
-        AdwebEnquiry target = adwebEnquiryList.get(0);
+    // 公共黑名单,站点黑名单过滤
+    judgeWasteEnquiryBySiteId(adwebEnquiryList, adwebSite, blackWordList);
 
-        // 获取最近一周的询盘数量,根据域名和record id 生成唯一标识,存入redis,用来过滤之后的询盘mq,防止重复消费
+    // 客户黑名单过滤
+    judgeBlacklist(adwebEnquiryList);
 
-        if (adwebRedisUtil.hasKey(EnquiryUniqueKey + target.getSiteHost())) {
-            List<String> enquiryUniqueIds =
-                    (List<String>) adwebRedisUtil.get(EnquiryUniqueKey + target.getSiteHost());
+    AdwebEnquiry target = adwebEnquiryList.get(0);
 
-            // 防止redis 唯一键存储过大,并始终更新
-            enquiryUniqueIds.remove(enquiryUniqueIds.size() - 1); // 移除第一个唯一键
-            enquiryUniqueIds.add(target.getSiteHost() + target.getRecordId()); // 添加最新的唯一键
+    // 获取最近一周的询盘数量,根据域名和record id 生成唯一标识,存入redis,用来过滤之后的询盘mq,防止重复消费
+    // 记录开始时间
+    long startTime = System.currentTimeMillis();
+    if (adwebRedisUtil.hasKey(EnquiryUniqueKey + target.getSiteHost())) {
+      List<String> enquiryUniqueIds =
+          (List<String>) adwebRedisUtil.get(EnquiryUniqueKey + target.getSiteHost());
 
-            adwebRedisUtil.set(
-                    EnquiryUniqueKey + target.getSiteHost(), enquiryUniqueIds, 60 * 60 * 24);
+      // 防止redis 唯一键存储过大,并始终更新
+      enquiryUniqueIds.remove(enquiryUniqueIds.size() - 1); // 移除第一个唯一键
+      enquiryUniqueIds.add(target.getSiteHost() + target.getRecordId()); // 添加最新的唯一键
 
-        } else {
-            Date start = DateUtil.addDays(new Date(), -7);
-            List<EnquiryDTO> enquiryList =
-                    this.enquiryList(
-                            target.getSiteCode(),
-                            DateUtil.formatDate(start, DateUtil.DATE_TIME_FORMAT),
-                            DateUtil.formatDate(new Date(), DateUtil.DATE_TIME_FORMAT));
-
-            if (enquiryList != null) {
-                List<String> enquiryUniqueIds =
-                        enquiryList.stream()
-                                .map(enquiry -> enquiry.getSiteHost() + enquiry.getRecordId())
-                                .collect(Collectors.toList());
-
-                adwebRedisUtil.set(
-                        EnquiryUniqueKey + target.getSiteHost(), enquiryUniqueIds, 60 * 60 * 24);
-            }
-        }
+      adwebRedisUtil.set(EnquiryUniqueKey + target.getSiteHost(), enquiryUniqueIds, 60 * 60 * 24);
 
-        try {
-            this.save(target);
-            adwebEnquiryFormService.save(form);
+    } else {
+      Date start = DateUtil.addDays(new Date(), -7);
+      List<EnquiryDTO> enquiryList =
+          this.enquiryList(
+              target.getSiteCode(),
+              DateUtil.formatDate(start, DateUtil.DATE_TIME_FORMAT),
+              DateUtil.formatDate(new Date(), DateUtil.DATE_TIME_FORMAT));
 
-        } catch (Exception e) {
-            log.error(
-                    "站点为:{},  recordId为:{} 保存询盘到数据库失败,原因是:{}",
-                    adwebSite.getName(),
-                    enquiryDto.getRecordId(),
-                    e.getMessage());
-        }
+      if (enquiryList != null) {
+        List<String> enquiryUniqueIds =
+            enquiryList.stream()
+                .map(enquiry -> enquiry.getSiteHost() + enquiry.getRecordId())
+                .collect(Collectors.toList());
 
-        // 站内websocket通知
-        AdwebSite targetSite = adwebSiteService.getSiteByCode(target.getSiteCode());
-        SysUser sysUser = sysUserService.getUserByName("admin");
-        String[] userIds = {targetSite.getUid(), sysUser.getId()};
-        webSocketService.sendMessage(userIds, "询盘通知", "您已经收到询盘,请尽快处理", WebsocketConst.CMD_ENQUIRY);
-
-        // 发送询盘邮件
-        sendValidateEmail(target, adwebSite, principalEmailMap);
-    }
-
-    /**
-     * 发送询盘邮件
-     *
-     * @param adwebEnquiry 待发送询盘列表
-     * @param adwebSite 接收邮箱集合
-     * @param principalEmailMap
-     */
-    private void sendValidateEmail(
-            AdwebEnquiry adwebEnquiry, AdwebSite adwebSite, Map<String, String> principalEmailMap) {
-        log.info("需要发送邮件的询盘:{}", FastJsonUtil.toJSONString(adwebEnquiry.getId()));
-
-        // 特殊站点发送邮件
-        List<DictPropertyModel> siteRes =
-                sysAdwebApiImpl.queryDictInfoByDictCode("turn_inquiry_site_code");
-        if (CollectionUtils.isNotEmpty(siteRes)
-                && siteRes.get(0).getValue().equals(adwebSite.getCode())) {
-            log.info("该询盘:{}, 是特殊站点发送邮件", adwebEnquiry.getId());
-            specialSendEmail(adwebEnquiry, adwebSite);
-        } else {
-            String emailStr = adwebSite.getEnquiryEmailList();
-            if (StringUtil.isEmpty(emailStr)) {
-                log.info("未获取到站点邮箱");
-                return;
-            }
-            log.info("发送询盘邮件--站点邮箱:{}", emailStr);
-            log.info("发送询盘邮件--子账户邮箱:{}", FastJsonUtil.toJSONString(principalEmailMap));
+        adwebRedisUtil.set(EnquiryUniqueKey + target.getSiteHost(), enquiryUniqueIds, 60 * 60 * 24);
+      }
+    }
+    // 记录结束时间
+    long endTime = System.currentTimeMillis();
+    log.info(
+        "站点:{},询盘ID:{} 唯一性条件处理耗时:{} ms",
+        enquiryDto.getSiteHost(),
+        enquiryDto.getRecordId(),
+        endTime - startTime);
+
+    try {
+      this.save(target);
+      adwebEnquiryFormService.save(form);
+
+    } catch (Exception e) {
+      log.error(
+          "站点为:{},询盘ID:{} 保存询盘到数据库失败,原因是:{}",
+          adwebSite.getName(),
+          enquiryDto.getRecordId(),
+          e.getMessage());
+    }
 
-            List<String> emailList = JSON.parseArray(emailStr, String.class);
-            if (CollectionUtils.isEmpty(emailList)) {
-                return;
+    // 记录开始时间
+    long startTimeWBS = System.currentTimeMillis();
+    // 站内websocket通知
+    AdwebSite targetSite = adwebSiteService.getSiteByCode(target.getSiteCode());
+    SysUser sysUser = sysUserService.getUserByName("admin");
+    String[] userIds = {targetSite.getUid(), sysUser.getId()};
+    webSocketService.sendMessage(userIds, "询盘通知", "您已经收到询盘,请尽快处理", WebsocketConst.CMD_ENQUIRY);
+    // 记录开始时间
+    long endTimeWBS = System.currentTimeMillis();
+
+    log.info(
+        "站点:{},询盘ID:{} 处理websocket消息耗时:{} ms",
+        enquiryDto.getSiteHost(),
+        enquiryDto.getRecordId(),
+        endTimeWBS - startTimeWBS);
+
+    // 发送询盘邮件
+    sendValidateEmail(target, adwebSite, principalEmailMap);
+  }
+
+  /**
+   * 发送询盘邮件
+   *
+   * @param adwebEnquiry 待发送询盘列表
+   * @param adwebSite 接收邮箱集合
+   * @param principalEmailMap
+   */
+  private void sendValidateEmail(
+      AdwebEnquiry adwebEnquiry, AdwebSite adwebSite, Map<String, String> principalEmailMap) {
+    log.info("需要发送邮件的询盘:{}", FastJsonUtil.toJSONString(adwebEnquiry.getId()));
+
+    // 特殊站点发送邮件
+    List<DictPropertyModel> siteRes =
+        sysAdwebApiImpl.queryDictInfoByDictCode("turn_inquiry_site_code");
+    if (CollectionUtils.isNotEmpty(siteRes)
+        && siteRes.get(0).getValue().equals(adwebSite.getCode())) {
+      log.info("该询盘:{}, 是特殊站点发送邮件", adwebEnquiry.getId());
+      specialSendEmail(adwebEnquiry, adwebSite);
+    } else {
+      String emailStr = adwebSite.getEnquiryEmailList();
+      if (StringUtil.isEmpty(emailStr)) {
+        log.info("未获取到站点邮箱");
+        return;
+      }
+      log.info("发送询盘邮件--站点邮箱:{}", emailStr);
+      log.info("发送询盘邮件--子账户邮箱:{}", FastJsonUtil.toJSONString(principalEmailMap));
+
+      List<String> emailList = JSON.parseArray(emailStr, String.class);
+      if (CollectionUtils.isEmpty(emailList)) {
+        return;
+      }
+
+      List<EnquiryEmailMessage> enquiryEmailMessageList = new ArrayList<>();
+
+      if (adwebEnquiry.getWasteEnquiry() != 1 && adwebEnquiry.getStatus() != 0) {
+        HashSet<String> emailSet = new HashSet<>();
+        String priUid = adwebEnquiry.getPrincipalUid();
+
+        if (principalEmailMap.isEmpty()) {
+          for (String e : emailList) {
+            if (emailSet.contains(e)) {
+              continue;
             }
-
-            List<EnquiryEmailMessage> enquiryEmailMessageList = new ArrayList<>();
-
-            if (adwebEnquiry.getWasteEnquiry() != 1 && adwebEnquiry.getStatus() != 0) {
-                HashSet<String> emailSet = new HashSet<>();
-                String priUid = adwebEnquiry.getPrincipalUid();
-
-                if (principalEmailMap.isEmpty()) {
-                    for (String e : emailList) {
-                        if (emailSet.contains(e)) {
-                            continue;
-                        }
-                        enquiryEmailMessageList.add(newEmail(adwebEnquiry, e));
-                        emailSet.add(e);
-                    }
-                }
-                // 1 如果选择发送全部 2.不是产品页面 全发
-                else if (StringUtil.isEmpty(adwebEnquiry.getPrincipalUid())
-                        || adwebEnquiry.getExistProductEnquiry() == null
-                        || adwebEnquiry.getExistProductEnquiry() == 0
-                        || adwebEnquiry.getPrincipalUid().equals("ALL")) {
-                    if (adwebSite.getEnquirySendEmailType().equals("ALL")) {
-                        log.info("发送询盘邮件--不是产品--进行所有账号发送规则");
-                        for (String e : principalEmailMap.values()) {
-                            if (emailSet.contains(e)) {
-                                continue;
-                            }
-                            enquiryEmailMessageList.add(newEmail(adwebEnquiry, e));
-                            emailSet.add(e);
-                        }
-                    } else {
-                        // 询盘邮件规则 主账号和添加了的负责人,如果负责人选择了all取所有人
-                        log.info("发送询盘邮件--不是产品--进行只有主账号发送规则--负责人不为all");
-                        if (!"ALL".equals(adwebEnquiry.getPrincipalUid())) {
-                            // 主账号
-                            SysUser masterUserAccount =
-                                    sysUserService.getById(adwebEnquiry.getUid());
-                            if (masterUserAccount != null
-                                    && StringUtils.isNotBlank(masterUserAccount.getEmail())) {
-                                emailSet.add(masterUserAccount.getEmail());
-                                enquiryEmailMessageList.add(
-                                        newEmail(adwebEnquiry, masterUserAccount.getEmail()));
-                            }
-                            // 负责人
-                            for (String key : principalEmailMap.keySet()) {
-                                if (adwebEnquiry.getPrincipalUid().equals(key)
-                                        && !emailSet.contains(principalEmailMap.get(key))) {
-                                    enquiryEmailMessageList.add(
-                                            newEmail(adwebEnquiry, principalEmailMap.get(key)));
-                                    emailSet.add(principalEmailMap.get(key));
-                                }
-                            }
-                        } else {
-                            // 判断是否走同步询盘,同步询盘不进行全部处理
-                            log.info("发送询盘邮件--不是产品--进行只有主账号发送规则--负责人为all");
-                            if (StringUtil.isEmpty(adwebEnquiry.getIsEnquirySync())) {
-                                for (String e : principalEmailMap.values()) {
-                                    if (emailSet.contains(e)) {
-                                        continue;
-                                    }
-                                    enquiryEmailMessageList.add(newEmail(adwebEnquiry, e));
-                                    emailSet.add(e);
-                                }
-                            } else {
-                                // 主账号
-                                SysUser masterUserAccount =
-                                        sysUserService.getById(adwebEnquiry.getUid());
-                                if (masterUserAccount != null
-                                        && StringUtils.isNotBlank(masterUserAccount.getEmail())) {
-                                    emailSet.add(masterUserAccount.getEmail());
-                                    enquiryEmailMessageList.add(
-                                            newEmail(adwebEnquiry, masterUserAccount.getEmail()));
-                                }
-                            }
-                        }
-                    }
-                    for (String e : emailList) {
-                        if (emailSet.contains(e)) {
-                            continue;
-                        }
-                        enquiryEmailMessageList.add(newEmail(adwebEnquiry, e));
-                        emailSet.add(e);
-                    }
-                }
-                // 当主站为空
-                else if (StringUtil.isEmpty(principalEmailMap.get(adwebEnquiry.getUid()))
-                        && adwebEnquiry.getExistProductEnquiry() == 1) {
-                    log.info("发送询盘邮件--产品询盘--当主站为空");
-                    String email = principalEmailMap.get(priUid);
-                    List<String> subSiteEmailList = null;
-                    if (StringUtils.isNotBlank(email)) {
-                        enquiryEmailMessageList.add(newEmail(adwebEnquiry, email));
-                        emailSet.add(email);
-                        // 筛选出子站点,不给子站点发,给配置询盘的地方发
-                        subSiteEmailList =
-                                principalEmailMap.entrySet().stream()
-                                        .filter(entry -> !email.equals(entry.getKey()))
-                                        .map(Map.Entry::getValue)
-                                        .collect(Collectors.toList());
-                    } else {
-                        subSiteEmailList = new ArrayList<>(principalEmailMap.values());
-                    }
-
-                    // 遍历emailList 不包含subSiteEmailList
-                    for (String e : emailList) {
-                        if (subSiteEmailList.contains(e) || emailSet.contains(e)) {
-                            continue;
-                        }
-                        enquiryEmailMessageList.add(newEmail(adwebEnquiry, e));
-                        emailSet.add(e);
-                    }
-                }
-                // 如果当前询盘配置的为子账户 则给子账户和主账户发
-                else if (adwebEnquiry.getExistProductEnquiry() == 1
-                        && !adwebEnquiry.getUid().equals(priUid)) {
-                    log.info("发送询盘邮件--产品询盘--如果当前询盘配置的为子账户 则给子账户和主账户发");
-                    String email = principalEmailMap.get(priUid);
-                    if (StringUtils.isNotBlank(email)) {
-                        enquiryEmailMessageList.add(newEmail(adwebEnquiry, email));
-                        emailSet.add(email);
-                    }
-
-                    // 给主账户发
-                    String masterEmail = principalEmailMap.get(adwebEnquiry.getUid());
-
-                    enquiryEmailMessageList.add(newEmail(adwebEnquiry, masterEmail));
-                    emailSet.add(masterEmail);
-
-                    // 筛选出子站点,不给子站点发,给配置询盘的地方发
-                    List<String> subSiteEmailList =
-                            principalEmailMap.entrySet().stream()
-                                    .filter(
-                                            entry ->
-                                                    !Arrays.asList(email, masterEmail)
-                                                            .contains(entry.getKey()))
-                                    .map(Map.Entry::getValue)
-                                    .toList();
-
-                    // 遍历emailList 不包含subSiteEmailList
-                    for (String e : emailList) {
-                        if (subSiteEmailList.contains(e) || emailSet.contains(e)) {
-                            continue;
-                        }
-                        enquiryEmailMessageList.add(newEmail(adwebEnquiry, e));
-                        emailSet.add(e);
-                    }
-                }
-                // 如果当前询盘配置的为主账户 则只给主账户发 //还有一种情况 子账户为空 只给主站发
-                else if (adwebEnquiry.getUid().equals(priUid)
-                        && adwebEnquiry.getExistProductEnquiry() == 1) {
-                    log.info("发送询盘邮件--产品询盘--如果当前询盘配置的为主账户 则只给主账户发 //还有一种情况 子账户为空 只给主站发");
-                    String email = principalEmailMap.get(priUid);
-                    enquiryEmailMessageList.add(newEmail(adwebEnquiry, email));
-                    emailSet.add(email);
-
-                    // 筛选出子站点,不给子站点发,给配置询盘的地方发
-                    List<String> subSiteEmailList =
-                            principalEmailMap.entrySet().stream()
-                                    .filter(entry -> !entry.getKey().equals(priUid))
-                                    .map(Map.Entry::getValue)
-                                    .toList();
-
-                    // 遍历emailList 不包含subSiteEmailList
-                    for (String e : emailList) {
-                        if (subSiteEmailList.contains(e) || emailSet.contains(e)) {
-                            continue;
-                        }
-                        enquiryEmailMessageList.add(newEmail(adwebEnquiry, e));
-                        emailSet.add(e);
-                    }
-                }
-
-                log.info("=======发送询盘邮件======");
-                enquiryEmailMessageList.forEach(e -> System.out.println(e.getEmail()));
-                log.info("需要添加的询盘邮件:{}", FastJsonUtil.toJSONString(enquiryEmailMessageList));
-                if (CollectionUtils.isNotEmpty(enquiryEmailMessageList)) {
-                    LambdaQueryWrapper<EnquiryEmailMessage> enquiryEmailMessageQueryWrapper =
-                            new LambdaQueryWrapper<>();
-                    enquiryEmailMessageQueryWrapper.eq(
-                            EnquiryEmailMessage::getSiteCode, adwebSite.getCode());
-                    List<EnquiryEmailMessage> enquiryEmailMessages =
-                            enquiryEmailMessageService.list(enquiryEmailMessageQueryWrapper);
-                    List<EnquiryEmailMessage> sameEnquiryEmailMessageList = new ArrayList<>();
-                    if (CollectionUtils.isNotEmpty(enquiryEmailMessages)) {
-                        for (EnquiryEmailMessage enquiryEmailMessage : enquiryEmailMessages) {
-                            for (EnquiryEmailMessage enquiryEmailMessage1 :
-                                    enquiryEmailMessageList) {
-                                if (enquiryEmailMessage
-                                                .getEnquiryId()
-                                                .equals(enquiryEmailMessage1.getEnquiryId())
-                                        && enquiryEmailMessage
-                                                .getEmail()
-                                                .equals(enquiryEmailMessage1.getEmail())) {
-                                    sameEnquiryEmailMessageList.add(enquiryEmailMessage1);
-                                }
-                            }
-                        }
-                        enquiryEmailMessageList.removeAll(sameEnquiryEmailMessageList);
-                    }
-                    log.info("最终添加的询盘邮件:{}", FastJsonUtil.toJSONString(enquiryEmailMessageList));
-                    enquiryEmailMessageService.saveBatch(enquiryEmailMessageList);
-                    try {
-                        for (EnquiryEmailMessage message : enquiryEmailMessageList) {
-                            JedisUtil.lpush(
-                                    redisKey, ObjectUtil.object2Bytes(message.getEnquiryId()));
-                            JedisUtil.publishMsg(
-                                    EnquiryConstants.ENQUIRY_EMAIL_CHANNEL,
-                                    EnquiryConstants.ENQUIRY_EMAIL);
-                        }
-                    } catch (Exception e) {
-                        log.info("推送发送询盘邮件的消息失败", e);
-                    }
-                }
-            } else {
-                log.info("=======该垃圾询盘不发送询盘邮件======{}", adwebEnquiry.getId());
+            enquiryEmailMessageList.add(newEmail(adwebEnquiry, e));
+            emailSet.add(e);
+          }
+        }
+        // 1 如果选择发送全部 2.不是产品页面 全发
+        else if (StringUtil.isEmpty(adwebEnquiry.getPrincipalUid())
+            || adwebEnquiry.getExistProductEnquiry() == null
+            || adwebEnquiry.getExistProductEnquiry() == 0
+            || adwebEnquiry.getPrincipalUid().equals("ALL")) {
+          if (adwebSite.getEnquirySendEmailType().equals("ALL")) {
+            log.info("发送询盘邮件--不是产品--进行所有账号发送规则");
+            for (String e : principalEmailMap.values()) {
+              if (emailSet.contains(e)) {
+                continue;
+              }
+              enquiryEmailMessageList.add(newEmail(adwebEnquiry, e));
+              emailSet.add(e);
             }
-        }
-    }
-
-    /**
-     * 特殊账号发送邮件
-     *
-     * @param adwebEnquiry
-     * @param adwebSite
-     */
-    public void specialSendEmail(AdwebEnquiry adwebEnquiry, AdwebSite adwebSite) {
-        // 通过主账号id获取子账号id集合
-        List<String> idList =
-                masterSubAccountRelationService.getSubAccountIdByMaster(adwebSite.getUid());
-
-        // 获取子账号信息
-        // TODO chenpeiqing: 字段在V3中不存在
-        QueryWrapper<SysUser> sysUserQueryWrapper = new QueryWrapper<>();
-        sysUserQueryWrapper.eq("is_inquiry", 2);
-        sysUserQueryWrapper.eq("status", 1);
-        if (CollectionUtils.isNotEmpty(idList)) {
-            sysUserQueryWrapper.in("id", idList);
-        }
-        List<SysUser> sysUsers = sysUserService.list(sysUserQueryWrapper);
-
-        List<EnquiryEmailMessage> enquiryEmailMessageList = new ArrayList<>();
-        if (adwebEnquiry.getWasteEnquiry() != 1 && adwebEnquiry.getStatus() != 0) {
-            // 当前发送邮件的账号
-            SysUser sysUser = new SysUser();
-
-            // 如果没有子账号,则只给主账号发送邮件
-            if (CollectionUtils.isEmpty(sysUsers)) {
-                // 获取主账号
-                SysUser mainUser = sysUserService.getById(adwebSite.getUid());
-                // 主账号邮件信息添加
-                if (mainUser != null && StringUtils.isNotBlank(mainUser.getEmail())) {
-                    enquiryEmailMessageList.add(newEmail(adwebEnquiry, mainUser.getEmail()));
+          } else {
+            // 询盘邮件规则 主账号和添加了的负责人,如果负责人选择了all取所有人
+            log.info("发送询盘邮件--不是产品--进行只有主账号发送规则--负责人不为all");
+            if (!"ALL".equals(adwebEnquiry.getPrincipalUid())) {
+              // 主账号
+              SysUser masterUserAccount = sysUserService.getById(adwebEnquiry.getUid());
+              if (masterUserAccount != null
+                  && StringUtils.isNotBlank(masterUserAccount.getEmail())) {
+                emailSet.add(masterUserAccount.getEmail());
+                enquiryEmailMessageList.add(newEmail(adwebEnquiry, masterUserAccount.getEmail()));
+              }
+              // 负责人
+              for (String key : principalEmailMap.keySet()) {
+                if (adwebEnquiry.getPrincipalUid().equals(key)
+                    && !emailSet.contains(principalEmailMap.get(key))) {
+                  enquiryEmailMessageList.add(newEmail(adwebEnquiry, principalEmailMap.get(key)));
+                  emailSet.add(principalEmailMap.get(key));
                 }
+              }
             } else {
-                // 轮流发送邮件逻辑处理
-                List<SubUserEmail> list = subUserEmailService.list();
-                if (CollectionUtils.isEmpty(list)) {
-                    sysUser = sysUsers.get(0);
-                } else {
-                    SubUserEmail subUserEmail = list.get(0);
-                    subUserEmailService.removeAll();
-
-                    SysUser user = sysUserService.getById(subUserEmail.getId());
-                    int index = sysUsers.indexOf(user);
-                    if (index == -1 || index == sysUsers.size() - 1) {
-                        sysUser = sysUsers.get(0);
-                    } else {
-                        sysUser = sysUsers.get(index + 1);
-                    }
-                }
-                SubUserEmail subUserEmail = new SubUserEmail();
-                subUserEmail.setId(sysUser.getId());
-                subUserEmail.setSid(adwebSite.getId());
-                subUserEmail.setUsername(sysUser.getUsername());
-                subUserEmail.setRealname(sysUser.getRealname());
-                subUserEmailService.save(subUserEmail);
-                // 子账号邮件信息添加
-                enquiryEmailMessageList.add(newEmail(adwebEnquiry, sysUser.getEmail()));
-
-                // 修改询盘信息的跟进人信息
-                adwebEnquiry.setPrincipalUid(sysUser.getId());
-                adwebEnquiryMapper.updateById(adwebEnquiry);
-
-                // 获取主账号
-                SysUser mainUser = sysUserService.getById(adwebSite.getUid());
-                // 主账号邮件信息添加
-                if (mainUser != null && StringUtils.isNotBlank(mainUser.getEmail())) {
-                    enquiryEmailMessageList.add(newEmail(adwebEnquiry, mainUser.getEmail()));
-                }
-            }
-            log.info("=======发送询盘邮件======");
-
-            enquiryEmailMessageList.forEach(e -> System.out.println(e.getEmail()));
-            log.info("需要添加的询盘邮件:{}", FastJsonUtil.toJSONString(enquiryEmailMessageList));
-            if (CollectionUtils.isNotEmpty(enquiryEmailMessageList)) {
-                LambdaQueryWrapper<EnquiryEmailMessage> enquiryEmailMessageQueryWrapper =
-                        new LambdaQueryWrapper<>();
-                enquiryEmailMessageQueryWrapper.eq(
-                        EnquiryEmailMessage::getSiteCode, adwebSite.getCode());
-                List<EnquiryEmailMessage> enquiryEmailMessages =
-                        enquiryEmailMessageService.list(enquiryEmailMessageQueryWrapper);
-                List<EnquiryEmailMessage> sameEnquiryEmailMessageList = new ArrayList<>();
-                if (CollectionUtils.isNotEmpty(enquiryEmailMessages)) {
-                    for (EnquiryEmailMessage enquiryEmailMessage : enquiryEmailMessages) {
-                        for (EnquiryEmailMessage enquiryEmailMessage1 : enquiryEmailMessageList) {
-                            if (enquiryEmailMessage
-                                            .getEnquiryId()
-                                            .equals(enquiryEmailMessage1.getEnquiryId())
-                                    && enquiryEmailMessage
-                                            .getEmail()
-                                            .equals(enquiryEmailMessage1.getEmail())) {
-                                sameEnquiryEmailMessageList.add(enquiryEmailMessage1);
-                            }
-                        }
-                    }
-                    enquiryEmailMessageList.removeAll(sameEnquiryEmailMessageList);
+              // 判断是否走同步询盘,同步询盘不进行全部处理
+              log.info("发送询盘邮件--不是产品--进行只有主账号发送规则--负责人为all");
+              if (StringUtil.isEmpty(adwebEnquiry.getIsEnquirySync())) {
+                for (String e : principalEmailMap.values()) {
+                  if (emailSet.contains(e)) {
+                    continue;
+                  }
+                  enquiryEmailMessageList.add(newEmail(adwebEnquiry, e));
+                  emailSet.add(e);
                 }
-                log.info("最终添加的询盘邮件:{}", FastJsonUtil.toJSONString(enquiryEmailMessageList));
-                enquiryEmailMessageService.saveBatch(enquiryEmailMessageList);
-                try {
-                    for (EnquiryEmailMessage message : enquiryEmailMessageList) {
-                        JedisUtil.lpush(redisKey, ObjectUtil.object2Bytes(message.getEnquiryId()));
-                        JedisUtil.publishMsg(
-                                EnquiryConstants.ENQUIRY_EMAIL_CHANNEL,
-                                EnquiryConstants.ENQUIRY_EMAIL);
-                    }
-                    SysUser user = sysUserService.getById(adwebEnquiry.getPrincipalUid());
-                    if (StringUtils.isNotBlank(adwebEnquiry.getRecordId())) {
-                        returnSalesperson(
-                                adwebSite.getCode(),
-                                adwebEnquiry.getRecordId(),
-                                user.getUsername());
-                    }
-                } catch (Exception e) {
-                    log.error("推送发送询盘邮件的消息失败", e);
+              } else {
+                // 主账号
+                SysUser masterUserAccount = sysUserService.getById(adwebEnquiry.getUid());
+                if (masterUserAccount != null
+                    && StringUtils.isNotBlank(masterUserAccount.getEmail())) {
+                  emailSet.add(masterUserAccount.getEmail());
+                  enquiryEmailMessageList.add(newEmail(adwebEnquiry, masterUserAccount.getEmail()));
                 }
+              }
             }
-
-        } else {
-            log.info("=======该垃圾询盘在特殊站点中不发送询盘邮件======{}", adwebEnquiry.getId());
-        }
-    }
-
-    /**
-     * 根据询盘信息创建邮件发送记录
-     *
-     * @param adwebEnquiry 询盘信息
-     * @param email 接收邮箱
-     * @return
-     */
-    private static EnquiryEmailMessage newEmail(AdwebEnquiry adwebEnquiry, String email) {
-        EnquiryEmailMessage enquiryEmailMessage = new EnquiryEmailMessage();
-        enquiryEmailMessage.setEnquiryId(adwebEnquiry.getId());
-        enquiryEmailMessage.setEmail(email);
-        enquiryEmailMessage.setFromEmail(adwebEnquiry.getFromEmail());
-        enquiryEmailMessage.setCreateTime(new Date());
-        enquiryEmailMessage.setSiteCode(adwebEnquiry.getSiteCode());
-        enquiryEmailMessage.setSendStatus(EnquirySendStatus.WAIT_SEND);
-        enquiryEmailMessage.setSendErrorNum(0);
-
-        return enquiryEmailMessage;
-    }
-
-    /**
-     * 通过询盘中的ip字段,获取国家信息并放在询盘对象种
-     *
-     * @param enquiry 询盘对象
-     */
-    private void setCountryByIp(AdwebEnquiry enquiry) {
-        CountryAreaApiDto countryAreaApiDto = geoIpUtil.getCountryAndAreaByIp(enquiry.getFromIp());
-        if (countryAreaApiDto != null) {
-            String countryCode = countryAreaApiDto.getCountryIsoCode();
-            if ("TW".equals(countryCode)) {
-                countryCode = "CN";
+          }
+          for (String e : emailList) {
+            if (emailSet.contains(e)) {
+              continue;
             }
-            String countryName = countryAreaApiDto.getCountryZhCN();
-            if ("中华民国".equals(countryName)) {
-                countryName = "中国";
+            enquiryEmailMessageList.add(newEmail(adwebEnquiry, e));
+            emailSet.add(e);
+          }
+        }
+        // 当主站为空
+        else if (StringUtil.isEmpty(principalEmailMap.get(adwebEnquiry.getUid()))
+            && adwebEnquiry.getExistProductEnquiry() == 1) {
+          log.info("发送询盘邮件--产品询盘--当主站为空");
+          String email = principalEmailMap.get(priUid);
+          List<String> subSiteEmailList = null;
+          if (StringUtils.isNotBlank(email)) {
+            enquiryEmailMessageList.add(newEmail(adwebEnquiry, email));
+            emailSet.add(email);
+            // 筛选出子站点,不给子站点发,给配置询盘的地方发
+            subSiteEmailList =
+                principalEmailMap.entrySet().stream()
+                    .filter(entry -> !email.equals(entry.getKey()))
+                    .map(Map.Entry::getValue)
+                    .collect(Collectors.toList());
+          } else {
+            subSiteEmailList = new ArrayList<>(principalEmailMap.values());
+          }
+
+          // 遍历emailList 不包含subSiteEmailList
+          for (String e : emailList) {
+            if (subSiteEmailList.contains(e) || emailSet.contains(e)) {
+              continue;
             }
-            enquiry.setCountryCode(countryCode);
-            enquiry.setCountryName(countryName);
-            if (StringUtils.isBlank(enquiry.getCountry())) {
-                enquiry.setCountry(countryName);
+            enquiryEmailMessageList.add(newEmail(adwebEnquiry, e));
+            emailSet.add(e);
+          }
+        }
+        // 如果当前询盘配置的为子账户 则给子账户和主账户发
+        else if (adwebEnquiry.getExistProductEnquiry() == 1
+            && !adwebEnquiry.getUid().equals(priUid)) {
+          log.info("发送询盘邮件--产品询盘--如果当前询盘配置的为子账户 则给子账户和主账户发");
+          String email = principalEmailMap.get(priUid);
+          if (StringUtils.isNotBlank(email)) {
+            enquiryEmailMessageList.add(newEmail(adwebEnquiry, email));
+            emailSet.add(email);
+          }
+
+          // 给主账户发
+          String masterEmail = principalEmailMap.get(adwebEnquiry.getUid());
+
+          enquiryEmailMessageList.add(newEmail(adwebEnquiry, masterEmail));
+          emailSet.add(masterEmail);
+
+          // 筛选出子站点,不给子站点发,给配置询盘的地方发
+          List<String> subSiteEmailList =
+              principalEmailMap.entrySet().stream()
+                  .filter(entry -> !Arrays.asList(email, masterEmail).contains(entry.getKey()))
+                  .map(Map.Entry::getValue)
+                  .toList();
+
+          // 遍历emailList 不包含subSiteEmailList
+          for (String e : emailList) {
+            if (subSiteEmailList.contains(e) || emailSet.contains(e)) {
+              continue;
             }
-        } else {
-            enquiry.setCountryCode("0000");
-            enquiry.setCountryName("其它");
-        }
-    }
-
-    /**
-     * 根据询盘对象和站点,构建一个本系统中的询盘对象
-     *
-     * @param enquiryDto 询盘对象
-     * @param adwebSite 询盘所属站点
-     * @return 本系统中的询盘队形
-     */
-    private AdwebEnquiry createEnquiry(EnquiryDTO enquiryDto, AdwebSite adwebSite) {
-        AdwebEnquiry adwebEnquiry = new AdwebEnquiry();
-        adwebEnquiry.setId(snowflakeIdUtil.nextId());
-        adwebEnquiry.setCtime(new Date());
-        adwebEnquiry.setStatus(1);
-        adwebEnquiry.setVisitId(enquiryDto.getVisitId());
-        adwebEnquiry.setSiteId(adwebSite.getId());
-        adwebEnquiry.setUid(adwebSite.getUid());
-        adwebEnquiry.setFromIp(enquiryDto.getFromIp());
-        adwebEnquiry.setFromEmail(enquiryDto.getFromEmail());
-        adwebEnquiry.setPluginName(enquiryDto.getPluginName());
-        adwebEnquiry.setRecordId(enquiryDto.getRecordId());
-        adwebEnquiry.setModifyRecordCtime(
-                geoIpUtil.getLocalhostTime(enquiryDto.getFromIp(), enquiryDto.getRecordCtime()));
-        adwebEnquiry.setRecordCtime(enquiryDto.getRecordCtime());
-        adwebEnquiry.setSiteCode(adwebSite.getCode());
-        adwebEnquiry.setModular(enquiryDto.getPluginName());
-        adwebEnquiry.setSysEffective(NumConstant.ONE);
-        adwebEnquiry.setUserEffective(NumConstant.TWO);
-        adwebEnquiry.setSiteHost(enquiryDto.getSiteHost());
-        adwebEnquiry.setNo(
-                "xp"
-                        + DateUtil.formatDate(new Date(), DateUtil.DATE_FORMAT)
-                        + adwebOpenApiService.loadNo(adwebSite.getCode()));
-
-        // 外部编号暂无作用,且多查询一次数据库,暂时注释
-        //        adwebEnquiry.setNoOut(DateUtil.dateToString(new Date(),
-        // DateUtil.DATE_FORMAT_THREE) + adwebOpenApiService.loadOutNoByUser(adwebSite.getUid()));
-        adwebEnquiry.setWasteEnquiry(0);
-        adwebEnquiry.setRequestTime(new Date());
-        adwebEnquiry.setAcquireMessageTime(adwebSite.getEnquiryMessageTime());
-        adwebEnquiry.setIsEnquirySync("enquirySync");
-
-        ObjectMapper objectMapper = new ObjectMapper();
-        try {
-            String jsonString = objectMapper.writeValueAsString(enquiryDto.getCartItems());
-            adwebEnquiry.setCartItems(jsonString);
-        } catch (JsonProcessingException e) {
-            // 记录异常信息
-            System.err.println("Error serializing cart items to JSON: " + e.getMessage());
-            // 可以选择记录更详细的堆栈跟踪信息
-            log.error(e.getMessage(), e);
-        }
-        return adwebEnquiry;
-    }
-
-    /**
-     * 解析form,将form中的字段加入到询盘对象种
-     *
-     * @param enquiry 询盘对象
-     * @param form 询盘表单信息
-     */
-    private void parseFormAndSetFields(AdwebEnquiry enquiry, String form, AdwebSite adwebSite) {
-        long startTime = System.currentTimeMillis();
-
-        List<String> nameKeys = this.getFormKeys("wp-name");
-        List<String> emailKeys = this.getFormKeys("wp-email");
-        List<String> messageKeys = this.getFormKeys("wp-content");
-        List<String> companyKeys = this.getFormKeys("wp-company");
-        List<String> fromPageKeys = this.getFormKeys("wp-page");
-        List<String> phoneKeys = this.getFormKeys("wp-phone");
-        List<String> whatsAppKeys = this.getFormKeys("wp-whatsapp");
-        List<String> countryKeys = this.getFormKeys("wp-country");
-        List<String> customerIpKeys = this.getFormKeys("wp-customerip");
-        List<String> addressKeys = this.getFormKeys("wp-address");
-
-        List<String> errorObjNames = new ArrayList<>();
-        Collection<JSONObject> formItems = null;
-        Map<String, JSONObject> formObj = FastJsonUtil.parseObject(form, Map.class);
-        if (formObj == null || formObj.size() == 0) {
-            List<JSONObject> formList = FastJsonUtil.parseObject(form, List.class);
-            if (CollectionUtils.isNotEmpty(formList)) {
-                formItems = formList;
+            enquiryEmailMessageList.add(newEmail(adwebEnquiry, e));
+            emailSet.add(e);
+          }
+        }
+        // 如果当前询盘配置的为主账户 则只给主账户发 //还有一种情况 子账户为空 只给主站发
+        else if (adwebEnquiry.getUid().equals(priUid)
+            && adwebEnquiry.getExistProductEnquiry() == 1) {
+          log.info("发送询盘邮件--产品询盘--如果当前询盘配置的为主账户 则只给主账户发 //还有一种情况 子账户为空 只给主站发");
+          String email = principalEmailMap.get(priUid);
+          enquiryEmailMessageList.add(newEmail(adwebEnquiry, email));
+          emailSet.add(email);
+
+          // 筛选出子站点,不给子站点发,给配置询盘的地方发
+          List<String> subSiteEmailList =
+              principalEmailMap.entrySet().stream()
+                  .filter(entry -> !entry.getKey().equals(priUid))
+                  .map(Map.Entry::getValue)
+                  .toList();
+
+          // 遍历emailList 不包含subSiteEmailList
+          for (String e : emailList) {
+            if (subSiteEmailList.contains(e) || emailSet.contains(e)) {
+              continue;
             }
-        } else {
-            formItems = formObj.values();
-        }
-
-        List<EnquirySpecialFields> specialFieldsList = new ArrayList<>();
-        for (JSONObject formItem : formItems) {
-            String formItemName = formItem.getString("name");
-            String formItemValue = formItem.getString("value");
-
-            if (contains(nameKeys, formItemName)) {
-                enquiry.setName(formItemValue);
-            } else if (contains(emailKeys, formItemName)) {
-                enquiry.setEmail(formItemValue);
-            } else if (contains(messageKeys, formItemName)) {
-                enquiry.setMessage(formItemValue);
-            } else if (contains(companyKeys, formItemName)) {
-                enquiry.setCompany(formItemValue);
-            } else if (contains(fromPageKeys, formItemName)) {
-                enquiry.setFromPage(formItemValue);
-            } else if (contains(phoneKeys, formItemName)) {
-                enquiry.setPhone(formItemValue);
-            } else if (contains(whatsAppKeys, formItemName)) {
-                enquiry.setWhatsApp(formItemValue);
-            } else if (contains(countryKeys, formItemName)) {
-                enquiry.setCountry(formItemValue);
-            } else if (contains(customerIpKeys, formItemName)) {
-                enquiry.setCustomerIp(formItemValue);
-            } else if (contains(addressKeys, formItemName)) {
-                enquiry.setAddress(formItemValue);
-            } else {
-                // 异常字段
-                errorObjNames.add(formItemName);
-                EnquirySpecialFields enquirySpecialFields = new EnquirySpecialFields();
-                enquirySpecialFields.setField(formItemName);
-                enquirySpecialFields.setValue(formItemValue);
-                specialFieldsList.add(enquirySpecialFields);
-            }
-        }
-
-        String specialField = FastJsonUtil.toJSONString(specialFieldsList);
-        enquiry.setSpecialField(specialField);
-
-        if (!errorObjNames.isEmpty()
-                || enquiry.getRecordCtime() == null
-                || StringUtil.isEmpty(enquiry.getMessage())
-                || StringUtil.isEmpty(enquiry.getEmail())
-                || StringUtil.isEmpty(enquiry.getFromPage())) {
-            // 发送飞书告警
-            StringBuilder msg =
-                    new StringBuilder(
-                            "询盘异常,\n询盘id:"
-                                    + enquiry.getId()
-                                    + ",\n站点名称:"
-                                    + adwebSite.getName()
-                                    + ",\n站点域名:"
-                                    + enquiry.getSiteHost()
-                                    + ",\n来源ip:"
-                                    + enquiry.getFromIp());
-            if (!errorObjNames.isEmpty()) {
-                msg.append(",\n字段异常,存在异常字段:");
-                for (String errorObjName : errorObjNames) {
-                    msg.append(errorObjName).append("、");
+            enquiryEmailMessageList.add(newEmail(adwebEnquiry, e));
+            emailSet.add(e);
+          }
+        }
+
+        log.info("=======发送询盘邮件======");
+        enquiryEmailMessageList.forEach(e -> System.out.println(e.getEmail()));
+        log.info("需要添加的询盘邮件:{}", FastJsonUtil.toJSONString(enquiryEmailMessageList));
+        if (CollectionUtils.isNotEmpty(enquiryEmailMessageList)) {
+          LambdaQueryWrapper<EnquiryEmailMessage> enquiryEmailMessageQueryWrapper =
+              new LambdaQueryWrapper<>();
+          enquiryEmailMessageQueryWrapper.eq(EnquiryEmailMessage::getSiteCode, adwebSite.getCode());
+          List<EnquiryEmailMessage> enquiryEmailMessages =
+              enquiryEmailMessageService.list(enquiryEmailMessageQueryWrapper);
+          List<EnquiryEmailMessage> sameEnquiryEmailMessageList = new ArrayList<>();
+          if (CollectionUtils.isNotEmpty(enquiryEmailMessages)) {
+            for (EnquiryEmailMessage enquiryEmailMessage : enquiryEmailMessages) {
+              for (EnquiryEmailMessage enquiryEmailMessage1 : enquiryEmailMessageList) {
+                if (enquiryEmailMessage.getEnquiryId().equals(enquiryEmailMessage1.getEnquiryId())
+                    && enquiryEmailMessage.getEmail().equals(enquiryEmailMessage1.getEmail())) {
+                  sameEnquiryEmailMessageList.add(enquiryEmailMessage1);
                 }
-                msg.deleteCharAt(msg.length() - 1);
-            }
-            if (enquiry.getRecordCtime() == null) {
-                msg.append(",\n询盘发送时间为空");
-            }
-            if (StringUtil.isEmpty(enquiry.getMessage())) {
-                msg.append(",\n询盘内容为空");
-            }
-            if (StringUtil.isEmpty(enquiry.getEmail())) {
-                msg.append(",\n邮箱内容为空");
+              }
             }
-            if (StringUtil.isEmpty(enquiry.getFromPage())) {
-                msg.append(",\n来源页面为空");
+            enquiryEmailMessageList.removeAll(sameEnquiryEmailMessageList);
+          }
+          log.info("最终添加的询盘邮件:{}", FastJsonUtil.toJSONString(enquiryEmailMessageList));
+          enquiryEmailMessageService.saveBatch(enquiryEmailMessageList);
+          try {
+            for (EnquiryEmailMessage message : enquiryEmailMessageList) {
+              JedisUtil.lpush(redisKey, ObjectUtil.object2Bytes(message.getEnquiryId()));
+              JedisUtil.publishMsg(
+                  EnquiryConstants.ENQUIRY_EMAIL_CHANNEL, EnquiryConstants.ENQUIRY_EMAIL);
             }
-            // 同一个站点,一天最多报错一次
-            String flag =
-                    adwebRedisUtil.getString(
-                            "forbidden_send_error_msg_by_enquiry_field_" + adwebSite.getDomain());
-            if (StringUtils.isNotBlank(flag)) {
-                log.info("同一个站点,一天最多报错一次,站点域名:" + adwebSite.getDomain());
-                return;
-            }
-            adwebRedisUtil.set(
-                    "forbidden_send_error_msg_by_enquiry_field_" + adwebSite.getDomain(),
-                    "forbidden",
-                    60 * 60 * 24);
-
-            // 异常入库
-            SysException exception = new SysException();
-            exception.setType(0);
-            exception.setFunctionModule("询盘字段配置异常");
-            exception.setExceptionDetail(msg.toString());
-            exception.setCreateTime(new Date());
-            exception.setStatus(1);
-            exception.setHandle(0);
-            exception.setPriority(1);
-            sysExceptionService.save(exception);
-
-            long diffTime = System.currentTimeMillis() - startTime;
-            String className = this.getClass().getName();
-            String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
-            feishuService.sendRobot(
-                    (float) diffTime / 1000,
-                    "wpforms-询盘警告:" + 0,
-                    className,
-                    methodName,
-                    String.valueOf(msg));
+          } catch (Exception e) {
+            log.info("推送发送询盘邮件的消息失败", e);
+          }
         }
+      } else {
+        log.info("=======该垃圾询盘不发送询盘邮件======{}", adwebEnquiry.getId());
+      }
     }
-
-    private boolean contains(List<String> keys, String key) {
-        if (CollectionUtils.isEmpty(keys) || StringUtil.isEmpty(key)) {
-            return false;
-        }
-        key = key.replace(":", "").replace(":", "").replaceAll(" {2,}", " ").toLowerCase().trim();
-        return keys.contains(key);
-    }
-
-    /**
-     * 根据字典code,获取相应数据在json中所有可能的key,用来解析json
-     *
-     * @param dictCode 字典code
-     * @return key的集合
-     */
-    private List<String> getFormKeys(String dictCode) {
-        String formKey = CacheConstant.SYS_DICT_CACHE + "::" + dictCode;
-        Object obj = adwebRedisUtil.get(formKey);
-        if (obj != null) {
-            List<String> keys = (List<String>) obj;
-            return keys;
-        }
-        List<SysDictItem> dictItems = sysAdwebApiImpl.selectItemsByDictCode(dictCode);
-        List<String> keys = new ArrayList<>();
-        if (CollectionUtils.isNotEmpty(dictItems)) {
-            for (SysDictItem item : dictItems) {
-                String value = item.getItemValue();
-                if (StringUtil.isEmpty(value)) {
-                    continue;
-                }
-                value = value.replaceAll(" {2,}", " ").toLowerCase().trim();
-                if (!keys.contains(value)) {
-                    keys.add(value);
-                }
-            }
-        }
-        adwebRedisUtil.set(formKey, keys, 60 * 60);
-        return keys;
-    }
-
-    /**
-     * 判断邮件是否是垃圾询盘 =》 基于站点黑名单 1、邮件过滤 2、根据邮件是否包含外部url过滤 3、根据关键词过滤
-     *
-     * @param adwebEnquiryList 询盘列表
-     */
-    private void judgeWasteEnquiryBySiteId(
-            List<AdwebEnquiry> adwebEnquiryList, AdwebSite adwebSite, List<String> blackWordList) {
-
-        // 邮箱 黑名单
-        // 先获取对应站点的邮箱黑名单
-        List<String> siteBlackEmailList =
-                (List<String>) adwebRedisUtil.get(SiteBlackEmailKey + "::" + adwebSite.getId());
-        if (CollectionUtils.isEmpty(siteBlackEmailList)) {
-            enquirySiteBlackEmailService.saveRedisSiteBlackEmailBySiteId(adwebSite.getId(), 0);
-            siteBlackEmailList =
-                    (List<String>) adwebRedisUtil.get(SiteBlackEmailKey + "::" + adwebSite.getId());
-            if (CollectionUtils.isEmpty(siteBlackEmailList)) {
-                siteBlackEmailList = new ArrayList<>();
-            }
-        }
-
-        // 邮箱 公共黑名单
-        List<String> publicBlackEmailList = (List<String>) adwebRedisUtil.get(BlackEmailKey);
-        if (CollectionUtils.isEmpty(publicBlackEmailList)) {
-            List<AdwebPublicBlackEmail> enquiryPublicBlackEmailList =
-                    adwebPublicBlackEmailService.list(
-                            new LambdaQueryWrapper<AdwebPublicBlackEmail>()
-                                    .ne(AdwebPublicBlackEmail::getStatus, 0)
-                                    .eq(AdwebPublicBlackEmail::getBlackOrWhite, 0)
-                                    .isNotNull(AdwebPublicBlackEmail::getEmail)
-                                    .select(AdwebPublicBlackEmail::getEmail));
-
-            if (CollectionUtils.isNotEmpty(enquiryPublicBlackEmailList)) {
-                publicBlackEmailList =
-                        enquiryPublicBlackEmailList.stream()
-                                .map(AdwebPublicBlackEmail::getEmail)
-                                .filter(StringUtil::isNotEmpty)
-                                .collect(Collectors.toList());
-                adwebRedisUtil.set(BlackEmailKey, publicBlackEmailList, 60 * 60 * 24);
-            } else {
-                publicBlackEmailList = new ArrayList<>();
-            }
-        } else {
-            publicBlackEmailList =
-                    publicBlackEmailList.stream()
-                            .filter(s -> !s.isEmpty())
-                            .collect(Collectors.toList());
-        }
-        List<String> allBlackEmailList = new ArrayList<>();
-        if (CollectionUtils.isNotEmpty(siteBlackEmailList)) {
-            allBlackEmailList = new ArrayList<>(siteBlackEmailList);
-        }
-        allBlackEmailList.addAll(publicBlackEmailList);
-        List<String> blackEmailList = new ArrayList<>();
-        if (CollectionUtils.isNotEmpty(allBlackEmailList)) {
-            HashSet<String> blackEmailHashSet = new HashSet<String>(allBlackEmailList);
-            blackEmailList = new ArrayList<>(blackEmailHashSet);
-        }
-
-        log.info("公共邮箱黑名单:{}", publicBlackEmailList.size());
-        log.info("站点邮箱黑名单:{}", siteBlackEmailList.size());
-
-        // 邮箱 白名单
-        // 先获取对应站点的邮箱白名单
-        List<String> siteWhiteEmailList =
-                (List<String>) adwebRedisUtil.get(SiteWhiteEmailListKey + "::" + adwebSite.getId());
-        if (CollectionUtils.isEmpty(siteWhiteEmailList)) {
-            enquirySiteBlackEmailService.saveRedisSiteBlackEmailBySiteId(adwebSite.getId(), 1);
-            siteWhiteEmailList =
-                    (List<String>)
-                            adwebRedisUtil.get(SiteWhiteEmailListKey + "::" + adwebSite.getId());
-        }
-        // 公共邮箱白名单数据
-        List<String> publicWhiteEmailList = (List<String>) adwebRedisUtil.get(WhiteEmailListKey);
-        if (CollectionUtils.isEmpty(publicWhiteEmailList)) {
-            List<AdwebPublicBlackEmail> enquiryPublicWhiteEmailList =
-                    adwebPublicBlackEmailService.list(
-                            new LambdaQueryWrapper<AdwebPublicBlackEmail>()
-                                    .ne(AdwebPublicBlackEmail::getStatus, 0)
-                                    .eq(AdwebPublicBlackEmail::getBlackOrWhite, 1)
-                                    .isNotNull(AdwebPublicBlackEmail::getEmail)
-                                    .select(AdwebPublicBlackEmail::getEmail));
-
-            if (CollectionUtils.isNotEmpty(enquiryPublicWhiteEmailList)) {
-                publicWhiteEmailList =
-                        enquiryPublicWhiteEmailList.stream()
-                                .map(AdwebPublicBlackEmail::getEmail)
-                                .filter(StringUtil::isNotEmpty)
-                                .collect(Collectors.toList());
-                adwebRedisUtil.set(WhiteEmailListKey, publicWhiteEmailList, 60 * 60 * 24);
-            } else {
-                publicWhiteEmailList = new ArrayList<>();
-            }
+  }
+
+  /**
+   * 特殊账号发送邮件
+   *
+   * @param adwebEnquiry
+   * @param adwebSite
+   */
+  public void specialSendEmail(AdwebEnquiry adwebEnquiry, AdwebSite adwebSite) {
+    // 通过主账号id获取子账号id集合
+    List<String> idList =
+        masterSubAccountRelationService.getSubAccountIdByMaster(adwebSite.getUid());
+
+    // 获取子账号信息
+    // TODO chenpeiqing: 字段在V3中不存在
+    QueryWrapper<SysUser> sysUserQueryWrapper = new QueryWrapper<>();
+    sysUserQueryWrapper.eq("is_inquiry", 2);
+    sysUserQueryWrapper.eq("status", 1);
+    if (CollectionUtils.isNotEmpty(idList)) {
+      sysUserQueryWrapper.in("id", idList);
+    }
+    List<SysUser> sysUsers = sysUserService.list(sysUserQueryWrapper);
+
+    List<EnquiryEmailMessage> enquiryEmailMessageList = new ArrayList<>();
+    if (adwebEnquiry.getWasteEnquiry() != 1 && adwebEnquiry.getStatus() != 0) {
+      // 当前发送邮件的账号
+      SysUser sysUser = new SysUser();
+
+      // 如果没有子账号,则只给主账号发送邮件
+      if (CollectionUtils.isEmpty(sysUsers)) {
+        // 获取主账号
+        SysUser mainUser = sysUserService.getById(adwebSite.getUid());
+        // 主账号邮件信息添加
+        if (mainUser != null && StringUtils.isNotBlank(mainUser.getEmail())) {
+          enquiryEmailMessageList.add(newEmail(adwebEnquiry, mainUser.getEmail()));
+        }
+      } else {
+        // 轮流发送邮件逻辑处理
+        List<SubUserEmail> list = subUserEmailService.list();
+        if (CollectionUtils.isEmpty(list)) {
+          sysUser = sysUsers.get(0);
         } else {
-            publicWhiteEmailList =
-                    publicWhiteEmailList.stream()
-                            .filter(s -> !s.isEmpty())
-                            .collect(Collectors.toList());
-        }
-        List<String> allWhiteEmailList = new ArrayList<>();
-        if (CollectionUtils.isNotEmpty(siteWhiteEmailList)) {
-            allWhiteEmailList = new ArrayList<>(siteWhiteEmailList);
-        }
-        allWhiteEmailList.addAll(publicWhiteEmailList);
-        List<String> whiteEmailList = new ArrayList<>();
-        if (CollectionUtils.isNotEmpty(allWhiteEmailList)) {
-            HashSet<String> whiteEmailHashSet = new HashSet<String>(allWhiteEmailList);
-            whiteEmailList = new ArrayList<>(whiteEmailHashSet);
-        }
-
-        log.info("公共邮箱白名单:" + FastJsonUtil.toJSONString(publicWhiteEmailList));
-        log.info("站点邮箱白名单:" + FastJsonUtil.toJSONString(siteWhiteEmailList));
-
-        // Ip黑名单
-        // 公共ip黑名单
-        List<String> publicBlackIpList = (List<String>) adwebRedisUtil.get(BlackIpKey);
-        if (CollectionUtils.isEmpty(publicBlackIpList)) {
-            List<AdwebPublicBlackIp> enquiryPublicBlackIpList =
-                    adwebPublicBlackIpService.list(
-                            new LambdaQueryWrapper<AdwebPublicBlackIp>()
-                                    .ne(AdwebPublicBlackIp::getStatus, 0)
-                                    .eq(AdwebPublicBlackIp::getBlackOrWhite, 0)
-                                    .select(AdwebPublicBlackIp::getIp));
-            if (CollectionUtils.isNotEmpty(enquiryPublicBlackIpList)) {
-                publicBlackIpList =
-                        enquiryPublicBlackIpList.stream()
-                                .map(AdwebPublicBlackIp::getIp)
-                                .collect(Collectors.toList());
-                adwebRedisUtil.set(BlackIpKey, publicBlackIpList, 60 * 60 * 24);
-            } else {
-                publicBlackIpList = new ArrayList<>();
+          SubUserEmail subUserEmail = list.get(0);
+          subUserEmailService.removeAll();
+
+          SysUser user = sysUserService.getById(subUserEmail.getId());
+          int index = sysUsers.indexOf(user);
+          if (index == -1 || index == sysUsers.size() - 1) {
+            sysUser = sysUsers.get(0);
+          } else {
+            sysUser = sysUsers.get(index + 1);
+          }
+        }
+        SubUserEmail subUserEmail = new SubUserEmail();
+        subUserEmail.setId(sysUser.getId());
+        subUserEmail.setSid(adwebSite.getId());
+        subUserEmail.setUsername(sysUser.getUsername());
+        subUserEmail.setRealname(sysUser.getRealname());
+        subUserEmailService.save(subUserEmail);
+        // 子账号邮件信息添加
+        enquiryEmailMessageList.add(newEmail(adwebEnquiry, sysUser.getEmail()));
+
+        // 修改询盘信息的跟进人信息
+        adwebEnquiry.setPrincipalUid(sysUser.getId());
+        adwebEnquiryMapper.updateById(adwebEnquiry);
+
+        // 获取主账号
+        SysUser mainUser = sysUserService.getById(adwebSite.getUid());
+        // 主账号邮件信息添加
+        if (mainUser != null && StringUtils.isNotBlank(mainUser.getEmail())) {
+          enquiryEmailMessageList.add(newEmail(adwebEnquiry, mainUser.getEmail()));
+        }
+      }
+      log.info("=======发送询盘邮件======");
+
+      enquiryEmailMessageList.forEach(e -> System.out.println(e.getEmail()));
+      log.info("需要添加的询盘邮件:{}", FastJsonUtil.toJSONString(enquiryEmailMessageList));
+      if (CollectionUtils.isNotEmpty(enquiryEmailMessageList)) {
+        LambdaQueryWrapper<EnquiryEmailMessage> enquiryEmailMessageQueryWrapper =
+            new LambdaQueryWrapper<>();
+        enquiryEmailMessageQueryWrapper.eq(EnquiryEmailMessage::getSiteCode, adwebSite.getCode());
+        List<EnquiryEmailMessage> enquiryEmailMessages =
+            enquiryEmailMessageService.list(enquiryEmailMessageQueryWrapper);
+        List<EnquiryEmailMessage> sameEnquiryEmailMessageList = new ArrayList<>();
+        if (CollectionUtils.isNotEmpty(enquiryEmailMessages)) {
+          for (EnquiryEmailMessage enquiryEmailMessage : enquiryEmailMessages) {
+            for (EnquiryEmailMessage enquiryEmailMessage1 : enquiryEmailMessageList) {
+              if (enquiryEmailMessage.getEnquiryId().equals(enquiryEmailMessage1.getEnquiryId())
+                  && enquiryEmailMessage.getEmail().equals(enquiryEmailMessage1.getEmail())) {
+                sameEnquiryEmailMessageList.add(enquiryEmailMessage1);
+              }
             }
+          }
+          enquiryEmailMessageList.removeAll(sameEnquiryEmailMessageList);
         }
-        // 站点ip黑名单
-        List<String> siteBlackIpList =
-                (List<String>) adwebRedisUtil.get(SiteBlackIpKey + "::" + adwebSite.getId());
-        if (CollectionUtils.isEmpty(siteBlackIpList)) {
-            List<AdwebSiteBlackIp> enquirySiteBlackIpList =
-                    adwebSiteBlackIpService.list(
-                            new LambdaQueryWrapper<AdwebSiteBlackIp>()
-                                    .ne(AdwebSiteBlackIp::getStatus, 0)
-                                    .eq(AdwebSiteBlackIp::getBlackOrWhite, 0)
-                                    .eq(AdwebSiteBlackIp::getSiteId, adwebSite.getId())
-                                    .select(AdwebSiteBlackIp::getIp));
-            if (CollectionUtils.isNotEmpty(enquirySiteBlackIpList)) {
-                siteBlackIpList =
-                        enquirySiteBlackIpList.stream()
-                                .map(AdwebSiteBlackIp::getIp)
-                                .collect(Collectors.toList());
-                adwebRedisUtil.set(
-                        SiteBlackIpKey + "::" + adwebSite.getId(), siteBlackIpList, 60 * 60 * 24);
-            } else {
-                siteBlackIpList = new ArrayList<>();
-            }
-        }
-        List<String> allBlackIpList = new ArrayList<>();
-        if (CollectionUtils.isNotEmpty(siteBlackIpList)) {
-            allBlackIpList = new ArrayList<>(siteBlackIpList);
-        }
-        allBlackIpList.addAll(publicBlackIpList);
-        List<String> blackIpList = new ArrayList<>();
-        if (CollectionUtils.isNotEmpty(allBlackIpList)) {
-            HashSet<String> blackIpHashSet = new HashSet<String>(allBlackIpList);
-            blackIpList = new ArrayList<>(blackIpHashSet);
+        log.info("最终添加的询盘邮件:{}", FastJsonUtil.toJSONString(enquiryEmailMessageList));
+        enquiryEmailMessageService.saveBatch(enquiryEmailMessageList);
+        try {
+          for (EnquiryEmailMessage message : enquiryEmailMessageList) {
+            JedisUtil.lpush(redisKey, ObjectUtil.object2Bytes(message.getEnquiryId()));
+            JedisUtil.publishMsg(
+                EnquiryConstants.ENQUIRY_EMAIL_CHANNEL, EnquiryConstants.ENQUIRY_EMAIL);
+          }
+          SysUser user = sysUserService.getById(adwebEnquiry.getPrincipalUid());
+          if (StringUtils.isNotBlank(adwebEnquiry.getRecordId())) {
+            returnSalesperson(adwebSite.getCode(), adwebEnquiry.getRecordId(), user.getUsername());
+          }
+        } catch (Exception e) {
+          log.error("推送发送询盘邮件的消息失败", e);
         }
+      }
 
-        log.info("公共ip黑名单:{} 个", publicBlackIpList.size());
-        log.info("站点ip黑名单:{} 个", siteBlackIpList.size());
-
-        // Ip白名单
-        // 公共Ip白名单
-        List<String> publicWhiteIpList = (List<String>) adwebRedisUtil.get(WhiteIpListKey);
-        if (publicWhiteIpList == null) {
-            List<AdwebPublicBlackIp> enquiryPublicWhiteIpList =
-                    adwebPublicBlackIpService.list(
-                            new LambdaQueryWrapper<AdwebPublicBlackIp>()
-                                    .ne(AdwebPublicBlackIp::getStatus, 0)
-                                    .eq(AdwebPublicBlackIp::getBlackOrWhite, 1)
-                                    .select(AdwebPublicBlackIp::getIp));
-            if (CollectionUtils.isNotEmpty(enquiryPublicWhiteIpList)) {
-                publicWhiteIpList =
-                        enquiryPublicWhiteIpList.stream()
-                                .map(AdwebPublicBlackIp::getIp)
-                                .collect(Collectors.toList());
-                adwebRedisUtil.set(WhiteIpListKey, publicWhiteIpList, 60 * 60 * 24);
-            } else {
-                publicWhiteIpList = new ArrayList<>();
-            }
-        }
-        // 站点Ip白名单, 基于站点查询
-        List<String> siteWhiteIpList =
-                (List<String>) adwebRedisUtil.get(SiteWhiteIpListKey + "::" + adwebSite.getId());
-        if (CollectionUtils.isEmpty(siteWhiteIpList)) {
-            List<AdwebSiteBlackIp> enquirySiteWhiteIpList =
-                    adwebSiteBlackIpService.list(
-                            new LambdaQueryWrapper<AdwebSiteBlackIp>()
-                                    .ne(AdwebSiteBlackIp::getStatus, 0)
-                                    .eq(AdwebSiteBlackIp::getBlackOrWhite, 1)
-                                    .eq(AdwebSiteBlackIp::getSiteId, adwebSite.getId())
-                                    .select(AdwebSiteBlackIp::getIp));
-            if (CollectionUtils.isNotEmpty(enquirySiteWhiteIpList)) {
-                siteWhiteIpList =
-                        enquirySiteWhiteIpList.stream()
-                                .map(AdwebSiteBlackIp::getIp)
-                                .collect(Collectors.toList());
-                adwebRedisUtil.set(
-                        SiteWhiteIpListKey + "::" + adwebSite.getId(),
-                        siteWhiteIpList,
-                        60 * 60 * 24);
-            } else {
-                siteWhiteIpList = new ArrayList<>();
-            }
-        }
-        List<String> allWhiteIpList = new ArrayList<>();
-        if (CollectionUtils.isNotEmpty(siteWhiteIpList)) {
-            allWhiteIpList = new ArrayList<>(siteWhiteIpList);
-        }
-        allWhiteIpList.addAll(publicWhiteIpList);
-        List<String> whiteIpList = new ArrayList<>();
-        if (CollectionUtils.isNotEmpty(allWhiteIpList)) {
-            HashSet<String> whiteIpHashSet = new HashSet<String>(allWhiteIpList);
-            whiteIpList = new ArrayList<>(whiteIpHashSet);
-        }
+    } else {
+      log.info("=======该垃圾询盘在特殊站点中不发送询盘邮件======{}", adwebEnquiry.getId());
+    }
+  }
+
+  /**
+   * 根据询盘信息创建邮件发送记录
+   *
+   * @param adwebEnquiry 询盘信息
+   * @param email 接收邮箱
+   * @return
+   */
+  private static EnquiryEmailMessage newEmail(AdwebEnquiry adwebEnquiry, String email) {
+    EnquiryEmailMessage enquiryEmailMessage = new EnquiryEmailMessage();
+    enquiryEmailMessage.setEnquiryId(adwebEnquiry.getId());
+    enquiryEmailMessage.setEmail(email);
+    enquiryEmailMessage.setFromEmail(adwebEnquiry.getFromEmail());
+    enquiryEmailMessage.setCreateTime(new Date());
+    enquiryEmailMessage.setSiteCode(adwebEnquiry.getSiteCode());
+    enquiryEmailMessage.setSendStatus(EnquirySendStatus.WAIT_SEND);
+    enquiryEmailMessage.setSendErrorNum(0);
+
+    return enquiryEmailMessage;
+  }
+
+  /**
+   * 通过询盘中的ip字段,获取国家信息并放在询盘对象种
+   *
+   * @param enquiry 询盘对象
+   */
+  private void setCountryByIp(AdwebEnquiry enquiry) {
+    CountryAreaApiDto countryAreaApiDto = geoIpUtil.getCountryAndAreaByIp(enquiry.getFromIp());
+    if (countryAreaApiDto != null) {
+      String countryCode = countryAreaApiDto.getCountryIsoCode();
+      if ("TW".equals(countryCode)) {
+        countryCode = "CN";
+      }
+      String countryName = countryAreaApiDto.getCountryZhCN();
+      if ("中华民国".equals(countryName)) {
+        countryName = "中国";
+      }
+      enquiry.setCountryCode(countryCode);
+      enquiry.setCountryName(countryName);
+      if (StringUtils.isBlank(enquiry.getCountry())) {
+        enquiry.setCountry(countryName);
+      }
+    } else {
+      enquiry.setCountryCode("0000");
+      enquiry.setCountryName("其它");
+    }
+  }
+
+  /**
+   * 根据询盘对象和站点,构建一个本系统中的询盘对象
+   *
+   * @param enquiryDto 询盘对象
+   * @param adwebSite 询盘所属站点
+   * @return 本系统中的询盘队形
+   */
+  private AdwebEnquiry createEnquiry(EnquiryDTO enquiryDto, AdwebSite adwebSite) {
+    AdwebEnquiry adwebEnquiry = new AdwebEnquiry();
+    adwebEnquiry.setId(snowflakeIdUtil.nextId());
+    adwebEnquiry.setCtime(new Date());
+    adwebEnquiry.setStatus(1);
+    adwebEnquiry.setVisitId(enquiryDto.getVisitId());
+    adwebEnquiry.setSiteId(adwebSite.getId());
+    adwebEnquiry.setUid(adwebSite.getUid());
+    adwebEnquiry.setFromIp(enquiryDto.getFromIp());
+    adwebEnquiry.setFromEmail(enquiryDto.getFromEmail());
+    adwebEnquiry.setPluginName(enquiryDto.getPluginName());
+    adwebEnquiry.setRecordId(enquiryDto.getRecordId());
+    adwebEnquiry.setModifyRecordCtime(
+        geoIpUtil.getLocalhostTime(enquiryDto.getFromIp(), enquiryDto.getRecordCtime()));
+    adwebEnquiry.setRecordCtime(enquiryDto.getRecordCtime());
+    adwebEnquiry.setSiteCode(adwebSite.getCode());
+    adwebEnquiry.setModular(enquiryDto.getPluginName());
+    adwebEnquiry.setSysEffective(NumConstant.ONE);
+    adwebEnquiry.setUserEffective(NumConstant.TWO);
+    adwebEnquiry.setSiteHost(enquiryDto.getSiteHost());
+    adwebEnquiry.setNo(
+        "xp"
+            + DateUtil.formatDate(new Date(), DateUtil.DATE_FORMAT)
+            + adwebOpenApiService.loadNo(adwebSite.getCode()));
+
+    // 外部编号暂无作用,且多查询一次数据库,暂时注释
+    //        adwebEnquiry.setNoOut(DateUtil.dateToString(new Date(),
+    // DateUtil.DATE_FORMAT_THREE) + adwebOpenApiService.loadOutNoByUser(adwebSite.getUid()));
+    adwebEnquiry.setWasteEnquiry(0);
+    adwebEnquiry.setRequestTime(new Date());
+    adwebEnquiry.setAcquireMessageTime(adwebSite.getEnquiryMessageTime());
+    adwebEnquiry.setIsEnquirySync("enquirySync");
+
+    ObjectMapper objectMapper = new ObjectMapper();
+    try {
+      String jsonString = objectMapper.writeValueAsString(enquiryDto.getCartItems());
+      adwebEnquiry.setCartItems(jsonString);
+    } catch (JsonProcessingException e) {
+      // 可以选择记录更详细的堆栈跟踪信息
+      log.error("Error serializing cart items to JSON: {}", e.getMessage(), e);
+    }
+    return adwebEnquiry;
+  }
+
+  /**
+   * 解析form,将form中的字段加入到询盘对象种
+   *
+   * @param enquiry 询盘对象
+   * @param form 询盘表单信息
+   */
+  private void parseFormAndSetFields(AdwebEnquiry enquiry, String form, AdwebSite adwebSite) {
+    long startTime = System.currentTimeMillis();
+
+    List<String> nameKeys = this.getFormKeys("wp-name");
+    List<String> emailKeys = this.getFormKeys("wp-email");
+    List<String> messageKeys = this.getFormKeys("wp-content");
+    List<String> companyKeys = this.getFormKeys("wp-company");
+    List<String> fromPageKeys = this.getFormKeys("wp-page");
+    List<String> phoneKeys = this.getFormKeys("wp-phone");
+    List<String> whatsAppKeys = this.getFormKeys("wp-whatsapp");
+    List<String> countryKeys = this.getFormKeys("wp-country");
+    List<String> customerIpKeys = this.getFormKeys("wp-customerip");
+    List<String> addressKeys = this.getFormKeys("wp-address");
+
+    List<String> errorObjNames = new ArrayList<>();
+    Collection<JSONObject> formItems = null;
+    Map<String, JSONObject> formObj = FastJsonUtil.parseObject(form, Map.class);
+    if (formObj == null || formObj.size() == 0) {
+      List<JSONObject> formList = FastJsonUtil.parseObject(form, List.class);
+      if (CollectionUtils.isNotEmpty(formList)) {
+        formItems = formList;
+      }
+    } else {
+      formItems = formObj.values();
+    }
 
-        log.info("公共ip白名单:" + FastJsonUtil.toJSONString(publicWhiteIpList));
-        log.info("站点ip白名单:" + FastJsonUtil.toJSONString(siteWhiteIpList));
-
-        // 站点询盘规则黑名单
-        LambdaQueryWrapper<AdwebSiteEnquiryRule> adwebEnquirySiteRuleQueryWrapper =
-                new LambdaQueryWrapper<>();
-        adwebEnquirySiteRuleQueryWrapper.eq(AdwebSiteEnquiryRule::getSiteId, adwebSite.getId());
-        adwebEnquirySiteRuleQueryWrapper.eq(AdwebSiteEnquiryRule::getStatus, 1);
-        adwebEnquirySiteRuleQueryWrapper.eq(AdwebSiteEnquiryRule::getBlackOrWhite, 0);
-        List<AdwebSiteEnquiryRule> siteBlackRuleList =
-                adwebSiteEnquiryRuleService.list(adwebEnquirySiteRuleQueryWrapper);
-        log.info("站点关键词黑名单:" + FastJsonUtil.toJSONString(siteBlackRuleList));
-
-        // 判断上一封询盘是否是垃圾询盘
-        AdwebEnquiry isJudgeWasteEnquiry = new AdwebEnquiry();
-
-        // 判断是否垃圾询盘
-        outerloop:
-        for (AdwebEnquiry adwebEnquiry : adwebEnquiryList) {
-            // 没有message的无法判断,认为是普通询盘
-            if (StringUtil.isEmpty(adwebEnquiry.getMessage())) {
-                adwebEnquiry.setWasteEnquiry(1);
-                adwebEnquiry.setUserEffective(0);
-                log.info(
-                        "询盘id是:{}, 站点code是:{}, 通过——询盘内容为空——检测到垃圾询盘",
-                        adwebEnquiry.getId(),
-                        adwebEnquiry.getSiteCode());
-                continue;
-            }
+    List<EnquirySpecialFields> specialFieldsList = new ArrayList<>();
+    for (JSONObject formItem : formItems) {
+      String formItemName = formItem.getString("name");
+      String formItemValue = formItem.getString("value");
+
+      if (contains(nameKeys, formItemName)) {
+        enquiry.setName(formItemValue);
+      } else if (contains(emailKeys, formItemName)) {
+        enquiry.setEmail(formItemValue);
+      } else if (contains(messageKeys, formItemName)) {
+        enquiry.setMessage(formItemValue);
+      } else if (contains(companyKeys, formItemName)) {
+        enquiry.setCompany(formItemValue);
+      } else if (contains(fromPageKeys, formItemName)) {
+        enquiry.setFromPage(formItemValue);
+      } else if (contains(phoneKeys, formItemName)) {
+        enquiry.setPhone(formItemValue);
+      } else if (contains(whatsAppKeys, formItemName)) {
+        enquiry.setWhatsApp(formItemValue);
+      } else if (contains(countryKeys, formItemName)) {
+        enquiry.setCountry(formItemValue);
+      } else if (contains(customerIpKeys, formItemName)) {
+        enquiry.setCustomerIp(formItemValue);
+      } else if (contains(addressKeys, formItemName)) {
+        enquiry.setAddress(formItemValue);
+      } else {
+        // 异常字段
+        errorObjNames.add(formItemName);
+        EnquirySpecialFields enquirySpecialFields = new EnquirySpecialFields();
+        enquirySpecialFields.setField(formItemName);
+        enquirySpecialFields.setValue(formItemValue);
+        specialFieldsList.add(enquirySpecialFields);
+      }
+    }
 
-            // 该分支用于判断上一封邮件是否为垃圾询盘
-            dealMultipleRepeatInfoEnquiry(
-                    siteBlackEmailList, siteBlackIpList, isJudgeWasteEnquiry, adwebSite);
-            isJudgeWasteEnquiry = adwebEnquiry;
-
-            // 判断 询盘邮箱黑名单
-            if (CollectionUtils.isNotEmpty(blackEmailList)
-                    || StringUtils.isNotBlank(adwebEnquiry.getEmail())) {
-
-                String email = adwebEnquiry.getEmail().toLowerCase();
-
-                String message =
-                        adwebEnquiry
-                                .getMessage()
-                                .replaceAll("[\\n\\t]", " ")
-                                .replaceAll(" {2,}", " ")
-                                .toLowerCase();
-
-                // 公共黑白名单
-                //                boolean isContainPublicWhite = false;
-                //                String containPublicWhiteStr = "";
-                // 白名单
-                //                for(String publicWhiteEmail : publicWhiteEmailList){
-                //                    log.info("judgeWasteEnquiry --
-                // 当前询盘Id:{},!whiteEmailList.contains(email):{}",adwebEnquiry.getId(),!whiteEmailList.contains(email));
-                //                    if(email.equals(publicWhiteEmail) ||
-                // message.equals(publicWhiteEmail)){
-                //                        containPublicWhiteStr = publicWhiteEmail;
-                //                        isContainPublicWhite = true;
-                //                        break;
-                //                    }
-                //                }
-
-                // 黑名单
-                String containPublicBlackStr = "";
-                boolean isContainPublicBlack = false;
-                if (CollectionUtils.isNotEmpty(publicBlackEmailList)) {
-                    for (String blackEmail : publicBlackEmailList) {
-                        String allBlackEmail = blackEmail;
-                        if (allBlackEmail.contains("*")) {
-                            allBlackEmail = allBlackEmail.substring(1, allBlackEmail.length() - 1);
-                            if (email.contains(allBlackEmail) || message.contains(allBlackEmail)) {
-                                containPublicBlackStr = blackEmail;
-                                isContainPublicBlack = true;
-                                break;
-                            }
-                        } else {
-                            if (email.equals(allBlackEmail) || message.equals(allBlackEmail)) {
-                                containPublicBlackStr = blackEmail;
-                                isContainPublicBlack = true;
-                                break;
-                            }
-                        }
-                    }
-                }
-                log.info("是否是公共黑名单:" + isContainPublicBlack);
-                log.info("匹配的公共黑名单:" + containPublicBlackStr);
-                // 站点黑白名单
-                boolean isContainSiteWhite = false;
-                boolean isSiteAllContain = true;
-                String containSiteWhiteStr = "";
-                // 白名单
-                if (CollectionUtils.isNotEmpty(siteWhiteEmailList)) {
-                    for (String whiteEmail : siteWhiteEmailList) {
-                        String compareWhiteEmail = whiteEmail;
-                        if (compareWhiteEmail.contains("*")) {
-                            compareWhiteEmail = whiteEmail.substring(1, whiteEmail.length() - 1);
-                            if (email.contains(compareWhiteEmail)
-                                    || message.contains(compareWhiteEmail)) {
-                                containSiteWhiteStr = compareWhiteEmail;
-                                isContainSiteWhite = true;
-                                isSiteAllContain = false;
-                                break;
-                            }
-                        } else {
-                            if (email.equals(compareWhiteEmail)
-                                    || message.equals(compareWhiteEmail)) {
-                                containSiteWhiteStr = compareWhiteEmail;
-                                isContainSiteWhite = true;
-                                isSiteAllContain = false;
-                                break;
-                            }
-                        }
-                    }
-                }
+    String specialField = FastJsonUtil.toJSONString(specialFieldsList);
+    enquiry.setSpecialField(specialField);
+
+    if (!errorObjNames.isEmpty()
+        || enquiry.getRecordCtime() == null
+        || StringUtil.isEmpty(enquiry.getMessage())
+        || StringUtil.isEmpty(enquiry.getEmail())
+        || StringUtil.isEmpty(enquiry.getFromPage())) {
+      // 发送飞书告警
+      StringBuilder msg =
+          new StringBuilder(
+              "询盘异常,\n询盘id:"
+                  + enquiry.getId()
+                  + ",\n站点名称:"
+                  + adwebSite.getName()
+                  + ",\n站点域名:"
+                  + enquiry.getSiteHost()
+                  + ",\n来源ip:"
+                  + enquiry.getFromIp());
+      if (!errorObjNames.isEmpty()) {
+        msg.append(",\n字段异常,存在异常字段:");
+        for (String errorObjName : errorObjNames) {
+          msg.append(errorObjName).append("、");
+        }
+        msg.deleteCharAt(msg.length() - 1);
+      }
+      if (enquiry.getRecordCtime() == null) {
+        msg.append(",\n询盘发送时间为空");
+      }
+      if (StringUtil.isEmpty(enquiry.getMessage())) {
+        msg.append(",\n询盘内容为空");
+      }
+      if (StringUtil.isEmpty(enquiry.getEmail())) {
+        msg.append(",\n邮箱内容为空");
+      }
+      if (StringUtil.isEmpty(enquiry.getFromPage())) {
+        msg.append(",\n来源页面为空");
+      }
+      // 同一个站点,一天最多报错一次
+      String flag =
+          adwebRedisUtil.getString(
+              "forbidden_send_error_msg_by_enquiry_field_" + adwebSite.getDomain());
+      if (StringUtils.isNotBlank(flag)) {
+        log.info("同一个站点,一天最多报错一次,站点域名:" + adwebSite.getDomain());
+        return;
+      }
+      adwebRedisUtil.set(
+          "forbidden_send_error_msg_by_enquiry_field_" + adwebSite.getDomain(),
+          "forbidden",
+          60 * 60 * 24);
+
+      // 异常入库
+      SysException exception = new SysException();
+      exception.setType(0);
+      exception.setFunctionModule("询盘字段配置异常");
+      exception.setExceptionDetail(msg.toString());
+      exception.setCreateTime(new Date());
+      exception.setStatus(1);
+      exception.setHandle(0);
+      exception.setPriority(1);
+      sysExceptionService.save(exception);
+
+      long diffTime = System.currentTimeMillis() - startTime;
+      String className = this.getClass().getName();
+      String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
+      feishuService.sendEnquiryRobot(
+          (float) diffTime / 1000, "wpforms-询盘警告:" + 0, className, methodName, String.valueOf(msg));
+    }
+  }
 
-                log.info("是否是站点白名单:" + isContainSiteWhite);
-                log.info("匹配的站点白名单:" + containSiteWhiteStr);
-                // 黑名单
-                boolean isContainSiteBlack = false;
-                String containSiteBlackStr = "";
-                if (CollectionUtils.isNotEmpty(siteBlackEmailList)) {
-                    for (String blackEmail : siteBlackEmailList) {
-                        String allBlackEmail = blackEmail;
-                        if (allBlackEmail.contains("*")) {
-                            allBlackEmail = allBlackEmail.substring(1, allBlackEmail.length() - 1);
-                            if (email.contains(allBlackEmail) || message.contains(allBlackEmail)) {
-                                containSiteBlackStr = allBlackEmail;
-                                isContainSiteBlack = true;
-                                isSiteAllContain = false;
-                                break;
-                            }
-                        } else {
-                            if (email.equals(allBlackEmail) || message.equals(allBlackEmail)) {
-                                containSiteBlackStr = allBlackEmail;
-                                isContainSiteBlack = true;
-                                isSiteAllContain = false;
-                                break;
-                            }
-                        }
-                    }
-                }
+  private boolean contains(List<String> keys, String key) {
+    if (CollectionUtils.isEmpty(keys) || StringUtil.isEmpty(key)) {
+      return false;
+    }
+    key = key.replace(":", "").replace(":", "").replaceAll(" {2,}", " ").toLowerCase().trim();
+    return keys.contains(key);
+  }
+
+  /**
+   * 根据字典code,获取相应数据在json中所有可能的key,用来解析json
+   *
+   * @param dictCode 字典code
+   * @return key的集合
+   */
+  private List<String> getFormKeys(String dictCode) {
+    String formKey = CacheConstant.SYS_DICT_CACHE + "::" + dictCode;
+    Object obj = adwebRedisUtil.get(formKey);
+    if (obj != null) {
+      List<String> keys = (List<String>) obj;
+      return keys;
+    }
+    List<SysDictItem> dictItems = sysAdwebApiImpl.selectItemsByDictCode(dictCode);
+    List<String> keys = new ArrayList<>();
+    if (CollectionUtils.isNotEmpty(dictItems)) {
+      for (SysDictItem item : dictItems) {
+        String value = item.getItemValue();
+        if (StringUtil.isEmpty(value)) {
+          continue;
+        }
+        value = value.replaceAll(" {2,}", " ").toLowerCase().trim();
+        if (!keys.contains(value)) {
+          keys.add(value);
+        }
+      }
+    }
+    adwebRedisUtil.set(formKey, keys, 60 * 60);
+    return keys;
+  }
+
+  /**
+   * 判断邮件是否是垃圾询盘 =》 基于站点黑名单 1、邮件过滤 2、根据邮件是否包含外部url过滤 3、根据关键词过滤
+   *
+   * @param adwebEnquiryList 询盘列表
+   */
+  private void judgeWasteEnquiryBySiteId(
+      List<AdwebEnquiry> adwebEnquiryList, AdwebSite adwebSite, List<String> blackWordList) {
+
+    // 邮箱 黑名单
+    // 先获取对应站点的邮箱黑名单
+    List<String> siteBlackEmailList =
+        (List<String>) adwebRedisUtil.get(SiteBlackEmailKey + "::" + adwebSite.getId());
+    if (CollectionUtils.isEmpty(siteBlackEmailList)) {
+      enquirySiteBlackEmailService.saveRedisSiteBlackEmailBySiteId(adwebSite.getId(), 0);
+      siteBlackEmailList =
+          (List<String>) adwebRedisUtil.get(SiteBlackEmailKey + "::" + adwebSite.getId());
+      if (CollectionUtils.isEmpty(siteBlackEmailList)) {
+        siteBlackEmailList = new ArrayList<>();
+      }
+    }
 
-                log.info("是否是站点黑名单:" + isContainSiteBlack);
-                log.info("匹配的站点黑名单:" + containSiteBlackStr);
-                // 判断邮箱或者内容即在黑名单里又在白名单里,特殊处理
-                if (isContainSiteBlack && isContainSiteWhite) {
-                    if (containSiteBlackStr.length() <= containSiteWhiteStr.length()) {
-                        isContainSiteBlack = false;
-                    }
-                }
+    // 邮箱 公共黑名单
+    List<String> publicBlackEmailList = (List<String>) adwebRedisUtil.get(BlackEmailKey);
+    if (CollectionUtils.isEmpty(publicBlackEmailList)) {
+      List<AdwebPublicBlackEmail> enquiryPublicBlackEmailList =
+          adwebPublicBlackEmailService.list(
+              new LambdaQueryWrapper<AdwebPublicBlackEmail>()
+                  .ne(AdwebPublicBlackEmail::getStatus, 0)
+                  .eq(AdwebPublicBlackEmail::getBlackOrWhite, 0)
+                  .isNotNull(AdwebPublicBlackEmail::getEmail)
+                  .select(AdwebPublicBlackEmail::getEmail));
+
+      if (CollectionUtils.isNotEmpty(enquiryPublicBlackEmailList)) {
+        publicBlackEmailList =
+            enquiryPublicBlackEmailList.stream()
+                .map(AdwebPublicBlackEmail::getEmail)
+                .filter(StringUtil::isNotEmpty)
+                .collect(Collectors.toList());
+        adwebRedisUtil.set(BlackEmailKey, publicBlackEmailList, 60 * 60 * 24);
+      } else {
+        publicBlackEmailList = new ArrayList<>();
+      }
+    } else {
+      publicBlackEmailList =
+          publicBlackEmailList.stream().filter(s -> !s.isEmpty()).collect(Collectors.toList());
+    }
+    List<String> allBlackEmailList = new ArrayList<>();
+    if (CollectionUtils.isNotEmpty(siteBlackEmailList)) {
+      allBlackEmailList = new ArrayList<>(siteBlackEmailList);
+    }
+    allBlackEmailList.addAll(publicBlackEmailList);
+    List<String> blackEmailList = new ArrayList<>();
+    if (CollectionUtils.isNotEmpty(allBlackEmailList)) {
+      HashSet<String> blackEmailHashSet = new HashSet<String>(allBlackEmailList);
+      blackEmailList = new ArrayList<>(blackEmailHashSet);
+    }
 
-                log.info("第二次处理是否是站点黑名单:" + isContainSiteBlack);
-                if (isContainPublicBlack || !isSiteAllContain) {
-                    if (isContainPublicBlack && isContainSiteBlack) {
-                        adwebEnquiry.setWasteEnquiry(1);
-                        adwebEnquiry.setUserEffective(0);
-                        adwebEnquiry.setWasteEnquiryType("email");
-                        adwebEnquiry.setEffectiveReason(
-                                "系统操作-通过公共和站点的询盘邮箱黑名单检测到垃圾询盘-" + containSiteBlackStr);
-                        log.info(
-                                "询盘id是:{}, 站点code是:{}, 通过——询盘邮箱黑名单——检测到垃圾询盘, 黑名单邮箱是:{}",
-                                adwebEnquiry.getId(),
-                                adwebEnquiry.getSiteCode(),
-                                containSiteBlackStr);
-                        continue outerloop;
-                    }
-                    if (isContainPublicBlack && isSiteAllContain) {
-                        adwebEnquiry.setWasteEnquiry(1);
-                        adwebEnquiry.setUserEffective(0);
-                        adwebEnquiry.setWasteEnquiryType("email");
-                        adwebEnquiry.setEffectiveReason(
-                                "系统操作-通过公共的询盘邮箱黑名单检测到垃圾询盘-" + containPublicBlackStr);
-                        log.info(
-                                "询盘id是:{}, 站点code是:{}, 通过——询盘邮箱黑名单——检测到垃圾询盘, 黑名单邮箱是:{}",
-                                adwebEnquiry.getId(),
-                                adwebEnquiry.getSiteCode(),
-                                containPublicBlackStr);
-                        continue outerloop;
-                    }
-                    if (!isContainPublicBlack && isContainSiteBlack) {
-                        adwebEnquiry.setWasteEnquiry(1);
-                        adwebEnquiry.setUserEffective(0);
-                        adwebEnquiry.setWasteEnquiryType("email");
-                        adwebEnquiry.setEffectiveReason(
-                                "系统操作-通过站点的询盘邮箱黑名单检测到垃圾询盘-" + containSiteBlackStr);
-                        log.info(
-                                "询盘id是:{}, 站点code是:{}, 通过——询盘邮箱黑名单——检测到垃圾询盘, 黑名单邮箱是:{}",
-                                adwebEnquiry.getId(),
-                                adwebEnquiry.getSiteCode(),
-                                containSiteBlackStr);
-                        continue outerloop;
-                    }
-                }
-            }
+    log.info("公共邮箱黑名单:{}", publicBlackEmailList.size());
+    log.info("站点邮箱黑名单:{}", siteBlackEmailList.size());
+
+    // 邮箱 白名单
+    // 先获取对应站点的邮箱白名单
+    List<String> siteWhiteEmailList =
+        (List<String>) adwebRedisUtil.get(SiteWhiteEmailListKey + "::" + adwebSite.getId());
+    if (CollectionUtils.isEmpty(siteWhiteEmailList)) {
+      enquirySiteBlackEmailService.saveRedisSiteBlackEmailBySiteId(adwebSite.getId(), 1);
+      siteWhiteEmailList =
+          (List<String>) adwebRedisUtil.get(SiteWhiteEmailListKey + "::" + adwebSite.getId());
+    }
+    // 公共邮箱白名单数据
+    List<String> publicWhiteEmailList = (List<String>) adwebRedisUtil.get(WhiteEmailListKey);
+    if (CollectionUtils.isEmpty(publicWhiteEmailList)) {
+      List<AdwebPublicBlackEmail> enquiryPublicWhiteEmailList =
+          adwebPublicBlackEmailService.list(
+              new LambdaQueryWrapper<AdwebPublicBlackEmail>()
+                  .ne(AdwebPublicBlackEmail::getStatus, 0)
+                  .eq(AdwebPublicBlackEmail::getBlackOrWhite, 1)
+                  .isNotNull(AdwebPublicBlackEmail::getEmail)
+                  .select(AdwebPublicBlackEmail::getEmail));
+
+      if (CollectionUtils.isNotEmpty(enquiryPublicWhiteEmailList)) {
+        publicWhiteEmailList =
+            enquiryPublicWhiteEmailList.stream()
+                .map(AdwebPublicBlackEmail::getEmail)
+                .filter(StringUtil::isNotEmpty)
+                .collect(Collectors.toList());
+        adwebRedisUtil.set(WhiteEmailListKey, publicWhiteEmailList, 60 * 60 * 24);
+      } else {
+        publicWhiteEmailList = new ArrayList<>();
+      }
+    } else {
+      publicWhiteEmailList =
+          publicWhiteEmailList.stream().filter(s -> !s.isEmpty()).collect(Collectors.toList());
+    }
+    List<String> allWhiteEmailList = new ArrayList<>();
+    if (CollectionUtils.isNotEmpty(siteWhiteEmailList)) {
+      allWhiteEmailList = new ArrayList<>(siteWhiteEmailList);
+    }
+    allWhiteEmailList.addAll(publicWhiteEmailList);
+    List<String> whiteEmailList = new ArrayList<>();
+    if (CollectionUtils.isNotEmpty(allWhiteEmailList)) {
+      HashSet<String> whiteEmailHashSet = new HashSet<String>(allWhiteEmailList);
+      whiteEmailList = new ArrayList<>(whiteEmailHashSet);
+    }
 
-            // @see http://52.83.154.198:8082/browse/ADWEBV2-12
-            // 垃圾询盘过滤时IP按照客户IP去使用黑名单过滤而不再使用来源IP
-            // 判断是否为ip黑名单
-            if (CollectionUtils.isNotEmpty(blackIpList)
-                    || StringUtils.isNotBlank(adwebEnquiry.getCustomerIp())) {
-                String ip = adwebEnquiry.getCustomerIp();
-                // 公共ip黑名单
-                boolean isPublicIp = false;
-                if (publicBlackIpList.contains(ip) && !publicWhiteIpList.contains(ip)) {
-                    isPublicIp = true;
-                }
+    log.info("公共邮箱白名单:" + FastJsonUtil.toJSONString(publicWhiteEmailList));
+    log.info("站点邮箱白名单:" + FastJsonUtil.toJSONString(siteWhiteEmailList));
+
+    // Ip黑名单
+    // 公共ip黑名单
+    List<String> publicBlackIpList = (List<String>) adwebRedisUtil.get(BlackIpKey);
+    if (CollectionUtils.isEmpty(publicBlackIpList)) {
+      List<AdwebPublicBlackIp> enquiryPublicBlackIpList =
+          adwebPublicBlackIpService.list(
+              new LambdaQueryWrapper<AdwebPublicBlackIp>()
+                  .ne(AdwebPublicBlackIp::getStatus, 0)
+                  .eq(AdwebPublicBlackIp::getBlackOrWhite, 0)
+                  .select(AdwebPublicBlackIp::getIp));
+      if (CollectionUtils.isNotEmpty(enquiryPublicBlackIpList)) {
+        publicBlackIpList =
+            enquiryPublicBlackIpList.stream()
+                .map(AdwebPublicBlackIp::getIp)
+                .collect(Collectors.toList());
+        adwebRedisUtil.set(BlackIpKey, publicBlackIpList, 60 * 60 * 24);
+      } else {
+        publicBlackIpList = new ArrayList<>();
+      }
+    }
+    // 站点ip黑名单
+    List<String> siteBlackIpList =
+        (List<String>) adwebRedisUtil.get(SiteBlackIpKey + "::" + adwebSite.getId());
+    if (CollectionUtils.isEmpty(siteBlackIpList)) {
+      List<AdwebSiteBlackIp> enquirySiteBlackIpList =
+          adwebSiteBlackIpService.list(
+              new LambdaQueryWrapper<AdwebSiteBlackIp>()
+                  .ne(AdwebSiteBlackIp::getStatus, 0)
+                  .eq(AdwebSiteBlackIp::getBlackOrWhite, 0)
+                  .eq(AdwebSiteBlackIp::getSiteId, adwebSite.getId())
+                  .select(AdwebSiteBlackIp::getIp));
+      if (CollectionUtils.isNotEmpty(enquirySiteBlackIpList)) {
+        siteBlackIpList =
+            enquirySiteBlackIpList.stream()
+                .map(AdwebSiteBlackIp::getIp)
+                .collect(Collectors.toList());
+        adwebRedisUtil.set(
+            SiteBlackIpKey + "::" + adwebSite.getId(), siteBlackIpList, 60 * 60 * 24);
+      } else {
+        siteBlackIpList = new ArrayList<>();
+      }
+    }
+    List<String> allBlackIpList = new ArrayList<>();
+    if (CollectionUtils.isNotEmpty(siteBlackIpList)) {
+      allBlackIpList = new ArrayList<>(siteBlackIpList);
+    }
+    allBlackIpList.addAll(publicBlackIpList);
+    List<String> blackIpList = new ArrayList<>();
+    if (CollectionUtils.isNotEmpty(allBlackIpList)) {
+      HashSet<String> blackIpHashSet = new HashSet<String>(allBlackIpList);
+      blackIpList = new ArrayList<>(blackIpHashSet);
+    }
 
-                // 站点ip黑名单
-                boolean isSiteIp = false;
-                if (siteBlackIpList.contains(ip) && !siteWhiteIpList.contains(ip)) {
-                    isSiteIp = true;
-                }
-                if (isPublicIp || isSiteIp) {
-                    adwebEnquiry.setWasteEnquiry(1);
-                    adwebEnquiry.setUserEffective(0);
-                    adwebEnquiry.setWasteEnquiryType("ip");
-                }
-                if (isPublicIp && isSiteIp) {
-                    adwebEnquiry.setEffectiveReason("系统操作-通过询盘公共和站点ip黑名单检测到垃圾询盘-" + ip);
-                    log.info(
-                            "询盘id是:{}, 站点code是:{}, 通过——询盘公共和站点ip黑名单——检测到垃圾询盘, ip是:{}",
-                            adwebEnquiry.getId(),
-                            adwebEnquiry.getSiteCode(),
-                            ip);
-                    continue;
-                }
-                if (isPublicIp) {
-                    adwebEnquiry.setEffectiveReason("系统操作-通过询盘公共ip黑名单检测到垃圾询盘-" + ip);
-                    log.info(
-                            "询盘id是:{}, 站点code是:{}, 通过——询盘公共ip黑名单——检测到垃圾询盘, ip是:{}",
-                            adwebEnquiry.getId(),
-                            adwebEnquiry.getSiteCode(),
-                            ip);
-                    continue;
-                }
-                if (isSiteIp) {
-                    adwebEnquiry.setEffectiveReason("系统操作-通过询盘站点ip黑名单检测到垃圾询盘-" + ip);
-                    log.info(
-                            "询盘id是:{}, 站点code是:{}, 通过——询盘站点ip黑名单——检测到垃圾询盘, ip是:{}",
-                            adwebEnquiry.getId(),
-                            adwebEnquiry.getSiteCode(),
-                            ip);
-                    continue;
-                }
-            }
+    log.info("公共ip黑名单:{} 个", publicBlackIpList.size());
+    log.info("站点ip黑名单:{} 个", siteBlackIpList.size());
+
+    // Ip白名单
+    // 公共Ip白名单
+    List<String> publicWhiteIpList = (List<String>) adwebRedisUtil.get(WhiteIpListKey);
+    if (publicWhiteIpList == null) {
+      List<AdwebPublicBlackIp> enquiryPublicWhiteIpList =
+          adwebPublicBlackIpService.list(
+              new LambdaQueryWrapper<AdwebPublicBlackIp>()
+                  .ne(AdwebPublicBlackIp::getStatus, 0)
+                  .eq(AdwebPublicBlackIp::getBlackOrWhite, 1)
+                  .select(AdwebPublicBlackIp::getIp));
+      if (CollectionUtils.isNotEmpty(enquiryPublicWhiteIpList)) {
+        publicWhiteIpList =
+            enquiryPublicWhiteIpList.stream()
+                .map(AdwebPublicBlackIp::getIp)
+                .collect(Collectors.toList());
+        adwebRedisUtil.set(WhiteIpListKey, publicWhiteIpList, 60 * 60 * 24);
+      } else {
+        publicWhiteIpList = new ArrayList<>();
+      }
+    }
+    // 站点Ip白名单, 基于站点查询
+    List<String> siteWhiteIpList =
+        (List<String>) adwebRedisUtil.get(SiteWhiteIpListKey + "::" + adwebSite.getId());
+    if (CollectionUtils.isEmpty(siteWhiteIpList)) {
+      List<AdwebSiteBlackIp> enquirySiteWhiteIpList =
+          adwebSiteBlackIpService.list(
+              new LambdaQueryWrapper<AdwebSiteBlackIp>()
+                  .ne(AdwebSiteBlackIp::getStatus, 0)
+                  .eq(AdwebSiteBlackIp::getBlackOrWhite, 1)
+                  .eq(AdwebSiteBlackIp::getSiteId, adwebSite.getId())
+                  .select(AdwebSiteBlackIp::getIp));
+      if (CollectionUtils.isNotEmpty(enquirySiteWhiteIpList)) {
+        siteWhiteIpList =
+            enquirySiteWhiteIpList.stream()
+                .map(AdwebSiteBlackIp::getIp)
+                .collect(Collectors.toList());
+        adwebRedisUtil.set(
+            SiteWhiteIpListKey + "::" + adwebSite.getId(), siteWhiteIpList, 60 * 60 * 24);
+      } else {
+        siteWhiteIpList = new ArrayList<>();
+      }
+    }
+    List<String> allWhiteIpList = new ArrayList<>();
+    if (CollectionUtils.isNotEmpty(siteWhiteIpList)) {
+      allWhiteIpList = new ArrayList<>(siteWhiteIpList);
+    }
+    allWhiteIpList.addAll(publicWhiteIpList);
+    List<String> whiteIpList = new ArrayList<>();
+    if (CollectionUtils.isNotEmpty(allWhiteIpList)) {
+      HashSet<String> whiteIpHashSet = new HashSet<String>(allWhiteIpList);
+      whiteIpList = new ArrayList<>(whiteIpHashSet);
+    }
 
-            // 判断邮箱是否包含外部链接
-            List<String> urlList = parser(adwebEnquiry.getMessage());
-            if (StringUtils.isNotBlank(adwebSite.getDomain())) {
-                for (String url : urlList) {
-                    if (!adwebSite.getDomain().contains(url)) {
-                        adwebEnquiry.setWasteEnquiry(1);
-                        adwebEnquiry.setUserEffective(0);
-                        adwebEnquiry.setWasteEnquiryType("other");
-                        adwebEnquiry.setEffectiveReason("系统操作-通过站点url检测到垃圾询盘-" + url);
-                        log.info(
-                                "询盘id是:{}, 站点code是:{}, 通过——站点url——检测到垃圾询盘",
-                                adwebEnquiry.getId(),
-                                adwebEnquiry.getSiteCode());
-                        continue outerloop;
-                    }
-                }
+    log.info("公共ip白名单:" + FastJsonUtil.toJSONString(publicWhiteIpList));
+    log.info("站点ip白名单:" + FastJsonUtil.toJSONString(siteWhiteIpList));
+
+    // 站点询盘规则黑名单
+    LambdaQueryWrapper<AdwebSiteEnquiryRule> adwebEnquirySiteRuleQueryWrapper =
+        new LambdaQueryWrapper<>();
+    adwebEnquirySiteRuleQueryWrapper.eq(AdwebSiteEnquiryRule::getSiteId, adwebSite.getId());
+    adwebEnquirySiteRuleQueryWrapper.eq(AdwebSiteEnquiryRule::getStatus, 1);
+    adwebEnquirySiteRuleQueryWrapper.eq(AdwebSiteEnquiryRule::getBlackOrWhite, 0);
+    List<AdwebSiteEnquiryRule> siteBlackRuleList =
+        adwebSiteEnquiryRuleService.list(adwebEnquirySiteRuleQueryWrapper);
+    log.info("站点关键词黑名单:" + FastJsonUtil.toJSONString(siteBlackRuleList));
+
+    // 判断上一封询盘是否是垃圾询盘
+    AdwebEnquiry isJudgeWasteEnquiry = new AdwebEnquiry();
+
+    // 判断是否垃圾询盘
+    outerloop:
+    for (AdwebEnquiry adwebEnquiry : adwebEnquiryList) {
+      // 没有message的无法判断,认为是普通询盘
+      if (StringUtil.isEmpty(adwebEnquiry.getMessage())) {
+        adwebEnquiry.setWasteEnquiry(1);
+        adwebEnquiry.setUserEffective(0);
+        log.info(
+            "询盘id是:{}, 站点code是:{}, 通过——询盘内容为空——检测到垃圾询盘",
+            adwebEnquiry.getId(),
+            adwebEnquiry.getSiteCode());
+        continue;
+      }
+
+      // 该分支用于判断上一封邮件是否为垃圾询盘
+      dealMultipleRepeatInfoEnquiry(
+          siteBlackEmailList, siteBlackIpList, isJudgeWasteEnquiry, adwebSite);
+      isJudgeWasteEnquiry = adwebEnquiry;
+
+      // 判断 询盘邮箱黑名单
+      if (CollectionUtils.isNotEmpty(blackEmailList)
+          || StringUtils.isNotBlank(adwebEnquiry.getEmail())) {
+
+        String email = adwebEnquiry.getEmail().toLowerCase();
+
+        String message =
+            adwebEnquiry
+                .getMessage()
+                .replaceAll("[\\n\\t]", " ")
+                .replaceAll(" {2,}", " ")
+                .toLowerCase();
+
+        // 公共黑白名单
+        //                boolean isContainPublicWhite = false;
+        //                String containPublicWhiteStr = "";
+        // 白名单
+        //                for(String publicWhiteEmail : publicWhiteEmailList){
+        //                    log.info("judgeWasteEnquiry --
+        // 当前询盘Id:{},!whiteEmailList.contains(email):{}",adwebEnquiry.getId(),!whiteEmailList.contains(email));
+        //                    if(email.equals(publicWhiteEmail) ||
+        // message.equals(publicWhiteEmail)){
+        //                        containPublicWhiteStr = publicWhiteEmail;
+        //                        isContainPublicWhite = true;
+        //                        break;
+        //                    }
+        //                }
+
+        // 黑名单
+        String containPublicBlackStr = "";
+        boolean isContainPublicBlack = false;
+        if (CollectionUtils.isNotEmpty(publicBlackEmailList)) {
+          for (String blackEmail : publicBlackEmailList) {
+            String allBlackEmail = blackEmail;
+            if (allBlackEmail.contains("*")) {
+              allBlackEmail = allBlackEmail.substring(1, allBlackEmail.length() - 1);
+              if (email.contains(allBlackEmail) || message.contains(allBlackEmail)) {
+                containPublicBlackStr = blackEmail;
+                isContainPublicBlack = true;
+                break;
+              }
             } else {
-                if (CollectionUtils.isNotEmpty(urlList)) {
-                    adwebEnquiry.setWasteEnquiry(1);
-                    adwebEnquiry.setUserEffective(0);
-                    adwebEnquiry.setWasteEnquiryType("other");
-                    adwebEnquiry.setEffectiveReason("系统操作-通过站点url检测到垃圾询盘-空");
-                    log.info(
-                            "询盘id是:{}, 站点code是:{}, 通过——站点url——检测到垃圾询盘",
-                            adwebEnquiry.getId(),
-                            adwebEnquiry.getSiteCode());
-                    continue;
-                }
-            }
-
-            // 判断询盘是否包含关键词
-            String message =
-                    adwebEnquiry
-                            .getMessage()
-                            .replaceAll("[\\n\\t]", " ")
-                            .replaceAll(" {2,}", " ")
-                            .toLowerCase();
-            if (CollectionUtils.isNotEmpty(blackWordList)
-                    || CollectionUtils.isNotEmpty(siteBlackRuleList)) {
-                // 公共关键词黑名单
-                boolean isPublicWord = false;
-                String isBlackWord = "";
-                for (String blackWord : blackWordList) {
-                    if (message.contains(blackWord)) {
-                        isPublicWord = true;
-                        isBlackWord = blackWord;
-                    }
-                }
-                // 站点关键词黑名单
-                boolean isSiteWord = false;
-                for (AdwebSiteEnquiryRule siteBlackRule : siteBlackRuleList) {
-                    if (message.contains(siteBlackRule.getWord())) {
-                        isSiteWord = true;
-                        isBlackWord = siteBlackRule.getWord();
-                    }
-                }
-                if (isPublicWord || isSiteWord) {
-                    adwebEnquiry.setWasteEnquiry(1);
-                    adwebEnquiry.setUserEffective(0);
-                    adwebEnquiry.setWasteEnquiryType("keyword");
-                }
-                if (isPublicWord && isSiteWord) {
-                    adwebEnquiry.setEffectiveReason("系统操作-通过公共和站点关键词黑名单检测到垃圾询盘-" + isBlackWord);
-                    log.info(
-                            "询盘id是:{}, 站点code是:{}, 通过——公共和站点关键词黑名单——检测到垃圾询盘, 关键词是:{}",
-                            adwebEnquiry.getId(),
-                            adwebEnquiry.getSiteCode(),
-                            isBlackWord);
-                    continue outerloop;
-                }
-                if (isPublicWord) {
-                    adwebEnquiry.setEffectiveReason("系统操作-通过公共关键词黑名单检测到垃圾询盘-" + isBlackWord);
-                    log.info(
-                            "询盘id是:{}, 站点code是:{}, 通过——公共关键词黑名单——检测到垃圾询盘, 关键词是:{}",
-                            adwebEnquiry.getId(),
-                            adwebEnquiry.getSiteCode(),
-                            isBlackWord);
-                    continue outerloop;
-                }
-                if (isSiteWord) {
-                    adwebEnquiry.setEffectiveReason("系统操作-通过站点关键词黑名单检测到垃圾询盘-" + isBlackWord);
-                    log.info(
-                            "询盘id是:{}, 站点code是:{}, 通过——站点关键词黑名单——检测到垃圾询盘, 关键词是:{}",
-                            adwebEnquiry.getId(),
-                            adwebEnquiry.getSiteCode(),
-                            isBlackWord);
-                    continue outerloop;
-                }
-            }
-
-            // 分词判断
-            if (validateWordLength(adwebEnquiry.getMessage())) {
-                adwebEnquiry.setWasteEnquiry(1);
-                adwebEnquiry.setUserEffective(0);
-                adwebEnquiry.setWasteEnquiryType("other");
-                adwebEnquiry.setEffectiveReason("系统操作-通过单词长度超过50个字符检测到垃圾询盘");
-                log.info(
-                        "询盘id是:{}, 站点code是:{}, 通过——单词长度超过50个字符——检测到垃圾询盘",
-                        adwebEnquiry.getId(),
-                        adwebEnquiry.getSiteCode());
-                continue;
+              if (email.equals(allBlackEmail) || message.equals(allBlackEmail)) {
+                containPublicBlackStr = blackEmail;
+                isContainPublicBlack = true;
+                break;
+              }
             }
-
-            boolean isBlackFlag = false;
-
-            // 询盘为正常询盘
-            // 判断十分钟和一天内同个站点是否有相同的邮箱
-            if (StringUtils.isNotBlank(adwebEnquiry.getEmail())
-                    && !whiteEmailList.contains(adwebEnquiry.getEmail().toLowerCase())) {
-                isBlackFlag =
-                        dealShortSameEmail(
-                                adwebEnquiry, blackEmailList, adwebSite, siteBlackEmailList);
-            }
-
-            // 判断十分钟和一天内同个站点是否有相同的Ip
-            if (StringUtils.isNotBlank(adwebEnquiry.getFromIp())
-                    && !whiteIpList.contains(adwebEnquiry.getFromIp())) {
-                isBlackFlag =
-                        dealShortSameIp(adwebEnquiry, blackIpList, adwebSite, siteBlackIpList);
-            }
-            if (isBlackFlag) {
-                continue;
+          }
+        }
+        log.info("是否是公共黑名单:" + isContainPublicBlack);
+        log.info("匹配的公共黑名单:" + containPublicBlackStr);
+        // 站点黑白名单
+        boolean isContainSiteWhite = false;
+        boolean isSiteAllContain = true;
+        String containSiteWhiteStr = "";
+        // 白名单
+        if (CollectionUtils.isNotEmpty(siteWhiteEmailList)) {
+          for (String whiteEmail : siteWhiteEmailList) {
+            String compareWhiteEmail = whiteEmail;
+            if (compareWhiteEmail.contains("*")) {
+              compareWhiteEmail = whiteEmail.substring(1, whiteEmail.length() - 1);
+              if (email.contains(compareWhiteEmail) || message.contains(compareWhiteEmail)) {
+                containSiteWhiteStr = compareWhiteEmail;
+                isContainSiteWhite = true;
+                isSiteAllContain = false;
+                break;
+              }
+            } else {
+              if (email.equals(compareWhiteEmail) || message.equals(compareWhiteEmail)) {
+                containSiteWhiteStr = compareWhiteEmail;
+                isContainSiteWhite = true;
+                isSiteAllContain = false;
+                break;
+              }
             }
-            adwebEnquiry.setWasteEnquiry(0);
-            adwebEnquiry.setUserEffective(2);
-            // 此处为正常询盘,清除疑似垃圾询盘可能性
-            isJudgeWasteEnquiry = null;
-            log.info(
-                    "询盘id是:{}, 站点code是:{}, 不是垃圾询盘",
-                    adwebEnquiry.getId(),
-                    adwebEnquiry.getSiteCode());
+          }
         }
 
-        // 判断最后一个询盘是否为垃圾询盘
-        isPreviousOneWasteEnquiry(blackEmailList, blackIpList, isJudgeWasteEnquiry);
-
-        // 更新redis
-        // 站点
+        log.info("是否是站点白名单:" + isContainSiteWhite);
+        log.info("匹配的站点白名单:" + containSiteWhiteStr);
+        // 黑名单
+        boolean isContainSiteBlack = false;
+        String containSiteBlackStr = "";
         if (CollectionUtils.isNotEmpty(siteBlackEmailList)) {
-            adwebRedisUtil.set(
-                    SiteBlackEmailKey + "::" + adwebSite.getId(), siteBlackEmailList, 86400);
-        }
-        if (CollectionUtils.isNotEmpty(siteBlackIpList)) {
-            adwebRedisUtil.set(SiteBlackIpKey + "::" + adwebSite.getId(), siteBlackIpList, 86400);
-        }
-        if (CollectionUtils.isNotEmpty(siteWhiteEmailList)) {
-            adwebRedisUtil.set(
-                    SiteWhiteEmailListKey + "::" + adwebSite.getId(), siteWhiteEmailList, 86400);
-        }
-        if (CollectionUtils.isNotEmpty(siteWhiteIpList)) {
-            adwebRedisUtil.set(
-                    SiteWhiteIpListKey + "::" + adwebSite.getId(), siteWhiteIpList, 86400);
-        }
-        // 公共
-        if (CollectionUtils.isNotEmpty(publicBlackEmailList)) {
-            adwebRedisUtil.set(BlackEmailKey, publicBlackEmailList, 86400);
-        }
-        if (CollectionUtils.isNotEmpty(publicBlackIpList)) {
-            adwebRedisUtil.set(BlackIpKey, publicBlackIpList, 86400);
-        }
-        if (CollectionUtils.isNotEmpty(publicWhiteEmailList)) {
-            adwebRedisUtil.set(WhiteEmailListKey, publicWhiteEmailList, 86400);
-        }
-        if (CollectionUtils.isNotEmpty(publicWhiteIpList)) {
-            adwebRedisUtil.set(WhiteIpListKey, publicWhiteIpList, 86400);
+          for (String blackEmail : siteBlackEmailList) {
+            String allBlackEmail = blackEmail;
+            if (allBlackEmail.contains("*")) {
+              allBlackEmail = allBlackEmail.substring(1, allBlackEmail.length() - 1);
+              if (email.contains(allBlackEmail) || message.contains(allBlackEmail)) {
+                containSiteBlackStr = allBlackEmail;
+                isContainSiteBlack = true;
+                isSiteAllContain = false;
+                break;
+              }
+            } else {
+              if (email.equals(allBlackEmail) || message.equals(allBlackEmail)) {
+                containSiteBlackStr = allBlackEmail;
+                isContainSiteBlack = true;
+                isSiteAllContain = false;
+                break;
+              }
+            }
+          }
         }
-    }
 
-    private boolean validateWordLength(String text) {
-        if (StringUtil.isEmpty(text)) {
-            return false;
-        }
-        int maxWordLength = EnglishAnalyzer.getLongestSize(text);
-        int limit;
-        SysDictItem dictItem = dictService.getDictItemByCodeAndText("max_word_length", "default");
-        if (dictItem == null || StringUtil.isEmpty(dictItem.getItemValue())) {
-            limit = 50;
-        } else {
-            limit = Integer.parseInt(dictItem.getItemValue());
+        log.info("是否是站点黑名单:" + isContainSiteBlack);
+        log.info("匹配的站点黑名单:" + containSiteBlackStr);
+        // 判断邮箱或者内容即在黑名单里又在白名单里,特殊处理
+        if (isContainSiteBlack && isContainSiteWhite) {
+          if (containSiteBlackStr.length() <= containSiteWhiteStr.length()) {
+            isContainSiteBlack = false;
+          }
         }
-        return (maxWordLength > limit);
-    }
 
-    private List<String> parser(String text) {
-        Pattern pattern1 = Pattern.compile("(https?|ftp|file)://([-a-zA-Z0-9]+\\.)+[a-zA-Z0-9]+");
-        List<String> domainPatterns = getFormKeys("enquiry_domain_pattern");
-        String domainPattern = "";
-        if (CollectionUtils.isNotEmpty(domainPatterns)) {
-            domainPattern = domainPatterns.get(0);
-        }
-        if (StringUtil.isEmpty(domainPattern)) {
-            domainPattern =
-                    "([-a-zA-Z0-9]+\\.)+(com|cn|net|org|edu|hk|fr|de|uk|eu|tw|ph|my|id|in|ind|co|pk|mx|us"
-                            + "|ve|ar|eg|online|xyz|me|jp|ly|baz|io|cc|tv|club|xxx|host|ltd|vip|work|fit|pub|love|xin|info|pro|post|coop|int|jobs|cat|travel"
-                            + "|ru|onion|site|it)+";
-        } else {
-            domainPattern = "([-a-zA-Z0-9]+\\.)+" + domainPattern;
-        }
-        Pattern pattern2 = Pattern.compile(domainPattern);
-
-        // 邮箱正则
-        Pattern pattern3 =
-                Pattern.compile("[a-zA-Z0-9_\\-\\.]+@[a-zA-Z0-9_\\-\\.]+\\.[a-zA-Z0-9_\\-\\.]+");
-
-        // 判断正文中是否存在邮箱
-        Matcher matcher = pattern3.matcher(text);
-        List<String> emailList = new ArrayList<>();
-        while (matcher.find()) {
-            String keyWord = matcher.group();
-            String lastWord = keyWord.substring(keyWord.length() - 1);
-            if (".".equals(lastWord)) {
-                keyWord = keyWord.substring(0, keyWord.length() - 1);
-            }
-            emailList.add(keyWord);
-            if (keyWord.lastIndexOf("@") > -1) {
-                emailList.add(keyWord.substring(keyWord.lastIndexOf("@") + 1));
-                emailList.add(keyWord.substring(0, keyWord.lastIndexOf("@")));
-            }
+        log.info("第二次处理是否是站点黑名单:" + isContainSiteBlack);
+        if (isContainPublicBlack || !isSiteAllContain) {
+          if (isContainPublicBlack && isContainSiteBlack) {
+            adwebEnquiry.setWasteEnquiry(1);
+            adwebEnquiry.setUserEffective(0);
+            adwebEnquiry.setWasteEnquiryType("email");
+            adwebEnquiry.setEffectiveReason("系统操作-通过公共和站点的询盘邮箱黑名单检测到垃圾询盘-" + containSiteBlackStr);
+            log.info(
+                "询盘id是:{}, 站点code是:{}, 通过——询盘邮箱黑名单——检测到垃圾询盘, 黑名单邮箱是:{}",
+                adwebEnquiry.getId(),
+                adwebEnquiry.getSiteCode(),
+                containSiteBlackStr);
+            continue outerloop;
+          }
+          if (isContainPublicBlack && isSiteAllContain) {
+            adwebEnquiry.setWasteEnquiry(1);
+            adwebEnquiry.setUserEffective(0);
+            adwebEnquiry.setWasteEnquiryType("email");
+            adwebEnquiry.setEffectiveReason("系统操作-通过公共的询盘邮箱黑名单检测到垃圾询盘-" + containPublicBlackStr);
+            log.info(
+                "询盘id是:{}, 站点code是:{}, 通过——询盘邮箱黑名单——检测到垃圾询盘, 黑名单邮箱是:{}",
+                adwebEnquiry.getId(),
+                adwebEnquiry.getSiteCode(),
+                containPublicBlackStr);
+            continue outerloop;
+          }
+          if (!isContainPublicBlack && isContainSiteBlack) {
+            adwebEnquiry.setWasteEnquiry(1);
+            adwebEnquiry.setUserEffective(0);
+            adwebEnquiry.setWasteEnquiryType("email");
+            adwebEnquiry.setEffectiveReason("系统操作-通过站点的询盘邮箱黑名单检测到垃圾询盘-" + containSiteBlackStr);
+            log.info(
+                "询盘id是:{}, 站点code是:{}, 通过——询盘邮箱黑名单——检测到垃圾询盘, 黑名单邮箱是:{}",
+                adwebEnquiry.getId(),
+                adwebEnquiry.getSiteCode(),
+                containSiteBlackStr);
+            continue outerloop;
+          }
+        }
+      }
+
+      // @see http://52.83.154.198:8082/browse/ADWEBV2-12
+      // 垃圾询盘过滤时IP按照客户IP去使用黑名单过滤而不再使用来源IP
+      // 判断是否为ip黑名单
+      if (CollectionUtils.isNotEmpty(blackIpList)
+          || StringUtils.isNotBlank(adwebEnquiry.getCustomerIp())) {
+        String ip = adwebEnquiry.getCustomerIp();
+        // 公共ip黑名单
+        boolean isPublicIp = false;
+        if (publicBlackIpList.contains(ip) && !publicWhiteIpList.contains(ip)) {
+          isPublicIp = true;
         }
 
-        List<String> urls = new ArrayList<>();
+        // 站点ip黑名单
+        boolean isSiteIp = false;
+        if (siteBlackIpList.contains(ip) && !siteWhiteIpList.contains(ip)) {
+          isSiteIp = true;
+        }
+        if (isPublicIp || isSiteIp) {
+          adwebEnquiry.setWasteEnquiry(1);
+          adwebEnquiry.setUserEffective(0);
+          adwebEnquiry.setWasteEnquiryType("ip");
+        }
+        if (isPublicIp && isSiteIp) {
+          adwebEnquiry.setEffectiveReason("系统操作-通过询盘公共和站点ip黑名单检测到垃圾询盘-" + ip);
+          log.info(
+              "询盘id是:{}, 站点code是:{}, 通过——询盘公共和站点ip黑名单——检测到垃圾询盘, ip是:{}",
+              adwebEnquiry.getId(),
+              adwebEnquiry.getSiteCode(),
+              ip);
+          continue;
+        }
+        if (isPublicIp) {
+          adwebEnquiry.setEffectiveReason("系统操作-通过询盘公共ip黑名单检测到垃圾询盘-" + ip);
+          log.info(
+              "询盘id是:{}, 站点code是:{}, 通过——询盘公共ip黑名单——检测到垃圾询盘, ip是:{}",
+              adwebEnquiry.getId(),
+              adwebEnquiry.getSiteCode(),
+              ip);
+          continue;
+        }
+        if (isSiteIp) {
+          adwebEnquiry.setEffectiveReason("系统操作-通过询盘站点ip黑名单检测到垃圾询盘-" + ip);
+          log.info(
+              "询盘id是:{}, 站点code是:{}, 通过——询盘站点ip黑名单——检测到垃圾询盘, ip是:{}",
+              adwebEnquiry.getId(),
+              adwebEnquiry.getSiteCode(),
+              ip);
+          continue;
+        }
+      }
+
+      // 判断邮箱是否包含外部链接
+      List<String> urlList = parser(adwebEnquiry.getMessage());
+      if (StringUtils.isNotBlank(adwebSite.getDomain())) {
+        for (String url : urlList) {
+          if (!adwebSite.getDomain().contains(url)) {
+            adwebEnquiry.setWasteEnquiry(1);
+            adwebEnquiry.setUserEffective(0);
+            adwebEnquiry.setWasteEnquiryType("other");
+            adwebEnquiry.setEffectiveReason("系统操作-通过站点url检测到垃圾询盘-" + url);
+            log.info(
+                "询盘id是:{}, 站点code是:{}, 通过——站点url——检测到垃圾询盘",
+                adwebEnquiry.getId(),
+                adwebEnquiry.getSiteCode());
+            continue outerloop;
+          }
+        }
+      } else {
+        if (CollectionUtils.isNotEmpty(urlList)) {
+          adwebEnquiry.setWasteEnquiry(1);
+          adwebEnquiry.setUserEffective(0);
+          adwebEnquiry.setWasteEnquiryType("other");
+          adwebEnquiry.setEffectiveReason("系统操作-通过站点url检测到垃圾询盘-空");
+          log.info(
+              "询盘id是:{}, 站点code是:{}, 通过——站点url——检测到垃圾询盘",
+              adwebEnquiry.getId(),
+              adwebEnquiry.getSiteCode());
+          continue;
+        }
+      }
+
+      // 判断询盘是否包含关键词
+      String message =
+          adwebEnquiry
+              .getMessage()
+              .replaceAll("[\\n\\t]", " ")
+              .replaceAll(" {2,}", " ")
+              .toLowerCase();
+      if (CollectionUtils.isNotEmpty(blackWordList)
+          || CollectionUtils.isNotEmpty(siteBlackRuleList)) {
+        // 公共关键词黑名单
+        boolean isPublicWord = false;
+        String isBlackWord = "";
+        for (String blackWord : blackWordList) {
+          if (message.contains(blackWord)) {
+            isPublicWord = true;
+            isBlackWord = blackWord;
+          }
+        }
+        // 站点关键词黑名单
+        boolean isSiteWord = false;
+        for (AdwebSiteEnquiryRule siteBlackRule : siteBlackRuleList) {
+          if (message.contains(siteBlackRule.getWord())) {
+            isSiteWord = true;
+            isBlackWord = siteBlackRule.getWord();
+          }
+        }
+        if (isPublicWord || isSiteWord) {
+          adwebEnquiry.setWasteEnquiry(1);
+          adwebEnquiry.setUserEffective(0);
+          adwebEnquiry.setWasteEnquiryType("keyword");
+        }
+        if (isPublicWord && isSiteWord) {
+          adwebEnquiry.setEffectiveReason("系统操作-通过公共和站点关键词黑名单检测到垃圾询盘-" + isBlackWord);
+          log.info(
+              "询盘id是:{}, 站点code是:{}, 通过——公共和站点关键词黑名单——检测到垃圾询盘, 关键词是:{}",
+              adwebEnquiry.getId(),
+              adwebEnquiry.getSiteCode(),
+              isBlackWord);
+          continue outerloop;
+        }
+        if (isPublicWord) {
+          adwebEnquiry.setEffectiveReason("系统操作-通过公共关键词黑名单检测到垃圾询盘-" + isBlackWord);
+          log.info(
+              "询盘id是:{}, 站点code是:{}, 通过——公共关键词黑名单——检测到垃圾询盘, 关键词是:{}",
+              adwebEnquiry.getId(),
+              adwebEnquiry.getSiteCode(),
+              isBlackWord);
+          continue outerloop;
+        }
+        if (isSiteWord) {
+          adwebEnquiry.setEffectiveReason("系统操作-通过站点关键词黑名单检测到垃圾询盘-" + isBlackWord);
+          log.info(
+              "询盘id是:{}, 站点code是:{}, 通过——站点关键词黑名单——检测到垃圾询盘, 关键词是:{}",
+              adwebEnquiry.getId(),
+              adwebEnquiry.getSiteCode(),
+              isBlackWord);
+          continue outerloop;
+        }
+      }
+
+      // 分词判断
+      if (validateWordLength(adwebEnquiry.getMessage())) {
+        adwebEnquiry.setWasteEnquiry(1);
+        adwebEnquiry.setUserEffective(0);
+        adwebEnquiry.setWasteEnquiryType("other");
+        adwebEnquiry.setEffectiveReason("系统操作-通过单词长度超过50个字符检测到垃圾询盘");
+        log.info(
+            "询盘id是:{}, 站点code是:{}, 通过——单词长度超过50个字符——检测到垃圾询盘",
+            adwebEnquiry.getId(),
+            adwebEnquiry.getSiteCode());
+        continue;
+      }
+
+      boolean isBlackFlag = false;
+
+      // 询盘为正常询盘
+      // 判断十分钟和一天内同个站点是否有相同的邮箱
+      if (StringUtils.isNotBlank(adwebEnquiry.getEmail())
+          && !whiteEmailList.contains(adwebEnquiry.getEmail().toLowerCase())) {
+        isBlackFlag =
+            dealShortSameEmail(adwebEnquiry, blackEmailList, adwebSite, siteBlackEmailList);
+      }
+
+      // 判断十分钟和一天内同个站点是否有相同的Ip
+      if (StringUtils.isNotBlank(adwebEnquiry.getFromIp())
+          && !whiteIpList.contains(adwebEnquiry.getFromIp())) {
+        isBlackFlag = dealShortSameIp(adwebEnquiry, blackIpList, adwebSite, siteBlackIpList);
+      }
+      if (isBlackFlag) {
+        continue;
+      }
+      adwebEnquiry.setWasteEnquiry(0);
+      adwebEnquiry.setUserEffective(2);
+      // 此处为正常询盘,清除疑似垃圾询盘可能性
+      isJudgeWasteEnquiry = null;
+      log.info("询盘id是:{}, 站点code是:{}, 不是垃圾询盘", adwebEnquiry.getId(), adwebEnquiry.getSiteCode());
+    }
 
-        Matcher matcher1 = pattern1.matcher(text);
-        while (matcher1.find()) {
-            urls.add(matcher1.group());
-        }
+    // 判断最后一个询盘是否为垃圾询盘
+    isPreviousOneWasteEnquiry(blackEmailList, blackIpList, isJudgeWasteEnquiry);
 
-        Matcher matcher2 = pattern2.matcher(text);
-        while (matcher2.find()) {
-            urls.add(matcher2.group());
-        }
+    // 更新redis
+    // 站点
+    if (CollectionUtils.isNotEmpty(siteBlackEmailList)) {
+      adwebRedisUtil.set(SiteBlackEmailKey + "::" + adwebSite.getId(), siteBlackEmailList, 86400);
+    }
+    if (CollectionUtils.isNotEmpty(siteBlackIpList)) {
+      adwebRedisUtil.set(SiteBlackIpKey + "::" + adwebSite.getId(), siteBlackIpList, 86400);
+    }
+    if (CollectionUtils.isNotEmpty(siteWhiteEmailList)) {
+      adwebRedisUtil.set(
+          SiteWhiteEmailListKey + "::" + adwebSite.getId(), siteWhiteEmailList, 86400);
+    }
+    if (CollectionUtils.isNotEmpty(siteWhiteIpList)) {
+      adwebRedisUtil.set(SiteWhiteIpListKey + "::" + adwebSite.getId(), siteWhiteIpList, 86400);
+    }
+    // 公共
+    if (CollectionUtils.isNotEmpty(publicBlackEmailList)) {
+      adwebRedisUtil.set(BlackEmailKey, publicBlackEmailList, 86400);
+    }
+    if (CollectionUtils.isNotEmpty(publicBlackIpList)) {
+      adwebRedisUtil.set(BlackIpKey, publicBlackIpList, 86400);
+    }
+    if (CollectionUtils.isNotEmpty(publicWhiteEmailList)) {
+      adwebRedisUtil.set(WhiteEmailListKey, publicWhiteEmailList, 86400);
+    }
+    if (CollectionUtils.isNotEmpty(publicWhiteIpList)) {
+      adwebRedisUtil.set(WhiteIpListKey, publicWhiteIpList, 86400);
+    }
+  }
 
-        // 如果邮箱和 URL 都存在,并且 URL 中不包含 http 和 https,则从 URL 中删除邮箱
-        if (CollectionUtils.isNotEmpty(emailList)) {
-            Set<String> urlSet = new HashSet<>(urls);
-            urlSet.removeAll(
-                    emailList.stream()
-                            .filter(
-                                    email ->
-                                            urlSet.contains(email)
-                                                    && !email.contains("http")
-                                                    && !email.contains("https"))
-                            .collect(Collectors.toSet()));
-            urls = new ArrayList<>(urlSet);
-        }
+  private boolean validateWordLength(String text) {
+    if (StringUtil.isEmpty(text)) {
+      return false;
+    }
+    int maxWordLength = EnglishAnalyzer.getLongestSize(text);
+    int limit;
+    SysDictItem dictItem = dictService.getDictItemByCodeAndText("max_word_length", "default");
+    if (dictItem == null || StringUtil.isEmpty(dictItem.getItemValue())) {
+      limit = 50;
+    } else {
+      limit = Integer.parseInt(dictItem.getItemValue());
+    }
+    return (maxWordLength > limit);
+  }
+
+  private List<String> parser(String text) {
+    Pattern pattern1 = Pattern.compile("(https?|ftp|file)://([-a-zA-Z0-9]+\\.)+[a-zA-Z0-9]+");
+    List<String> domainPatterns = getFormKeys("enquiry_domain_pattern");
+    String domainPattern = "";
+    if (CollectionUtils.isNotEmpty(domainPatterns)) {
+      domainPattern = domainPatterns.get(0);
+    }
+    if (StringUtil.isEmpty(domainPattern)) {
+      domainPattern =
+          "([-a-zA-Z0-9]+\\.)+(com|cn|net|org|edu|hk|fr|de|uk|eu|tw|ph|my|id|in|ind|co|pk|mx|us"
+              + "|ve|ar|eg|online|xyz|me|jp|ly|baz|io|cc|tv|club|xxx|host|ltd|vip|work|fit|pub|love|xin|info|pro|post|coop|int|jobs|cat|travel"
+              + "|ru|onion|site|it)+";
+    } else {
+      domainPattern = "([-a-zA-Z0-9]+\\.)+" + domainPattern;
+    }
+    Pattern pattern2 = Pattern.compile(domainPattern);
+
+    // 邮箱正则
+    Pattern pattern3 =
+        Pattern.compile("[a-zA-Z0-9_\\-\\.]+@[a-zA-Z0-9_\\-\\.]+\\.[a-zA-Z0-9_\\-\\.]+");
+
+    // 判断正文中是否存在邮箱
+    Matcher matcher = pattern3.matcher(text);
+    List<String> emailList = new ArrayList<>();
+    while (matcher.find()) {
+      String keyWord = matcher.group();
+      String lastWord = keyWord.substring(keyWord.length() - 1);
+      if (".".equals(lastWord)) {
+        keyWord = keyWord.substring(0, keyWord.length() - 1);
+      }
+      emailList.add(keyWord);
+      if (keyWord.lastIndexOf("@") > -1) {
+        emailList.add(keyWord.substring(keyWord.lastIndexOf("@") + 1));
+        emailList.add(keyWord.substring(0, keyWord.lastIndexOf("@")));
+      }
+    }
 
-        urls = urls.stream().distinct().collect(Collectors.toList());
-        return urls;
-    }
-
-    /** 判断是否时垃圾询盘 */
-    private void isPreviousOneWasteEnquiry(
-            List<String> blackEmailList,
-            List<String> blackIpList,
-            AdwebEnquiry isJudgeWasteEnquiry) {
-        if (isJudgeWasteEnquiry != null
-                && StringUtils.isNotBlank(isJudgeWasteEnquiry.getSiteCode())) {
-            log.info("上一封邮件为垃圾询盘,处理中...");
-            boolean emailFlag = false;
-            String isJudgeWasteEnquiryEmail = isJudgeWasteEnquiry.getEmail().toLowerCase();
-            if (StringUtils.isNotBlank(isJudgeWasteEnquiryEmail)
-                    && CollectionUtils.isNotEmpty(blackEmailList)) {
-                for (String blackEmail : blackEmailList) {
-                    if (isJudgeWasteEnquiry.getEmail().equals(blackEmail)) {
-                        emailFlag = false;
-                        break;
-                    } else if (blackEmail.contains("*")) {
-                        String generalBlackEmail =
-                                blackEmail.substring(1, blackEmail.length() - 1 - 1);
-                        if (isJudgeWasteEnquiry.getEmail().contains(generalBlackEmail)) {
-                            emailFlag = false;
-                            break;
-                        }
-                    } else {
-                        emailFlag = true;
-                    }
-                }
-            }
+    List<String> urls = new ArrayList<>();
 
-            boolean ipFlag =
-                    StringUtils.isNotBlank(isJudgeWasteEnquiry.getFromIp())
-                            && blackIpList != null
-                            && !blackIpList.contains(isJudgeWasteEnquiry.getFromIp());
-
-            // 该分支用于判断上一封垃圾询盘 不在邮箱黑名单中
-            if (emailFlag) {
-                Integer notBlackEmailWasteListCount = null;
-                if (adwebRedisUtil.hasKey(
-                        NotBlackEmailWasteEnquiryKey + isJudgeWasteEnquiry.getEmail())) {
-                    notBlackEmailWasteListCount =
-                            (Integer)
-                                            adwebRedisUtil.get(
-                                                    NotBlackEmailWasteEnquiryKey
-                                                            + isJudgeWasteEnquiry.getEmail())
-                                    + 1;
-                } else {
-                    notBlackEmailWasteListCount = 1;
-                }
-                adwebRedisUtil.set(
-                        NotBlackEmailWasteEnquiryKey + isJudgeWasteEnquiry.getEmail(),
-                        notBlackEmailWasteListCount,
-                        60L * 60 * 24 * emailNotBlackListDate);
-
-                // 该分支用于判断是否超过
-                if (notBlackEmailWasteListCount > emailNotBlackListNum) {
-                    AdwebPublicBlackEmail blackEmail =
-                            new AdwebPublicBlackEmail(
-                                    isJudgeWasteEnquiry.getEmail(),
-                                    NumConstant.ONE,
-                                    NumConstant.ZERO);
-                    if (adwebPublicBlackEmailService.count(
-                                    new LambdaQueryWrapper<AdwebPublicBlackEmail>()
-                                            .eq(
-                                                    AdwebPublicBlackEmail::getEmail,
-                                                    isJudgeWasteEnquiry.getEmail())
-                                            .ne(AdwebPublicBlackEmail::getStatus, 0))
-                            == 0) {
-                        adwebPublicBlackEmailService.save(blackEmail);
-                        blackEmailList.add(isJudgeWasteEnquiry.getEmail());
-                        log.info(
-                                "询盘id是:{}, 站点code是:{}, 检测重复,已标记邮箱, 邮箱是:{}",
-                                isJudgeWasteEnquiry.getId(),
-                                isJudgeWasteEnquiry.getSiteCode(),
-                                isJudgeWasteEnquiry.getEmail());
-                    }
-                    adwebRedisUtil.del(
-                            NotBlackEmailWasteEnquiryKey + isJudgeWasteEnquiry.getEmail());
-                }
-            }
-            if (ipFlag) {
-                Integer notBlackIpWasteListCount = null;
-                if (adwebRedisUtil.hasKey(
-                        NotBlackIpWasteEnquiryKey + isJudgeWasteEnquiry.getFromIp())) {
-                    notBlackIpWasteListCount =
-                            (Integer)
-                                            adwebRedisUtil.get(
-                                                    NotBlackIpWasteEnquiryKey
-                                                            + isJudgeWasteEnquiry.getFromIp())
-                                    + 1;
-                } else {
-                    notBlackIpWasteListCount = 1;
-                }
-                adwebRedisUtil.set(
-                        NotBlackIpWasteEnquiryKey + isJudgeWasteEnquiry.getFromIp(),
-                        notBlackIpWasteListCount,
-                        60L * 60 * 24 * ipNotBlackListDate);
-
-                // 该分支用于判断是否出现超过
-                if (notBlackIpWasteListCount > ipNotBlackListNum) {
-                    AdwebPublicBlackIp blackIp =
-                            new AdwebPublicBlackIp(
-                                    isJudgeWasteEnquiry.getFromIp(),
-                                    NumConstant.ONE,
-                                    NumConstant.ZERO);
-                    if (adwebPublicBlackIpService.count(
-                                    new LambdaQueryWrapper<AdwebPublicBlackIp>()
-                                            .eq(
-                                                    AdwebPublicBlackIp::getIp,
-                                                    isJudgeWasteEnquiry.getFromIp())
-                                            .ne(AdwebPublicBlackIp::getStatus, 0))
-                            == 0) {
-                        adwebPublicBlackIpService.save(blackIp);
-                        blackIpList.add(isJudgeWasteEnquiry.getFromIp());
-                        log.info(
-                                "询盘id是:{}, 站点code是:{}, 检测重复,已标记ip, ip是:{}",
-                                isJudgeWasteEnquiry.getId(),
-                                isJudgeWasteEnquiry.getSiteCode(),
-                                isJudgeWasteEnquiry.getFromIp());
-                    }
-                    adwebRedisUtil.del(NotBlackIpWasteEnquiryKey + isJudgeWasteEnquiry.getFromIp());
-                }
-            }
-        }
+    Matcher matcher1 = pattern1.matcher(text);
+    while (matcher1.find()) {
+      urls.add(matcher1.group());
     }
 
-    /** 当同步询盘拉取时,处理同个邮箱或者同个ip的询盘达到一定数量后置为黑名单 如果是公共黑名单 */
-    private void dealMultipleRepeatInfoEnquiry(
-            List<String> siteBlackEmailList,
-            List<String> siteBlackIpList,
-            AdwebEnquiry isJudgeWasteEnquiry,
-            AdwebSite adwebSite) {
-        if (isJudgeWasteEnquiry != null
-                && StringUtils.isNotBlank(isJudgeWasteEnquiry.getSiteCode())) {
-            log.info("上一封邮件为垃圾询盘,处理中...");
-            boolean emailFlag = false;
-            String isJudgeWasteEnquiryEmail = isJudgeWasteEnquiry.getEmail().toLowerCase();
-            if (StringUtils.isNotBlank(isJudgeWasteEnquiryEmail)
-                    && CollectionUtils.isNotEmpty(siteBlackEmailList)) {
-                for (String blackEmail : siteBlackEmailList) {
-                    if (isJudgeWasteEnquiry.getEmail().equals(blackEmail)) {
-                        emailFlag = false;
-                        break;
-                    } else if (blackEmail.contains("*")) {
-                        String generalBlackEmail =
-                                blackEmail.substring(1, blackEmail.length() - 1 - 1);
-                        if (isJudgeWasteEnquiry.getEmail().contains(generalBlackEmail)) {
-                            emailFlag = false;
-                            break;
-                        }
-                    } else {
-                        emailFlag = true;
-                    }
-                }
-            }
-
-            boolean ipFlag =
-                    StringUtils.isNotBlank(isJudgeWasteEnquiry.getFromIp())
-                            && siteBlackIpList != null
-                            && !siteBlackIpList.contains(isJudgeWasteEnquiry.getFromIp());
-
-            // 该分支用于判断上一封垃圾询盘 不在邮箱黑名单中
-            if (emailFlag) {
-                Integer notBlackEmailWasteListCount = null;
-                if (adwebRedisUtil.hasKey(
-                        NotBlackEmailWasteSiteEnquiryKey
-                                + adwebSite.getId()
-                                + "::"
-                                + isJudgeWasteEnquiry.getEmail())) {
-                    notBlackEmailWasteListCount =
-                            (Integer)
-                                            adwebRedisUtil.get(
-                                                    NotBlackEmailWasteSiteEnquiryKey
-                                                            + adwebSite.getId()
-                                                            + "::"
-                                                            + isJudgeWasteEnquiry.getEmail())
-                                    + 1;
-                } else {
-                    notBlackEmailWasteListCount = 1;
-                }
-                adwebRedisUtil.set(
-                        NotBlackEmailWasteSiteEnquiryKey
-                                + adwebSite.getId()
-                                + "::"
-                                + isJudgeWasteEnquiry.getEmail(),
-                        notBlackEmailWasteListCount,
-                        60L * 60 * 24 * emailNotBlackListDate);
-
-                // 该分支用于判断是否超过
-                if (notBlackEmailWasteListCount > emailNotBlackListNum) {
-                    if (enquirySiteBlackEmailService.count(
-                                    new LambdaQueryWrapper<AdwebSiteBlackEmail>()
-                                            .eq(
-                                                    AdwebSiteBlackEmail::getEmail,
-                                                    isJudgeWasteEnquiry.getEmail())
-                                            .ne(AdwebSiteBlackEmail::getStatus, 0)
-                                            .eq(AdwebSiteBlackEmail::getSiteId, adwebSite.getId())
-                                            .eq(AdwebSiteBlackEmail::getBlackOrWhite, 0))
-                            == 0) {
-                        siteBlackEmailList.add(isJudgeWasteEnquiry.getEmail());
-                        log.info(
-                                "询盘id是:{}, 站点code是:{}, 检测重复,已标记邮箱, 邮箱是:{}",
-                                isJudgeWasteEnquiry.getId(),
-                                isJudgeWasteEnquiry.getSiteCode(),
-                                isJudgeWasteEnquiry.getEmail());
-                    }
-                    EffectiveEnquiryParamDto effectiveEnquiryParamDto =
-                            new EffectiveEnquiryParamDto();
-                    effectiveEnquiryParamDto.setSiteId(adwebSite.getId());
-                    effectiveEnquiryParamDto.setSiteCode(adwebSite.getCode());
-                    effectiveEnquiryParamDto.setWasteEnquirySeason(isJudgeWasteEnquiry.getEmail());
-                    enquirySiteBlackEmailService.addBlackEmailByContent(effectiveEnquiryParamDto);
-                    adwebRedisUtil.del(
-                            NotBlackEmailWasteSiteEnquiryKey
-                                    + adwebSite.getId()
-                                    + "::"
-                                    + isJudgeWasteEnquiry.getEmail());
-                }
-            }
-            if (ipFlag) {
-                Integer notBlackIpWasteListCount = null;
-                if (adwebRedisUtil.hasKey(
-                        NotSiteBlackIpWasteEnquiryKey
-                                + adwebSite.getId()
-                                + "::"
-                                + isJudgeWasteEnquiry.getFromIp())) {
-                    notBlackIpWasteListCount =
-                            (Integer)
-                                            adwebRedisUtil.get(
-                                                    NotSiteBlackIpWasteEnquiryKey
-                                                            + adwebSite.getId()
-                                                            + "::"
-                                                            + isJudgeWasteEnquiry.getFromIp())
-                                    + 1;
-                } else {
-                    notBlackIpWasteListCount = 1;
-                }
-                adwebRedisUtil.set(
-                        NotSiteBlackIpWasteEnquiryKey
-                                + adwebSite.getId()
-                                + "::"
-                                + isJudgeWasteEnquiry.getFromIp(),
-                        notBlackIpWasteListCount,
-                        60L * 60 * 24 * ipNotBlackListDate);
-
-                // 该分支用于判断是否出现超过
-                if (notBlackIpWasteListCount > ipNotBlackListNum) {
-                    if (adwebSiteBlackIpService.count(
-                                    new LambdaQueryWrapper<AdwebSiteBlackIp>()
-                                            .eq(
-                                                    AdwebSiteBlackIp::getIp,
-                                                    isJudgeWasteEnquiry.getFromIp())
-                                            .ne(AdwebSiteBlackIp::getStatus, 0)
-                                            .eq(AdwebSiteBlackIp::getSiteId, adwebSite.getId())
-                                            .eq(AdwebSiteBlackIp::getBlackOrWhite, 0))
-                            == 0) {
-                        siteBlackIpList.add(isJudgeWasteEnquiry.getFromIp());
-                        log.info(
-                                "询盘id是:{}, 站点code是:{}, 检测重复,已标记ip, ip是:{}",
-                                isJudgeWasteEnquiry.getId(),
-                                isJudgeWasteEnquiry.getSiteCode(),
-                                isJudgeWasteEnquiry.getFromIp());
-                    }
-                    EffectiveEnquiryParamDto effectiveEnquiryParamDto =
-                            new EffectiveEnquiryParamDto();
-                    effectiveEnquiryParamDto.setWasteEnquirySeason(isJudgeWasteEnquiry.getFromIp());
-                    effectiveEnquiryParamDto.setSiteId(adwebSite.getId());
-                    effectiveEnquiryParamDto.setSiteCode(adwebSite.getCode());
-                    adwebSiteBlackIpService.addBlackIpByContent(effectiveEnquiryParamDto);
-                    adwebRedisUtil.del(
-                            NotSiteBlackIpWasteEnquiryKey
-                                    + adwebSite.getId()
-                                    + "::"
-                                    + isJudgeWasteEnquiry.getFromIp());
-                }
-            }
-        }
+    Matcher matcher2 = pattern2.matcher(text);
+    while (matcher2.find()) {
+      urls.add(matcher2.group());
     }
 
-    /** 当同步询盘拉取时,处理10分钟或一天同个邮箱的询盘达到一定数量后置为黑名单 */
-    private boolean dealShortSameEmail(
-            AdwebEnquiry adwebEnquiry,
-            List<String> blackEmailList,
-            AdwebSite adwebSite,
-            List<String> siteBlackEmailList) {
-        Integer tenMin = null;
-        String TenMinKey = SiteEmailTenMinKey + adwebSite.getId() + "::" + adwebEnquiry.getEmail();
-        String oneDayKey = SiteEmailOneDayKey + adwebSite.getId() + "::" + adwebEnquiry.getEmail();
-        if (adwebRedisUtil.hasKey(TenMinKey)) {
-            tenMin = (Integer) adwebRedisUtil.get(TenMinKey) + 1;
-        } else {
-            tenMin = 1;
-        }
-        adwebRedisUtil.set(TenMinKey, tenMin, 10 * 60);
+    // 如果邮箱和 URL 都存在,并且 URL 中不包含 http 和 https,则从 URL 中删除邮箱
+    if (CollectionUtils.isNotEmpty(emailList)) {
+      Set<String> urlSet = new HashSet<>(urls);
+      urlSet.removeAll(
+          emailList.stream()
+              .filter(
+                  email ->
+                      urlSet.contains(email) && !email.contains("http") && !email.contains("https"))
+              .collect(Collectors.toSet()));
+      urls = new ArrayList<>(urlSet);
+    }
 
-        if (tenMin > emailTenMinNum) {
-            adwebEnquiry.setWasteEnquiry(1);
-            adwebEnquiry.setUserEffective(0);
-            adwebEnquiry.setWasteEnquiryType("email");
-            adwebEnquiry.setEffectiveReason("系统操作-通过十分钟内重复邮箱检测到垃圾询盘-" + adwebEnquiry.getEmail());
-            log.info(
-                    "询盘id是:{}, 站点code是:{}, 通过——十分钟内—重复邮箱—检测到垃圾询盘",
-                    adwebEnquiry.getId(),
-                    adwebEnquiry.getSiteCode());
-            if (enquirySiteBlackEmailService.count(
-                            new LambdaQueryWrapper<AdwebSiteBlackEmail>()
-                                    .eq(AdwebSiteBlackEmail::getEmail, adwebEnquiry.getEmail())
-                                    .ne(AdwebSiteBlackEmail::getStatus, 0)
-                                    .eq(AdwebSiteBlackEmail::getSiteId, adwebSite.getId())
-                                    .eq(AdwebSiteBlackEmail::getBlackOrWhite, 0))
-                    == 0) {
-                siteBlackEmailList.add(adwebEnquiry.getEmail());
-                blackEmailList.add(adwebEnquiry.getEmail());
-                log.info(
-                        "询盘id是:{}, 站点code是:{}, 检测十分钟内重复,已标记邮箱, 邮箱是:{}",
-                        adwebEnquiry.getId(),
-                        adwebEnquiry.getSiteCode(),
-                        adwebEnquiry.getEmail());
+    urls = urls.stream().distinct().collect(Collectors.toList());
+    return urls;
+  }
+
+  /** 判断是否时垃圾询盘 */
+  private void isPreviousOneWasteEnquiry(
+      List<String> blackEmailList, List<String> blackIpList, AdwebEnquiry isJudgeWasteEnquiry) {
+    if (isJudgeWasteEnquiry != null && StringUtils.isNotBlank(isJudgeWasteEnquiry.getSiteCode())) {
+      log.info("上一封邮件为垃圾询盘,处理中...");
+      boolean emailFlag = false;
+      String isJudgeWasteEnquiryEmail = isJudgeWasteEnquiry.getEmail().toLowerCase();
+      if (StringUtils.isNotBlank(isJudgeWasteEnquiryEmail)
+          && CollectionUtils.isNotEmpty(blackEmailList)) {
+        for (String blackEmail : blackEmailList) {
+          if (isJudgeWasteEnquiry.getEmail().equals(blackEmail)) {
+            emailFlag = false;
+            break;
+          } else if (blackEmail.contains("*")) {
+            String generalBlackEmail = blackEmail.substring(1, blackEmail.length() - 1 - 1);
+            if (isJudgeWasteEnquiry.getEmail().contains(generalBlackEmail)) {
+              emailFlag = false;
+              break;
             }
-            // 存储到数据库中
-            EffectiveEnquiryParamDto effectiveEnquiryParamDto = new EffectiveEnquiryParamDto();
-            effectiveEnquiryParamDto.setSiteId(adwebSite.getId());
-            effectiveEnquiryParamDto.setSiteCode(adwebSite.getCode());
-            effectiveEnquiryParamDto.setWasteEnquirySeason(adwebEnquiry.getEmail());
-            enquirySiteBlackEmailService.addBlackEmailByContent(effectiveEnquiryParamDto);
-            // 清除map中的数据
-            adwebRedisUtil.del(TenMinKey);
-            adwebRedisUtil.del(oneDayKey);
-            return true;
-        }
-
-        // 如果10分钟内发送了则1天用判断了
-        Integer oneDay = null;
-        if (adwebRedisUtil.hasKey(oneDayKey)) {
-            oneDay = (Integer) adwebRedisUtil.get(oneDayKey) + 1;
+          } else {
+            emailFlag = true;
+          }
+        }
+      }
+
+      boolean ipFlag =
+          StringUtils.isNotBlank(isJudgeWasteEnquiry.getFromIp())
+              && blackIpList != null
+              && !blackIpList.contains(isJudgeWasteEnquiry.getFromIp());
+
+      // 该分支用于判断上一封垃圾询盘 不在邮箱黑名单中
+      if (emailFlag) {
+        Integer notBlackEmailWasteListCount = null;
+        if (adwebRedisUtil.hasKey(NotBlackEmailWasteEnquiryKey + isJudgeWasteEnquiry.getEmail())) {
+          notBlackEmailWasteListCount =
+              (Integer)
+                      adwebRedisUtil.get(
+                          NotBlackEmailWasteEnquiryKey + isJudgeWasteEnquiry.getEmail())
+                  + 1;
         } else {
-            oneDay = 1;
-        }
-        adwebRedisUtil.set(oneDayKey, oneDay, 24 * 60 * 60);
-
-        if (oneDay > emailOneDayNum) {
-            adwebEnquiry.setWasteEnquiry(1);
-            adwebEnquiry.setUserEffective(0);
-            adwebEnquiry.setWasteEnquiryType("email");
-            adwebEnquiry.setEffectiveReason("系统操作-通过一天内重复邮箱检测到垃圾询盘-" + adwebEnquiry.getEmail());
-            log.info(
-                    "询盘id是:{}, 站点code是:{}, 通过——一天内—重复邮箱—检测到垃圾询盘",
-                    adwebEnquiry.getId(),
-                    adwebEnquiry.getSiteCode());
+          notBlackEmailWasteListCount = 1;
+        }
+        adwebRedisUtil.set(
+            NotBlackEmailWasteEnquiryKey + isJudgeWasteEnquiry.getEmail(),
+            notBlackEmailWasteListCount,
+            60L * 60 * 24 * emailNotBlackListDate);
+
+        // 该分支用于判断是否超过
+        if (notBlackEmailWasteListCount > emailNotBlackListNum) {
+          AdwebPublicBlackEmail blackEmail =
+              new AdwebPublicBlackEmail(
+                  isJudgeWasteEnquiry.getEmail(), NumConstant.ONE, NumConstant.ZERO);
+          if (adwebPublicBlackEmailService.count(
+                  new LambdaQueryWrapper<AdwebPublicBlackEmail>()
+                      .eq(AdwebPublicBlackEmail::getEmail, isJudgeWasteEnquiry.getEmail())
+                      .ne(AdwebPublicBlackEmail::getStatus, 0))
+              == 0) {
+            adwebPublicBlackEmailService.save(blackEmail);
+            blackEmailList.add(isJudgeWasteEnquiry.getEmail());
             log.info(
-                    "'--------dealShortSameEmail -----'===>adwebEnquiry.getEmail():{}",
-                    adwebEnquiry.getEmail());
+                "询盘id是:{}, 站点code是:{}, 检测重复,已标记邮箱, 邮箱是:{}",
+                isJudgeWasteEnquiry.getId(),
+                isJudgeWasteEnquiry.getSiteCode(),
+                isJudgeWasteEnquiry.getEmail());
+          }
+          adwebRedisUtil.del(NotBlackEmailWasteEnquiryKey + isJudgeWasteEnquiry.getEmail());
+        }
+      }
+      if (ipFlag) {
+        Integer notBlackIpWasteListCount = null;
+        if (adwebRedisUtil.hasKey(NotBlackIpWasteEnquiryKey + isJudgeWasteEnquiry.getFromIp())) {
+          notBlackIpWasteListCount =
+              (Integer)
+                      adwebRedisUtil.get(
+                          NotBlackIpWasteEnquiryKey + isJudgeWasteEnquiry.getFromIp())
+                  + 1;
+        } else {
+          notBlackIpWasteListCount = 1;
+        }
+        adwebRedisUtil.set(
+            NotBlackIpWasteEnquiryKey + isJudgeWasteEnquiry.getFromIp(),
+            notBlackIpWasteListCount,
+            60L * 60 * 24 * ipNotBlackListDate);
+
+        // 该分支用于判断是否出现超过
+        if (notBlackIpWasteListCount > ipNotBlackListNum) {
+          AdwebPublicBlackIp blackIp =
+              new AdwebPublicBlackIp(
+                  isJudgeWasteEnquiry.getFromIp(), NumConstant.ONE, NumConstant.ZERO);
+          if (adwebPublicBlackIpService.count(
+                  new LambdaQueryWrapper<AdwebPublicBlackIp>()
+                      .eq(AdwebPublicBlackIp::getIp, isJudgeWasteEnquiry.getFromIp())
+                      .ne(AdwebPublicBlackIp::getStatus, 0))
+              == 0) {
+            adwebPublicBlackIpService.save(blackIp);
+            blackIpList.add(isJudgeWasteEnquiry.getFromIp());
             log.info(
-                    "'--------dealShortSameEmail -----'===>adwebSite.getId():{}",
-                    adwebSite.getId());
-            if (enquirySiteBlackEmailService.count(
-                            new LambdaQueryWrapper<AdwebSiteBlackEmail>()
-                                    .eq(AdwebSiteBlackEmail::getEmail, adwebEnquiry.getEmail())
-                                    .ne(AdwebSiteBlackEmail::getStatus, 0)
-                                    .eq(AdwebSiteBlackEmail::getSiteId, adwebSite.getId())
-                                    .eq(AdwebSiteBlackEmail::getBlackOrWhite, 0))
-                    == 0) {
-                siteBlackEmailList.add(adwebEnquiry.getEmail());
-                blackEmailList.add(adwebEnquiry.getEmail());
-                log.info(
-                        "询盘id是:{}, 站点code是:{}, 检测十分钟内重复,已标记邮箱, 邮箱是:{}",
-                        adwebEnquiry.getId(),
-                        adwebEnquiry.getSiteCode(),
-                        adwebEnquiry.getEmail());
+                "询盘id是:{}, 站点code是:{}, 检测重复,已标记ip, ip是:{}",
+                isJudgeWasteEnquiry.getId(),
+                isJudgeWasteEnquiry.getSiteCode(),
+                isJudgeWasteEnquiry.getFromIp());
+          }
+          adwebRedisUtil.del(NotBlackIpWasteEnquiryKey + isJudgeWasteEnquiry.getFromIp());
+        }
+      }
+    }
+  }
+
+  /** 当同步询盘拉取时,处理同个邮箱或者同个ip的询盘达到一定数量后置为黑名单 如果是公共黑名单 */
+  private void dealMultipleRepeatInfoEnquiry(
+      List<String> siteBlackEmailList,
+      List<String> siteBlackIpList,
+      AdwebEnquiry isJudgeWasteEnquiry,
+      AdwebSite adwebSite) {
+    if (isJudgeWasteEnquiry != null && StringUtils.isNotBlank(isJudgeWasteEnquiry.getSiteCode())) {
+      log.info("上一封邮件为垃圾询盘,处理中...");
+      boolean emailFlag = false;
+      String isJudgeWasteEnquiryEmail = isJudgeWasteEnquiry.getEmail().toLowerCase();
+      if (StringUtils.isNotBlank(isJudgeWasteEnquiryEmail)
+          && CollectionUtils.isNotEmpty(siteBlackEmailList)) {
+        for (String blackEmail : siteBlackEmailList) {
+          if (isJudgeWasteEnquiry.getEmail().equals(blackEmail)) {
+            emailFlag = false;
+            break;
+          } else if (blackEmail.contains("*")) {
+            String generalBlackEmail = blackEmail.substring(1, blackEmail.length() - 1 - 1);
+            if (isJudgeWasteEnquiry.getEmail().contains(generalBlackEmail)) {
+              emailFlag = false;
+              break;
             }
-            // 存储到数据库中
-            EffectiveEnquiryParamDto effectiveEnquiryParamDto = new EffectiveEnquiryParamDto();
-            effectiveEnquiryParamDto.setSiteId(adwebSite.getId());
-            effectiveEnquiryParamDto.setSiteCode(adwebSite.getCode());
-            effectiveEnquiryParamDto.setWasteEnquirySeason(adwebEnquiry.getEmail());
-            enquirySiteBlackEmailService.addBlackEmailByContent(effectiveEnquiryParamDto);
-            // 清除map中的数据
-            adwebRedisUtil.del(oneDayKey);
-            return true;
-        }
-        return false;
-    }
-
-    /** 当同步询盘拉取时,处理同个ip的询盘达到一定数量后置为黑名单 如果是公共黑名单 */
-    private boolean dealShortSameIp(
-            AdwebEnquiry adwebEnquiry,
-            List<String> blackIpList,
-            AdwebSite adwebSite,
-            List<String> siteBlackIpList) {
-        Integer tenMin = null;
-        String tenMinKey = SiteIpTenMinKey + adwebSite.getId() + "::" + adwebEnquiry.getFromIp();
-        String oneDayKey = SiteIpOneDayKey + adwebSite.getId() + "::" + adwebEnquiry.getFromIp();
-        if (adwebRedisUtil.hasKey(tenMinKey)) {
-            tenMin = (Integer) adwebRedisUtil.get(tenMinKey) + 1;
+          } else {
+            emailFlag = true;
+          }
+        }
+      }
+
+      boolean ipFlag =
+          StringUtils.isNotBlank(isJudgeWasteEnquiry.getFromIp())
+              && siteBlackIpList != null
+              && !siteBlackIpList.contains(isJudgeWasteEnquiry.getFromIp());
+
+      // 该分支用于判断上一封垃圾询盘 不在邮箱黑名单中
+      if (emailFlag) {
+        Integer notBlackEmailWasteListCount = null;
+        if (adwebRedisUtil.hasKey(
+            NotBlackEmailWasteSiteEnquiryKey
+                + adwebSite.getId()
+                + "::"
+                + isJudgeWasteEnquiry.getEmail())) {
+          notBlackEmailWasteListCount =
+              (Integer)
+                      adwebRedisUtil.get(
+                          NotBlackEmailWasteSiteEnquiryKey
+                              + adwebSite.getId()
+                              + "::"
+                              + isJudgeWasteEnquiry.getEmail())
+                  + 1;
         } else {
-            tenMin = 1;
-        }
-        adwebRedisUtil.set(tenMinKey, tenMin, 10 * 60);
-        if (tenMin > ipTenMinNum) {
-            adwebEnquiry.setWasteEnquiry(1);
-            adwebEnquiry.setUserEffective(0);
-            adwebEnquiry.setWasteEnquiryType("ip");
-            adwebEnquiry.setEffectiveReason("系统操作-通过十分钟内重复IP检测到垃圾询盘-" + adwebEnquiry.getFromIp());
+          notBlackEmailWasteListCount = 1;
+        }
+        adwebRedisUtil.set(
+            NotBlackEmailWasteSiteEnquiryKey
+                + adwebSite.getId()
+                + "::"
+                + isJudgeWasteEnquiry.getEmail(),
+            notBlackEmailWasteListCount,
+            60L * 60 * 24 * emailNotBlackListDate);
+
+        // 该分支用于判断是否超过
+        if (notBlackEmailWasteListCount > emailNotBlackListNum) {
+          if (enquirySiteBlackEmailService.count(
+                  new LambdaQueryWrapper<AdwebSiteBlackEmail>()
+                      .eq(AdwebSiteBlackEmail::getEmail, isJudgeWasteEnquiry.getEmail())
+                      .ne(AdwebSiteBlackEmail::getStatus, 0)
+                      .eq(AdwebSiteBlackEmail::getSiteId, adwebSite.getId())
+                      .eq(AdwebSiteBlackEmail::getBlackOrWhite, 0))
+              == 0) {
+            siteBlackEmailList.add(isJudgeWasteEnquiry.getEmail());
             log.info(
-                    "询盘id是:{}, 站点code是:{}, 通过——十分钟内—重复IP—检测到垃圾询盘",
-                    adwebEnquiry.getId(),
-                    adwebEnquiry.getSiteCode());
-            if (adwebSiteBlackIpService.count(
-                            new LambdaQueryWrapper<AdwebSiteBlackIp>()
-                                    .eq(AdwebSiteBlackIp::getIp, adwebEnquiry.getFromIp())
-                                    .ne(AdwebSiteBlackIp::getStatus, 0)
-                                    .eq(AdwebSiteBlackIp::getSiteId, adwebSite.getId())
-                                    .eq(AdwebSiteBlackIp::getBlackOrWhite, 0))
-                    == 0) {
-                siteBlackIpList.add(adwebEnquiry.getFromIp());
-                blackIpList.add(adwebEnquiry.getFromIp());
-                log.info(
-                        "询盘id是:{}, 站点code是:{}, 检测十分钟内重复,已标记ip, ip是:{}",
-                        adwebEnquiry.getId(),
-                        adwebEnquiry.getSiteCode(),
-                        adwebEnquiry.getFromIp());
-            }
-            // 存储到数据库中
-            EffectiveEnquiryParamDto effectiveEnquiryParamDto = new EffectiveEnquiryParamDto();
-            effectiveEnquiryParamDto.setWasteEnquirySeason(adwebEnquiry.getFromIp());
-            effectiveEnquiryParamDto.setSiteId(adwebSite.getId());
-            effectiveEnquiryParamDto.setSiteCode(adwebSite.getCode());
-            adwebSiteBlackIpService.addBlackIpByContent(effectiveEnquiryParamDto);
-            // 清除map中的数据
-            adwebRedisUtil.del(tenMinKey);
-            adwebRedisUtil.del(oneDayKey);
-            return true;
-        }
-
-        Integer oneDay = null;
-        if (adwebRedisUtil.hasKey(oneDayKey)) {
-            oneDay = (Integer) adwebRedisUtil.get(oneDayKey) + 1;
+                "询盘id是:{}, 站点code是:{}, 检测重复,已标记邮箱, 邮箱是:{}",
+                isJudgeWasteEnquiry.getId(),
+                isJudgeWasteEnquiry.getSiteCode(),
+                isJudgeWasteEnquiry.getEmail());
+          }
+          EffectiveEnquiryParamDto effectiveEnquiryParamDto = new EffectiveEnquiryParamDto();
+          effectiveEnquiryParamDto.setSiteId(adwebSite.getId());
+          effectiveEnquiryParamDto.setSiteCode(adwebSite.getCode());
+          effectiveEnquiryParamDto.setWasteEnquirySeason(isJudgeWasteEnquiry.getEmail());
+          enquirySiteBlackEmailService.addBlackEmailByContent(effectiveEnquiryParamDto);
+          adwebRedisUtil.del(
+              NotBlackEmailWasteSiteEnquiryKey
+                  + adwebSite.getId()
+                  + "::"
+                  + isJudgeWasteEnquiry.getEmail());
+        }
+      }
+      if (ipFlag) {
+        Integer notBlackIpWasteListCount = null;
+        if (adwebRedisUtil.hasKey(
+            NotSiteBlackIpWasteEnquiryKey
+                + adwebSite.getId()
+                + "::"
+                + isJudgeWasteEnquiry.getFromIp())) {
+          notBlackIpWasteListCount =
+              (Integer)
+                      adwebRedisUtil.get(
+                          NotSiteBlackIpWasteEnquiryKey
+                              + adwebSite.getId()
+                              + "::"
+                              + isJudgeWasteEnquiry.getFromIp())
+                  + 1;
         } else {
-            oneDay = 1;
-        }
-        adwebRedisUtil.set(oneDayKey, oneDay, 24 * 60 * 60);
-        if (oneDay > ipOneDayNum) {
-            adwebEnquiry.setWasteEnquiry(1);
-            adwebEnquiry.setUserEffective(0);
-            adwebEnquiry.setWasteEnquiryType("ip");
-            adwebEnquiry.setEffectiveReason("系统操作-通过一天内重复IP检测到垃圾询盘-" + adwebEnquiry.getFromIp());
+          notBlackIpWasteListCount = 1;
+        }
+        adwebRedisUtil.set(
+            NotSiteBlackIpWasteEnquiryKey
+                + adwebSite.getId()
+                + "::"
+                + isJudgeWasteEnquiry.getFromIp(),
+            notBlackIpWasteListCount,
+            60L * 60 * 24 * ipNotBlackListDate);
+
+        // 该分支用于判断是否出现超过
+        if (notBlackIpWasteListCount > ipNotBlackListNum) {
+          if (adwebSiteBlackIpService.count(
+                  new LambdaQueryWrapper<AdwebSiteBlackIp>()
+                      .eq(AdwebSiteBlackIp::getIp, isJudgeWasteEnquiry.getFromIp())
+                      .ne(AdwebSiteBlackIp::getStatus, 0)
+                      .eq(AdwebSiteBlackIp::getSiteId, adwebSite.getId())
+                      .eq(AdwebSiteBlackIp::getBlackOrWhite, 0))
+              == 0) {
+            siteBlackIpList.add(isJudgeWasteEnquiry.getFromIp());
             log.info(
-                    "询盘id是:{}, 站点code是:{}, 通过——一天内—重复IP—检测到垃圾询盘",
-                    adwebEnquiry.getId(),
-                    adwebEnquiry.getSiteCode());
-            if (adwebSiteBlackIpService.count(
-                            new LambdaQueryWrapper<AdwebSiteBlackIp>()
-                                    .eq(AdwebSiteBlackIp::getIp, adwebEnquiry.getFromIp())
-                                    .ne(AdwebSiteBlackIp::getStatus, 0)
-                                    .eq(AdwebSiteBlackIp::getSiteId, adwebSite.getId())
-                                    .eq(AdwebSiteBlackIp::getBlackOrWhite, 0))
-                    == 0) {
-                siteBlackIpList.add(adwebEnquiry.getFromIp());
-                blackIpList.add(adwebEnquiry.getFromIp());
-                log.info(
-                        "询盘id是:{}, 站点code是:{}, 检测一天内重复,已标记ip, ip是:{}",
-                        adwebEnquiry.getId(),
-                        adwebEnquiry.getSiteCode(),
-                        adwebEnquiry.getFromIp());
-            }
-            // 存储到数据库中
-            EffectiveEnquiryParamDto effectiveEnquiryParamDto = new EffectiveEnquiryParamDto();
-            effectiveEnquiryParamDto.setWasteEnquirySeason(adwebEnquiry.getFromIp());
-            effectiveEnquiryParamDto.setSiteId(adwebSite.getId());
-            effectiveEnquiryParamDto.setSiteCode(adwebSite.getCode());
-            adwebSiteBlackIpService.addBlackIpByContent(effectiveEnquiryParamDto);
-            // 清除map中的数据
-            adwebRedisUtil.del(oneDayKey);
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * 判断是否是在黑名单中
-     *
-     * @param adwebEnquiryList 询盘列表
-     */
-    private void judgeBlacklist(List<AdwebEnquiry> adwebEnquiryList) {
-        for (AdwebEnquiry enquiry : adwebEnquiryList) {
-            boolean isBlackEnquiry = adwebEnquiryBlacklistService.isBlackEnquiry(enquiry);
-            if (isBlackEnquiry) {
-                enquiry.setStatus(0);
-                enquiry.setPushStatus(2);
-            }
-        }
+                "询盘id是:{}, 站点code是:{}, 检测重复,已标记ip, ip是:{}",
+                isJudgeWasteEnquiry.getId(),
+                isJudgeWasteEnquiry.getSiteCode(),
+                isJudgeWasteEnquiry.getFromIp());
+          }
+          EffectiveEnquiryParamDto effectiveEnquiryParamDto = new EffectiveEnquiryParamDto();
+          effectiveEnquiryParamDto.setWasteEnquirySeason(isJudgeWasteEnquiry.getFromIp());
+          effectiveEnquiryParamDto.setSiteId(adwebSite.getId());
+          effectiveEnquiryParamDto.setSiteCode(adwebSite.getCode());
+          adwebSiteBlackIpService.addBlackIpByContent(effectiveEnquiryParamDto);
+          adwebRedisUtil.del(
+              NotSiteBlackIpWasteEnquiryKey
+                  + adwebSite.getId()
+                  + "::"
+                  + isJudgeWasteEnquiry.getFromIp());
+        }
+      }
+    }
+  }
+
+  /** 当同步询盘拉取时,处理10分钟或一天同个邮箱的询盘达到一定数量后置为黑名单 */
+  private boolean dealShortSameEmail(
+      AdwebEnquiry adwebEnquiry,
+      List<String> blackEmailList,
+      AdwebSite adwebSite,
+      List<String> siteBlackEmailList) {
+    Integer tenMin = null;
+    String TenMinKey = SiteEmailTenMinKey + adwebSite.getId() + "::" + adwebEnquiry.getEmail();
+    String oneDayKey = SiteEmailOneDayKey + adwebSite.getId() + "::" + adwebEnquiry.getEmail();
+    if (adwebRedisUtil.hasKey(TenMinKey)) {
+      tenMin = (Integer) adwebRedisUtil.get(TenMinKey) + 1;
+    } else {
+      tenMin = 1;
+    }
+    adwebRedisUtil.set(TenMinKey, tenMin, 10 * 60);
+
+    if (tenMin > emailTenMinNum) {
+      adwebEnquiry.setWasteEnquiry(1);
+      adwebEnquiry.setUserEffective(0);
+      adwebEnquiry.setWasteEnquiryType("email");
+      adwebEnquiry.setEffectiveReason("系统操作-通过十分钟内重复邮箱检测到垃圾询盘-" + adwebEnquiry.getEmail());
+      log.info(
+          "询盘id是:{}, 站点code是:{}, 通过——十分钟内—重复邮箱—检测到垃圾询盘",
+          adwebEnquiry.getId(),
+          adwebEnquiry.getSiteCode());
+      if (enquirySiteBlackEmailService.count(
+              new LambdaQueryWrapper<AdwebSiteBlackEmail>()
+                  .eq(AdwebSiteBlackEmail::getEmail, adwebEnquiry.getEmail())
+                  .ne(AdwebSiteBlackEmail::getStatus, 0)
+                  .eq(AdwebSiteBlackEmail::getSiteId, adwebSite.getId())
+                  .eq(AdwebSiteBlackEmail::getBlackOrWhite, 0))
+          == 0) {
+        siteBlackEmailList.add(adwebEnquiry.getEmail());
+        blackEmailList.add(adwebEnquiry.getEmail());
+        log.info(
+            "询盘id是:{}, 站点code是:{}, 检测十分钟内重复,已标记邮箱, 邮箱是:{}",
+            adwebEnquiry.getId(),
+            adwebEnquiry.getSiteCode(),
+            adwebEnquiry.getEmail());
+      }
+      // 存储到数据库中
+      EffectiveEnquiryParamDto effectiveEnquiryParamDto = new EffectiveEnquiryParamDto();
+      effectiveEnquiryParamDto.setSiteId(adwebSite.getId());
+      effectiveEnquiryParamDto.setSiteCode(adwebSite.getCode());
+      effectiveEnquiryParamDto.setWasteEnquirySeason(adwebEnquiry.getEmail());
+      enquirySiteBlackEmailService.addBlackEmailByContent(effectiveEnquiryParamDto);
+      // 清除map中的数据
+      adwebRedisUtil.del(TenMinKey);
+      adwebRedisUtil.del(oneDayKey);
+      return true;
     }
 
-    @Override
-    public void returnSalesperson(String siteCode, String inquiryId, String sales) {
-        log.info("返回跟进人名称开始");
-        // 获取站点
-        LambdaQueryWrapper<AdwebSite> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(AdwebSite::getCode, siteCode);
-        AdwebSite adwebSite = adwebSiteService.getOne(queryWrapper);
-
-        RestTemplate restTemplate = new RestTemplate();
-        String url = adwebSite.getDomain() + "/wp-json/inquiry/v1/add-sales";
-        log.info("请求地址{}", url);
-        // 如果需要传递参数
-        HttpHeaders headers = new HttpHeaders();
-        headers.set("Content-Type", "application/json");
-        // 构建请求体,将 recordId 和 name 作为参数传递
-        String requestBody =
-                "{ \"inquiryId\": \"" + inquiryId + "\", \"sales\": \"" + sales + "\" }";
-        log.info("请求参数{}", requestBody);
-        HttpEntity<String> entity = new HttpEntity<>(requestBody, headers);
-
-        // 发送请求
-        restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
-        log.info("返回跟进人名称结束");
-    }
-
-    /** 根据地区更新询盘跟进人 */
-    @Override
-    public void updatePrincipalUidByRegion(Integer siteId) {
-        List<Integer> siteIds = adwebSiteService.getAllSiteIdByParentId(siteId);
-        adwebEnquiryMapper.updatePrincipalUidByRegion(siteId, siteIds);
-    }
-
-    /**
-     * 更改询盘用户有效性
-     *
-     * @return
-     */
-    @Override
-    public boolean updateUserEffective(EffectiveEnquiryParamDto effectiveEnquiryParamDto) {
-        String id = effectiveEnquiryParamDto.getId();
-        Integer userEffective = effectiveEnquiryParamDto.getUserEffective();
-        if (userEffective == null || StringUtil.isEmpty(id)) {
-            return false;
-        }
+    // 如果10分钟内发送了则1天用判断了
+    Integer oneDay = null;
+    if (adwebRedisUtil.hasKey(oneDayKey)) {
+      oneDay = (Integer) adwebRedisUtil.get(oneDayKey) + 1;
+    } else {
+      oneDay = 1;
+    }
+    adwebRedisUtil.set(oneDayKey, oneDay, 24 * 60 * 60);
+
+    if (oneDay > emailOneDayNum) {
+      adwebEnquiry.setWasteEnquiry(1);
+      adwebEnquiry.setUserEffective(0);
+      adwebEnquiry.setWasteEnquiryType("email");
+      adwebEnquiry.setEffectiveReason("系统操作-通过一天内重复邮箱检测到垃圾询盘-" + adwebEnquiry.getEmail());
+      log.info(
+          "询盘id是:{}, 站点code是:{}, 通过——一天内—重复邮箱—检测到垃圾询盘",
+          adwebEnquiry.getId(),
+          adwebEnquiry.getSiteCode());
+      log.info(
+          "'--------dealShortSameEmail -----'===>adwebEnquiry.getEmail():{}",
+          adwebEnquiry.getEmail());
+      log.info("'--------dealShortSameEmail -----'===>adwebSite.getId():{}", adwebSite.getId());
+      if (enquirySiteBlackEmailService.count(
+              new LambdaQueryWrapper<AdwebSiteBlackEmail>()
+                  .eq(AdwebSiteBlackEmail::getEmail, adwebEnquiry.getEmail())
+                  .ne(AdwebSiteBlackEmail::getStatus, 0)
+                  .eq(AdwebSiteBlackEmail::getSiteId, adwebSite.getId())
+                  .eq(AdwebSiteBlackEmail::getBlackOrWhite, 0))
+          == 0) {
+        siteBlackEmailList.add(adwebEnquiry.getEmail());
+        blackEmailList.add(adwebEnquiry.getEmail());
+        log.info(
+            "询盘id是:{}, 站点code是:{}, 检测十分钟内重复,已标记邮箱, 邮箱是:{}",
+            adwebEnquiry.getId(),
+            adwebEnquiry.getSiteCode(),
+            adwebEnquiry.getEmail());
+      }
+      // 存储到数据库中
+      EffectiveEnquiryParamDto effectiveEnquiryParamDto = new EffectiveEnquiryParamDto();
+      effectiveEnquiryParamDto.setSiteId(adwebSite.getId());
+      effectiveEnquiryParamDto.setSiteCode(adwebSite.getCode());
+      effectiveEnquiryParamDto.setWasteEnquirySeason(adwebEnquiry.getEmail());
+      enquirySiteBlackEmailService.addBlackEmailByContent(effectiveEnquiryParamDto);
+      // 清除map中的数据
+      adwebRedisUtil.del(oneDayKey);
+      return true;
+    }
+    return false;
+  }
+
+  /** 当同步询盘拉取时,处理同个ip的询盘达到一定数量后置为黑名单 如果是公共黑名单 */
+  private boolean dealShortSameIp(
+      AdwebEnquiry adwebEnquiry,
+      List<String> blackIpList,
+      AdwebSite adwebSite,
+      List<String> siteBlackIpList) {
+    Integer tenMin = null;
+    String tenMinKey = SiteIpTenMinKey + adwebSite.getId() + "::" + adwebEnquiry.getFromIp();
+    String oneDayKey = SiteIpOneDayKey + adwebSite.getId() + "::" + adwebEnquiry.getFromIp();
+    if (adwebRedisUtil.hasKey(tenMinKey)) {
+      tenMin = (Integer) adwebRedisUtil.get(tenMinKey) + 1;
+    } else {
+      tenMin = 1;
+    }
+    adwebRedisUtil.set(tenMinKey, tenMin, 10 * 60);
+    if (tenMin > ipTenMinNum) {
+      adwebEnquiry.setWasteEnquiry(1);
+      adwebEnquiry.setUserEffective(0);
+      adwebEnquiry.setWasteEnquiryType("ip");
+      adwebEnquiry.setEffectiveReason("系统操作-通过十分钟内重复IP检测到垃圾询盘-" + adwebEnquiry.getFromIp());
+      log.info(
+          "询盘id是:{}, 站点code是:{}, 通过——十分钟内—重复IP—检测到垃圾询盘",
+          adwebEnquiry.getId(),
+          adwebEnquiry.getSiteCode());
+      if (adwebSiteBlackIpService.count(
+              new LambdaQueryWrapper<AdwebSiteBlackIp>()
+                  .eq(AdwebSiteBlackIp::getIp, adwebEnquiry.getFromIp())
+                  .ne(AdwebSiteBlackIp::getStatus, 0)
+                  .eq(AdwebSiteBlackIp::getSiteId, adwebSite.getId())
+                  .eq(AdwebSiteBlackIp::getBlackOrWhite, 0))
+          == 0) {
+        siteBlackIpList.add(adwebEnquiry.getFromIp());
+        blackIpList.add(adwebEnquiry.getFromIp());
+        log.info(
+            "询盘id是:{}, 站点code是:{}, 检测十分钟内重复,已标记ip, ip是:{}",
+            adwebEnquiry.getId(),
+            adwebEnquiry.getSiteCode(),
+            adwebEnquiry.getFromIp());
+      }
+      // 存储到数据库中
+      EffectiveEnquiryParamDto effectiveEnquiryParamDto = new EffectiveEnquiryParamDto();
+      effectiveEnquiryParamDto.setWasteEnquirySeason(adwebEnquiry.getFromIp());
+      effectiveEnquiryParamDto.setSiteId(adwebSite.getId());
+      effectiveEnquiryParamDto.setSiteCode(adwebSite.getCode());
+      adwebSiteBlackIpService.addBlackIpByContent(effectiveEnquiryParamDto);
+      // 清除map中的数据
+      adwebRedisUtil.del(tenMinKey);
+      adwebRedisUtil.del(oneDayKey);
+      return true;
+    }
 
-        List<String> idList = Arrays.asList(id.split(","));
-        if (CollectionUtils.isEmpty(idList)) {
-            return false;
-        }
+    Integer oneDay = null;
+    if (adwebRedisUtil.hasKey(oneDayKey)) {
+      oneDay = (Integer) adwebRedisUtil.get(oneDayKey) + 1;
+    } else {
+      oneDay = 1;
+    }
+    adwebRedisUtil.set(oneDayKey, oneDay, 24 * 60 * 60);
+    if (oneDay > ipOneDayNum) {
+      adwebEnquiry.setWasteEnquiry(1);
+      adwebEnquiry.setUserEffective(0);
+      adwebEnquiry.setWasteEnquiryType("ip");
+      adwebEnquiry.setEffectiveReason("系统操作-通过一天内重复IP检测到垃圾询盘-" + adwebEnquiry.getFromIp());
+      log.info(
+          "询盘id是:{}, 站点code是:{}, 通过——一天内—重复IP—检测到垃圾询盘",
+          adwebEnquiry.getId(),
+          adwebEnquiry.getSiteCode());
+      if (adwebSiteBlackIpService.count(
+              new LambdaQueryWrapper<AdwebSiteBlackIp>()
+                  .eq(AdwebSiteBlackIp::getIp, adwebEnquiry.getFromIp())
+                  .ne(AdwebSiteBlackIp::getStatus, 0)
+                  .eq(AdwebSiteBlackIp::getSiteId, adwebSite.getId())
+                  .eq(AdwebSiteBlackIp::getBlackOrWhite, 0))
+          == 0) {
+        siteBlackIpList.add(adwebEnquiry.getFromIp());
+        blackIpList.add(adwebEnquiry.getFromIp());
+        log.info(
+            "询盘id是:{}, 站点code是:{}, 检测一天内重复,已标记ip, ip是:{}",
+            adwebEnquiry.getId(),
+            adwebEnquiry.getSiteCode(),
+            adwebEnquiry.getFromIp());
+      }
+      // 存储到数据库中
+      EffectiveEnquiryParamDto effectiveEnquiryParamDto = new EffectiveEnquiryParamDto();
+      effectiveEnquiryParamDto.setWasteEnquirySeason(adwebEnquiry.getFromIp());
+      effectiveEnquiryParamDto.setSiteId(adwebSite.getId());
+      effectiveEnquiryParamDto.setSiteCode(adwebSite.getCode());
+      adwebSiteBlackIpService.addBlackIpByContent(effectiveEnquiryParamDto);
+      // 清除map中的数据
+      adwebRedisUtil.del(oneDayKey);
+      return true;
+    }
+    return false;
+  }
+
+  /**
+   * 判断是否是在黑名单中
+   *
+   * @param adwebEnquiryList 询盘列表
+   */
+  private void judgeBlacklist(List<AdwebEnquiry> adwebEnquiryList) {
+    for (AdwebEnquiry enquiry : adwebEnquiryList) {
+      boolean isBlackEnquiry = adwebEnquiryBlacklistService.isBlackEnquiry(enquiry);
+      if (isBlackEnquiry) {
+        enquiry.setStatus(0);
+        enquiry.setPushStatus(2);
+      }
+    }
+  }
+
+  @Override
+  public void returnSalesperson(String siteCode, String inquiryId, String sales) {
+    log.info("返回跟进人名称开始");
+    // 获取站点
+    LambdaQueryWrapper<AdwebSite> queryWrapper = new LambdaQueryWrapper<>();
+    queryWrapper.eq(AdwebSite::getCode, siteCode);
+    AdwebSite adwebSite = adwebSiteService.getOne(queryWrapper);
+
+    RestTemplate restTemplate = new RestTemplate();
+    String url = adwebSite.getDomain() + "/wp-json/inquiry/v1/add-sales";
+    log.info("请求地址{}", url);
+    // 如果需要传递参数
+    HttpHeaders headers = new HttpHeaders();
+    headers.set("Content-Type", "application/json");
+    // 构建请求体,将 recordId 和 name 作为参数传递
+    String requestBody = "{ \"inquiryId\": \"" + inquiryId + "\", \"sales\": \"" + sales + "\" }";
+    log.info("请求参数{}", requestBody);
+    HttpEntity<String> entity = new HttpEntity<>(requestBody, headers);
+
+    // 发送请求
+    restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
+    log.info("返回跟进人名称结束");
+  }
+
+  /** 根据地区更新询盘跟进人 */
+  @Override
+  public void updatePrincipalUidByRegion(Integer siteId) {
+    List<Integer> siteIds = adwebSiteService.getAllSiteIdByParentId(siteId);
+    adwebEnquiryMapper.updatePrincipalUidByRegion(siteId, siteIds);
+  }
+
+  /**
+   * 更改询盘用户有效性
+   *
+   * @return
+   */
+  @Override
+  public boolean updateUserEffective(EffectiveEnquiryParamDto effectiveEnquiryParamDto) {
+    String id = effectiveEnquiryParamDto.getId();
+    Integer userEffective = effectiveEnquiryParamDto.getUserEffective();
+    if (userEffective == null || StringUtil.isEmpty(id)) {
+      return false;
+    }
 
-        LambdaUpdateWrapper<AdwebEnquiry> updateWrapper = new LambdaUpdateWrapper<>();
-        updateWrapper.in(AdwebEnquiry::getId, idList);
-        // 用户有效性  0:无效 1:有效   2 : 待定 取自字典表
-        updateWrapper.set(AdwebEnquiry::getUserEffective, userEffective);
-        // 0:不是;1:是
-        if (userEffective.equals(0)) { // 垃圾询盘
-            String wasteEnquiryType = effectiveEnquiryParamDto.getWasteEnquiryType();
-            String wasteEnquirySeason = effectiveEnquiryParamDto.getWasteEnquirySeason();
-            updateWrapper.set(AdwebEnquiry::getWasteEnquiry, 1);
-            updateWrapper.set(AdwebEnquiry::getWasteEnquiryType, wasteEnquiryType);
-
-            // 特殊处理垃圾询盘是邮箱或者ip
-            if (wasteEnquiryType.equals("ip")) {
-                updateWrapper.set(
-                        AdwebEnquiry::getEffectiveReason, "人工操作-ip-" + wasteEnquirySeason);
-                adwebSiteBlackIpService.addBlackIpByContent(effectiveEnquiryParamDto);
-            }
-            if (wasteEnquiryType.equals("email")) {
-                updateWrapper.set(
-                        AdwebEnquiry::getEffectiveReason, "人工操作-邮箱-" + wasteEnquirySeason);
-                enquirySiteBlackEmailService.addBlackEmailByContent(effectiveEnquiryParamDto);
+    List<String> idList = Arrays.asList(id.split(","));
+    if (CollectionUtils.isEmpty(idList)) {
+      return false;
+    }
+
+    LambdaUpdateWrapper<AdwebEnquiry> updateWrapper = new LambdaUpdateWrapper<>();
+    updateWrapper.in(AdwebEnquiry::getId, idList);
+    // 用户有效性  0:无效 1:有效   2 : 待定 取自字典表
+    updateWrapper.set(AdwebEnquiry::getUserEffective, userEffective);
+    // 0:不是;1:是
+    if (userEffective.equals(0)) { // 垃圾询盘
+      String wasteEnquiryType = effectiveEnquiryParamDto.getWasteEnquiryType();
+      String wasteEnquirySeason = effectiveEnquiryParamDto.getWasteEnquirySeason();
+      updateWrapper.set(AdwebEnquiry::getWasteEnquiry, 1);
+      updateWrapper.set(AdwebEnquiry::getWasteEnquiryType, wasteEnquiryType);
+
+      // 特殊处理垃圾询盘是邮箱或者ip
+      if (wasteEnquiryType.equals("ip")) {
+        updateWrapper.set(AdwebEnquiry::getEffectiveReason, "人工操作-ip-" + wasteEnquirySeason);
+        adwebSiteBlackIpService.addBlackIpByContent(effectiveEnquiryParamDto);
+      }
+      if (wasteEnquiryType.equals("email")) {
+        updateWrapper.set(AdwebEnquiry::getEffectiveReason, "人工操作-邮箱-" + wasteEnquirySeason);
+        enquirySiteBlackEmailService.addBlackEmailByContent(effectiveEnquiryParamDto);
+      }
+      if (wasteEnquiryType.equals("keyword")) {
+        updateWrapper.set(AdwebEnquiry::getEffectiveReason, "人工操作-关键词-" + wasteEnquirySeason);
+        adwebSiteEnquiryRuleService.addBlackKeywordByContent(effectiveEnquiryParamDto);
+      }
+      if (wasteEnquiryType.equals("other")) {
+        updateWrapper.set(AdwebEnquiry::getEffectiveReason, "人工操作-其他-" + wasteEnquirySeason);
+      }
+    } else { // 有效询盘
+      updateWrapper.set(AdwebEnquiry::getWasteEnquiry, 0);
+      updateWrapper.set(AdwebEnquiry::getEffectiveReason, "人工操作");
+      updateWrapper.set(AdwebEnquiry::getWasteEnquiryType, "");
+    }
+    this.update(updateWrapper);
+
+    if (userEffective.equals(0)) {
+      return true;
+    }
+
+    // 有效询盘发送邮件
+    try {
+      List<AdwebEnquiry> enquiryList =
+          this.list(new LambdaQueryWrapper<AdwebEnquiry>().in(AdwebEnquiry::getId, idList));
+      if (CollectionUtils.isNotEmpty(enquiryList)) {
+        AdwebSite adwebSite =
+            adwebSiteService.getOne(
+                new LambdaQueryWrapper<AdwebSite>()
+                    .eq(AdwebSite::getCode, enquiryList.get(0).getSiteCode()));
+        if (adwebSite != null) {
+
+          Map<String, String> principalEmailMap = new HashMap<>();
+
+          // 判断是否为产品询盘
+          for (AdwebEnquiry adwebEnquiry : enquiryList) {
+            if (StringUtils.isNotBlank(adwebEnquiry.getCartItems())) {
+              adwebEnquiry.setExistProductEnquiry(1); // 产品询盘
             }
-            if (wasteEnquiryType.equals("keyword")) {
-                updateWrapper.set(
-                        AdwebEnquiry::getEffectiveReason, "人工操作-关键词-" + wasteEnquirySeason);
-                adwebSiteEnquiryRuleService.addBlackKeywordByContent(effectiveEnquiryParamDto);
+          }
+
+          // 判断是否为联系我们询盘
+          for (AdwebEnquiry adwebEnquiry : enquiryList) {
+            List<DictModel> contactEnquiryWebsites =
+                dictService.queryDictItemsByCode("send_contact_enquiry_website");
+            List<String> contactEnquiryCodes =
+                contactEnquiryWebsites.stream().map(DictModel::getValue).toList();
+            if (contactEnquiryCodes.contains(adwebSite.getCode())) {
+              if (StringUtils.isNotBlank(adwebEnquiry.getFromPage())
+                  && adwebEnquiry.getFromPage().contains("contact")) {
+                adwebEnquiry.setExistContactEnquiry(1);
+              }
             }
-            if (wasteEnquiryType.equals("other")) {
-                updateWrapper.set(
-                        AdwebEnquiry::getEffectiveReason, "人工操作-其他-" + wasteEnquirySeason);
+          }
+
+          // 获取子账户
+          List<String> subAccountIdList =
+              masterSubAccountRelationService.getSubAccountIdByMaster(
+                  String.valueOf(adwebSite.getUid()));
+          log.info("获取的子账户id:{}", FastJsonUtil.toJSONString(subAccountIdList));
+          if (CollectionUtils.isNotEmpty(subAccountIdList)) {
+            subAccountIdList.add(String.valueOf(adwebSite.getUid()));
+            List<SysUser> principalEmailList =
+                sysUserService.list(
+                    new LambdaQueryWrapper<SysUser>()
+                        .in(SysUser::getId, subAccountIdList)
+                        .eq(SysUser::getDelFlag, 0)
+                        .isNotNull(SysUser::getEmail)
+                        .ne(SysUser::getEmail, "")
+                        .select(SysUser::getId, SysUser::getEmail));
+            if (CollectionUtils.isNotEmpty(principalEmailList)) {
+              principalEmailMap =
+                  principalEmailList.stream()
+                      .collect(Collectors.toMap(SysUser::getId, SysUser::getEmail));
             }
-        } else { // 有效询盘
-            updateWrapper.set(AdwebEnquiry::getWasteEnquiry, 0);
-            updateWrapper.set(AdwebEnquiry::getEffectiveReason, "人工操作");
-            updateWrapper.set(AdwebEnquiry::getWasteEnquiryType, "");
-        }
-        this.update(updateWrapper);
+          }
 
-        if (userEffective.equals(0)) {
-            return true;
+          for (AdwebEnquiry adwebEnquiry : enquiryList) {
+            sendValidateEmail(adwebEnquiry, adwebSite, principalEmailMap);
+          }
         }
-
-        // 有效询盘发送邮件
-        try {
-            List<AdwebEnquiry> enquiryList =
-                    this.list(
-                            new LambdaQueryWrapper<AdwebEnquiry>().in(AdwebEnquiry::getId, idList));
-            if (CollectionUtils.isNotEmpty(enquiryList)) {
-                AdwebSite adwebSite =
-                        adwebSiteService.getOne(
-                                new LambdaQueryWrapper<AdwebSite>()
-                                        .eq(AdwebSite::getCode, enquiryList.get(0).getSiteCode()));
-                if (adwebSite != null) {
-
-                    Map<String, String> principalEmailMap = new HashMap<>();
-
-                    // 判断是否为产品询盘
-                    for (AdwebEnquiry adwebEnquiry : enquiryList) {
-                        if (StringUtils.isNotBlank(adwebEnquiry.getCartItems())) {
-                            adwebEnquiry.setExistProductEnquiry(1); // 产品询盘
-                        }
-                    }
-
-                    // 判断是否为联系我们询盘
-                    for (AdwebEnquiry adwebEnquiry : enquiryList) {
-                        List<DictModel> contactEnquiryWebsites =
-                                dictService.queryDictItemsByCode("send_contact_enquiry_website");
-                        List<String> contactEnquiryCodes =
-                                contactEnquiryWebsites.stream().map(DictModel::getValue).toList();
-                        if (contactEnquiryCodes.contains(adwebSite.getCode())) {
-                            if (StringUtils.isNotBlank(adwebEnquiry.getFromPage())
-                                    && adwebEnquiry.getFromPage().contains("contact")) {
-                                adwebEnquiry.setExistContactEnquiry(1);
-                            }
-                        }
-                    }
-
-                    // 获取子账户
-                    List<String> subAccountIdList =
-                            masterSubAccountRelationService.getSubAccountIdByMaster(
-                                    String.valueOf(adwebSite.getUid()));
-                    log.info("获取的子账户id:{}", FastJsonUtil.toJSONString(subAccountIdList));
-                    if (CollectionUtils.isNotEmpty(subAccountIdList)) {
-                        subAccountIdList.add(String.valueOf(adwebSite.getUid()));
-                        List<SysUser> principalEmailList =
-                                sysUserService.list(
-                                        new LambdaQueryWrapper<SysUser>()
-                                                .in(SysUser::getId, subAccountIdList)
-                                                .eq(SysUser::getDelFlag, 0)
-                                                .isNotNull(SysUser::getEmail)
-                                                .ne(SysUser::getEmail, "")
-                                                .select(SysUser::getId, SysUser::getEmail));
-                        if (CollectionUtils.isNotEmpty(principalEmailList)) {
-                            principalEmailMap =
-                                    principalEmailList.stream()
-                                            .collect(
-                                                    Collectors.toMap(
-                                                            SysUser::getId, SysUser::getEmail));
-                        }
-                    }
-
-                    for (AdwebEnquiry adwebEnquiry : enquiryList) {
-                        sendValidateEmail(adwebEnquiry, adwebSite, principalEmailMap);
-                    }
-                }
-            }
-        } catch (Exception e) {
-            log.error("推送发送询盘邮件的消息失败", e);
-        }
-        return true;
-    }
-
-    /**
-     * @param siteCode
-     * @param startTime
-     * @param endTime
-     * @return
-     */
-    @Override
-    public List<EnquiryDTO> enquiryList(String siteCode, String startTime, String endTime) {
-        List<EnquiryDTO> enquiryList =
-                adwebEnquiryMapper.getEnquiryList(siteCode, startTime, endTime);
-
-        if (enquiryList.isEmpty()) {
-            return null;
-        }
-
-        return enquiryList;
+      }
+    } catch (Exception e) {
+      log.error("推送发送询盘邮件的消息失败", e);
     }
+    return true;
+  }
+
+  /**
+   * @param siteCode
+   * @param startTime
+   * @param endTime
+   * @return
+   */
+  @Override
+  public List<EnquiryDTO> enquiryList(String siteCode, String startTime, String endTime) {
+    List<EnquiryDTO> enquiryList = adwebEnquiryMapper.getEnquiryList(siteCode, startTime, endTime);
+
+    if (enquiryList.isEmpty()) {
+      return null;
+    }
+
+    return enquiryList;
+  }
 }

+ 93 - 55
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/mq/EnquiryReceiver.java

@@ -1,11 +1,16 @@
 package org.jeecg.modules.mq;
 
+import static org.jeecg.modules.adweb.enquiry.service.impl.AdwebEnquiryServiceImpl.EnquiryUniqueKey;
+
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.rabbitmq.client.Channel;
+import java.io.IOException;
+import java.util.List;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.boot.starter.rabbitmq.core.BaseRabbiMqHandler;
 import org.jeecg.boot.starter.rabbitmq.listenter.MqListener;
 import org.jeecg.common.annotation.RabbitComponent;
+import org.jeecg.modules.adweb.common.service.FeishuService;
 import org.jeecg.modules.adweb.common.util.AdwebRedisUtil;
 import org.jeecg.modules.adweb.enquiry.dto.EnquiryDTO;
 import org.jeecg.modules.adweb.enquiry.service.IAdwebEnquiryService;
@@ -17,11 +22,6 @@ import org.springframework.amqp.support.AmqpHeaders;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.messaging.handler.annotation.Header;
 
-import java.io.IOException;
-import java.util.List;
-
-import static org.jeecg.modules.adweb.enquiry.service.impl.AdwebEnquiryServiceImpl.EnquiryUniqueKey;
-
 /**
  * Rabbit MQ - 询盘消息接收
  *
@@ -31,63 +31,101 @@ import static org.jeecg.modules.adweb.enquiry.service.impl.AdwebEnquiryServiceIm
 @RabbitComponent(value = "enquiryReceiver")
 public class EnquiryReceiver extends BaseRabbiMqHandler<List<EnquiryDTO>> {
 
-    @Autowired
-    private IAdwebSiteService adwebSiteService;
+  @Autowired private IAdwebSiteService adwebSiteService;
 
-    @Autowired
-    private IAdwebEnquiryService adwebEnquiryService;
+  @Autowired private IAdwebEnquiryService adwebEnquiryService;
 
-    @Autowired
-    private AdwebRedisUtil adwebRedisUtil;
+  @Autowired private AdwebRedisUtil adwebRedisUtil;
 
-    @RabbitHandler
-    // ackMode需要设置为MANUAL - BaseRabbiMqHandler.onMessage()有channel.basicAck()操作
-    @RabbitListener(queues = "site_enquiry", ackMode = "MANUAL")
-    public void onMessage(List<EnquiryDTO> enquiries, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
-        super.onMessage(enquiries, deliveryTag, channel, new MqListener<List<EnquiryDTO>>() {
-            @Override
-            public void handler(List<EnquiryDTO> enquiries, Channel channel) {
-                // 业务处理
-                log.info("收到MQ消息 {}", enquiries);
+  @Autowired private FeishuService feishuService;
 
-                for (EnquiryDTO enquiry : enquiries) {
-                    // 查看发布当前消息的站点是否是 adweb3 平台中绑定的是否是有效站点, 如果不是则直接确认消息,不做业务处理
-                    List<AdwebSite> adwebSites =
-                            adwebSiteService.list(
-                                    new LambdaQueryWrapper<AdwebSite>()
-                                            .like(AdwebSite::getDomain, enquiry.getSiteHost())
-                                            .ne(AdwebSite::getStatus, 0));
+  @RabbitHandler
+  // ackMode需要设置为MANUAL - BaseRabbiMqHandler.onMessage()有channel.basicAck()操作
+  @RabbitListener(queues = "site_enquiry", ackMode = "MANUAL")
+  public void onMessage(
+      List<EnquiryDTO> enquiries,
+      Channel channel,
+      @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
+    super.onMessage(
+        enquiries,
+        deliveryTag,
+        channel,
+        new MqListener<List<EnquiryDTO>>() {
+          @Override
+          public void handler(List<EnquiryDTO> enquiries, Channel channel) {
+            // 业务处理
+            log.info("收到询盘MQ消息 {}", enquiries);
+            for (EnquiryDTO enquiry : enquiries) {
+              // 查看发布当前消息的站点是否是 adweb3 平台中绑定的是否是有效站点, 如果不是则直接确认消息,不做业务处理
+              List<AdwebSite> adwebSites =
+                  adwebSiteService.list(
+                      new LambdaQueryWrapper<AdwebSite>()
+                          .like(AdwebSite::getDomain, enquiry.getSiteHost())
+                          .ne(AdwebSite::getStatus, 0));
 
-                    if (adwebSites.isEmpty()) {
-                        log.error(
-                                "站点:{} 不是adweb3的有效绑定站点,MQ消息确认失败",
-                                enquiry.getSiteHost());
-                        return;
-                    }
-                    
-                    if (adwebRedisUtil.hasKey(EnquiryUniqueKey + enquiry.getSiteHost())) {
-                        // 消息内容唯一性判断
-                        List<String> enquiryUniqueIds = (List<String>) adwebRedisUtil.get(EnquiryUniqueKey + enquiry.getSiteHost());
-                        // 如果该消息内容原数据中已存在,则将该重复消息踢出队列
-                        if (enquiryUniqueIds.contains(enquiry.getSiteHost() + enquiry.getRecordId())) {
-                            log.info("该询盘已经消费过,从队列中清除:{}", enquiry.getRecordId());
-                            try {
-                                channel.basicAck(deliveryTag, false);
-                            } catch (IOException e) {
-                                throw new RuntimeException(e);
-                            }
-                        }
-                    }
+              if (adwebSites.isEmpty()) {
+                log.error("站点:{} 不是adweb3的有效绑定站点,MQ消息确认失败", enquiry.getSiteHost());
+                return;
+              }
 
-                    try {
-                        // 询盘入库
-                        adwebEnquiryService.addEnquiry(
-                                enquiry, enquiry.getPluginName(), adwebSites);
-                    } catch (Exception e) {
-                        log.error("询盘入库异常:{}", e.getMessage());
-                    }
+              // 记录开始时间
+              long startTime = System.currentTimeMillis();
+              if (adwebRedisUtil.hasKey(EnquiryUniqueKey + enquiry.getSiteHost())) {
+                // 消息内容唯一性判断
+                List<String> enquiryUniqueIds =
+                    (List<String>) adwebRedisUtil.get(EnquiryUniqueKey + enquiry.getSiteHost());
+                // 如果该消息内容原数据中已存在,则将该重复消息踢出队列
+                if (enquiryUniqueIds.contains(enquiry.getSiteHost() + enquiry.getRecordId())) {
+                  log.info("该询盘已经消费过,从队列中清除:{}", enquiry.getRecordId());
+                  try {
+                    channel.basicAck(deliveryTag, false);
+                  } catch (IOException e) {
+                    throw new RuntimeException(e);
+                  }
                 }
+              }
+              // 记录结束时间
+              long endTime = System.currentTimeMillis();
+
+              log.info(
+                  "站点:{},询盘ID:{} 唯一性检测耗时:{} ms",
+                  enquiry.getSiteHost(),
+                  enquiry.getRecordId(),
+                  endTime - startTime);
+
+              // 记录开始时间
+              long startTimeEnquiry = System.currentTimeMillis();
+              try {
+                // 询盘入库
+                adwebEnquiryService.addEnquiry(enquiry, enquiry.getPluginName(), adwebSites);
+              } catch (Exception e) {
+                log.error(
+                    "站点:{},询盘ID:{},询盘入库异常:{}",
+                    enquiry.getSiteHost(),
+                    enquiry.getRecordId(),
+                    e.getMessage());
+                // 拉取询盘失败时,发送告警到飞书
+                long endTimeEnquiry = System.currentTimeMillis();
+                long diffTime = endTimeEnquiry - startTime;
+
+                String className = this.getClass().getName();
+                String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
+                feishuService.sendEnquiryRobot(
+                    (float) diffTime / 1000,
+                    "MQ消费询盘失败:",
+                    className,
+                    methodName,
+                    "站点域名为:" + enquiry.getSiteHost() + "  的网站,询盘入库失败。 异常信息为:" + e.getMessage());
+              }
+              // 记录结束时间
+              long endTimeEnquiry = System.currentTimeMillis();
+              log.info(
+                  "站点:{},询盘ID:{} 询盘入库耗时:{} ms",
+                  enquiry.getSiteHost(),
+                  enquiry.getRecordId(),
+                  startTimeEnquiry - endTimeEnquiry);
             }
+          }
         });
-    }
+  }
 }

+ 1 - 2
jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml

@@ -391,11 +391,10 @@ geoip:
 
 ### 机器人预警url
 robot:
-  enquiry-url: https://open.feishu.cn/open-apis/bot/v2/hook/042cf8d0-0072-435c-bf5c-656b9368a5ac  #询盘拉取失败通知
+  enquiry-url: https://open.feishu.cn/open-apis/bot/v2/hook/38c1e0fb-1aa9-4097-8625-2b928684b1b2  #询盘拉取失败通知
   market-plan-missing-url: https://open.feishu.cn/open-apis/bot/v2/hook/4a7110ff-9121-49fc-b0b6-0d809b548ad4  #缺少营销方案导致的拉取站点失败
   flow-abnormal-url: https://open.feishu.cn/open-apis/bot/v2/hook/81ec5829-ba64-43d7-9662-2054e80a4ebe  #流量异常通知
   keyword-preOrSuffix-url: https://open.feishu.cn/open-apis/bot/v2/hook/325b4b0a-df54-4c7f-adaf-c5da61bb12b3  #关键词前后缀通知
-  localize-product-fail-url: https://open.feishu.cn/open-apis/bot/v2/hook/46e780fc-6ed9-45ec-b39f-1e332a236386 #产品图片本地化失败通知
   site-url: https://open.feishu.cn/open-apis/bot/v2/hook/c5f2a9a5-b0e9-4b58-8622-7e39f66e00b0 #站点管理通知消息
 
 ### 垃圾询盘判断规则

+ 2 - 2
jeecg-module-system/jeecg-system-start/src/main/resources/application-prod.yml

@@ -393,13 +393,13 @@ geoip:
 
 ### 机器人预警url
 robot:
-  enquiry-url: https://open.feishu.cn/open-apis/bot/v2/hook/042cf8d0-0072-435c-bf5c-656b9368a5ac  #询盘拉取失败通知
+  enquiry-url: https://open.feishu.cn/open-apis/bot/v2/hook/38c1e0fb-1aa9-4097-8625-2b928684b1b2  #询盘消费失败通知
   market-plan-missing-url: https://open.feishu.cn/open-apis/bot/v2/hook/4a7110ff-9121-49fc-b0b6-0d809b548ad4  #缺少营销方案导致的拉取站点失败
   flow-abnormal-url: https://open.feishu.cn/open-apis/bot/v2/hook/81ec5829-ba64-43d7-9662-2054e80a4ebe  #流量异常通知
   keyword-preOrSuffix-url: https://open.feishu.cn/open-apis/bot/v2/hook/325b4b0a-df54-4c7f-adaf-c5da61bb12b3
-  localize-product-fail-url: https://open.feishu.cn/open-apis/bot/v2/hook/46e780fc-6ed9-45ec-b39f-1e332a236386
   site-url: https://open.feishu.cn/open-apis/bot/v2/hook/c5f2a9a5-b0e9-4b58-8622-7e39f66e00b0 #站点管理通知消息
 
+
 ### 垃圾询盘判断规则
 judge_waste_enquiry:
   email:

+ 1 - 2
jeecg-module-system/jeecg-system-start/src/main/resources/application-test.yml

@@ -390,11 +390,10 @@ geoip:
 
 ### 机器人预警url
 robot:
-  enquiry-url: https://open.feishu.cn/open-apis/bot/v2/hook/042cf8d0-0072-435c-bf5c-656b9368a5ac  #询盘拉取失败通知
+  enquiry-url: https://open.feishu.cn/open-apis/bot/v2/hook/38c1e0fb-1aa9-4097-8625-2b928684b1b2  #询盘拉取失败通知
   market-plan-missing-url: https://open.feishu.cn/open-apis/bot/v2/hook/4a7110ff-9121-49fc-b0b6-0d809b548ad4  #缺少营销方案导致的拉取站点失败
   flow-abnormal-url: https://open.feishu.cn/open-apis/bot/v2/hook/81ec5829-ba64-43d7-9662-2054e80a4ebe  #流量异常通知
   keyword-preOrSuffix-url: https://open.feishu.cn/open-apis/bot/v2/hook/325b4b0a-df54-4c7f-adaf-c5da61bb12b3  #关键词前后缀通知
-  localize-product-fail-url: https://open.feishu.cn/open-apis/bot/v2/hook/46e780fc-6ed9-45ec-b39f-1e332a236386 #产品图片本地化失败通知
   site-url: https://open.feishu.cn/open-apis/bot/v2/hook/c5f2a9a5-b0e9-4b58-8622-7e39f66e00b0 #站点管理通知消息
 
 ### 垃圾询盘判断规则