Browse Source

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

chenpeiqing 5 months ago
parent
commit
0220836bac

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

@@ -55,6 +55,10 @@ public class FeishuService {
      */
     public static String PROFILES_ACTIVE;
 
+    @Value("${spring.profiles.active}")
+    public void setCustomName(String customName) {
+        PROFILES_ACTIVE = customName;
+    }
 
     /**
      * 异常栈发送机器人消息

+ 23 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/common/util/DateUtil.java

@@ -166,6 +166,29 @@ public class DateUtil {
     }
 
     /**
+     * 转换为指定格式Date
+     *
+     * @param date String
+     * @param strFormat String
+     *
+     * @return FormatDate
+     *
+     * @throws ParseException ParseException
+     */
+    public static Date formatDate(Date date, String strFormat) {
+        if (date == null) {
+            return null;
+        }
+        Date reDate = null;
+        try {
+            reDate = getFormatDate(dateToString(date, strFormat), strFormat);
+        } catch (ParseException e) {
+            date = null;
+        }
+        return reDate;
+    }
+
+    /**
      * 计算两个Date的日期差
      *
      * @param start

+ 3 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/constant/EnquiryConstants.java

@@ -8,4 +8,7 @@ public class EnquiryConstants {
     public static final String ENQUIRY_EMAIL = "enquiry_email";
 
     public static final String ENQUIRY_EMAIL_CHANNEL = "enquiry_email_channel";
+
+    //独立询盘
+    public static final String ENQUIRY_MODULAR_INDEPENDENT = "independent";
 }

+ 1 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/controller/AdwebEnquiryController.java

@@ -86,7 +86,7 @@ public class AdwebEnquiryController extends JeecgController<AdwebEnquiry, IAdweb
      * @param searchDto
      * @param pageNo
      * @param pageSize
-     * @param req
+     * @param principalUid
      * @return
      */
     //@AutoLog(value = "询盘信息存储表单-分页列表查询")

+ 26 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/dto/IndependentEnquiryDto.java

@@ -0,0 +1,26 @@
+package org.jeecg.modules.adweb.enquiry.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class IndependentEnquiryDto {
+    private String name;
+    private String email;
+    private String company;
+    private String phone;
+    private String message;
+    private String siteCode;
+    private String pageHref;
+    private String pageTitle;
+    private String fromPage;
+    private List<String> job;
+    // 简历路径
+    private String path;
+    private String country;
+    private String whatsApp;
+    public String dealFromPage() {
+        return this.pageTitle + " " + this.pageHref;
+    }
+}

+ 81 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/service/AdwebOpenApiService.java

@@ -0,0 +1,81 @@
+package org.jeecg.modules.adweb.enquiry.service;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import jakarta.annotation.Resource;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.jeecg.common.util.FastJsonUtil;
+import org.jeecg.modules.adweb.common.constant.NumConstant;
+import org.jeecg.modules.adweb.common.util.DateUtil;
+import org.jeecg.modules.adweb.common.util.ListUtil;
+import org.jeecg.modules.adweb.common.util.SnowflakeIdUtil;
+import org.jeecg.modules.adweb.enquiry.constant.EnquiryConstants;
+import org.jeecg.modules.adweb.enquiry.dto.IndependentEnquiryDto;
+import org.jeecg.modules.adweb.enquiry.entity.AdwebEnquiry;
+import org.jeecg.modules.adweb.enquiry.entity.AdwebEnquiryForm;
+import org.jeecg.modules.adweb.site.entity.AdwebSite;
+import org.jeecg.modules.adweb.site.service.IAdwebSiteService;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Author: cyan
+ * @Date: 2021-04-25
+ * @Version: V1.0
+ */
+@Service
+@Slf4j
+public class AdwebOpenApiService {
+    @Resource
+    private IAdwebSiteService adwebSiteService;
+
+    @Value("${server.servlet.context-path}")
+    public String contextPath;
+
+
+    /**
+     * @param siteCode
+     * @return
+     */
+    public List<AdwebSite> selectBySiteCode(String siteCode) {
+        QueryWrapper<AdwebSite> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("code", siteCode);
+        return adwebSiteService.list(queryWrapper);
+    }
+
+    /**
+     * 获取4位编号
+     *
+     * @param siteCode
+     * @return
+     */
+    public String loadNo(String siteCode) {
+        int code = 0;
+        List<AdwebSite> adwebSites = selectBySiteCode(siteCode);
+        if (ListUtil.notEmpty(adwebSites)) {
+            AdwebSite adwebSite = adwebSites.get(0);
+            if(adwebSite.getDayEnquiryCount()!= null){
+                code = adwebSite.getDayEnquiryCount() + 1;
+            } else {
+                code = 1;
+            }
+        } else {
+            code = 1;
+        }
+        return String.format("%04d", code);
+    }
+
+//    public String loadOutNoByUser(String uid) {
+//        if (StringUtils.isEmpty(uid)) {
+//            return "000";
+//        }
+//        Date todayZero = DateUtil.formatDate(new Date(), DateUtil.DATE_PATTERN);
+//        QueryWrapper<AdwebEnquiry> queryWrapper = new QueryWrapper<>();
+//        queryWrapper.eq("uid", uid).gt("ctime", todayZero);
+//        int count = (int) adwebEnquiryService.count(queryWrapper);
+//        return String.format("%03d", count + 1);
+//    }
+}

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

@@ -15,7 +15,7 @@ import org.jeecg.common.constant.CacheConstant;
 import org.jeecg.common.system.vo.DictModel;
 import org.jeecg.common.system.vo.DictPropertyModel;
 import org.jeecg.common.util.FastJsonUtil;
-import org.jeecg.common.util.RedisUtil;
+
 import org.jeecg.modules.adweb.common.constant.NumConstant;
 import org.jeecg.modules.adweb.common.dto.CountryAreaApiDto;
 import org.jeecg.modules.adweb.common.service.FeishuService;
@@ -86,7 +86,7 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
     private SnowflakeIdUtil snowflakeIdUtil;
 
     @Resource
-    private RedisUtil redisUtil;
+    private AdwebRedisUtil adwebRedisUtil;
 
     @Resource
     private ISysExceptionService sysExceptionService;
@@ -118,6 +118,12 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
     @Resource
     private IAdwebSiteService adwebSiteService;
 
+    @Resource
+    private AdwebOpenApiService adwebOpenApiService;
+
+    @Resource
+    private IAdwebEnquiryFormService adwebEnquiryFormService;
+
     private static final byte[] redisKey = EnquiryConstants.ENQUIRY_EMAIL.getBytes();
 
     private static final byte[] siteRedisKey = EnquiryConstants.ENQUIRY_SITE.getBytes();
@@ -216,14 +222,24 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
         }
 
         List<AdwebEnquiry> adwebEnquiryList = new ArrayList<>();
