Browse Source

公共关键词黑名单

chenlei1231 5 tháng trước cách đây
mục cha
commit
8f16c33091

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

@@ -0,0 +1,25 @@
+package org.jeecg.modules.adweb.common.util;
+
+import org.apache.poi.ss.usermodel.Sheet;
+
+
+public class AdaptiveWidthUtils {
+    /**
+     * 自适应宽度(中文支持)
+     *
+     * @param sheet sheet
+     * @param size  因为for循环从0开始,size值为 列数-1
+     */
+    public static void setSizeColumn(Sheet sheet, int size) {
+        for (int i = 0; i < size; i++) {
+            int orgWidth = sheet.getColumnWidth(i);
+            sheet.autoSizeColumn(i, true);
+            int newWidth = (int) (sheet.getColumnWidth(i) + 100);
+            int maxWith = 256 * 255;
+            //限制下最大宽度
+            if (newWidth > maxWith) {
+                sheet.setColumnWidth(i, maxWith);
+            } else sheet.setColumnWidth(i, Math.max(newWidth, orgWidth));
+        }
+    }
+}

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

@@ -0,0 +1,294 @@
+package org.jeecg.modules.adweb.enquiry.controller;
+
+import cn.hutool.core.io.IoUtil;
+import cn.hutool.poi.excel.ExcelReader;
+import cn.hutool.poi.excel.ExcelUtil;
+import cn.hutool.poi.excel.ExcelWriter;
+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.ServletOutputStream;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.poi.ss.usermodel.Sheet;
+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.modules.adweb.common.util.AdaptiveWidthUtils;
+import org.jeecg.modules.adweb.enquiry.entity.AdwebPublicEnquiryRule;
+import org.jeecg.modules.adweb.enquiry.service.IAdwebPublicEnquiryRuleService;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @Description: 用于询盘规则过滤
+ * @Author: jeecg-boot
+ * @Date: 2023-02-01
+ * @Version: V1.0
+ */
+@Tag(name = "用于询盘规则过滤")
+@RestController
+@RequestMapping("/adweb/adwebEnquiryRule")
+@Slf4j
+public class AdwebPublicEnquriyRuleController extends JeecgController<AdwebPublicEnquiryRule, IAdwebPublicEnquiryRuleService> {
+    @Resource
+    private IAdwebPublicEnquiryRuleService adwebEnquiryRuleService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param adwebEnquiryRule
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "用于询盘规则过滤-分页列表查询")
+    @Operation(summary = "用于询盘规则过滤-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<?> queryPageList(AdwebPublicEnquiryRule adwebEnquiryRule,
+                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                   HttpServletRequest req) {
+        Page<AdwebPublicEnquiryRule> page = new Page<AdwebPublicEnquiryRule>(pageNo, pageSize);
+        String column = req.getParameter("column");
+        String order = req.getParameter("order");
+        IPage<AdwebPublicEnquiryRule> pageList = getPageList(page, adwebEnquiryRule, column, order);
+        return Result.OK(pageList);
+    }
+
+    public IPage<AdwebPublicEnquiryRule> getPageList(Page<AdwebPublicEnquiryRule> page, AdwebPublicEnquiryRule adwebEnquiryRule, String column, String order) {
+        IPage<AdwebPublicEnquiryRule> pageList = adwebEnquiryRuleService.pageList(page, adwebEnquiryRule.getWord(), adwebEnquiryRule.getBlackOrWhiteList(), adwebEnquiryRule.getIsEnable(), adwebEnquiryRule.getUseStatus(), column, order);
+        return pageList;
+    }
+
+    /**
+     * 添加
+     *
+     * @param adwebEnquiryRule
+     * @return
+     */
+    @AutoLog(value = "用于询盘规则过滤-添加")
+    @Operation(summary = "用于询盘规则过滤-添加")
+    @PostMapping(value = "/add")
+    public Result<?> add(@RequestBody AdwebPublicEnquiryRule adwebEnquiryRule) {
+        if (StringUtils.isBlank(adwebEnquiryRule.getWord())) {
+            return Result.error("规则关键词不能为空");
+        }
+
+        adwebEnquiryRule.setWord(adwebEnquiryRule.getWord().replaceAll(" {2,}", " ").trim().toLowerCase());
+
+        int count = (int) adwebEnquiryRuleService.count(new QueryWrapper<AdwebPublicEnquiryRule>().eq("word", adwebEnquiryRule.getWord()).ne("status", 0).eq("use_status", adwebEnquiryRule.getUseStatus()));
+        if (count > 0) {
+            return Result.error("规则关键词已存在");
+        }
+
+        adwebEnquiryRule.setStatus(1);
+        adwebEnquiryRuleService.save(adwebEnquiryRule);
+        return Result.OK("添加成功!");
+    }
+
+    /**
+     * 编辑
+     *
+     * @param adwebEnquiryRule
+     * @return
+     */
+    @AutoLog(value = "用于询盘规则过滤-编辑")
+    @Operation(summary = "用于询盘规则过滤-编辑")
+    @PutMapping(value = "/edit")
+    public Result<?> edit(@RequestBody AdwebPublicEnquiryRule adwebEnquiryRule) {
+        if (StringUtils.isBlank(adwebEnquiryRule.getWord())) {
+            return Result.error("规则关键词不能为空");
+        }
+
+        adwebEnquiryRule.setWord(adwebEnquiryRule.getWord().replaceAll(" {2,}", " ").trim().toLowerCase());
+
+        int count = (int) adwebEnquiryRuleService.count(new QueryWrapper<AdwebPublicEnquiryRule>().eq("word", adwebEnquiryRule.getWord()).ne("status", 0).ne("id", adwebEnquiryRule.getId()).eq("use_status", adwebEnquiryRule.getUseStatus()));
+
+        if (count > 0) {
+            return Result.error("规则关键词已存在");
+        }
+
+        adwebEnquiryRuleService.updateById(adwebEnquiryRule);
+        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 (id == null) {
+            return Result.error("参数不识别!");
+        }
+        boolean update = adwebEnquiryRuleService.update(new UpdateWrapper<AdwebPublicEnquiryRule>().set("status", 0).eq("id", id));
+
+        return update ? Result.OK("删除成功!") : Result.error("删除失败!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "用于询盘规则过滤-批量删除")
+    @Operation(summary = "用于询盘规则过滤-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        if (ids == null) {
+            return Result.error("参数不识别!");
+        }
+        List<String> idList = Arrays.asList(ids.split(","));
+        boolean update = adwebEnquiryRuleService.update(new UpdateWrapper<AdwebPublicEnquiryRule>().set("status", 0).in("id", idList));
+        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.isNotBlank(id)) {
+            return Result.error("参数不识别!");
+        }
+
+        AdwebPublicEnquiryRule adwebEnquiryRule = adwebEnquiryRuleService.getById(id);
+        if (adwebEnquiryRule == null) {
+            return Result.error("未找到对应数据");
+        }
+        return Result.OK(adwebEnquiryRule);
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param adwebEnquiryRule
+     */
+    @RequestMapping(value = "/exportXls")
+    public void exportXls(HttpServletRequest request, AdwebPublicEnquiryRule adwebEnquiryRule, HttpServletResponse response) {
+        Page<AdwebPublicEnquiryRule> page = new Page<AdwebPublicEnquiryRule>(1, -1);
+        String column = request.getParameter("column");
+        String order = request.getParameter("order");
+        List<AdwebPublicEnquiryRule> list = getPageList(page, adwebEnquiryRule, column, order).getRecords();
+//		QueryWrapper<AdwebPublicEnquiryRule> queryWrapper = QueryGenerator.initQueryWrapper(adwebEnquiryRule, request.getParameterMap());
+//		queryWrapper.ne("status", 0);
+//		List<AdwebPublicEnquiryRule> list = adwebEnquiryRuleService.list(queryWrapper);
+        // 通过工具类创建writer,默认创建xls格式
+        ExcelWriter writer = ExcelUtil.getWriter(true);
+
+        writer.addHeaderAlias("word", "关键词");
+        writer.addHeaderAlias("translateWord", "关键词翻译");
+        writer.addHeaderAlias("blackOrWhiteList", "黑白名单");
+        writer.addHeaderAlias("isEnable", "是否启用");
+        writer.addHeaderAlias("useStatus", "作用域");
+        // 默认的,未添加alias的属性也会写出,如果想只写出加了别名的字段,可以调用此方法排除之
+        writer.setOnlyAlias(true);
+
+        StringBuilder fileName = new StringBuilder();
+        fileName.append("用于询盘规则过滤");
+
+        response.setContentType("application/vnd.ms-excel;charset=utf-8");
+        // test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码
+        ServletOutputStream out = null;
+        try {
+            Sheet sheet = writer.getSheet();
+            sheet.setDefaultColumnWidth(12);
+            sheet.setDefaultRowHeightInPoints(20);
+            // 设置请求头属性
+            response.setHeader("Content-Disposition", "attachment;filename=" + new String((fileName + ".xlsx").getBytes(), StandardCharsets.ISO_8859_1));
+            out = response.getOutputStream();
+            writer.write(list, true);
+            AdaptiveWidthUtils.setSizeColumn(sheet, 3);
+            // 写出到文件
+            writer.flush(out, true);
+            // 关闭writer,释放内存
+            writer.close();
+            // 此处记得关闭输出Servlet流
+            IoUtil.close(out);
+        } catch (IOException e) {
+            log.error(e.getMessage());
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(@RequestParam("file") MultipartFile file) {
+        try {
+            //字节输入流
+            InputStream inputStream = file.getInputStream();
+            //通过输入流创建ExcelReader 对象
+            ExcelReader reader = ExcelUtil.getReader(inputStream);
+            //这个同上导入
+            reader.addHeaderAlias("关键词", "word");
+            reader.addHeaderAlias("关键词翻译", "translateWord");
+            reader.addHeaderAlias("黑白名单", "blackOrWhiteList");
+            reader.addHeaderAlias("是否启用", "isEnable");
+            reader.addHeaderAlias("作用域", "useStatus");
+
+            List<AdwebPublicEnquiryRule> rulesList = reader.readAll(AdwebPublicEnquiryRule.class);
+
+            if (rulesList.isEmpty()) {
+                return Result.error("导入数据异常!");
+            }
+
+            for (AdwebPublicEnquiryRule adwebEnquiryRule : rulesList) {
+                UpdateWrapper updateWrapper = new UpdateWrapper();
+                updateWrapper.eq("word", adwebEnquiryRule.getWord());
+                updateWrapper.ne("status", 0);
+                updateWrapper.eq("use_status", 0);
+                updateWrapper.set("translate_word", adwebEnquiryRule.getTranslateWord());
+                adwebEnquiryRuleService.update(updateWrapper);
+            }
+
+            List<String> wordList = rulesList.stream().map(AdwebPublicEnquiryRule::getWord).collect(Collectors.toList());
+            List<AdwebPublicEnquiryRule> adwebEnquiryRules = adwebEnquiryRuleService.list(new QueryWrapper<AdwebPublicEnquiryRule>().in("word", wordList).ne("status", 0).select("word").eq("use_status", 0));
+            List<String> adwebEnquiryRuleList = adwebEnquiryRules.stream().map(AdwebPublicEnquiryRule::getWord).collect(Collectors.toList());
+
+            List<AdwebPublicEnquiryRule> collect = rulesList.stream().filter(adwebEnquiryRule -> !adwebEnquiryRuleList.contains(adwebEnquiryRule.getWord())).collect(Collectors.toList());
+
+            collect.forEach(adwebEnquiryRule -> adwebEnquiryRule.setStatus(1));
+
+            if (CollectionUtils.isNotEmpty(collect)) {
+                adwebEnquiryRuleService.saveBatch(collect);
+            }
+            return Result.OK("文件导入成功!数据行数:" + rulesList.size() + ",重复数据行数:" + adwebEnquiryRules.size() + ",导入数据行数:" + collect.size());
+        } catch (IOException e) {
+            e.printStackTrace();
+            return Result.error("文件导入失败!失败信息:" + e.getMessage());
+        }
+    }
+
+}

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

@@ -0,0 +1,231 @@
+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.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.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.modules.adweb.enquiry.entity.AdwebSiteEnquiryRule;
+import org.jeecg.modules.adweb.enquiry.mapper.AdwebSiteEnquiryRuleMapper;
+import org.jeecg.modules.adweb.enquiry.service.IAdwebSiteEnquiryRuleService;
+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.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @Description: adweb_site_enquiry_rule
+ * @Author: jeecg-boot
+ * @Date: 2023-08-31
+ * @Version: V1.0
+ */
+@Tag(name = "adweb_site_enquiry_rule")
+@RestController
+@RequestMapping("/adweb/adwebEnquirySiteRule")
+@Slf4j
+public class AdwebSiteEnquiryRuleController extends JeecgController<AdwebSiteEnquiryRule, IAdwebSiteEnquiryRuleService> {
+    @Resource
+    private IAdwebSiteEnquiryRuleService adwebSiteEnquiryRuleService;
+    @Resource
+    private AdwebSiteEnquiryRuleMapper adwebEnquirySiteRuleMapper;
+    @Resource
+    private IAdwebSiteService adwebSiteService;
+    @Resource
+    private ISysBaseAPI sysBaseAPI;
+    @Resource
+    private ISiteUserPermissionService siteUserPermissionService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param adwebEnquirySiteRule
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "adweb_site_enquiry_rule-分页列表查询")
+    @Operation(summary = "adweb_site_enquiry_rule-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<?> queryPageList(AdwebSiteEnquiryRule adwebEnquirySiteRule,
+                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                   HttpServletRequest req) {
+        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 (adwebEnquirySiteRule.getSiteId() != null) {
+            String siteCode = adwebSiteService.getSiteCodeById(adwebEnquirySiteRule.getSiteId());
+            if (StringUtils.isNotBlank(siteCode)) {
+                QueryWrapper<AdwebSite> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("id", adwebEnquirySiteRule.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;
+        }
+        Page<AdwebSiteEnquiryRule> page = new Page<AdwebSiteEnquiryRule>(pageNo, pageSize);
+        IPage<AdwebSiteEnquiryRule> pageList = getPageList(page, adwebEnquirySiteRule, codeList);
+        List<AdwebSiteEnquiryRule> record = pageList.getRecords();
+
+        return Result.OK(pageList);
+    }
+
+    public IPage<AdwebSiteEnquiryRule> getPageList(Page<AdwebSiteEnquiryRule> page, AdwebSiteEnquiryRule adwebEnquirySiteRule, List<String> codeList) {
+
+        IPage<AdwebSiteEnquiryRule> pageList = adwebEnquirySiteRuleMapper.pageList(page, adwebEnquirySiteRule, codeList);
+        return pageList;
+    }
+
+    /**
+     * 添加
+     *
+     * @param adwebEnquirySiteRule
+     * @return
+     */
+    @AutoLog(value = "adweb_site_enquiry_rule-添加")
+    @Operation(summary = "adweb_site_enquiry_rule-添加")
+    @PostMapping(value = "/add")
+    public Result<?> add(@RequestBody AdwebSiteEnquiryRule adwebEnquirySiteRule) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        AdwebSite adwebSite = adwebSiteService.getById(adwebEnquirySiteRule.getSiteId());
+        adwebEnquirySiteRule.setSiteCode(adwebSite.getCode());
+        adwebEnquirySiteRule.setStatus(1);
+        adwebSiteEnquiryRuleService.save(adwebEnquirySiteRule);
+        return Result.OK("添加成功!");
+    }
+
+    /**
+     * 编辑
+     *
+     * @param adwebEnquirySiteRule
+     * @return
+     */
+    @AutoLog(value = "adweb_site_enquiry_rule-编辑")
+    @Operation(summary = "adweb_site_enquiry_rule-编辑")
+    @PutMapping(value = "/edit")
+    public Result<?> edit(@RequestBody AdwebSiteEnquiryRule adwebEnquirySiteRule) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        AdwebSite adwebSite = adwebSiteService.getById(adwebEnquirySiteRule.getSiteId());
+        adwebEnquirySiteRule.setSiteCode(adwebSite.getCode());
+        adwebSiteEnquiryRuleService.updateById(adwebEnquirySiteRule);
+        return Result.OK("编辑成功!");
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "adweb_site_enquiry_rule-通过id删除")
+    @Operation(summary = "adweb_site_enquiry_rule-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        AdwebSiteEnquiryRule adwebEnquirySiteRule = adwebSiteEnquiryRuleService.getById(id);
+        adwebEnquirySiteRule.setStatus(0);
+        adwebSiteEnquiryRuleService.updateById(adwebEnquirySiteRule);
+//		adwebSiteEnquiryRuleService.removeById(id);
+        return Result.OK("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "adweb_site_enquiry_rule-批量删除")
+    @Operation(summary = "adweb_site_enquiry_rule-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        List<String> strings = Arrays.asList(ids.split(","));
+        for (String s : strings) {
+            AdwebSiteEnquiryRule adwebEnquirySiteRule = adwebSiteEnquiryRuleService.getById(s);
+            adwebEnquirySiteRule.setStatus(0);
+            adwebSiteEnquiryRuleService.updateById(adwebEnquirySiteRule);
+        }
+//		this.adwebSiteEnquiryRuleService.removeByIds(Arrays.asList(ids.split(",")));
+        return Result.OK("批量删除成功!");
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "adweb_site_enquiry_rule-通过id查询")
+    @Operation(summary = "adweb_site_enquiry_rule-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
+        AdwebSiteEnquiryRule adwebEnquirySiteRule = adwebSiteEnquiryRuleService.getById(id);
+        if (adwebEnquirySiteRule == null) {
+            return Result.error("未找到对应数据");
+        }
+        return Result.OK(adwebEnquirySiteRule);
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param adwebEnquirySiteRule
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, AdwebSiteEnquiryRule adwebEnquirySiteRule) {
+        return super.exportXls(request, adwebEnquirySiteRule, AdwebSiteEnquiryRule.class, "adweb_site_enquiry_rule");
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, AdwebSiteEnquiryRule.class);
+    }
+
+}

+ 32 - 18
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/entity/AdwebSiteEnquiryRule.java

@@ -16,46 +16,60 @@ import java.io.Serializable;
 import java.util.Date;
 
 /**
- * @Description: adweb_enquiry_site_rule
+ * @Description: adweb_site_enquiry_rule
  * @Author: jeecg-boot
- * @Date:   2023-08-31
+ * @Date: 2023-08-31
  * @Version: V1.0
  */
 @Data
 @TableName("adweb_site_enquiry_rule")
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = false)
-@Schema(description="adweb_site_enquiry_rule")
+@Schema(description = "adweb_site_enquiry_rule")
 public class AdwebSiteEnquiryRule implements Serializable {
     private static final long serialVersionUID = 1L;
 
-	/**id*/
-	@TableId(type = IdType.ASSIGN_ID)
+    /**
+     * id
+     */
+    @TableId(type = IdType.ASSIGN_ID)
     @Schema(description = "id")
     private String id;
-	/**站点id*/
-	@Excel(name = "站点id", width = 15)
+    /**
+     * 站点id
+     */
+    @Excel(name = "站点id", width = 15)
     @Schema(description = "站点id")
     private Integer siteId;
-	/**站点code*/
-	@Excel(name = "站点code", width = 15)
+    /**
+     * 站点code
+     */
+    @Excel(name = "站点code", width = 15)
     @Schema(description = "站点code")
     private String siteCode;
-	/**状态0为删除1为使用中*/
-	@Excel(name = "状态0为删除1为使用中", width = 15)
+    /**
+     * 状态0为删除1为使用中
+     */
+    @Excel(name = "状态0为删除1为使用中", width = 15)
     @Schema(description = "状态0为删除1为使用中")
     private Integer status;
-	/**关键词*/
-	@Excel(name = "关键词", width = 15)
+    /**
+     * 关键词
+     */
+    @Excel(name = "关键词", width = 15)
     @Schema(description = "关键词")
     private String word;
-	/**黑名单或白名单0为黑名单,1为白名单*/
-	@Excel(name = "黑名单或白名单0为黑名单,1为白名单", width = 15)
+    /**
+     * 黑名单或白名单0为黑名单,1为白名单
+     */
+    @Excel(name = "黑名单或白名单0为黑名单,1为白名单", width = 15)
     @Schema(description = "黑名单或白名单0为黑名单,1为白名单")
     private Integer blackOrWhite;
-	/**创建日期*/
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern="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 createTime;
 

+ 3 - 3
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/mapper/AdwebSiteEnquiryRuleMapper.java

@@ -8,11 +8,11 @@ import org.jeecg.modules.adweb.enquiry.entity.AdwebSiteEnquiryRule;
 import java.util.List;
 
 /**
- * @Description: adweb_enquiry_site_rule
+ * @Description: adweb_site_enquiry_rule
  * @Author: jeecg-boot
- * @Date:   2023-08-31
+ * @Date: 2023-08-31
  * @Version: V1.0
  */
 public interface AdwebSiteEnquiryRuleMapper extends BaseMapper<AdwebSiteEnquiryRule> {
-    IPage<AdwebSiteEnquiryRule> pageList(Page<AdwebSiteEnquiryRule> page, AdwebSiteEnquiryRule adwebEnquirySiteRule,List<String> codeList);
+    IPage<AdwebSiteEnquiryRule> pageList(Page<AdwebSiteEnquiryRule> page, AdwebSiteEnquiryRule adwebEnquirySiteRule, List<String> codeList);
 }

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

@@ -3,16 +3,16 @@
 <mapper namespace="org.jeecg.modules.adweb.enquiry.mapper.AdwebSiteEnquiryRuleMapper">
     <select id="pageList" resultType="org.jeecg.modules.adweb.enquiry.entity.AdwebSiteEnquiryRule">
         SELECT t1.*, t2.num wasteEnquiryNum,t3.`name` siteName
-        FROM `adweb_enquiry_site_rule` t1
+        FROM `adweb_site_enquiry_rule` t1
         LEFT JOIN (
-            SELECT
-                   t1.reason,t1.site_code,count(*) num
-            FROM
-            (
-                SELECT SUBSTRING_INDEX(effective_reason,'-',-1) reason,site_code
-                FROM `adweb_enquiry`
-                WHERE `status` = 1 AND user_effective = 0 AND sys_effective = 1 AND waste_enquiry_type = 'keyword'
-            ) t1 GROUP BY t1.reason,t1.site_code
+        SELECT
+        t1.reason,t1.site_code,count(*) num
+        FROM
+        (
+        SELECT SUBSTRING_INDEX(effective_reason,'-',-1) reason,site_code
+        FROM `adweb_enquiry`
+        WHERE `status` = 1 AND user_effective = 0 AND sys_effective = 1 AND waste_enquiry_type = 'keyword'
+        ) t1 GROUP BY t1.reason,t1.site_code
         ) t2 ON t2.reason LIKE CONCAT('%',t1.word,'%') AND t2.site_code = t1.site_code,adweb_site t3
         WHERE t1.site_id = t3.id
         AND t1.status = 1
@@ -26,7 +26,7 @@
                 </when>
             </choose>
         </if>
-        <if test = "adwebEnquirySiteRule.siteId != null and adwebEnquirySiteRule.siteId != ''" >
+        <if test="adwebEnquirySiteRule.siteId != null and adwebEnquirySiteRule.siteId != ''">
             AND t1.site_id = #{adwebEnquirySiteRule.siteId}
         </if>
         <if test="adwebEnquirySiteRule.word != null and adwebEnquirySiteRule.word != ''">

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

@@ -3,16 +3,16 @@
 <mapper namespace="org.jeecg.modules.adweb.enquiry.mapper.AdwebPublicEnquiryRuleMapper">
     <select id="pageList" resultType="org.jeecg.modules.adweb.enquiry.entity.AdwebPublicEnquiryRule">
         SELECT t1.*, t2.num wasteEnquiryNum
-        FROM `adweb_enquiry_rule` t1
-                 LEFT JOIN (SELECT
-                                t1.reason,count(*) num
-                            FROM
-                            (
-                                SELECT SUBSTRING_INDEX(effective_reason,'-',-1) reason
-                                FROM `adweb_enquiry`
-                                WHERE `status` = 1 AND user_effective = 0 AND sys_effective = 1 AND waste_enquiry_type = 'keyword'
-                            ) t1 GROUP BY t1.reason) t2
-                           ON t2.reason = t1.word WHERE t1.`status` != 0
+        FROM `adweb_public_enquiry_rule` t1
+        LEFT JOIN (SELECT
+        t1.reason,count(*) num
+        FROM
+        (
+        SELECT SUBSTRING_INDEX(effective_reason,'-',-1) reason
+        FROM `adweb_enquiry`
+        WHERE `status` = 1 AND user_effective = 0 AND sys_effective = 1 AND waste_enquiry_type = 'keyword'
+        ) t1 GROUP BY t1.reason) t2
+        ON t2.reason = t1.word WHERE t1.`status` != 0
         <if test="word != null and word != ''">
             AND t1.word like CONCAT('%', #{word}, '%')
         </if>
@@ -25,20 +25,20 @@
         <if test="useStatus != null">
             AND t1.use_status = #{useStatus}
         </if>
-        <if test = "column != null and column != ''">
-              ORDER BY
-              <if test = "column == 'createTime'">
+        <if test="column != null and column != ''">
+            ORDER BY
+            <if test="column == 'createTime'">
                 t1.create_time ${order}
-              </if>
-              <if test = "column == 'isEnable'">
+            </if>
+            <if test="column == 'isEnable'">
                 t1.is_enable ${order}
-              </if>
-              <if test = "column == 'useStatus'">
+            </if>
+            <if test="column == 'useStatus'">
                 t1.use_status ${order}
-              </if>
-              <if test = "column == 'blackOrWhiteList'">
+            </if>
+            <if test="column == 'blackOrWhiteList'">
                 t1.black_or_white_list ${order}
-              </if>
+            </if>
         </if>
     </select>
 </mapper>

+ 3 - 2
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/service/IAdwebSiteEnquiryRuleService.java

@@ -5,15 +5,16 @@ import org.jeecg.modules.adweb.enquiry.dto.param.EffectiveEnquiryParamDto;
 import org.jeecg.modules.adweb.enquiry.entity.AdwebSiteEnquiryRule;
 
 /**
- * @Description: adweb_enquiry_site_rule
+ * @Description: adweb_site_enquiry_rule
  * @Author: jeecg-boot
- * @Date:   2023-08-31
+ * @Date: 2023-08-31
  * @Version: V1.0
  */
 public interface IAdwebSiteEnquiryRuleService extends IService<AdwebSiteEnquiryRule> {
 
     /**
      * 更改为垃圾询盘处理关键词黑名单
+     *
      * @param effectiveEnquiryParamDto
      */
     void addBlackKeywordByContent(EffectiveEnquiryParamDto effectiveEnquiryParamDto);

+ 7 - 6
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/service/impl/AdwebSiteEnquiryRuleServiceImpl.java

@@ -12,9 +12,9 @@ import java.util.Date;
 import java.util.List;
 
 /**
- * @Description: adweb_enquiry_site_rule
+ * @Description: adweb_site_enquiry_rule
  * @Author: jeecg-boot
- * @Date:   2023-08-31
+ * @Date: 2023-08-31
  * @Version: V1.0
  */
 @Service
@@ -22,10 +22,11 @@ public class AdwebSiteEnquiryRuleServiceImpl extends ServiceImpl<AdwebSiteEnquir
 
     /**
      * 更改为垃圾询盘处理关键词黑名单
+     *
      * @param effectiveEnquiryParamDto
      */
     @Override
-    public void addBlackKeywordByContent(EffectiveEnquiryParamDto effectiveEnquiryParamDto){
+    public void addBlackKeywordByContent(EffectiveEnquiryParamDto effectiveEnquiryParamDto) {
         //排查添加的关键词是否已有
         QueryWrapper<AdwebSiteEnquiryRule> adwebEnquirySiteRuleQueryWrapper = new QueryWrapper<>();
         adwebEnquirySiteRuleQueryWrapper.eq("word", effectiveEnquiryParamDto.getWasteEnquirySeason());
@@ -33,10 +34,10 @@ public class AdwebSiteEnquiryRuleServiceImpl extends ServiceImpl<AdwebSiteEnquir
         adwebEnquirySiteRuleQueryWrapper.eq("site_code", effectiveEnquiryParamDto.getSiteCode());
         adwebEnquirySiteRuleQueryWrapper.eq("status", 1);
         List<AdwebSiteEnquiryRule> adwebEnquirySiteRuleList = list(adwebEnquirySiteRuleQueryWrapper);
-        if(!adwebEnquirySiteRuleList.isEmpty()){
+        if (!adwebEnquirySiteRuleList.isEmpty()) {
             //如果有白名单 先删除原数据,后添加新的黑名单数据
             AdwebSiteEnquiryRule adwebEnquirySiteRule = adwebEnquirySiteRuleList.get(0);
-            if(adwebEnquirySiteRule.getBlackOrWhite() == 1){
+            if (adwebEnquirySiteRule.getBlackOrWhite() == 1) {
                 adwebEnquirySiteRule.setStatus(0);
                 updateById(adwebEnquirySiteRule);
 
@@ -49,7 +50,7 @@ public class AdwebSiteEnquiryRuleServiceImpl extends ServiceImpl<AdwebSiteEnquir
                 newAdwebSiteEnquiryRule.setCreateTime(new Date());
                 save(newAdwebSiteEnquiryRule);
             }
-        }else{
+        } else {
             AdwebSiteEnquiryRule newAdwebSiteEnquiryRule = new AdwebSiteEnquiryRule();
             newAdwebSiteEnquiryRule.setWord(effectiveEnquiryParamDto.getWasteEnquirySeason());
             newAdwebSiteEnquiryRule.setBlackOrWhite(0);