Browse Source

Merge branch 'refs/heads/master' into dev-zenas-20241018

zq940222 5 months ago
parent
commit
f26a92f5db
27 changed files with 1941 additions and 196 deletions
  1. 1 1
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/common/service/FeishuService.java
  2. 34 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/common/util/NumberUtil.java
  3. 75 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/dmp/controller/GADataController.java
  4. 3 3
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/dmp/controller/GTMController.java
  5. 8 5
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/dmp/mapper/GAPagePathReportMapper.java
  6. 41 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/dmp/mapper/xml/GAPagePathReportMapper.xml
  7. 6 4
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/dmp/service/IGAPagePathReportService.java
  8. 49 5
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/dmp/service/impl/GAPagePathReportServiceImpl.java
  9. 23 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/dmp/vo/report/PagePathStatsVO.java
  10. 18 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/controller/AdwebEnquiryController.java
  11. 193 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/controller/AdwebEnquiryRecordController.java
  12. 318 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/controller/AdwebPublicBlackEmailController.java
  13. 316 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/controller/AdwebPublicBlackIpController.java
  14. 371 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/controller/AdwebSiteBlackIpController.java
  15. 269 145
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/entity/AdwebEnquiry.java
  16. 43 23
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/entity/AdwebEnquiryBlacklist.java
  17. 76 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/entity/AdwebEnquiryRecord.java
  18. 17 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/mapper/AdwebEnquiryRecordMapper.java
  19. 16 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/mapper/xml/AdwebEnquiryRecordMapper.xml
  20. 1 1
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/mapper/xml/AdwebPublicBlackEmailMapper.xml
  21. 1 1
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/mapper/xml/AdwebPublicBlackIpMapper.xml
  22. 13 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/service/IAdwebEnquiryRecordService.java
  23. 18 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/service/impl/AdwebEnquiryRecordServiceImpl.java
  24. 15 2
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/service/impl/AdwebEnquiryServiceImpl.java
  25. 6 1
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/site/service/IAdwebSiteService.java
  26. 9 4
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/site/service/impl/AdwebSiteServiceImpl.java
  27. 1 1
      jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml

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

@@ -104,7 +104,7 @@ public class FeishuService {
             return;
         }
 
-        String siteName = adwebSiteService.getSiteNameByCode(siteCode);
+        String siteName = adwebSiteService.getSiteByCode(siteCode).getName();
 
         String template = dictItem.getItemValue();
         template = template.replace("{{siteName}}", siteName);

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

@@ -0,0 +1,34 @@
+package org.jeecg.modules.adweb.common.util;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.NumberFormat;
+
+/**
+ * @author wfansh
+ */
+public class NumberUtil {
+
+    private static final NumberFormat PERCENTAGE_FORMAT = NumberFormat.getPercentInstance();
+
+    static {
+        PERCENTAGE_FORMAT.setRoundingMode(RoundingMode.HALF_UP);
+        // No grouping with ',' delimiter.
+        PERCENTAGE_FORMAT.setGroupingUsed(false);
+    }
+
+    public static BigDecimal formatDecimal(double number, int fractionDigits) {
+        BigDecimal decimal = new BigDecimal(number);
+        return decimal.setScale(fractionDigits, RoundingMode.HALF_UP);
+    }
+
+    /**
+     * {@link cn.hutool.core.util.NumberUtil#formatPercent(double, int)} 没有设置minimumFractionDigits
+     */
+    public static String formatPercentage(double number, int fractionDigits) {
+        PERCENTAGE_FORMAT.setMinimumFractionDigits(fractionDigits);
+        PERCENTAGE_FORMAT.setMaximumFractionDigits(fractionDigits);
+
+        return PERCENTAGE_FORMAT.format(number);
+    }
+}

+ 75 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/dmp/controller/GADataController.java

@@ -0,0 +1,75 @@
+package org.jeecg.modules.adweb.dmp.controller;
+
+import io.swagger.v3.oas.annotations.tags.Tag;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.apache.commons.lang.StringUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.modules.adweb.common.util.DateUtil;
+import org.jeecg.modules.adweb.dmp.service.IGAPagePathReportService;
+import org.jeecg.modules.adweb.dmp.vo.report.PagePathStatsVO;
+import org.jeecg.modules.adweb.site.service.IAdwebSiteService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * GA网站流量
+ *
+ * @author wfansh
+ */
+@Tag(name = "Google Analytics网站流量")
+@RestController
+@RequestMapping("/ga-data")
+@Slf4j
+public class GADataController {
+
+    @Autowired private IAdwebSiteService adwebSiteService;
+
+    @Autowired private IGAPagePathReportService gaPagePathReportService;
+
+    //    /** 网站流量分析统计 */
+    //    public Result<?> getSiteTraffic(
+    //            String siteCode,
+    //            String dateType,
+    //            @DateTimeFormat(pattern = "yyyy-MM-dd") Date start,
+    //            @DateTimeFormat(pattern = "yyyy-MM-dd") Date end) {
+    //        // 1. 计算时间区间
+    //        if (StringUtils.isNotBlank(dateType)) {
+    //            Map<String, Date> map = DateUtil.getDateRangeByType(dateType);
+    //            start = map.get("start");
+    //            end = map.get("end");
+    //        } else {
+    //            if (end != null) {
+    //                end = DateUtil.addDays(end, 1);
+    //            }
+    //        }
+    //    }
+
+    @GetMapping("/page-path/stats")
+    public Result<List<PagePathStatsVO>> getPagePathStats(
+            String siteCode,
+            String dateType,
+            @DateTimeFormat(pattern = "yyyy-MM-dd") Date start,
+            @DateTimeFormat(pattern = "yyyy-MM-dd") Date end,
+            int limit) {
+        // 1. 计算时间区间
+        if (StringUtils.isNotBlank(dateType)) {
+            Map<String, Date> dateRange = DateUtil.getDateRangeByType(dateType);
+            start = dateRange.get("start");
+            end = dateRange.get("end");
+        }
+
+        // 2. 查询并返回
+        return Result.ok(
+                gaPagePathReportService.getPagePathStats(
+                        siteCode, start, end, limit >= 0 ? limit : 10));
+    }
+}

+ 3 - 3
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/dmp/controller/GTMController.java