+        AdwebEnquiryForm form = new AdwebEnquiryForm();
 
         try {
             AdwebEnquiry adwebEnquiry = createEnquiry(enquiryDto, adwebSite);
+
             String forms = FastJsonUtil.toJSONString(enquiryDto.getForms());
             parseFormAndSetFields(adwebEnquiry, forms, adwebSite);
             setCountryByIp(adwebEnquiry);
 
             adwebEnquiryList.add(adwebEnquiry);
+
+
+            form.setEnquiryId(adwebEnquiry.getId());
+            form.setForm(forms);
+            form.setCountry(adwebEnquiry.getCountry());
+            form.setPluginName(plugin);
+
+
         } catch (Exception e) {
             log.error("消费站点为:{}, recordId为:{} 的询盘出现问题", adwebSite.getName(), enquiryDto.getRecordId(), e);
         }
@@ -236,7 +252,9 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
 
         if (!adwebEnquiryList.isEmpty()) {
             try {
-                this.save(adwebEnquiryList.get(0));
+                AdwebEnquiry target = adwebEnquiryList.get(0);
+                this.save(target);
+                adwebEnquiryFormService.save(form);
             } catch (Exception e) {
                 log.error("站点为:{},  recordId为:{} 保存询盘到数据库失败,原因是:{}", adwebSite.getName(), enquiryDto.getRecordId(), e.getMessage());
             }
@@ -623,10 +641,12 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
         adwebEnquiry.setSysEffective(NumConstant.ONE);
         adwebEnquiry.setUserEffective(NumConstant.TWO);
         adwebEnquiry.setSiteHost(enquiryDto.getSiteHost());
-//        adwebEnquiry.setNo("xp" + DateUtil.dateToString(new Date(), DateUtil.DATE_FORMAT) + adwebOpenApiService.loadNo(adwebSite.getCode()));
+        adwebEnquiry.setNo("xp" + DateUtil.dateToString(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(requestTime);
+        adwebEnquiry.setRequestTime( new Date());
         adwebEnquiry.setAcquireMessageTime(adwebSite.getEnquiryMessageTime());
         adwebEnquiry.setIsEnquirySync("enquirySync");
 
@@ -736,12 +756,12 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
                 msg.append(",\n来源页面为空");
             }
             // 同一个站点,一天最多报错一次
-            String flag = redisUtil.get("forbidden_send_error_msg_by_enquiry_field_" + adwebSite.getDomain()).toString();
+            String flag = adwebRedisUtil.getString("forbidden_send_error_msg_by_enquiry_field_" + adwebSite.getDomain());
             if (StringUtils.isNotBlank(flag)) {
                 log.info("同一个站点,一天最多报错一次,站点域名:" + adwebSite.getDomain());
                 return;
             }
-            redisUtil.set("forbidden_send_error_msg_by_enquiry_field_" + adwebSite.getDomain(), "forbidden", 60 * 60 * 24);
+            adwebRedisUtil.set("forbidden_send_error_msg_by_enquiry_field_" + adwebSite.getDomain(), "forbidden", 60 * 60 * 24);
 
             // 异常入库
             SysException exception = new SysException();
@@ -778,16 +798,16 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
      */
     private List<String> getFormKeys(String dictCode) {
         String formKey = CacheConstant.SYS_DICT_CACHE + "::" + dictCode;
-        Object obj = redisUtil.get(formKey);
+        Object obj = adwebRedisUtil.get(formKey);
         if (obj != null) {
             List<String> keys = (List<String>) obj;
             return keys;
         }
-        List<DictModel> dictItems = dictService.queryDictItemsByCode(dictCode);
+        List<SysDictItem> dictItems = sysAdwebApiImpl.selectItemsByDictCode(dictCode);
         List<String> keys = new ArrayList<>();
         if (ListUtil.notEmpty(dictItems)) {
-            for (DictModel item : dictItems) {
-                String value = item.getValue();
+            for (SysDictItem item : dictItems) {
+                String value = item.getItemValue();
                 if (StringUtil.isEmpty(value)) {
                     continue;
                 }
@@ -797,7 +817,7 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
                 }
             }
         }
-        redisUtil.set(formKey, keys, 60 * 60);
+        adwebRedisUtil.set(formKey, keys, 60 * 60);
         return keys;
     }
 
@@ -813,17 +833,17 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
 
         //邮箱 黑名单
         //先获取对应站点的邮箱黑名单
-        List<String> siteBlackEmailList = (List<String>) redisUtil.get(SiteBlackEmailKey + "::" + adwebSite.getId());
+        List<String> siteBlackEmailList = (List<String>) adwebRedisUtil.get(SiteBlackEmailKey + "::" + adwebSite.getId());
         if (ListUtil.isEmpty(siteBlackEmailList)) {
             enquirySiteBlackEmailService.saveRedisSiteBlackEmailBySiteId(adwebSite.getId(), 0);
-            siteBlackEmailList = (List<String>) redisUtil.get(SiteBlackEmailKey + "::" + adwebSite.getId());
+            siteBlackEmailList = (List<String>) adwebRedisUtil.get(SiteBlackEmailKey + "::" + adwebSite.getId());
             if (ListUtil.isEmpty(siteBlackEmailList)) {
                 siteBlackEmailList = new ArrayList<>();
             }
         }
 
         //邮箱 公共黑名单
-        List<String> publicBlackEmailList = (List<String>) redisUtil.get(BlackEmailKey);
+        List<String> publicBlackEmailList = (List<String>) adwebRedisUtil.get(BlackEmailKey);
         if (ListUtil.isEmpty(publicBlackEmailList)) {
             List<AdwebPublicBlackEmail> enquiryPublicBlackEmailList = adwebPublicBlackEmailService
                     .list(new LambdaQueryWrapper<AdwebPublicBlackEmail>()
@@ -834,7 +854,7 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
 
             if (ListUtil.notEmpty(enquiryPublicBlackEmailList)) {
                 publicBlackEmailList = enquiryPublicBlackEmailList.stream().map(AdwebPublicBlackEmail::getEmail).filter(StringUtil::isNotEmpty).collect(Collectors.toList());
-                redisUtil.set(BlackEmailKey, publicBlackEmailList, 60 * 60 * 24);
+                adwebRedisUtil.set(BlackEmailKey, publicBlackEmailList, 60 * 60 * 24);
             } else {
                 publicBlackEmailList = new ArrayList<>();
             }
@@ -851,18 +871,18 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
             HashSet<String> blackEmailHashSet = new HashSet<String>(allBlackEmailList);
             blackEmailList = new ArrayList<>(blackEmailHashSet);
         }
-        log.info("公共邮箱黑名单:" + FastJsonUtil.toJSONString(publicBlackEmailList));
-        log.info("站点邮箱黑名单:" + FastJsonUtil.toJSONString(siteBlackEmailList));
+        log.info("公共邮箱黑名单:" + publicBlackEmailList.size());
+        log.info("站点邮箱黑名单:" + siteBlackEmailList.size());
 
         //邮箱 白名单
         //先获取对应站点的邮箱白名单
-        List<String> siteWhiteEmailList = (List<String>) redisUtil.get(SiteWhiteEmailListKey + "::" + adwebSite.getId());
+        List<String> siteWhiteEmailList = (List<String>) adwebRedisUtil.get(SiteWhiteEmailListKey + "::" + adwebSite.getId());
         if (ListUtil.isEmpty(siteWhiteEmailList)) {
             enquirySiteBlackEmailService.saveRedisSiteBlackEmailBySiteId(adwebSite.getId(), 1);
-            siteWhiteEmailList = (List<String>) redisUtil.get(SiteWhiteEmailListKey + "::" + adwebSite.getId());
+            siteWhiteEmailList = (List<String>) adwebRedisUtil.get(SiteWhiteEmailListKey + "::" + adwebSite.getId());
         }
         //公共邮箱白名单数据
-        List<String> publicWhiteEmailList = (List<String>) redisUtil.get(WhiteEmailListKey);
+        List<String> publicWhiteEmailList = (List<String>) adwebRedisUtil.get(WhiteEmailListKey);
         if (ListUtil.isEmpty(publicWhiteEmailList)) {
             List<AdwebPublicBlackEmail> enquiryPublicWhiteEmailList = adwebPublicBlackEmailService
                     .list(new LambdaQueryWrapper<AdwebPublicBlackEmail>()
@@ -873,7 +893,7 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
 
             if (ListUtil.notEmpty(enquiryPublicWhiteEmailList)) {
                 publicWhiteEmailList = enquiryPublicWhiteEmailList.stream().map(AdwebPublicBlackEmail::getEmail).filter(StringUtil::isNotEmpty).collect(Collectors.toList());
-                redisUtil.set(WhiteEmailListKey, publicWhiteEmailList, 60 * 60 * 24);
+                adwebRedisUtil.set(WhiteEmailListKey, publicWhiteEmailList, 60 * 60 * 24);
             } else {
                 publicWhiteEmailList = new ArrayList<>();
             }
@@ -896,7 +916,7 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
 
         //Ip黑名单
         //公共ip黑名单
-        List<String> publicBlackIpList = (List<String>) redisUtil.get(BlackIpKey);
+        List<String> publicBlackIpList = (List<String>) adwebRedisUtil.get(BlackIpKey);
         if (ListUtil.isEmpty(publicBlackIpList)) {
             List<AdwebPublicBlackIp> enquiryPublicBlackIpList = adwebPublicBlackIpService
                     .list(new LambdaQueryWrapper<AdwebPublicBlackIp>()
@@ -905,13 +925,13 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
                             .select(AdwebPublicBlackIp::getIp));
             if (ListUtil.notEmpty(enquiryPublicBlackIpList)) {
                 publicBlackIpList = enquiryPublicBlackIpList.stream().map(AdwebPublicBlackIp::getIp).collect(Collectors.toList());
-                redisUtil.set(BlackIpKey, publicBlackIpList, 60 * 60 * 24);
+                adwebRedisUtil.set(BlackIpKey, publicBlackIpList, 60 * 60 * 24);
             } else {
                 publicBlackIpList = new ArrayList<>();
             }
         }
         //站点ip黑名单
-        List<String> siteBlackIpList = (List<String>) redisUtil.get(SiteBlackIpKey + "::" + adwebSite.getId());
+        List<String> siteBlackIpList = (List<String>) adwebRedisUtil.get(SiteBlackIpKey + "::" + adwebSite.getId());
         if (ListUtil.isEmpty(siteBlackIpList)) {
             List<AdwebSiteBlackIp> enquirySiteBlackIpList = adwebSiteBlackIpService
                     .list(new LambdaQueryWrapper<AdwebSiteBlackIp>()
@@ -921,7 +941,7 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
                             .select(AdwebSiteBlackIp::getIp));
             if (ListUtil.notEmpty(enquirySiteBlackIpList)) {
                 siteBlackIpList = enquirySiteBlackIpList.stream().map(AdwebSiteBlackIp::getIp).collect(Collectors.toList());
-                redisUtil.set(SiteBlackIpKey + "::" + adwebSite.getId(), siteBlackIpList, 60 * 60 * 24);
+                adwebRedisUtil.set(SiteBlackIpKey + "::" + adwebSite.getId(), siteBlackIpList, 60 * 60 * 24);
             } else {
                 siteBlackIpList = new ArrayList<>();
             }
@@ -937,12 +957,12 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
             blackIpList = new ArrayList<>(blackIpHashSet);
         }
 
-        log.info("公共ip黑名单:" + FastJsonUtil.toJSONString(publicBlackIpList));
-        log.info("站点ip黑名单:" + FastJsonUtil.toJSONString(siteBlackIpList));
+        log.info("公共ip黑名单:{} 个", publicBlackIpList.size());
+        log.info("站点ip黑名单:{} 个", siteBlackIpList.size());
 
         //Ip白名单
         //公共Ip白名单
-        List<String> publicWhiteIpList = (List<String>) redisUtil.get(WhiteIpListKey);
+        List<String> publicWhiteIpList = (List<String>) adwebRedisUtil.get(WhiteIpListKey);
         if (publicWhiteIpList == null) {
             List<AdwebPublicBlackIp> enquiryPublicWhiteIpList = adwebPublicBlackIpService
                     .list(new LambdaQueryWrapper<AdwebPublicBlackIp>()
@@ -951,13 +971,13 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
                             .select(AdwebPublicBlackIp::getIp));
             if (ListUtil.notEmpty(enquiryPublicWhiteIpList)) {
                 publicWhiteIpList = enquiryPublicWhiteIpList.stream().map(AdwebPublicBlackIp::getIp).collect(Collectors.toList());
-                redisUtil.set(WhiteIpListKey, publicWhiteIpList, 60 * 60 * 24);
+                adwebRedisUtil.set(WhiteIpListKey, publicWhiteIpList, 60 * 60 * 24);
             } else {
                 publicWhiteIpList = new ArrayList<>();
             }
         }
         //站点Ip白名单, 基于站点查询
-        List<String> siteWhiteIpList = (List<String>) redisUtil.get(SiteWhiteIpListKey + "::" + adwebSite.getId());
+        List<String> siteWhiteIpList = (List<String>) adwebRedisUtil.get(SiteWhiteIpListKey + "::" + adwebSite.getId());
         if (ListUtil.isEmpty(siteWhiteIpList)) {
             List<AdwebSiteBlackIp> enquirySiteWhiteIpList = adwebSiteBlackIpService
                     .list(new LambdaQueryWrapper<AdwebSiteBlackIp>()
@@ -967,7 +987,7 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
                             .select(AdwebSiteBlackIp::getIp));
             if (ListUtil.notEmpty(enquirySiteWhiteIpList)) {
                 siteWhiteIpList = enquirySiteWhiteIpList.stream().map(AdwebSiteBlackIp::getIp).collect(Collectors.toList());
-                redisUtil.set(SiteWhiteIpListKey + "::" + adwebSite.getId(), siteWhiteIpList, 60 * 60 * 24);
+                adwebRedisUtil.set(SiteWhiteIpListKey + "::" + adwebSite.getId(), siteWhiteIpList, 60 * 60 * 24);
             } else {
                 siteWhiteIpList = new ArrayList<>();
             }
@@ -1308,29 +1328,29 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
         //更新redis
         //站点
         if (ListUtil.notEmpty(siteBlackEmailList)) {
-            redisUtil.set(SiteBlackEmailKey + "::" + adwebSite.getId(), siteBlackEmailList, 86400);
+            adwebRedisUtil.set(SiteBlackEmailKey + "::" + adwebSite.getId(), siteBlackEmailList, 86400);
         }
         if (ListUtil.notEmpty(siteBlackIpList)) {
-            redisUtil.set(SiteBlackIpKey + "::" + adwebSite.getId(), siteBlackIpList, 86400);
+            adwebRedisUtil.set(SiteBlackIpKey + "::" + adwebSite.getId(), siteBlackIpList, 86400);
         }
         if (ListUtil.notEmpty(siteWhiteEmailList)) {
-            redisUtil.set(SiteWhiteEmailListKey + "::" + adwebSite.getId(), siteWhiteEmailList, 86400);
+            adwebRedisUtil.set(SiteWhiteEmailListKey + "::" + adwebSite.getId(), siteWhiteEmailList, 86400);
         }
         if (ListUtil.notEmpty(siteWhiteIpList)) {
-            redisUtil.set(SiteWhiteIpListKey + "::" + adwebSite.getId(), siteWhiteIpList, 86400);
+            adwebRedisUtil.set(SiteWhiteIpListKey + "::" + adwebSite.getId(), siteWhiteIpList, 86400);
         }
         //公共
         if (ListUtil.notEmpty(publicBlackEmailList)) {
-            redisUtil.set(BlackEmailKey, publicBlackEmailList, 86400);
+            adwebRedisUtil.set(BlackEmailKey, publicBlackEmailList, 86400);
         }
         if (ListUtil.notEmpty(publicBlackIpList)) {
-            redisUtil.set(BlackIpKey, publicBlackIpList, 86400);
+            adwebRedisUtil.set(BlackIpKey, publicBlackIpList, 86400);
         }
         if (ListUtil.notEmpty(publicWhiteEmailList)) {
-            redisUtil.set(WhiteEmailListKey, publicWhiteEmailList, 86400);
+            adwebRedisUtil.set(WhiteEmailListKey, publicWhiteEmailList, 86400);
         }
         if (ListUtil.notEmpty(publicWhiteIpList)) {
-            redisUtil.set(WhiteIpListKey, publicWhiteIpList, 86400);
+            adwebRedisUtil.set(WhiteIpListKey, publicWhiteIpList, 86400);
         }
     }
 
@@ -1440,12 +1460,12 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
             //该分支用于判断上一封垃圾询盘 不在邮箱黑名单中
             if (emailFlag) {
                 Integer notBlackEmailWasteListCount = null;
-                if (redisUtil.hasKey(NotBlackEmailWasteEnquiryKey + isJudgeWasteEnquiry.getEmail())) {
-                    notBlackEmailWasteListCount = (Integer) redisUtil.get(NotBlackEmailWasteEnquiryKey + isJudgeWasteEnquiry.getEmail()) + 1;
+                if (adwebRedisUtil.hasKey(NotBlackEmailWasteEnquiryKey + isJudgeWasteEnquiry.getEmail())) {
+                    notBlackEmailWasteListCount = (Integer) adwebRedisUtil.get(NotBlackEmailWasteEnquiryKey + isJudgeWasteEnquiry.getEmail()) + 1;
                 } else {
                     notBlackEmailWasteListCount = 1;
                 }
-                redisUtil.set(NotBlackEmailWasteEnquiryKey + isJudgeWasteEnquiry.getEmail(), notBlackEmailWasteListCount, 60L * 60 * 24 * emailNotBlackListDate);
+                adwebRedisUtil.set(NotBlackEmailWasteEnquiryKey + isJudgeWasteEnquiry.getEmail(), notBlackEmailWasteListCount, 60L * 60 * 24 * emailNotBlackListDate);
 
                 //该分支用于判断是否超过
                 if (notBlackEmailWasteListCount > emailNotBlackListNum) {
@@ -1455,17 +1475,17 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
                         blackEmailList.add(isJudgeWasteEnquiry.getEmail());
                         log.info("询盘id是:{}, 站点code是:{}, 检测重复,已标记邮箱, 邮箱是:{}", isJudgeWasteEnquiry.getId(), isJudgeWasteEnquiry.getSiteCode(), isJudgeWasteEnquiry.getEmail());
                     }
-                    redisUtil.del(NotBlackEmailWasteEnquiryKey + isJudgeWasteEnquiry.getEmail());
+                    adwebRedisUtil.del(NotBlackEmailWasteEnquiryKey + isJudgeWasteEnquiry.getEmail());
                 }
             }
             if (ipFlag) {
                 Integer notBlackIpWasteListCount = null;
-                if (redisUtil.hasKey(NotBlackIpWasteEnquiryKey + isJudgeWasteEnquiry.getFromIp())) {
-                    notBlackIpWasteListCount = (Integer) redisUtil.get(NotBlackIpWasteEnquiryKey + isJudgeWasteEnquiry.getFromIp()) + 1;
+                if (adwebRedisUtil.hasKey(NotBlackIpWasteEnquiryKey + isJudgeWasteEnquiry.getFromIp())) {
+                    notBlackIpWasteListCount = (Integer) adwebRedisUtil.get(NotBlackIpWasteEnquiryKey + isJudgeWasteEnquiry.getFromIp()) + 1;
                 } else {
                     notBlackIpWasteListCount = 1;
                 }
-                redisUtil.set(NotBlackIpWasteEnquiryKey + isJudgeWasteEnquiry.getFromIp(), notBlackIpWasteListCount, 60L * 60 * 24 * ipNotBlackListDate);
+                adwebRedisUtil.set(NotBlackIpWasteEnquiryKey + isJudgeWasteEnquiry.getFromIp(), notBlackIpWasteListCount, 60L * 60 * 24 * ipNotBlackListDate);
 
                 //该分支用于判断是否出现超过
                 if (notBlackIpWasteListCount > ipNotBlackListNum) {
@@ -1475,7 +1495,7 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
                         blackIpList.add(isJudgeWasteEnquiry.getFromIp());
                         log.info("询盘id是:{}, 站点code是:{}, 检测重复,已标记ip, ip是:{}", isJudgeWasteEnquiry.getId(), isJudgeWasteEnquiry.getSiteCode(), isJudgeWasteEnquiry.getFromIp());
                     }
-                    redisUtil.del(NotBlackIpWasteEnquiryKey + isJudgeWasteEnquiry.getFromIp());
+                    adwebRedisUtil.del(NotBlackIpWasteEnquiryKey + isJudgeWasteEnquiry.getFromIp());
                 }
             }
         }
@@ -1512,12 +1532,12 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
             //该分支用于判断上一封垃圾询盘 不在邮箱黑名单中
             if (emailFlag) {
                 Integer notBlackEmailWasteListCount = null;
-                if (redisUtil.hasKey(NotBlackEmailWasteSiteEnquiryKey + adwebSite.getId() + "::" + isJudgeWasteEnquiry.getEmail())) {
-                    notBlackEmailWasteListCount = (Integer) redisUtil.get(NotBlackEmailWasteSiteEnquiryKey + adwebSite.getId() + "::" + isJudgeWasteEnquiry.getEmail()) + 1;
+                if (adwebRedisUtil.hasKey(NotBlackEmailWasteSiteEnquiryKey + adwebSite.getId() + "::" + isJudgeWasteEnquiry.getEmail())) {
+                    notBlackEmailWasteListCount = (Integer) adwebRedisUtil.get(NotBlackEmailWasteSiteEnquiryKey + adwebSite.getId() + "::" + isJudgeWasteEnquiry.getEmail()) + 1;
                 } else {
                     notBlackEmailWasteListCount = 1;
                 }
-                redisUtil.set(NotBlackEmailWasteSiteEnquiryKey + adwebSite.getId() + "::" + isJudgeWasteEnquiry.getEmail(), notBlackEmailWasteListCount, 60L * 60 * 24 * emailNotBlackListDate);
+                adwebRedisUtil.set(NotBlackEmailWasteSiteEnquiryKey + adwebSite.getId() + "::" + isJudgeWasteEnquiry.getEmail(), notBlackEmailWasteListCount, 60L * 60 * 24 * emailNotBlackListDate);
 
                 //该分支用于判断是否超过
                 if (notBlackEmailWasteListCount > emailNotBlackListNum) {
@@ -1530,17 +1550,17 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
                     effectiveEnquiryParamDto.setSiteCode(adwebSite.getCode());
                     effectiveEnquiryParamDto.setWasteEnquirySeason(isJudgeWasteEnquiry.getEmail());
                     enquirySiteBlackEmailService.addBlackEmailByContent(effectiveEnquiryParamDto);
-                    redisUtil.del(NotBlackEmailWasteSiteEnquiryKey + adwebSite.getId() + "::" + isJudgeWasteEnquiry.getEmail());
+                    adwebRedisUtil.del(NotBlackEmailWasteSiteEnquiryKey + adwebSite.getId() + "::" + isJudgeWasteEnquiry.getEmail());
                 }
             }
             if (ipFlag) {
                 Integer notBlackIpWasteListCount = null;
-                if (redisUtil.hasKey(NotSiteBlackIpWasteEnquiryKey + adwebSite.getId() + "::" + isJudgeWasteEnquiry.getFromIp())) {
-                    notBlackIpWasteListCount = (Integer) redisUtil.get(NotSiteBlackIpWasteEnquiryKey + adwebSite.getId() + "::" + isJudgeWasteEnquiry.getFromIp()) + 1;
+                if (adwebRedisUtil.hasKey(NotSiteBlackIpWasteEnquiryKey + adwebSite.getId() + "::" + isJudgeWasteEnquiry.getFromIp())) {
+                    notBlackIpWasteListCount = (Integer) adwebRedisUtil.get(NotSiteBlackIpWasteEnquiryKey + adwebSite.getId() + "::" + isJudgeWasteEnquiry.getFromIp()) + 1;
                 } else {
                     notBlackIpWasteListCount = 1;
                 }
-                redisUtil.set(NotSiteBlackIpWasteEnquiryKey + adwebSite.getId() + "::" + isJudgeWasteEnquiry.getFromIp(), notBlackIpWasteListCount, 60L * 60 * 24 * ipNotBlackListDate);
+                adwebRedisUtil.set(NotSiteBlackIpWasteEnquiryKey + adwebSite.getId() + "::" + isJudgeWasteEnquiry.getFromIp(), notBlackIpWasteListCount, 60L * 60 * 24 * ipNotBlackListDate);
 
                 //该分支用于判断是否出现超过
                 if (notBlackIpWasteListCount > ipNotBlackListNum) {
@@ -1553,7 +1573,7 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
                     effectiveEnquiryParamDto.setSiteId(adwebSite.getId());
                     effectiveEnquiryParamDto.setSiteCode(adwebSite.getCode());
                     adwebSiteBlackIpService.addBlackIpByContent(effectiveEnquiryParamDto);
-                    redisUtil.del(NotSiteBlackIpWasteEnquiryKey + adwebSite.getId() + "::" + isJudgeWasteEnquiry.getFromIp());
+                    adwebRedisUtil.del(NotSiteBlackIpWasteEnquiryKey + adwebSite.getId() + "::" + isJudgeWasteEnquiry.getFromIp());
                 }
             }
         }
@@ -1566,12 +1586,12 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
         Integer tenMin = null;
         String TenMinKey = SiteEmailTenMinKey + adwebSite.getId() + "::" + adwebEnquiry.getEmail();
         String oneDayKey = SiteEmailOneDayKey + adwebSite.getId() + "::" + adwebEnquiry.getEmail();
-        if (redisUtil.hasKey(TenMinKey)) {
-            tenMin = (Integer) redisUtil.get(TenMinKey) + 1;
+        if (adwebRedisUtil.hasKey(TenMinKey)) {
+            tenMin = (Integer) adwebRedisUtil.get(TenMinKey) + 1;
         } else {
             tenMin = 1;
         }
-        redisUtil.set(TenMinKey, tenMin, 10 * 60);
+        adwebRedisUtil.set(TenMinKey, tenMin, 10 * 60);
 
         if (tenMin > emailTenMinNum) {
             adwebEnquiry.setWasteEnquiry(1);
@@ -1592,19 +1612,19 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
             effectiveEnquiryParamDto.setWasteEnquirySeason(adwebEnquiry.getEmail());
             enquirySiteBlackEmailService.addBlackEmailByContent(effectiveEnquiryParamDto);
             // 清除map中的数据
-            redisUtil.del(TenMinKey);
-            redisUtil.del(oneDayKey);
+            adwebRedisUtil.del(TenMinKey);
+            adwebRedisUtil.del(oneDayKey);
             return true;
         }
 
         //如果10分钟内发送了则1天用判断了
         Integer oneDay = null;
-        if (redisUtil.hasKey(oneDayKey)) {
-            oneDay = (Integer) redisUtil.get(oneDayKey) + 1;
+        if (adwebRedisUtil.hasKey(oneDayKey)) {
+            oneDay = (Integer) adwebRedisUtil.get(oneDayKey) + 1;
         } else {
             oneDay = 1;
         }
-        redisUtil.set(oneDayKey, oneDay, 24 * 60 * 60);
+        adwebRedisUtil.set(oneDayKey, oneDay, 24 * 60 * 60);
 
         if (oneDay > emailOneDayNum) {
             adwebEnquiry.setWasteEnquiry(1);
@@ -1627,7 +1647,7 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
             effectiveEnquiryParamDto.setWasteEnquirySeason(adwebEnquiry.getEmail());
             enquirySiteBlackEmailService.addBlackEmailByContent(effectiveEnquiryParamDto);
             // 清除map中的数据
-            redisUtil.del(oneDayKey);
+            adwebRedisUtil.del(oneDayKey);
             return true;
         }
         return false;
@@ -1641,12 +1661,12 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
         Integer tenMin = null;
         String tenMinKey = SiteIpTenMinKey + adwebSite.getId() + "::" + adwebEnquiry.getFromIp();
         String oneDayKey = SiteIpOneDayKey + adwebSite.getId() + "::" + adwebEnquiry.getFromIp();
-        if (redisUtil.hasKey(tenMinKey)) {
-            tenMin = (Integer) redisUtil.get(tenMinKey) + 1;
+        if (adwebRedisUtil.hasKey(tenMinKey)) {
+            tenMin = (Integer) adwebRedisUtil.get(tenMinKey) + 1;
         } else {
             tenMin = 1;
         }
-        redisUtil.set(tenMinKey, tenMin, 10 * 60);
+        adwebRedisUtil.set(tenMinKey, tenMin, 10 * 60);
         if (tenMin > ipTenMinNum) {
             adwebEnquiry.setWasteEnquiry(1);
             adwebEnquiry.setUserEffective(0);
@@ -1665,18 +1685,18 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
             effectiveEnquiryParamDto.setSiteCode(adwebSite.getCode());
             adwebSiteBlackIpService.addBlackIpByContent(effectiveEnquiryParamDto);
             // 清除map中的数据
-            redisUtil.del(tenMinKey);
-            redisUtil.del(oneDayKey);
+            adwebRedisUtil.del(tenMinKey);
+            adwebRedisUtil.del(oneDayKey);
             return true;
         }
 
         Integer oneDay = null;
-        if (redisUtil.hasKey(oneDayKey)) {
-            oneDay = (Integer) redisUtil.get(oneDayKey) + 1;
+        if (adwebRedisUtil.hasKey(oneDayKey)) {
+            oneDay = (Integer) adwebRedisUtil.get(oneDayKey) + 1;
         } else {
             oneDay = 1;
         }
-        redisUtil.set(oneDayKey, oneDay, 24 * 60 * 60);
+        adwebRedisUtil.set(oneDayKey, oneDay, 24 * 60 * 60);
         if (oneDay > ipOneDayNum) {
             adwebEnquiry.setWasteEnquiry(1);
             adwebEnquiry.setUserEffective(0);
@@ -1695,7 +1715,7 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
             effectiveEnquiryParamDto.setSiteCode(adwebSite.getCode());
             adwebSiteBlackIpService.addBlackIpByContent(effectiveEnquiryParamDto);
             // 清除map中的数据
-            redisUtil.del(oneDayKey);
+            adwebRedisUtil.del(oneDayKey);
             return true;
         }
         return false;

+ 2 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/site/entity/AdwebSite.java

@@ -378,7 +378,8 @@ public class AdwebSite implements Serializable {
 
     @TableField(exist = false)
     private Date enquiryMessageTime;
-    
+
+    @TableField(exist = false)
     private String planId;
 
     @TableField(exist = false)

+ 3 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/system/service/SysAdwebApi.java

@@ -1,6 +1,7 @@
 package org.jeecg.modules.adweb.system.service;
 
 import org.jeecg.common.system.vo.DictPropertyModel;
+import org.jeecg.modules.system.entity.SysDictItem;
 
 import java.util.List;
 
@@ -37,4 +38,6 @@ public interface SysAdwebApi {
      * @return
      */
     public List<DictPropertyModel> queryDictInfoByDictCode(String dictCode);
+
+    List<SysDictItem> selectItemsByDictCode(String mainId);
 }

+ 10 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/system/service/impl/SysAdwebApiImpl.java

@@ -17,7 +17,9 @@ import org.jeecg.modules.adweb.site.entity.AdwebSite;
 import org.jeecg.modules.adweb.site.service.IAdwebSiteService;
 import org.jeecg.modules.adweb.site.service.ISiteUserPermissionService;
 import org.jeecg.modules.adweb.system.service.SysAdwebApi;
+import org.jeecg.modules.system.entity.SysDictItem;
 import org.jeecg.modules.system.entity.SysUser;
+import org.jeecg.modules.system.mapper.SysDictItemMapper;
 import org.jeecg.modules.system.mapper.SysUserMapper;
 import org.jeecg.modules.system.mapper.SysUserRoleMapper;
 import org.jeecg.modules.system.service.ISysDictService;
@@ -37,6 +39,9 @@ public class SysAdwebApiImpl implements SysAdwebApi {
     @Resource
     private SysUserMapper userMapper;
 
+    @Resource
+    private SysDictItemMapper sysDictItemMapper;
+
     @Autowired
     private ISiteUserPermissionService siteUserPermissionService;
 
@@ -194,4 +199,9 @@ public class SysAdwebApiImpl implements SysAdwebApi {
         }
         return propertyModels;
     }
+
+    @Override
+    public List<SysDictItem> selectItemsByDictCode(String dictCode) {
+        return sysDictItemMapper.selectItemsByDictCode(dictCode);
+    }
 }

+ 10 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/SysDictItemMapper.java

@@ -23,4 +23,14 @@ public interface SysDictItemMapper extends BaseMapper<SysDictItem> {
      */
     @Select("SELECT * FROM sys_dict_item WHERE DICT_ID = #{mainId} order by sort_order asc, item_value asc")
     public List<SysDictItem> selectItemsByMainId(String mainId);
+
+    @Select("SELECT\n" +
+            "\t * \n" +
+            "FROM\n" +
+            "\tsys_dict_item t1\n" +
+            "\tJOIN sys_dict t2 ON t1.dict_id = t2.id\n" +
+            "WHERE\n" +
+            "\tt2.dict_code = #{dictCode} AND\n" +
+            "\tt1.`status` = 1")
+    List<SysDictItem> selectItemsByDictCode(String dictCode);
 }