@@ -35,10 +35,10 @@ public class GTMController {
 
     @RequestMapping(value = "/add", method = RequestMethod.POST)
     @ResponseBody
-    public Result<Pair<String, String>> addContainer(String siteId) {
-        AdwebSite adwebSite = adwebSiteService.getById(siteId);
+    public Result<Pair<String, String>> addContainer(String siteCode) {
+        AdwebSite adwebSite = adwebSiteService.getSiteByCode(siteCode);
         if (Objects.isNull(adwebSite)) {
-            return Result.error("站点未找到" + siteId);
+            return Result.error("站点未找到" + siteCode);
         }
 
         // 如果GoogleGTM表中已存在,不再创建,返回现有记录

+ 8 - 5
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/dmp/mapper/GAPagePathReportMapper.java

@@ -1,16 +1,19 @@
 package org.jeecg.modules.adweb.dmp.mapper;
 
-
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 import org.jeecg.modules.adweb.dmp.entity.GAPagePathReport;
+import org.jeecg.modules.adweb.dmp.vo.report.PagePathStatsVO;
+
+import java.util.Date;
+import java.util.List;
 
 /**
- * @Description: dmp_ga_page_path_report
- * @Author: jeecg-boot
- * @Date:   2024-10-11
- * @Version: V1.0
+ * @Description: dmp_ga_page_path_report @Author: jeecg-boot @Date: 2024-10-11 @Version: V1.0
  */
 public interface GAPagePathReportMapper extends BaseMapper<GAPagePathReport> {
 
+    List<PagePathStatsVO> getPagePathStats(String siteCode, Date start, Date end, int limit);
+
+    int countTotalPVs(String siteCode, Date start, Date end);
 }

+ 41 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/dmp/mapper/xml/GAPagePathReportMapper.xml

@@ -2,4 +2,45 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.jeecg.modules.adweb.dmp.mapper.GAPagePathReportMapper">
 
+    <select id="getPagePathStats" resultType="org.jeecg.modules.adweb.dmp.vo.report.PagePathStatsVO">
+        SELECT
+        *
+        FROM
+        (
+        SELECT
+        page_path,
+        SUM(page_views) page_views,
+        ROUND(SUM(page_views * avg_time_on_page) / SUM(page_views), 2) avg_time_on_page
+        FROM dmp_ga_page_path_report
+        WHERE
+        site_code = #{siteCode}
+        <if test="start != null">
+            AND date >= #{start}
+        </if>
+        <if test="end != null">
+            AND date &lt; DATE_ADD(#{end}, INTERVAL 1 DAY)
+        </if>
+        GROUP BY page_path
+        ) t
+        ORDER BY
+        page_views DESC,
+        avg_time_on_page DESC
+        LIMIT #{limit}
+    </select>
+
+    <select id="countTotalPVs" resultType="java.lang.Integer">
+        SELECT
+        SUM(page_views) page_views
+        FROM
+        dmp_ga_page_path_report
+        WHERE
+        site_code = #{siteCode}
+        <if test="start != null">
+            AND date >= #{start}
+        </if>
+        <if test="end != null">
+            AND date &lt; DATE_ADD(#{end}, INTERVAL 1 DAY)
+        </if>
+    </select>
+
 </mapper>

+ 6 - 4
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/dmp/service/IGAPagePathReportService.java

@@ -3,13 +3,15 @@ package org.jeecg.modules.adweb.dmp.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 import org.jeecg.modules.adweb.dmp.entity.GAPagePathReport;
+import org.jeecg.modules.adweb.dmp.vo.report.PagePathStatsVO;
+
+import java.util.Date;
+import java.util.List;
 
 /**
- * @Description: dmp_ga_page_path_report
- * @Author: jeecg-boot
- * @Date:   2024-10-11
- * @Version: V1.0
+ * @Description: dmp_ga_page_path_report @Author: jeecg-boot @Date: 2024-10-11 @Version: V1.0
  */
 public interface IGAPagePathReportService extends IService<GAPagePathReport> {
 
+    List<PagePathStatsVO> getPagePathStats(String siteCode, Date start, Date end, int limit);
 }

+ 49 - 5
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/dmp/service/impl/GAPagePathReportServiceImpl.java

@@ -1,19 +1,63 @@
 package org.jeecg.modules.adweb.dmp.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.base.Strings;
 
+import lombok.extern.slf4j.Slf4j;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.jeecg.modules.adweb.common.util.NumberUtil;
 import org.jeecg.modules.adweb.dmp.entity.GAPagePathReport;
 import org.jeecg.modules.adweb.dmp.mapper.GAPagePathReportMapper;
 import org.jeecg.modules.adweb.dmp.service.IGAPagePathReportService;
+import org.jeecg.modules.adweb.dmp.vo.report.PagePathStatsVO;
+import org.jeecg.modules.adweb.site.entity.AdwebSite;
+import org.jeecg.modules.adweb.site.service.IAdwebSiteService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
 /**
- * @Description: dmp_ga_page_path_report
- * @Author: jeecg-boot
- * @Date:   2024-10-11
- * @Version: V1.0
+ * @Description: dmp_ga_page_path_report @Author: jeecg-boot @Date: 2024-10-11 @Version: V1.0
  */
 @Service
-public class GAPagePathReportServiceImpl extends ServiceImpl<GAPagePathReportMapper, GAPagePathReport> implements IGAPagePathReportService {
+@Slf4j
+public class GAPagePathReportServiceImpl
+        extends ServiceImpl<GAPagePathReportMapper, GAPagePathReport>
+        implements IGAPagePathReportService {
+
+    @Autowired private GAPagePathReportMapper gaPagePathReportMapper;
+
+    @Autowired private IAdwebSiteService adwebSiteService;
+
+    public List<PagePathStatsVO> getPagePathStats(
+            String siteCode, Date start, Date end, int limit) {
+        List<PagePathStatsVO> pagePathStatsVOs =
+                gaPagePathReportMapper.getPagePathStats(siteCode, start, end, limit);
+        if (CollectionUtils.isEmpty(pagePathStatsVOs)) {
+            return Collections.EMPTY_LIST;
+        }
+
+        // 1. 网站URL及格式化
+        AdwebSite adwebSite = adwebSiteService.getSiteByCode(siteCode);
+        String siteUrl = StringUtils.removeEnd(Strings.nullToEmpty(adwebSite.getDomain()), "/");
+
+        // 2. 时间区间内PV总数
+        int totalPVs = gaPagePathReportMapper.countTotalPVs(siteCode, start, end);
+
+        // 3. VO数据填充
+        for (PagePathStatsVO pagePathStatsVO : pagePathStatsVOs) {
+            pagePathStatsVO.setPagePath(siteUrl + pagePathStatsVO.getPagePath());
+            pagePathStatsVO.setPvProportion(
+                    NumberUtil.formatPercentage(
+                            totalPVs == 0 ? 0 : (double) pagePathStatsVO.getPageViews() / totalPVs,
+                            2));
+        }
 
+        return pagePathStatsVOs;
+    }
 }

+ 23 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/dmp/vo/report/PagePathStatsVO.java

@@ -0,0 +1,23 @@
+package org.jeecg.modules.adweb.dmp.vo.report;
+
+import lombok.Data;
+
+import org.jeecg.modules.adweb.dmp.dto.google.analytics.report.data.PagePathViewData;
+import org.jeecg.modules.adweb.dmp.entity.GAPagePathReport;
+
+/**
+ * GA页面访问统计数据VO,see {@link PagePathViewData} and {@link GAPagePathReport}
+ *
+ * @author wfansh
+ */
+@Data
+public class PagePathStatsVO {
+
+    private String pagePath;
+
+    private int pageViews;
+
+    private double avgTimeOnPage;
+
+    private String pvProportion;
+}

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

@@ -651,6 +651,24 @@ public class AdwebEnquiryController extends JeecgController<AdwebEnquiry, IAdweb
         return Result.OK(pageList);
     }
 
+    /**
+     * 批量复原
+     *
+     * @param adwebEnquiry
+     * @return
+     */
+    @PutMapping(value = "/refreshBatch")
+    public Result<?> refreshBatch(@RequestBody AdwebEnquiry adwebEnquiry) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        UpdateWrapper<AdwebEnquiry> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.in("id", adwebEnquiry.getNo().split(","));
+        updateWrapper.set("status", 1);
+        adwebEnquiryService.update(updateWrapper);
+
+        return Result.OK("批量复原成功!");
+    }
+
 
     /**
      * 根据询盘信息创建邮件发送记录

+ 193 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/controller/AdwebEnquiryRecordController.java

@@ -0,0 +1,193 @@
+package org.jeecg.modules.adweb.enquiry.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.FastJsonUtil;
+import org.jeecg.modules.adweb.enquiry.entity.AdwebEnquiryRecord;
+import org.jeecg.modules.adweb.enquiry.mapper.AdwebEnquiryRecordMapper;
+import org.jeecg.modules.adweb.enquiry.service.IAdwebEnquiryRecordService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Description: adweb_enquiry_record
+ * @Author: jeecg-boot
+ * @Date: 2021-05-11
+ * @Version: V1.0
+ */
+@Tag(name = "adweb_enquiry_record")
+@RestController
+@RequestMapping("/adweb/adwebEnquiryRecord")
+@Slf4j
+public class AdwebEnquiryRecordController extends JeecgController<AdwebEnquiryRecord, IAdwebEnquiryRecordService> {
+
+    @Autowired
+    private IAdwebEnquiryRecordService adwebEnquiryRecordService;
+
+    @Resource
+    private AdwebEnquiryRecordMapper adwebEnquiryRecordMapper;
+
+    /**
+     * 分页列表查询
+     *
+     * @param adwebEnquiryRecord
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "adweb_enquiry_record-分页列表查询")
+    @Operation(summary = "adweb_enquiry_record-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<?> queryPageList(AdwebEnquiryRecord adwebEnquiryRecord,
+                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                   HttpServletRequest req) {
+        QueryWrapper<AdwebEnquiryRecord> queryWrapper = QueryGenerator.initQueryWrapper(adwebEnquiryRecord, req.getParameterMap());
+        Page<AdwebEnquiryRecord> page = new Page<AdwebEnquiryRecord>(pageNo, pageSize);
+        IPage<AdwebEnquiryRecord> pageList = adwebEnquiryRecordService.page(page, queryWrapper);
+        return Result.OK(pageList);
+    }
+
+    /**
+     * @param adwebEnquiryRecord
+     * @return
+     */
+    @GetMapping(value = "/enquiryRecordList")
+    public Result<?> enquiryRecordList(AdwebEnquiryRecord adwebEnquiryRecord) {
+        QueryWrapper<AdwebEnquiryRecord> queryWrapper = new QueryWrapper<>();
+        List<AdwebEnquiryRecord> pageList = adwebEnquiryRecordMapper.getEnquiryRecord(adwebEnquiryRecord);
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        return Result.OK(pageList);
+    }
+
+    /**
+     * 添加
+     *
+     * @param adwebEnquiryRecord
+     * @return
+     */
+    @AutoLog(value = "adweb_enquiry_record-添加")
+    @Operation(summary = "adweb_enquiry_record-添加")
+    @PostMapping(value = "/add")
+    public Result<?> add(AdwebEnquiryRecord adwebEnquiryRecord) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        log.info("adwebEnquiryRecord:{}", FastJsonUtil.toJSONString(adwebEnquiryRecord));
+        adwebEnquiryRecord.setCtime(new Date());
+        adwebEnquiryRecord.setStatus(1);
+        adwebEnquiryRecord.setUid(sysUser.getId());
+        adwebEnquiryRecordService.save(adwebEnquiryRecord);
+        return Result.OK("添加成功!");
+    }
+
+    /**
+     * 编辑
+     *
+     * @param adwebEnquiryRecord
+     * @return
+     */
+    @AutoLog(value = "adweb_enquiry_record-编辑")
+    @Operation(summary = "adweb_enquiry_record-编辑")
+    @PutMapping(value = "/edit")
+    public Result<?> edit(@RequestBody AdwebEnquiryRecord adwebEnquiryRecord) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        adwebEnquiryRecordService.updateById(adwebEnquiryRecord);
+        return Result.OK("编辑成功!");
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "adweb_enquiry_record-通过id删除")
+    @Operation(summary = "adweb_enquiry_record-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        adwebEnquiryRecordService.removeById(id);
+        return Result.OK("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "adweb_enquiry_record-批量删除")
+    @Operation(summary = "adweb_enquiry_record-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        this.adwebEnquiryRecordService.removeByIds(Arrays.asList(ids.split(",")));
+        return Result.OK("批量删除成功!");
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "adweb_enquiry_record-通过id查询")
+    @Operation(summary = "adweb_enquiry_record-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
+        AdwebEnquiryRecord adwebEnquiryRecord = adwebEnquiryRecordService.getById(id);
+        if (adwebEnquiryRecord == null) {
+            return Result.error("未找到对应数据");
+        }
+        return Result.OK(adwebEnquiryRecord);
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param adwebEnquiryRecord
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, AdwebEnquiryRecord adwebEnquiryRecord) {
+        return super.exportXls(request, adwebEnquiryRecord, AdwebEnquiryRecord.class, "adweb_enquiry_record");
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        return super.importExcel(request, response, AdwebEnquiryRecord.class);
+    }
+
+}

+ 318 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/controller/AdwebPublicBlackEmailController.java

@@ -0,0 +1,318 @@
+package org.jeecg.modules.adweb.enquiry.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.common.util.RedisUtil;
+import org.jeecg.modules.adweb.enquiry.entity.AdwebPublicBlackEmail;
+import org.jeecg.modules.adweb.enquiry.service.IAdwebPublicBlackEmailService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @Description: 询盘公共邮箱黑名单
+ * @Author: jeecg-boot
+ * @Date: 2024-10-29
+ * @Version: V1.0
+ */
+@Tag(name = "询盘公共邮箱黑名单")
+@RestController
+@RequestMapping("/adweb/enquiryPublicBlackEmail")
+@Slf4j
+public class AdwebPublicBlackEmailController extends JeecgController<AdwebPublicBlackEmail, IAdwebPublicBlackEmailService> {
+    @Autowired
+    private IAdwebPublicBlackEmailService adwebPublicBlackEmailService;
+
+    @Resource
+    private RedisUtil redisUtil;
+
+    // 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 NotBlackEmailWasteEnquiryKey = "NOT_BLACK_EMAIL_WASTE_ENQUIRY_MAP::";
+    private static final String WhiteEmailListKey = "WHITE_EMAIL_LIST";
+
+    /**
+     * 分页列表查询
+     *
+     * @param enquiryPublicBlackEmail
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "询盘公共邮箱黑名单-分页列表查询")
+    @Operation(summary = "询盘公共邮箱黑名单-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<?> queryPageList(AdwebPublicBlackEmail enquiryPublicBlackEmail,
+                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                   HttpServletRequest req) {
+        Page<AdwebPublicBlackEmail> page = new Page<>(pageNo, pageSize);
+        String column = req.getParameter("column");
+        String order = req.getParameter("order");
+        IPage<AdwebPublicBlackEmail> pageList = getPageList(page, enquiryPublicBlackEmail, column, order);
+        return Result.OK(pageList);
+    }
+
+    public IPage<AdwebPublicBlackEmail> getPageList(Page<AdwebPublicBlackEmail> page, AdwebPublicBlackEmail enquiryPublicBlackEmail, String column, String order) {
+        IPage<AdwebPublicBlackEmail> pageList = adwebPublicBlackEmailService.pageList(page, enquiryPublicBlackEmail.getEmail(), enquiryPublicBlackEmail.getBlackOrWhite(), column, order);
+        return pageList;
+    }
+
+    /**
+     * 添加
+     *
+     * @param enquiryPublicBlackEmail
+     * @return
+     */
+    @AutoLog(value = "询盘公共邮箱黑名单-添加")
+    @Operation(summary = "询盘公共邮箱黑名单-添加")
+    @PostMapping(value = "/add")
+    public Result<?> add(@RequestBody AdwebPublicBlackEmail enquiryPublicBlackEmail) {
+
+        if (StringUtils.isBlank(enquiryPublicBlackEmail.getEmail())) {
+            return Result.error("邮箱不能为空");
+        }
+
+        //将邮箱转换为小写
+        enquiryPublicBlackEmail.setEmail(enquiryPublicBlackEmail.getEmail().trim().toLowerCase());
+
+        int count = (int) adwebPublicBlackEmailService.count(new QueryWrapper<AdwebPublicBlackEmail>().ne("status", 0).eq("email", enquiryPublicBlackEmail.getEmail()));
+
+        if (count > 0) {
+            return Result.error("邮箱已存在");
+        }
+
+        enquiryPublicBlackEmail.setStatus(1);
+        adwebPublicBlackEmailService.save(enquiryPublicBlackEmail);
+
+        List<AdwebPublicBlackEmail> emailList = adwebPublicBlackEmailService.list(new QueryWrapper<AdwebPublicBlackEmail>().ne("status", 0).eq("black_or_white", 0));
+
+        if (CollectionUtils.isNotEmpty(emailList)) {
+            List<String> collect = emailList.stream().map(AdwebPublicBlackEmail::getEmail).collect(Collectors.toList());
+            redisUtil.set(BlackEmailKey, collect, 60 * 60 * 24);
+        } else {
+            redisUtil.del(BlackEmailKey);
+        }
+        List<AdwebPublicBlackEmail> whiteEmailList = adwebPublicBlackEmailService.list(new QueryWrapper<AdwebPublicBlackEmail>().ne("status", 0).eq("black_or_white", 1));
+
+        if (CollectionUtils.isNotEmpty(whiteEmailList)) {
+            List<String> collect = whiteEmailList.stream().map(AdwebPublicBlackEmail::getEmail).collect(Collectors.toList());
+            redisUtil.set(WhiteEmailListKey, collect, 60 * 60 * 24);
+        } else {
+            redisUtil.del(WhiteEmailListKey);
+        }
+        return Result.OK("添加成功!");
+    }
+
+    /**
+     * 编辑
+     *
+     * @param enquiryPublicBlackEmail
+     * @return
+     */
+    @AutoLog(value = "询盘公共邮箱黑名单-编辑")
+    @Operation(summary = "询盘公共邮箱黑名单-编辑")
+    @PutMapping(value = "/edit")
+    public Result<?> edit(@RequestBody AdwebPublicBlackEmail enquiryPublicBlackEmail) {
+
+        if (StringUtils.isBlank(enquiryPublicBlackEmail.getEmail())) {
+            return Result.error("邮箱不能为空");
+        }
+
+        //将邮箱转换为小写
+        enquiryPublicBlackEmail.setEmail(enquiryPublicBlackEmail.getEmail().trim().toLowerCase());
+
+        int count = (int) adwebPublicBlackEmailService.count(new QueryWrapper<AdwebPublicBlackEmail>().ne("status", 0).eq("email", enquiryPublicBlackEmail.getEmail()).ne("id", enquiryPublicBlackEmail.getId()));
+
+        if (count > 0) {
+            return Result.error("邮箱已存在");
+        }
+
+        adwebPublicBlackEmailService.updateById(enquiryPublicBlackEmail);
+
+        List<AdwebPublicBlackEmail> emailList = adwebPublicBlackEmailService.list(new QueryWrapper<AdwebPublicBlackEmail>().ne("status", 0).eq("black_or_white", 0));
+
+        if (CollectionUtils.isNotEmpty(emailList)) {
+            List<String> collect = emailList.stream().map(AdwebPublicBlackEmail::getEmail).collect(Collectors.toList());
+            redisUtil.set(BlackEmailKey, collect, 60 * 60 * 24);
+        } else {
+            redisUtil.del(BlackEmailKey);
+        }
+        List<AdwebPublicBlackEmail> whiteEmailList = adwebPublicBlackEmailService.list(new QueryWrapper<AdwebPublicBlackEmail>().ne("status", 0).eq("black_or_white", 1));
+
+        if (CollectionUtils.isNotEmpty(whiteEmailList)) {
+            List<String> collect = whiteEmailList.stream().map(AdwebPublicBlackEmail::getEmail).collect(Collectors.toList());
+            redisUtil.set(WhiteEmailListKey, collect, 60 * 60 * 24);
+        } else {
+            redisUtil.del(WhiteEmailListKey);
+        }
+        return Result.OK("编辑成功!");
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "询盘公共邮箱黑名单-通过id删除")
+    @Operation(summary = "询盘公共邮箱黑名单-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+
+        if (StringUtils.isBlank(id)) {
+            return Result.error("参数不识别!");
+        }
+
+        AdwebPublicBlackEmail enquiryPublicBlackEmail = adwebPublicBlackEmailService.getById(id);
+
+        if (enquiryPublicBlackEmail == null) {
+            return Result.error("未找到对应数据");
+        }
+
+        enquiryPublicBlackEmail.setStatus(0);
+
+        adwebPublicBlackEmailService.updateById(enquiryPublicBlackEmail);
+
+        redisUtil.del(EmailTenMinKey + enquiryPublicBlackEmail.getEmail());
+        redisUtil.del(EmailOneDayKey + enquiryPublicBlackEmail.getEmail());
+        redisUtil.del(NotBlackEmailWasteEnquiryKey + enquiryPublicBlackEmail.getEmail());
+
+        List<AdwebPublicBlackEmail> emailList = adwebPublicBlackEmailService.list(new QueryWrapper<AdwebPublicBlackEmail>().ne("status", 0).eq("black_or_white", 0));
+
+        if (CollectionUtils.isNotEmpty(emailList)) {
+            List<String> collect = emailList.stream().map(AdwebPublicBlackEmail::getEmail).collect(Collectors.toList());
+            redisUtil.set(BlackEmailKey, collect, 60 * 60 * 24);
+        } else {
+            redisUtil.del(BlackEmailKey);
+        }
+        List<AdwebPublicBlackEmail> whiteEmailList = adwebPublicBlackEmailService.list(new QueryWrapper<AdwebPublicBlackEmail>().ne("status", 0).eq("black_or_white", 1));
+
+        if (CollectionUtils.isNotEmpty(whiteEmailList)) {
+            List<String> collect = whiteEmailList.stream().map(AdwebPublicBlackEmail::getEmail).collect(Collectors.toList());
+            redisUtil.set(WhiteEmailListKey, collect, 60 * 60 * 24);
+        } else {
+            redisUtil.del(WhiteEmailListKey);
+        }
+
+        return Result.OK("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "询盘公共邮箱黑名单-批量删除")
+    @Operation(summary = "询盘公共邮箱黑名单-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+
+        if (StringUtils.isBlank(ids)) {
+            return Result.error("参数不识别!");
+        }
+
+        List<String> idList = Arrays.asList(ids.split(","));
+
+        List<AdwebPublicBlackEmail> list = adwebPublicBlackEmailService.list(new QueryWrapper<AdwebPublicBlackEmail>().in("id", idList).ne("status", 0));
+
+        if (list.isEmpty()) {
+            return Result.error("未找到对应数据");
+        }
+
+        boolean update = adwebPublicBlackEmailService.update(new UpdateWrapper<AdwebPublicBlackEmail>().in("id", idList).set("status", 0));
+
+        //删除redis中的数据
+        for (AdwebPublicBlackEmail enquiryPublicBlackEmail : list) {
+            redisUtil.del(EmailTenMinKey + enquiryPublicBlackEmail.getEmail());
+            redisUtil.del(EmailOneDayKey + enquiryPublicBlackEmail.getEmail());
+            redisUtil.del(NotBlackEmailWasteEnquiryKey + enquiryPublicBlackEmail.getEmail());
+        }
+        List<AdwebPublicBlackEmail> emailList = adwebPublicBlackEmailService.list(new QueryWrapper<AdwebPublicBlackEmail>().ne("status", 0).eq("black_or_white", 0));
+
+        if (emailList != null) {
+            List<String> collect = emailList.stream().map(AdwebPublicBlackEmail::getEmail).collect(Collectors.toList());
+            redisUtil.set(BlackEmailKey, collect, 60 * 60 * 24);
+        } else {
+            redisUtil.del(BlackEmailKey);
+        }
+        List<AdwebPublicBlackEmail> whiteEmailList = adwebPublicBlackEmailService.list(new QueryWrapper<AdwebPublicBlackEmail>().ne("status", 0).eq("black_or_white", 1));
+
+        if (whiteEmailList != null) {
+            List<String> collect = whiteEmailList.stream().map(AdwebPublicBlackEmail::getEmail).collect(Collectors.toList());
+            redisUtil.set(WhiteEmailListKey, collect, 60 * 60 * 24);
+        } else {
+            redisUtil.del(WhiteEmailListKey);
+        }
+
+        return update ? Result.OK("删除成功!") : Result.error("删除失败!");
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "询盘公共邮箱黑名单-通过id查询")
+    @Operation(summary = "询盘公共邮箱黑名单-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
+
+        if (StringUtils.isBlank(id)) {
+            return Result.error("参数不识别!");
+        }
+        AdwebPublicBlackEmail enquiryPublicBlackEmail = adwebPublicBlackEmailService.getById(id);
+
+        if (enquiryPublicBlackEmail == null) {
+            return Result.error("未找到对应数据");
+        }
+
+        return Result.OK(enquiryPublicBlackEmail);
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param enquiryPublicBlackEmail
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, AdwebPublicBlackEmail enquiryPublicBlackEmail) {
+        return super.exportXls(request, enquiryPublicBlackEmail, AdwebPublicBlackEmail.class, "询盘公共邮箱黑名单");
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, AdwebPublicBlackEmail.class);
+    }
+
+}

+ 316 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/controller/AdwebPublicBlackIpController.java

@@ -0,0 +1,316 @@
+package org.jeecg.modules.adweb.enquiry.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.common.util.RedisUtil;
+import org.jeecg.modules.adweb.enquiry.entity.AdwebPublicBlackIp;
+import org.jeecg.modules.adweb.enquiry.service.IAdwebPublicBlackIpService;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @Description: IP黑名单
+ * @Author: jeecg-boot
+ * @Date: 2023-02-20
+ * @Version: V1.0
+ */
+@Tag(name = "IP黑名单")
+@RestController
+@RequestMapping("/blackip/adwebBlackIp")
+@Slf4j
+public class AdwebPublicBlackIpController extends JeecgController<AdwebPublicBlackIp, IAdwebPublicBlackIpService> {
+
+    @Resource
+    private IAdwebPublicBlackIpService adwebBlackIpService;
+
+    @Resource
+    private RedisUtil redisUtil;
+
+    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 NotBlackIpWasteEnquiryKey = "NOT_BLACK_IP_WASTE_ENQUIRY_MAP::";
+    private static final String WhiteIpListKey = "WHITE_IP_LIST";
+
+    /**
+     * 分页列表查询
+     *
+     * @param adwebBlackIp
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "IP黑名单-分页列表查询")
+    @Operation(summary = "IP黑名单-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<?> queryPageList(AdwebPublicBlackIp adwebBlackIp,
+                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                   HttpServletRequest req) {
+        Page<AdwebPublicBlackIp> page = new Page<AdwebPublicBlackIp>(pageNo, pageSize);
+        String column = req.getParameter("column");
+        String order = req.getParameter("order");
+        IPage<AdwebPublicBlackIp> pageList = adwebBlackIpService.pageList(page, adwebBlackIp.getIp(), adwebBlackIp.getBlackOrWhite(), column, order);
+        return Result.OK(pageList);
+    }
+
+    /**
+     * 添加
+     *
+     * @param adwebBlackIp
+     * @return
+     */
+    @AutoLog(value = "IP黑名单-添加")
+    @Operation(summary = "IP黑名单-添加")
+    @PostMapping(value = "/add")
+    public Result<?> add(@RequestBody AdwebPublicBlackIp adwebBlackIp) {
+
+        if (adwebBlackIp.getIp() == null || "".equals(adwebBlackIp.getIp())) {
+            return Result.error("IP不能为空");
+        }
+        if (adwebBlackIp.getIp().length() > 15) {
+            return Result.error("IP长度不能超过15");
+        }
+
+        int count = (int) adwebBlackIpService.count(new QueryWrapper<AdwebPublicBlackIp>().eq("ip", adwebBlackIp.getIp()).eq("status", 1));
+
+        if (count > 0) {
+            return Result.error("该IP已存在");
+        }
+
+        adwebBlackIp.setStatus(1);
+        adwebBlackIpService.save(adwebBlackIp);
+        List<AdwebPublicBlackIp> blackIpList = adwebBlackIpService.list(new QueryWrapper<AdwebPublicBlackIp>().eq("status", 1).eq("black_or_white", 0));
+
+        if (CollectionUtils.isNotEmpty(blackIpList)) {
+            List<String> collect = blackIpList.stream().map(AdwebPublicBlackIp::getIp).collect(Collectors.toList());
+            redisUtil.set(BlackIpKey, collect, 60 * 60 * 24);
+        } else {
+            redisUtil.del(BlackIpKey);
+        }
+
+        List<AdwebPublicBlackIp> whiteIpList = adwebBlackIpService.list(new QueryWrapper<AdwebPublicBlackIp>().eq("status", 1).eq("black_or_white", 1));
+
+        if (CollectionUtils.isNotEmpty(whiteIpList)) {
+            List<String> collect = whiteIpList.stream().map(AdwebPublicBlackIp::getIp).collect(Collectors.toList());
+            redisUtil.set(WhiteIpListKey, collect, 60 * 60 * 24);
+        } else {
+            redisUtil.del(WhiteIpListKey);
+        }
+        return Result.OK("添加成功!");
+    }
+
+    /**
+     * 编辑
+     *
+     * @param adwebBlackIp
+     * @return
+     */
+    @AutoLog(value = "IP黑名单-编辑")
+    @Operation(summary = "IP黑名单-编辑")
+    @PutMapping(value = "/edit")
+    public Result<?> edit(@RequestBody AdwebPublicBlackIp adwebBlackIp) {
+
+        if (adwebBlackIp.getIp() == null || "".equals(adwebBlackIp.getIp())) {
+            return Result.error("IP不能为空");
+        }
+        if (adwebBlackIp.getIp().length() > 15) {
+            return Result.error("IP长度不能超过15");
+        }
+
+        int count = (int) adwebBlackIpService.count(new QueryWrapper<AdwebPublicBlackIp>().eq("ip", adwebBlackIp.getIp()).eq("status", 1).ne("id", adwebBlackIp.getId()));
+
+        if (count > 0) {
+            return Result.error("该IP已存在");
+        }
+
+        adwebBlackIpService.updateById(adwebBlackIp);
+
+        List<AdwebPublicBlackIp> blackIpList = adwebBlackIpService.list(new QueryWrapper<AdwebPublicBlackIp>().eq("status", 1).eq("black_or_white", 0));
+
+        if (CollectionUtils.isNotEmpty(blackIpList)) {
+            List<String> collect = blackIpList.stream().map(AdwebPublicBlackIp::getIp).collect(Collectors.toList());
+            redisUtil.set(BlackIpKey, collect, 60 * 60 * 24);
+        } else {
+            redisUtil.del(BlackIpKey);
+        }
+
+        List<AdwebPublicBlackIp> whiteIpList = adwebBlackIpService.list(new QueryWrapper<AdwebPublicBlackIp>().eq("status", 1).eq("black_or_white", 1));
+
+        if (CollectionUtils.isNotEmpty(whiteIpList)) {
+            List<String> collect = whiteIpList.stream().map(AdwebPublicBlackIp::getIp).collect(Collectors.toList());
+            redisUtil.set(WhiteIpListKey, collect, 60 * 60 * 24);
+        } else {
+            redisUtil.del(WhiteIpListKey);
+        }
+        return Result.OK("编辑成功!");
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "IP黑名单-通过id删除")
+    @Operation(summary = "IP黑名单-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+
+        if (id == null || "".equals(id)) {
+            return Result.error("ID不能为空");
+        }
+
+        List<AdwebPublicBlackIp> list = adwebBlackIpService.list(new QueryWrapper<AdwebPublicBlackIp>().eq("id", id).eq("status", 1));
+
+        if (list.size() == 0) {
+            return Result.error("该IP不存在");
+        }
+
+        AdwebPublicBlackIp adwebBlackIp = list.get(0);
+        adwebBlackIp.setStatus(0);
+
+        adwebBlackIpService.updateById(adwebBlackIp);
+
+        redisUtil.del(IpTenMinKey + adwebBlackIp.getIp());
+        redisUtil.del(IpOneDayKey + adwebBlackIp.getIp());
+        redisUtil.del(NotBlackIpWasteEnquiryKey + adwebBlackIp.getIp());
+
+        List<AdwebPublicBlackIp> blackIpList = adwebBlackIpService.list(new QueryWrapper<AdwebPublicBlackIp>().eq("status", 1).eq("black_or_white", 0));
+
+        if (CollectionUtils.isNotEmpty(blackIpList)) {
+            List<String> collect = blackIpList.stream().map(AdwebPublicBlackIp::getIp).collect(Collectors.toList());
+            redisUtil.set(BlackIpKey, collect, 60 * 60 * 24);
+        } else {
+            redisUtil.del(BlackIpKey);
+        }
+
+        List<AdwebPublicBlackIp> whiteIpList = adwebBlackIpService.list(new QueryWrapper<AdwebPublicBlackIp>().eq("status", 1).eq("black_or_white", 1));
+
+        if (CollectionUtils.isNotEmpty(whiteIpList)) {
+            List<String> collect = whiteIpList.stream().map(AdwebPublicBlackIp::getIp).collect(Collectors.toList());
+            redisUtil.set(WhiteIpListKey, collect, 60 * 60 * 24);
+        } else {
+            redisUtil.del(WhiteIpListKey);
+        }
+
+        return Result.OK("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "IP黑名单-批量删除")
+    @Operation(summary = "IP黑名单-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+
+        if (ids == null || "".equals(ids.trim())) {
+            return Result.error("ID不能为空");
+        }
+        List<String> idList = Arrays.asList(ids.split(","));
+
+        List<AdwebPublicBlackIp> list = adwebBlackIpService.list(new QueryWrapper<AdwebPublicBlackIp>().eq("status", 1).in("id", idList));
+
+        if (list.size() == 0) {
+            return Result.error("该IP不存在");
+        }
+
+        adwebBlackIpService.update(new UpdateWrapper<AdwebPublicBlackIp>().in("id", idList).set("status", 0));
+
+        for (AdwebPublicBlackIp adwebBlackIp : list) {
+            redisUtil.del(IpTenMinKey + adwebBlackIp.getIp());
+            redisUtil.del(IpOneDayKey + adwebBlackIp.getIp());
+            redisUtil.del(NotBlackIpWasteEnquiryKey + adwebBlackIp.getIp());
+        }
+
+        List<AdwebPublicBlackIp> blackIpList = adwebBlackIpService.list(new QueryWrapper<AdwebPublicBlackIp>().eq("status", 1).eq("black_or_white", 0));
+
+        if (CollectionUtils.isNotEmpty(blackIpList)) {
+            List<String> collect = blackIpList.stream().map(AdwebPublicBlackIp::getIp).collect(Collectors.toList());
+            redisUtil.set(BlackIpKey, collect, 60 * 60 * 24);
+        } else {
+            redisUtil.del(BlackIpKey);
+        }
+
+        List<AdwebPublicBlackIp> whiteIpList = adwebBlackIpService.list(new QueryWrapper<AdwebPublicBlackIp>().eq("status", 1).eq("black_or_white", 1));
+
+        if (CollectionUtils.isNotEmpty(whiteIpList)) {
+            List<String> collect = whiteIpList.stream().map(AdwebPublicBlackIp::getIp).collect(Collectors.toList());
+            redisUtil.set(WhiteIpListKey, collect, 60 * 60 * 24);
+        } else {
+            redisUtil.del(WhiteIpListKey);
+        }
+
+
+        return Result.OK("批量删除成功!");
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "IP黑名单-通过id查询")
+    @Operation(summary = "IP黑名单-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
+
+        if (id == null || "".equals(id)) {
+            return Result.error("ID不能为空");
+        }
+
+        List<AdwebPublicBlackIp> list = adwebBlackIpService.list(new QueryWrapper<AdwebPublicBlackIp>().eq("id", id).eq("status", 1));
+
+        if (list.size() == 0) {
+            return Result.error("该IP不存在");
+        }
+
+        return Result.OK(list.get(0));
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param adwebBlackIp
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, AdwebPublicBlackIp adwebBlackIp) {
+        return super.exportXls(request, adwebBlackIp, AdwebPublicBlackIp.class, "IP黑名单");
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, AdwebPublicBlackIp.class);
+    }
+
+}

+ 371 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/controller/AdwebSiteBlackIpController.java

@@ -0,0 +1,371 @@
+package org.jeecg.modules.adweb.enquiry.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.api.ISysBaseAPI;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.RedisUtil;
+import org.jeecg.modules.adweb.enquiry.entity.AdwebSiteBlackIp;
+import org.jeecg.modules.adweb.enquiry.service.IAdwebSiteBlackIpService;
+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.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @Description: adweb_site_black_ip
+ * @Author: jeecg-boot
+ * @Date: 2023-08-31
+ * @Version: V1.0
+ */
+@Tag(name = "adweb_site_black_ip")
+@RestController
+@RequestMapping("/adweb/adwebSiteBlackIp")
+@Slf4j
+public class AdwebSiteBlackIpController extends JeecgController<AdwebSiteBlackIp, IAdwebSiteBlackIpService> {
+    @Resource
+    private IAdwebSiteBlackIpService adwebSiteBlackIpService;
+    @Resource
+    private IAdwebSiteService adwebSiteService;
+    @Resource
+    private ISiteUserPermissionService siteUserPermissionService;
+    @Resource
+    private ISysBaseAPI sysBaseAPI;
+
+    @Resource
+    private RedisUtil redisUtil;
+
+    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";
+
+    /**
+     * 分页列表查询
+     *
+     * @param adwebSiteBlackIp
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "adweb_site_black_ip-分页列表查询")
+    @Operation(summary = "adweb_site_black_ip-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<?> queryPageList(AdwebSiteBlackIp adwebSiteBlackIp,
+                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                   HttpServletRequest req) {
+
+        Page<AdwebSiteBlackIp> page = new Page<AdwebSiteBlackIp>(pageNo, pageSize);
+
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        List<String> codeList = null;
+        List<String> uidList = null;
+        if (sysBaseAPI.isAdmin()) {
+
+        } else if (sysBaseAPI.isOem()) {
+            uidList = sysBaseAPI.getOemGroupUids();
+        } else {
+            uidList = new ArrayList<>();
+            uidList.add(sysUser.getId());
+        }
+        List<String> siteCodeList = null;
+        if (CollectionUtils.isNotEmpty(uidList)) {
+            siteCodeList = siteUserPermissionService.getSiteCodeListByUids(uidList);
+        }
+
+        if (adwebSiteBlackIp.getSiteId() != null) {
+            String siteCode = adwebSiteService.getSiteCodeById(adwebSiteBlackIp.getSiteId());
+            if (StringUtils.isNotBlank(siteCode)) {
+                QueryWrapper<AdwebSite> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("id", adwebSiteBlackIp.getSiteId()).or().eq("parent_group_code", siteCode);
+                queryWrapper.ne("status", 0);
+                queryWrapper.in(!sysBaseAPI.isAdmin(), "code", siteCodeList);
+                codeList = adwebSiteService.list(queryWrapper).stream().map(AdwebSite::getCode).collect(Collectors.toList());
+            }
+        } else {
+            codeList = siteCodeList;
+        }
+
+        String column = req.getParameter("column");
+        String order = req.getParameter("order");
+        IPage<AdwebSiteBlackIp> pageList = adwebSiteBlackIpService.pageList(page, adwebSiteBlackIp, codeList, column, order);
+        List<AdwebSiteBlackIp> record = pageList.getRecords();
+
+        return Result.OK(pageList);
+    }
+
+    /**
+     * 添加
+     *
+     * @param adwebSiteBlackIp
+     * @return
+     */
+    @AutoLog(value = "adweb_site_black_ip-添加")
+    @Operation(summary = "adweb_site_black_ip-添加")
+    @PostMapping(value = "/add")
+    public Result<?> add(@RequestBody AdwebSiteBlackIp adwebSiteBlackIp) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        int count = (int) adwebSiteBlackIpService.count(new QueryWrapper<AdwebSiteBlackIp>().ne("status", 0).eq("ip", adwebSiteBlackIp.getIp())
+                .eq("site_id", adwebSiteBlackIp.getSiteId()));
+
+        if (count > 0) {
+            return Result.error("当前站点已存在此ip");
+        }
+        adwebSiteBlackIp.setStatus(1);
+        adwebSiteBlackIp.setCreateTime(new Date());
+        adwebSiteBlackIpService.save(adwebSiteBlackIp);
+
+        List<AdwebSiteBlackIp> siteBlackIpList = adwebSiteBlackIpService.list(new QueryWrapper<AdwebSiteBlackIp>().eq("status", 1).eq("site_id", adwebSiteBlackIp.getSiteId()));
+
+        if (CollectionUtils.isEmpty(siteBlackIpList)) {
+            redisUtil.del(SiteBlackIpKey + "::" + adwebSiteBlackIp.getSiteId());
+            redisUtil.del(SiteWhiteIpListKey + "::" + adwebSiteBlackIp.getSiteId());
+            return Result.OK("编辑成功!");
+        }
+
+        List<String> blackIpList = siteBlackIpList.stream().filter(siteBlackIp -> siteBlackIp.getBlackOrWhite().equals(0)).map(AdwebSiteBlackIp::getIp).collect(Collectors.toList());
+        if (CollectionUtils.isNotEmpty(blackIpList)) {
+            redisUtil.set(SiteBlackIpKey + "::" + adwebSiteBlackIp.getSiteId(), blackIpList, 60 * 60 * 24);
+        } else {
+            redisUtil.del(SiteBlackIpKey + "::" + adwebSiteBlackIp.getSiteId());
+        }
+
+        List<String> whiteIpList = siteBlackIpList.stream().filter(siteBlackIp -> siteBlackIp.getBlackOrWhite().equals(1)).map(AdwebSiteBlackIp::getIp).collect(Collectors.toList());
+        if (CollectionUtils.isNotEmpty(whiteIpList)) {
+            redisUtil.set(SiteWhiteIpListKey + "::" + adwebSiteBlackIp.getSiteId(), whiteIpList, 60 * 60 * 24);
+        } else {
+            redisUtil.del(SiteWhiteIpListKey + "::" + adwebSiteBlackIp.getSiteId());
+        }
+        return Result.OK("添加成功!");
+    }
+
+    /**
+     * 编辑
+     *
+     * @param adwebSiteBlackIp
+     * @return
+     */
+    @AutoLog(value = "adweb_site_black_ip-编辑")
+    @Operation(summary = "adweb_site_black_ip-编辑")
+    @PutMapping(value = "/edit")
+    public Result<?> edit(@RequestBody AdwebSiteBlackIp adwebSiteBlackIp) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        int count = (int) adwebSiteBlackIpService.count(new QueryWrapper<AdwebSiteBlackIp>().ne("status", 0).eq("ip", adwebSiteBlackIp.getIp())
+                .eq("site_id", adwebSiteBlackIp.getSiteId()).ne("id", adwebSiteBlackIp.getId()));
+
+        if (count > 0) {
+            return Result.error("当前站点已存在此ip");
+        }
+        AdwebSiteBlackIp oldSiteBlackIp = adwebSiteBlackIpService.getById(adwebSiteBlackIp.getId());
+        if (!oldSiteBlackIp.getSiteId().equals(adwebSiteBlackIp.getSiteId())) {
+            redisUtil.del(SiteBlackIpKey + "::" + oldSiteBlackIp.getSiteId());
+            redisUtil.del(SiteWhiteIpListKey + "::" + oldSiteBlackIp.getSiteId());
+        }
+        adwebSiteBlackIpService.updateById(adwebSiteBlackIp);
+
+        List<AdwebSiteBlackIp> siteBlackIpList = adwebSiteBlackIpService.list(new QueryWrapper<AdwebSiteBlackIp>().eq("status", 1).eq("site_id", adwebSiteBlackIp.getSiteId()));
+
+        if (CollectionUtils.isEmpty(siteBlackIpList)) {
+            redisUtil.del(SiteBlackIpKey + "::" + adwebSiteBlackIp.getSiteId());
+            redisUtil.del(SiteWhiteIpListKey + "::" + adwebSiteBlackIp.getSiteId());
+            return Result.OK("编辑成功!");
+        }
+
+        List<String> blackIpList = siteBlackIpList.stream().filter(siteBlackIp -> siteBlackIp.getBlackOrWhite().equals(0)).map(AdwebSiteBlackIp::getIp).collect(Collectors.toList());
+        if (CollectionUtils.isNotEmpty(blackIpList)) {
+            redisUtil.set(SiteBlackIpKey + "::" + adwebSiteBlackIp.getSiteId(), blackIpList, 60 * 60 * 24);
+        } else {
+            redisUtil.del(SiteBlackIpKey + "::" + adwebSiteBlackIp.getSiteId());
+        }
+
+        List<String> whiteIpList = siteBlackIpList.stream().filter(siteBlackIp -> siteBlackIp.getBlackOrWhite().equals(1)).map(AdwebSiteBlackIp::getIp).collect(Collectors.toList());
+        if (CollectionUtils.isNotEmpty(whiteIpList)) {
+            redisUtil.set(SiteWhiteIpListKey + "::" + adwebSiteBlackIp.getSiteId(), whiteIpList, 60 * 60 * 24);
+        } else {
+            redisUtil.del(SiteWhiteIpListKey + "::" + adwebSiteBlackIp.getSiteId());
+        }
+        return Result.OK("编辑成功!");
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "adweb_site_black_ip-通过id删除")
+    @Operation(summary = "adweb_site_black_ip-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        if (id == null || "".equals(id)) {
+            return Result.error("id不能为空");
+        }
+
+        List<AdwebSiteBlackIp> list = adwebSiteBlackIpService.list(new QueryWrapper<AdwebSiteBlackIp>().eq("id", id).eq("status", 1));
+
+        if (list.size() == 0) {
+            return Result.error("该IP不存在");
+        }
+
+        AdwebSiteBlackIp adwebSiteBlackIp = list.get(0);
+        adwebSiteBlackIp.setStatus(0);
+        adwebSiteBlackIpService.updateById(adwebSiteBlackIp);
+
+        redisUtil.del(SiteIpTenMinKey + adwebSiteBlackIp.getSiteId() + "::" + adwebSiteBlackIp.getIp());
+        redisUtil.del(SiteIpOneDayKey + adwebSiteBlackIp.getSiteId() + "::" + adwebSiteBlackIp.getIp());
+        redisUtil.del(NotSiteBlackIpWasteEnquiryKey + adwebSiteBlackIp.getSiteId() + "::" + adwebSiteBlackIp.getIp());
+
+        List<AdwebSiteBlackIp> siteBlackIpList = adwebSiteBlackIpService.list(new QueryWrapper<AdwebSiteBlackIp>().eq("status", 1).eq("site_id", adwebSiteBlackIp.getSiteId()));
+
+        if (CollectionUtils.isEmpty(siteBlackIpList)) {
+            redisUtil.del(SiteBlackIpKey + "::" + adwebSiteBlackIp.getSiteId());
+            redisUtil.del(SiteWhiteIpListKey + "::" + adwebSiteBlackIp.getSiteId());
+            return Result.OK("编辑成功!");
+        }
+
+        List<String> blackIpList = siteBlackIpList.stream().filter(siteBlackIp -> siteBlackIp.getBlackOrWhite().equals(0)).map(AdwebSiteBlackIp::getIp).collect(Collectors.toList());
+        if (CollectionUtils.isNotEmpty(blackIpList)) {
+            redisUtil.set(SiteBlackIpKey + "::" + adwebSiteBlackIp.getSiteId(), blackIpList, 60 * 60 * 24);
+        } else {
+            redisUtil.del(SiteBlackIpKey + "::" + adwebSiteBlackIp.getSiteId());
+        }
+
+        List<String> whiteIpList = siteBlackIpList.stream().filter(siteBlackIp -> siteBlackIp.getBlackOrWhite().equals(1)).map(AdwebSiteBlackIp::getIp).collect(Collectors.toList());
+        if (CollectionUtils.isNotEmpty(whiteIpList)) {
+            redisUtil.set(SiteWhiteIpListKey + "::" + adwebSiteBlackIp.getSiteId(), whiteIpList, 60 * 60 * 24);
+        } else {
+            redisUtil.del(SiteWhiteIpListKey + "::" + adwebSiteBlackIp.getSiteId());
+        }
+
+        return Result.OK("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "adweb_site_black_ip-批量删除")
+    @Operation(summary = "adweb_site_black_ip-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        if (ids == null || "".equals(ids.trim())) {
+            return Result.error("ID不能为空");
+        }
+        List<String> idList = Arrays.asList(ids.split(","));
+
+        List<AdwebSiteBlackIp> list = adwebSiteBlackIpService.list(new QueryWrapper<AdwebSiteBlackIp>().eq("status", 1).in("id", idList));
+
+        if (list.size() == 0) {
+            return Result.error("该IP不存在");
+        }
+
+        UpdateWrapper<AdwebSiteBlackIp> adwebSiteBlackIpUpdateWrapper = new UpdateWrapper<>();
+        adwebSiteBlackIpUpdateWrapper.in("id", idList);
+        adwebSiteBlackIpUpdateWrapper.set("status", 0);
+        adwebSiteBlackIpService.update(adwebSiteBlackIpUpdateWrapper);
+
+        HashSet<Integer> siteIdHashSet = new HashSet<Integer>();
+        for (AdwebSiteBlackIp adwebSiteBlackIp : list) {
+            redisUtil.del(SiteIpTenMinKey + adwebSiteBlackIp.getSiteId() + "::" + adwebSiteBlackIp.getIp());
+            redisUtil.del(SiteIpOneDayKey + adwebSiteBlackIp.getSiteId() + "::" + adwebSiteBlackIp.getIp());
+            redisUtil.del(NotSiteBlackIpWasteEnquiryKey + adwebSiteBlackIp.getSiteId() + "::" + adwebSiteBlackIp.getIp());
+            siteIdHashSet.add(adwebSiteBlackIp.getSiteId());
+        }
+
+        for (Integer siteId : siteIdHashSet) {
+            List<AdwebSiteBlackIp> siteBlackIpList = adwebSiteBlackIpService.list(new QueryWrapper<AdwebSiteBlackIp>().eq("status", 1).eq("site_id", siteId));
+
+            if (CollectionUtils.isEmpty(siteBlackIpList)) {
+                redisUtil.del(SiteBlackIpKey + "::" + siteId);
+                redisUtil.del(SiteWhiteIpListKey + "::" + siteId);
+                return Result.OK("编辑成功!");
+            }
+
+            List<String> blackIpList = siteBlackIpList.stream().filter(siteBlackIp -> siteBlackIp.getBlackOrWhite().equals(0)).map(AdwebSiteBlackIp::getIp).collect(Collectors.toList());
+            if (CollectionUtils.isNotEmpty(blackIpList)) {
+                redisUtil.set(SiteBlackIpKey + "::" + siteId, blackIpList, 60 * 60 * 24);
+            } else {
+                redisUtil.del(SiteBlackIpKey + "::" + siteId);
+            }
+
+            List<String> whiteIpList = siteBlackIpList.stream().filter(siteBlackIp -> siteBlackIp.getBlackOrWhite().equals(1)).map(AdwebSiteBlackIp::getIp).collect(Collectors.toList());
+            if (CollectionUtils.isNotEmpty(whiteIpList)) {
+                redisUtil.set(SiteWhiteIpListKey + "::" + siteId, whiteIpList, 60 * 60 * 24);
+            } else {
+                redisUtil.del(SiteWhiteIpListKey + "::" + siteId);
+            }
+        }
+
+        return Result.OK("批量删除成功!");
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "adweb_site_black_ip-通过id查询")
+    @Operation(summary = "adweb_site_black_ip-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
+        AdwebSiteBlackIp adwebSiteBlackIp = adwebSiteBlackIpService.getById(id);
+        if (adwebSiteBlackIp == null) {
+            return Result.error("未找到对应数据");
+        }
+        return Result.OK(adwebSiteBlackIp);
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param adwebSiteBlackIp
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, AdwebSiteBlackIp adwebSiteBlackIp) {
+        return super.exportXls(request, adwebSiteBlackIp, AdwebSiteBlackIp.class, "adweb_site_black_ip");
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, AdwebSiteBlackIp.class);
+    }
+
+}

+ 269 - 145
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/entity/AdwebEnquiry.java

@@ -18,296 +18,420 @@ import lombok.experimental.Accessors;
 /**
  * @Description: 询盘信息存储表单
  * @Author: jeecg-boot
- * @Date:   2024-10-12
+ * @Date: 2024-10-12
  * @Version: V1.0
  */
 @Data
 @TableName("adweb_enquiry")
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = false)
-@Schema(description="询盘信息存储表单")
+@Schema(description = "询盘信息存储表单")
 public class AdwebEnquiry implements Serializable {
     private static final long serialVersionUID = 1L;
 
-	/**主键ID*/
-	@TableId(type = IdType.ASSIGN_ID)
+    /**
+     * 主键ID
+     */
+    @TableId(type = IdType.ASSIGN_ID)
     @Schema(description = "主键ID")
     private Long id;
-	/**询盘单号、根据系统规定生成*/
-	@Excel(name = "询盘单号、根据系统规定生成", width = 15)
+    /**
+     * 询盘单号、根据系统规定生成
+     */
+    @Excel(name = "询盘单号、根据系统规定生成", width = 15)
     @Schema(description = "询盘单号、根据系统规定生成")
     private String no;
-	/**询盘来源IP*/
-	@Excel(name = "询盘来源IP", width = 15)
+    /**
+     * 询盘来源IP
+     */
+    @Excel(name = "询盘来源IP", width = 15)
     @Schema(description = "询盘来源IP")
     private String fromIp;
-	/**询盘发送者邮箱账号*/
-	@Excel(name = "询盘发送者邮箱账号", width = 15)
+    /**
+     * 询盘发送者邮箱账号
+     */
+    @Excel(name = "询盘发送者邮箱账号", width = 15)
     @Schema(description = "询盘发送者邮箱账号")
     private String fromEmail;
-	/**询盘模块:web:网站询盘 ;email:邮件询盘  ;diy_element:自定义组件询盘*/
-	@Excel(name = "询盘模块:web:网站询盘 ;email:邮件询盘  ;diy_element:自定义组件询盘", width = 15)
+    /**
+     * 询盘模块:web:网站询盘 ;email:邮件询盘  ;diy_element:自定义组件询盘
+     */
+    @Excel(name = "询盘模块:web:网站询盘 ;email:邮件询盘  ;diy_element:自定义组件询盘", width = 15)
     @Schema(description = "询盘模块:web:网站询盘 ;email:邮件询盘  ;diy_element:自定义组件询盘")
     private String modular;
-	/**发送人姓名*/
-	@Excel(name = "发送人姓名", width = 15)
+    /**
+     * 发送人姓名
+     */
+    @Excel(name = "发送人姓名", width = 15)
     @Schema(description = "发送人姓名")
     private String fromUser;
-	/**0删除,1有效,默认值1   2:待解析  3:数据解析中 4.解析失败*/
-	@Excel(name = "0删除,1有效,默认值1   2:待解析  3:数据解析中 4.解析失败", width = 15)
+    /**
+     * 0删除,1有效,默认值1   2:待解析  3:数据解析中 4.解析失败
+     */
+    @Excel(name = "0删除,1有效,默认值1   2:待解析  3:数据解析中 4.解析失败", width = 15)
     @Schema(description = "0删除,1有效,默认值1   2:待解析  3:数据解析中 4.解析失败")
     private Integer status;
-	/**数据解析次数*/
-	@Excel(name = "数据解析次数", width = 15)
+    /**
+     * 数据解析次数
+     */
+    @Excel(name = "数据解析次数", width = 15)
     @Schema(description = "数据解析次数")
     private Integer dealCount;
-	/**系统有效性  0:无效       1;有效 后台字段*/
-	@Excel(name = "系统有效性  0:无效       1;有效 后台字段", width = 15)
+    /**
+     * 系统有效性  0:无效       1;有效 后台字段
+     */
+    @Excel(name = "系统有效性  0:无效       1;有效 后台字段", width = 15)
     @Schema(description = "系统有效性  0:无效       1;有效 后台字段")
     private Integer sysEffective;
-	/**用户有效性  0:无效       1:有效   2 : 待定 取自字典表*/
-	@Excel(name = "用户有效性  0:无效       1:有效   2 : 待定 取自字典表", width = 15)
+    /**
+     * 用户有效性  0:无效       1:有效   2 : 待定 取自字典表
+     */
+    @Excel(name = "用户有效性  0:无效       1:有效   2 : 待定 取自字典表", width = 15)
     @Schema(description = "用户有效性  0:无效       1:有效   2 : 待定 取自字典表")
     private Integer userEffective;
-	/**敏感信息*/
-	@Excel(name = "敏感信息", width = 15)
+    /**
+     * 敏感信息
+     */
+    @Excel(name = "敏感信息", width = 15)
     @Schema(description = "敏感信息")
     private String sensitiveMessage;
-	/**询盘阶段,由跟踪来决定(1:待沟通 ;2:沟通中;3:成单;4;放弃)*/
-	@Excel(name = "询盘阶段,由跟踪来决定(1:待沟通 ;2:沟通中;3:成单;4;放弃)", width = 15)
+    /**
+     * 询盘阶段,由跟踪来决定(1:待沟通 ;2:沟通中;3:成单;4;放弃)
+     */
+    @Excel(name = "询盘阶段,由跟踪来决定(1:待沟通 ;2:沟通中;3:成单;4;放弃)", width = 15)
     @Schema(description = "询盘阶段,由跟踪来决定(1:待沟通 ;2:沟通中;3:成单;4;放弃)")
     private String phase;
-	/**跟进跟进状态,由跟踪来决定(1:待跟进 ;2:跟进中;3:完成;4;停止)*/
-	@Excel(name = "跟进跟进状态,由跟踪来决定(1:待跟进 ;2:跟进中;3:完成;4;停止)", width = 15)
+    /**
+     * 跟进跟进状态,由跟踪来决定(1:待跟进 ;2:跟进中;3:完成;4;停止)
+     */
+    @Excel(name = "跟进跟进状态,由跟踪来决定(1:待跟进 ;2:跟进中;3:完成;4;停止)", width = 15)
     @Schema(description = "跟进跟进状态,由跟踪来决定(1:待跟进 ;2:跟进中;3:完成;4;停止)")
     private String trackStatus;
-	/**询盘所属用户主账号ID*/
-	@Excel(name = "询盘所属用户主账号ID", width = 15)
+    /**
+     * 询盘所属用户主账号ID
+     */
+    @Excel(name = "询盘所属用户主账号ID", width = 15)
     @Schema(description = "询盘所属用户主账号ID")
     private String uid;
-	/**询盘跟进人 id*/
-	@Excel(name = "询盘跟进人 id", width = 15)
+    /**
+     * 询盘跟进人 id
+     */
+    @Excel(name = "询盘跟进人 id", width = 15)
     @Schema(description = "询盘跟进人 id")
     private Integer tracker;
-	/**询盘创建时间*/
-	@Excel(name = "询盘创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    /**
+     * 询盘创建时间
+     */
+    @Excel(name = "询盘创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Schema(description = "询盘创建时间")
     private Date recordCtime;
-	/**ADMP平台创建时间*/
-	@Excel(name = "ADMP平台创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    /**
+     * ADMP平台创建时间
+     */
+    @Excel(name = "ADMP平台创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Schema(description = "ADMP平台创建时间")
     private Date ctime;
-	/**国家/地区(根据ip获取)*/
-	@Excel(name = "国家/地区(根据ip获取)", width = 15)
+    /**
+     * 国家/地区(根据ip获取)
+     */
+    @Excel(name = "国家/地区(根据ip获取)", width = 15)
     @Schema(description = "国家/地区(根据ip获取)")
     private String country;
-	/**通过ip解析获得国家码*/
-	@Excel(name = "通过ip解析获得国家码", width = 15)
+    /**
+     * 通过ip解析获得国家码
+     */
+    @Excel(name = "通过ip解析获得国家码", width = 15)
     @Schema(description = "通过ip解析获得国家码")
     private String countryIsoCode;
-	/**通过ip解析获得区域码*/
-	@Excel(name = "通过ip解析获得区域码", width = 15)
+    /**
+     * 通过ip解析获得区域码
+     */
+    @Excel(name = "通过ip解析获得区域码", width = 15)
     @Schema(description = "通过ip解析获得区域码")
     private String areaIsoCode;
-	/**询盘插件名称,名称小写,如:wpforms*/
-	@Excel(name = "询盘插件名称,名称小写,如:wpforms", width = 15)
+    /**
+     * 询盘插件名称,名称小写,如:wpforms
+     */
+    @Excel(name = "询盘插件名称,名称小写,如:wpforms", width = 15)
     @Schema(description = "询盘插件名称,名称小写,如:wpforms")
     private String pluginName;
-	/**站点code,关联站点表*/
-	@Excel(name = "站点code,关联站点表", width = 15)
+    /**
+     * 站点code,关联站点表
+     */
+    @Excel(name = "站点code,关联站点表", width = 15)
     @Schema(description = "站点code,关联站点表")
     private String siteCode;
-	/**站点token*/
-	@Excel(name = "站点token", width = 15)
+    /**
+     * 站点token
+     */
+    @Excel(name = "站点token", width = 15)
     @Schema(description = "站点token")
     private String siteToken;
-	/**询盘来自站点的域名*/
-	@Excel(name = "询盘来自站点的域名", width = 15)
+    /**
+     * 询盘来自站点的域名
+     */
+    @Excel(name = "询盘来自站点的域名", width = 15)
     @Schema(description = "询盘来自站点的域名")
     private String siteHost;
-	/**询盘原站点记录ID*/
-	@Excel(name = "询盘原站点记录ID", width = 15)
+    /**
+     * 询盘原站点记录ID
+     */
+    @Excel(name = "询盘原站点记录ID", width = 15)
     @Schema(description = "询盘原站点记录ID")
     private String recordId;
-	/**状态更新时间*/
-	@Excel(name = "状态更新时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    /**
+     * 状态更新时间
+     */
+    @Excel(name = "状态更新时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Schema(description = "状态更新时间")
     private Date utime;
-	/**回复时间*/
-	@Excel(name = "回复时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    /**
+     * 回复时间
+     */
+    @Excel(name = "回复时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Schema(description = "回复时间")
     private Date replyTime;
-	/**转发状态:0未转发,1已转发,默认值0*/
-	@Excel(name = "转发状态:0未转发,1已转发,默认值0", width = 15)
+    /**
+     * 转发状态:0未转发,1已转发,默认值0
+     */
+    @Excel(name = "转发状态:0未转发,1已转发,默认值0", width = 15)
     @Schema(description = "转发状态:0未转发,1已转发,默认值0")
     private Integer forward;
-	/**转发时间*/
-	@Excel(name = "转发时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    /**
+     * 转发时间
+     */
+    @Excel(name = "转发时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Schema(description = "转发时间")
     private Date forwardTime;
-	/**访客id*/
-	@Excel(name = "访客id", width = 15)
+    /**
+     * 访客id
+     */
+    @Excel(name = "访客id", width = 15)
     @Schema(description = "访客id")
     private String visitId;
-	/**来源于站点的id*/
-	@Excel(name = "来源于站点的id", width = 15)
+    /**
+     * 来源于站点的id
+     */
+    @Excel(name = "来源于站点的id", width = 15)
     @Schema(description = "来源于站点的id")
     private Integer siteId;
-	/**公司id*/
-	@Excel(name = "公司id", width = 15)
+    /**
+     * 公司id
+     */
+    @Excel(name = "公司id", width = 15)
     @Schema(description = "公司id")
     private Integer companyId;
-	/**联系人id,字符串组合*/
-	@Excel(name = "联系人id,字符串组合", width = 15)
+    /**
+     * 联系人id,字符串组合
+     */
+    @Excel(name = "联系人id,字符串组合", width = 15)
     @Schema(description = "联系人id,字符串组合")
     private String contactIds;
-	/**定时器任务修改查询唯一标识(10位随机数)*/
-	@Excel(name = "定时器任务修改查询唯一标识(10位随机数)", width = 15)
+    /**
+     * 定时器任务修改查询唯一标识(10位随机数)
+     */
+    @Excel(name = "定时器任务修改查询唯一标识(10位随机数)", width = 15)
     @Schema(description = "定时器任务修改查询唯一标识(10位随机数)")
     private String jobId;
-	/**回复状态*/
-	@Excel(name = "回复状态", width = 15)
+    /**
+     * 回复状态
+     */
+    @Excel(name = "回复状态", width = 15)
     @Schema(description = "回复状态")
     private String replayStatus;
-	/**外部编号*/
-	@Excel(name = "外部编号", width = 15)
+    /**
+     * 外部编号
+     */
+    @Excel(name = "外部编号", width = 15)
     @Schema(description = "外部编号")
     private String noOut;
-	/**处理后的询盘当地时间字段*/
-	@Excel(name = "处理后的询盘当地时间字段", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    /**
+     * 处理后的询盘当地时间字段
+     */
+    @Excel(name = "处理后的询盘当地时间字段", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Schema(description = "处理后的询盘当地时间字段")
     private Date modifyRecordCtime;
-	/**transContent*/
-	@Excel(name = "transContent", width = 15)
+    /**
+     * transContent
+     */
+    @Excel(name = "transContent", width = 15)
     @Schema(description = "transContent")
     private String transContent;
-	/**国家code*/
-	@Excel(name = "国家code", width = 15)
+    /**
+     * 国家code
+     */
+    @Excel(name = "国家code", width = 15)
     @Schema(description = "国家code")
     private String countryCode;
-	/**国家名*/
-	@Excel(name = "国家名", width = 15)
+    /**
+     * 国家名
+     */
+    @Excel(name = "国家名", width = 15)
     @Schema(description = "国家名")
     private String countryName;
-	/**whatsApp*/
-	@Excel(name = "whatsApp", width = 15)
+    /**
+     * whatsApp
+     */
+    @Excel(name = "whatsApp", width = 15)
     @Schema(description = "whatsApp")
     private String whatsApp;
-	/**0:不是;1:是*/
-	@Excel(name = "0:不是;1:是", width = 15)
+    /**
+     * 0:不是;1:是
+     */
+    @Excel(name = "0:不是;1:是", width = 15)
     @Schema(description = "0:不是;1:是")
     private Integer wasteEnquiry;
-	/**推送状态,0:待发送,1:成功,2不予发送*/
-	@Excel(name = "推送状态,0:待发送,1:成功,2不予发送", width = 15)
+    /**
+     * 推送状态,0:待发送,1:成功,2不予发送
+     */
+    @Excel(name = "推送状态,0:待发送,1:成功,2不予发送", width = 15)
     @Schema(description = "推送状态,0:待发送,1:成功,2不予发送")
     private Integer pushStatus;
-	/**推送错误次数*/
-	@Excel(name = "推送错误次数", width = 15)
+    /**
+     * 推送错误次数
+     */
+    @Excel(name = "推送错误次数", width = 15)
     @Schema(description = "推送错误次数")
     private Integer pushErrorNum;
-	/**姓名*/
-	@Excel(name = "姓名", width = 15)
+    /**
+     * 姓名
+     */
+    @Excel(name = "姓名", width = 15)
     @Schema(description = "姓名")
     private String name;
-	/**邮箱地址*/
-	@Excel(name = "邮箱地址", width = 15)
+    /**
+     * 邮箱地址
+     */
+    @Excel(name = "邮箱地址", width = 15)
     @Schema(description = "邮箱地址")
     private String email;
-	/**询盘信息*/
-	@Excel(name = "询盘信息", width = 15)
+    /**
+     * 询盘信息
+     */
+    @Excel(name = "询盘信息", width = 15)
     @Schema(description = "询盘信息")
     private String message;
-	/**公司名称*/
-	@Excel(name = "公司名称", width = 15)
+    /**
+     * 公司名称
+     */
+    @Excel(name = "公司名称", width = 15)
     @Schema(description = "公司名称")
     private String company;
-	/**来源页面*/
-	@Excel(name = "来源页面", width = 15)
+    /**
+     * 来源页面
+     */
+    @Excel(name = "来源页面", width = 15)
     @Schema(description = "来源页面")
     private String fromPage;
-	/**form表单传入Ip*/
-	@Excel(name = "form表单传入Ip", width = 15)
+    /**
+     * form表单传入Ip
+     */
+    @Excel(name = "form表单传入Ip", width = 15)
     @Schema(description = "form表单传入Ip")
     private String customerIp;
-	/**手机号*/
-	@Excel(name = "手机号", width = 15)
+    /**
+     * 手机号
+     */
+    @Excel(name = "手机号", width = 15)
     @Schema(description = "手机号")
     private String phone;
-	/**whatsapp*/
+    /**
+     * whatsapp
+     */
 
     private String whatsapp;
-	/**阅读状态,0是未阅读,1是已阅读*/
-	@Excel(name = "阅读状态,0是未阅读,1是已阅读", width = 15)
+    /**
+     * 阅读状态,0是未阅读,1是已阅读
+     */
+    @Excel(name = "阅读状态,0是未阅读,1是已阅读", width = 15)
     @Schema(description = "阅读状态,0是未阅读,1是已阅读")
     private Integer readStatus;
-	/**负责人的id*/
-	@Excel(name = "负责人的id", width = 15)
+    /**
+     * 负责人的id
+     */
+    @Excel(name = "负责人的id", width = 15)
     @Schema(description = "负责人的id")
     private String principalUid;
-	/**0代表系统根据规则分配,1代表主账户指定*/
-	@Excel(name = "0代表系统根据规则分配,1代表主账户指定", width = 15)
+    /**
+     * 0代表系统根据规则分配,1代表主账户指定
+     */
+    @Excel(name = "0代表系统根据规则分配,1代表主账户指定", width = 15)
     @Schema(description = "0代表系统根据规则分配,1代表主账户指定")
     private Integer principalType;
-	/**form表单中的地址*/
-	@Excel(name = "form表单中的地址", width = 15)
+    /**
+     * form表单中的地址
+     */
+    @Excel(name = "form表单中的地址", width = 15)
     @Schema(description = "form表单中的地址")
     private String address;
-	/**客户自定义字段*/
-	@Excel(name = "客户自定义字段", width = 15)
+    /**
+     * 客户自定义字段
+     */
+    @Excel(name = "客户自定义字段", width = 15)
     @Schema(description = "客户自定义字段")
     private String specialField;
-	/**向Wp发送请求时间*/
-	@Excel(name = "向Wp发送请求时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    /**
+     * 向Wp发送请求时间
+     */
+    @Excel(name = "向Wp发送请求时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Schema(description = "向Wp发送请求时间")
     private Date requestTime;
-	/**Adweb实时获取WebHookS消息时间,定时器无该值*/
-	@Excel(name = "Adweb实时获取WebHookS消息时间,定时器无该值", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    /**
+     * Adweb实时获取WebHookS消息时间,定时器无该值
+     */
+    @Excel(name = "Adweb实时获取WebHookS消息时间,定时器无该值", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Schema(description = "Adweb实时获取WebHookS消息时间,定时器无该值")
     private Date acquireMessageTime;
-	/**疑似垃圾询盘理由*/
-	@Excel(name = "疑似垃圾询盘理由", width = 15)
+    /**
+     * 疑似垃圾询盘理由
+     */
+    @Excel(name = "疑似垃圾询盘理由", width = 15)
     @Schema(description = "疑似垃圾询盘理由")
     private String effectiveReason;
-	/**垃圾询盘类型,关键词:keyword,邮箱:email,ip: ip,其他:other*/
-	@Excel(name = "垃圾询盘类型,关键词:keyword,邮箱:email,ip: ip,其他:other", width = 15)
+    /**
+     * 垃圾询盘类型,关键词:keyword,邮箱:email,ip: ip,其他:other
+     */
+    @Excel(name = "垃圾询盘类型,关键词:keyword,邮箱:email,ip: ip,其他:other", width = 15)
     @Schema(description = "垃圾询盘类型,关键词:keyword,邮箱:email,ip: ip,其他:other")
     private String wasteEnquiryType;
-	/**询盘关联产品*/
-	@Excel(name = "询盘关联产品", width = 15)
+    /**
+     * 询盘关联产品
+     */
+    @Excel(name = "询盘关联产品", width = 15)
     @Schema(description = "询盘关联产品")
     private String cartItems;
 
     /**
      * 用于判断是否是·产品询盘·
-     * */
+     */
     @TableField(exist = false)
-    private Integer  existProductEnquiry;
+    private Integer existProductEnquiry;
 
     /**
      * 用于判断是否是同步询盘进行发送询盘邮件
-     * */
+     */
     @TableField(exist = false)
     private String isEnquirySync;
 
     /**
      * 用于判断是否是·联系我们询盘·
-     * */
+     */
     @TableField(exist = false)
     private Integer existContactEnquiry;
 }

+ 43 - 23
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/entity/AdwebEnquiryBlacklist.java

@@ -17,57 +17,77 @@ import java.util.Date;
 /**
  * @Description: adweb_enquiry_blacklist
  * @Author: jeecg-boot
- * @Date:   2022-08-05
+ * @Date: 2022-08-05
  * @Version: V1.0
  */
 @Data
 @TableName("adweb_enquiry_blacklist")
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = false)
-@Schema(description="adweb_enquiry_blacklist")
+@Schema(description = "adweb_enquiry_blacklist")
 public class AdwebEnquiryBlacklist implements Serializable {
     private static final long serialVersionUID = 1L;
 
-	/**id*/
-	@TableId(type = IdType.AUTO)
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
     @Schema(description = "id")
     private Integer id;
     private Integer siteId;
-	/**来源询盘*/
-	@Excel(name = "来源询盘", width = 15)
+    /**
+     * 来源询盘
+     */
+    @Excel(name = "来源询盘", width = 15)
     @Schema(description = "来源询盘")
     private Long enquiryId;
-	/**姓名*/
-	@Excel(name = "姓名", width = 15)
+    /**
+     * 姓名
+     */
+    @Excel(name = "姓名", width = 15)
     @Schema(description = "姓名")
     private String name;
-	/**邮箱*/
-	@Excel(name = "邮箱", width = 15)
+    /**
+     * 邮箱
+     */
+    @Excel(name = "邮箱", width = 15)
     @Schema(description = "邮箱")
     private String email;
-	/**电话*/
-	@Excel(name = "电话", width = 15)
+    /**
+     * 电话
+     */
+    @Excel(name = "电话", width = 15)
     @Schema(description = "电话")
     private String phone;
-	/**whatsapp*/
-	@Excel(name = "whatsapp", width = 15)
+    /**
+     * whatsapp
+     */
+    @Excel(name = "whatsapp", width = 15)
     @Schema(description = "whatsapp")
     private String whatsapp;
-	/**国家编码*/
-	@Excel(name = "国家编码", width = 15)
+    /**
+     * 国家编码
+     */
+    @Excel(name = "国家编码", width = 15)
     @Schema(description = "国家编码")
     private String countryCode;
-	/**国家名称*/
-	@Excel(name = "国家名称", width = 15)
+    /**
+     * 国家名称
+     */
+    @Excel(name = "国家名称", width = 15)
     @Schema(description = "国家名称")
     private String countryName;
-	/**0删除状态,1正常状态*/
-	@Excel(name = "0删除状态,1正常状态", width = 15)
+    /**
+     * 0删除状态,1正常状态
+     */
+    @Excel(name = "0删除状态,1正常状态", width = 15)
     @Schema(description = "0删除状态,1正常状态")
     private Integer status;
-	/**创建时间*/
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
-    @DateTimeFormat(pattern="yyyy-MM-dd")
+    /**
+     * 创建时间
+     */
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     @Schema(description = "创建时间")
     private Date createTime;
 }

+ 76 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/entity/AdwebEnquiryRecord.java

@@ -0,0 +1,76 @@
+package org.jeecg.modules.adweb.enquiry.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Description: adweb_enquiry_record
+ * @Author: jeecg-boot
+ * @Date: 2021-05-11
+ * @Version: V1.0
+ */
+@Data
+@TableName("adweb_enquiry_record")
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@Schema(description = "adweb_enquiry_record: 询盘跟踪记录信息")
+public class AdwebEnquiryRecord implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @Schema(description = "id")
+    private Long id;
+    /**
+     * enquiryId
+     */
+    @Excel(name = "enquiryId", width = 15)
+    @Schema(description = "enquiryId")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long enquiryId;
+    /**
+     * content
+     */
+    @Excel(name = "content", width = 15)
+    @Schema(description = "content")
+    private String content;
+    /**
+     * ctime
+     */
+    @Excel(name = "ctime", width = 15, format = "yyyy-MM-dd")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @Schema(description = "ctime")
+    private Date ctime;
+    /**
+     * status
+     */
+    @Excel(name = "status", width = 15)
+    @Schema(description = "status")
+    private Integer status;
+    /**
+     * uid
+     */
+    @Excel(name = "uid", width = 15)
+    @Schema(description = "uid")
+    private String uid;
+
+    @TableField(exist = false)
+    private String realname;
+}

+ 17 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/mapper/AdwebEnquiryRecordMapper.java

@@ -0,0 +1,17 @@
+package org.jeecg.modules.adweb.enquiry.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.adweb.enquiry.entity.AdwebEnquiryRecord;
+
+import java.util.List;
+
+/**
+ * @Description: adweb_enquiry_record
+ * @Author: jeecg-boot
+ * @Date: 2021-05-11
+ * @Version: V1.0
+ */
+public interface AdwebEnquiryRecordMapper extends BaseMapper<AdwebEnquiryRecord> {
+
+    List<AdwebEnquiryRecord> getEnquiryRecord(AdwebEnquiryRecord enquiryRecord);
+}

+ 16 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/mapper/xml/AdwebEnquiryRecordMapper.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.adweb.enquiry.mapper.AdwebEnquiryRecordMapper">
+
+    <select id="getEnquiryRecord" parameterType="org.jeecg.modules.adweb.enquiry.entity.AdwebEnquiryRecord"
+            resultType="org.jeecg.modules.adweb.enquiry.entity.AdwebEnquiryRecord">
+        select t1.*, t2.realname
+        from adweb_enquiry_record t1,
+             sys_user t2
+        where t1.uid = t2.id
+          and t1.enquiry_id = #{enquiryId}
+          and t1.`status` = 1
+        ORDER BY t1.ctime desc;
+    </select>
+
+</mapper>

+ 1 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/mapper/xml/AdwebPublicBlackEmailMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="org.jeecg.modules.adweb.enquiry.mapper.AdwebPublicBlackEmailMapper">
     <select id="pageList" resultType="org.jeecg.modules.adweb.enquiry.entity.AdwebPublicBlackEmail">
         SELECT t1.*, t2.num wasteEnquiryNum
-        FROM `enquiry_public_black_email` t1
+        FROM `adweb_public_black_email` t1
                  LEFT JOIN (SELECT COUNT(*) num, from_email
                             FROM adweb_enquiry
                             WHERE `status` = 1

+ 1 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/mapper/xml/AdwebPublicBlackIpMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="org.jeecg.modules.adweb.enquiry.mapper.AdwebPublicBlackIpMapper">
     <select id="pageList" resultType="org.jeecg.modules.adweb.enquiry.entity.AdwebPublicBlackIp">
         SELECT t1.*, t2.num wasteEnquiryNum
-        FROM `adweb_black_ip` t1
+        FROM `adweb_public_black_ip` t1
                  LEFT JOIN (SELECT from_ip, COUNT(*) num
                             FROM `adweb_enquiry`
                             WHERE `status` = 1

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

@@ -0,0 +1,13 @@
+package org.jeecg.modules.adweb.enquiry.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.adweb.enquiry.entity.AdwebEnquiryRecord;
+
+/**
+ * @Description: adweb_enquiry_record
+ * @Author: jeecg-boot
+ * @Date: 2021-05-11
+ * @Version: V1.0
+ */
+public interface IAdwebEnquiryRecordService extends IService<AdwebEnquiryRecord> {
+}

+ 18 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/service/impl/AdwebEnquiryRecordServiceImpl.java

@@ -0,0 +1,18 @@
+package org.jeecg.modules.adweb.enquiry.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.adweb.enquiry.entity.AdwebEnquiryRecord;
+import org.jeecg.modules.adweb.enquiry.mapper.AdwebEnquiryRecordMapper;
+import org.jeecg.modules.adweb.enquiry.service.IAdwebEnquiryRecordService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Description: adweb_enquiry_record
+ * @Author: jeecg-boot
+ * @Date: 2021-05-11
+ * @Version: V1.0
+ */
+@Service
+public class AdwebEnquiryRecordServiceImpl extends ServiceImpl<AdwebEnquiryRecordMapper, AdwebEnquiryRecord> implements IAdwebEnquiryRecordService {
+
+}

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

@@ -38,6 +38,7 @@ import org.jeecg.modules.adweb.system.entity.SysException;
 import org.jeecg.modules.adweb.system.service.IMasterSubAccountRelationService;
 import org.jeecg.modules.adweb.system.service.ISysExceptionService;
 import org.jeecg.modules.adweb.system.service.impl.SysAdwebApiImpl;
+import org.jeecg.modules.message.websocket.WebSocket;
 import org.jeecg.modules.system.entity.SysDictItem;
 import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.service.ISysDictService;
@@ -127,6 +128,12 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
     @Resource
     private IAdwebEnquiryFormService adwebEnquiryFormService;
 
+    @Resource
+    private SysAdwebApiImpl sysAdwebApiImpl;
+
+    @Resource
+    private WebSocket webSocket;
+
     private static final byte[] redisKey = EnquiryConstants.ENQUIRY_EMAIL.getBytes();
 
     private static final byte[] siteRedisKey = EnquiryConstants.ENQUIRY_SITE.getBytes();
@@ -175,8 +182,6 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
     private Integer emailNotBlackListDate;
     @Value("${judge_waste_enquiry.ip.notBlackListDate}")
     private Integer ipNotBlackListDate;
-    @Autowired
-    private SysAdwebApiImpl sysAdwebApiImpl;
 
     // 获取有效公共询盘规则
     private List<String> getPublicEnquiryRules(int blackOrWhite, int useStatus) {
@@ -258,6 +263,14 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
                 AdwebEnquiry target = adwebEnquiryList.get(0);
                 this.save(target);
                 adwebEnquiryFormService.save(form);
+
+                //创建业务消息信息
+                JSONObject obj = new JSONObject();
+                obj.put("cmd", "user");//业务类型
+                obj.put("msgId", target.getId());//消息id
+                obj.put("msgTxt",  target.getEmail());//消息内容
+                //单个用户发送 (userId为用户id)
+                webSocket.sendMessage("e9ca23d68d884d4ebb19d07889727dae", obj.toJSONString());
             } catch (Exception e) {
                 log.error("站点为:{},  recordId为:{} 保存询盘到数据库失败,原因是:{}", adwebSite.getName(), enquiryDto.getRecordId(), e.getMessage());
             }

+ 6 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/site/service/IAdwebSiteService.java

@@ -45,7 +45,12 @@ public interface IAdwebSiteService extends IService<AdwebSite> {
      */
     List<Integer> getAllSiteIdBySiteId(Integer siteId);
 
-    String getSiteNameByCode(String siteCode);
+    /**
+     * 根据siteCode返回站点信息
+     * @param siteCode
+     * @return
+     */
+    AdwebSite getSiteByCode(String siteCode);
 
     /**
      * 根据用户id查询所有未删除的站点

+ 9 - 4
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/site/service/impl/AdwebSiteServiceImpl.java

@@ -186,19 +186,24 @@ public class AdwebSiteServiceImpl extends ServiceImpl<AdwebSiteMapper, AdwebSite
         return siteIds;
     }
 
+    /**
+     * 根据siteCode返回站点信息
+     * @param siteCode
+     * @return
+     */
     @Override
-    public String getSiteNameByCode(String siteCode) {
+    public AdwebSite getSiteByCode(String siteCode) {
         try {
             List<AdwebSite> adwebSites = this.list(new LambdaQueryWrapper<AdwebSite>()
                     .eq(AdwebSite::getCode, siteCode)
                     .ne(AdwebSite::getStatus, 0));
             if (!adwebSites.isEmpty()) {
-                return adwebSites.get(0).getName();
+                return adwebSites.get(0);
             }
         } catch (Exception e) {
-            log.error("获取站点名称失败");
+            log.error("获取站点失败, code = " + siteCode, e);
         }
-        return "";
+        return null;
     }
     /**
      * 根据用户id查询所有未删除的站点

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

@@ -397,7 +397,7 @@ dataforseo:
 
 ### 询盘列表配置
 enquiry:
-  disable-admin-read: true
+  disable-admin-read: false
   demoFlag: false
   token: zQ3jJqtIexedIw6tZGk6p
   pullCount: 5