浏览代码

询盘回收站,询盘黑名单

chenlei1231 5 月之前
父节点
当前提交
81a62f4e2b
共有 12 个文件被更改,包括 729 次插入70 次删除
  1. 305 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/controller/AdwebEnquiryBlacklistController.java
  2. 138 10
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/controller/AdwebEnquiryController.java
  3. 1 1
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/dto/param/EnquirySearchDto.java
  4. 1 1
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/dto/result/EnquiryListDto.java
  5. 6 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/entity/AdwebEnquiry.java
  6. 34 14
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/mapper/AdwebEnquiryMapper.java
  7. 88 2
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/mapper/xml/AdwebEnquiryMapper.xml
  8. 11 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/service/IAdwebEnquiryService.java
  9. 108 4
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/service/impl/AdwebEnquiryServiceImpl.java
  10. 9 1
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/site/service/IAdwebSiteService.java
  11. 28 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/site/service/impl/AdwebSiteServiceImpl.java
  12. 0 37
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/userCountry/controller/AdwebUserCountryController.java

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

@@ -0,0 +1,305 @@
+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.core.toolkit.StringUtils;
+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.api.ISysBaseAPI;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.common.system.vo.LoginUser;
+
+import org.jeecg.modules.adweb.common.util.ListUtil;
+import org.jeecg.modules.adweb.enquiry.constant.EnquiryDistributeTypeConstant;
+import org.jeecg.modules.adweb.enquiry.dto.result.EnquiryListDto;
+import org.jeecg.modules.adweb.enquiry.entity.AdwebEnquiry;
+import org.jeecg.modules.adweb.enquiry.entity.AdwebEnquiryBlacklist;
+import org.jeecg.modules.adweb.enquiry.entity.AdwebSiteBlackEmail;
+import org.jeecg.modules.adweb.enquiry.service.IAdwebEnquiryBlacklistService;
+import org.jeecg.modules.adweb.enquiry.service.IAdwebEnquiryService;
+import org.jeecg.modules.adweb.enquiry.service.IAdwebSiteBlackEmailService;
+
+import org.jeecg.modules.adweb.site.entity.AdwebSite;
+import org.jeecg.modules.adweb.site.service.IAdwebSiteService;
+import org.jeecg.modules.adweb.site.service.ISiteUserPermissionService;
+import org.jeecg.modules.adweb.system.service.SysAdwebApi;
+import org.jeecg.modules.adweb.userCountry.service.IAdwebUserCountryService;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Description: adweb_enquiry_blacklist
+ * @Author: jeecg-boot
+ * @Date: 2022-08-05
+ * @Version: V1.0
+ */
+@Tag(name = "adweb_enquiry_blacklist")
+@RestController
+@RequestMapping("/enquiry/blacklist")
+@Slf4j
+public class AdwebEnquiryBlacklistController extends JeecgController<AdwebEnquiryBlacklist, IAdwebEnquiryBlacklistService> {
+    @Resource
+    private IAdwebEnquiryBlacklistService adwebEnquiryBlacklistService;
+
+    @Resource
+    private IAdwebEnquiryService adwebEnquiryService;
+
+    @Resource
+    private ISysBaseAPI sysBaseAPI;
+
+	@Resource
+	private SysAdwebApi sysAdwebApi;
+
+    @Resource
+    private IAdwebSiteService adwebSiteService;
+
+    @Resource
+    private ISiteUserPermissionService siteUserPermissionService;
+
+    @Resource
+    private IAdwebSiteBlackEmailService enquirySiteBlackEmailService;
+
+    @Resource
+    private IAdwebUserCountryService adwebUserCountryService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param queryParam 查询参数,邮箱/姓名/国家
+     */
+    @GetMapping(value = "/list")
+    public Result<?> queryPageList(String queryParam,
+                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                   Integer siteId) {
+        LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        QueryWrapper<AdwebEnquiryBlacklist> queryWrapper = new QueryWrapper<>();
+        if (siteId != null) {
+            List<Integer> siteIds = adwebSiteService.getAllSiteIdByParentId(siteId);
+            queryWrapper.in("site_id", siteIds);
+        } else if (!sysBaseAPI.isAdmin()) {
+            if (sysBaseAPI.isOem()) {
+                List<String> oemGroupUids = sysBaseAPI.getOemGroupUids();
+
+                List<String> codeList = siteUserPermissionService.getSiteCodeListByUids(oemGroupUids);
+                QueryWrapper<AdwebSite> queryWrapper1 = new QueryWrapper<>();
+                queryWrapper1.ne("status", 0);
+                queryWrapper1.in("code", codeList);
+                List<AdwebSite> siteList = adwebSiteService.list(queryWrapper1);
+                List<Integer> siteIds = new ArrayList<>();
+                for (AdwebSite site : siteList) {
+                    siteIds.add(site.getId());
+                }
+                queryWrapper.in("site_id", siteIds);
+            } else {
+                List<Integer> siteIds = adwebSiteService.getAllSiteIdByUid(loginUser.getId());
+                queryWrapper.in("site_id", siteIds);
+            }
+        }
+        if (StringUtils.isNotBlank(queryParam)) {
+            queryWrapper.and(wrapper -> wrapper.like("email", queryParam)
+                    .or().like("name", queryParam)
+                    .or().like("country_name", queryParam));
+        }
+
+        if (sysAdwebApi.isAdwebSubVip()) {
+            AdwebSite site = adwebSiteService.getById(siteId);
+            String distributeType = site.getEnquiryDistributeType();
+            if (EnquiryDistributeTypeConstant.MASTER.equals(distributeType)) {
+                return Result.OK(new Page<>(pageNo, pageSize));
+            }
+            if (EnquiryDistributeTypeConstant.REGION.equals(distributeType)) {
+                List<String> countryCodes = adwebUserCountryService.getCountryCodesBySubId(loginUser.getId(), siteId);
+                if (ListUtil.isEmpty(countryCodes)) {
+                    return Result.OK(new Page<>(pageNo, pageSize));
+                }
+                queryWrapper.in("country_code", countryCodes);
+            }
+        }
+
+        queryWrapper.eq("status", 1);
+        queryWrapper.orderByDesc("create_time");
+        Page<AdwebEnquiryBlacklist> page = new Page<AdwebEnquiryBlacklist>(pageNo, pageSize);
+        IPage<AdwebEnquiryBlacklist> pageList = adwebEnquiryBlacklistService.page(page, queryWrapper);
+        
+        return Result.OK(pageList);
+    }
+
+    /**
+     * 添加
+     *
+     * @param adwebEnquiryBlacklist
+     * @return
+     */
+    @AutoLog(value = "adweb_enquiry_blacklist-添加")
+    @Operation(summary = "adweb_enquiry_blacklist-添加")
+    @PostMapping(value = "/add")
+    public Result<?> add(@RequestBody AdwebEnquiryBlacklist adwebEnquiryBlacklist) {
+        adwebEnquiryBlacklistService.save(adwebEnquiryBlacklist);
+        return Result.OK("添加成功!");
+    }
+
+    /**
+     * 增加黑名单,从询盘中抽取出一个虚拟的人,同时将询盘放入黑名单
+     *
+     * @param adwebEnquiry 询盘
+     * @return 处理结果
+     */
+    @PostMapping(value = "/addBlacklist")
+    public Result<?> addBlacklist(@RequestBody EnquiryListDto adwebEnquiry) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+
+        //判断站点询盘黑名单是否存在添加进来的黑名单
+        QueryWrapper<AdwebSiteBlackEmail> enquirySiteBlackEmailQueryWrapper = new QueryWrapper<>();
+        enquirySiteBlackEmailQueryWrapper.eq("site_id", adwebEnquiry.getSiteId());
+        enquirySiteBlackEmailQueryWrapper.eq("status", 1);
+        enquirySiteBlackEmailQueryWrapper.eq("email", adwebEnquiry.getFromEmail());
+        List<AdwebSiteBlackEmail> enquirySiteBlackEmailList = enquirySiteBlackEmailService.list(enquirySiteBlackEmailQueryWrapper);
+
+        if (ListUtil.notEmpty(enquirySiteBlackEmailList)) {
+            Integer blackOrWhite = enquirySiteBlackEmailList.get(0).getBlackOrWhite();
+            String blackOrWhiteStr = "";
+            if (blackOrWhite == 0) {
+                blackOrWhiteStr = "黑名单";
+            } else {
+                blackOrWhiteStr = "白名单";
+            }
+            return Result.error("当前拒收的邮箱黑名单已被站点询盘黑名单记录为" + blackOrWhiteStr);
+        }
+        AdwebEnquiryBlacklist blacklist = new AdwebEnquiryBlacklist();
+        blacklist.setSiteId(adwebEnquiry.getSiteId());
+        blacklist.setEnquiryId(adwebEnquiry.getId());
+        blacklist.setName(adwebEnquiry.getContact());
+        blacklist.setEmail(adwebEnquiry.getFromEmail());
+        blacklist.setPhone(adwebEnquiry.getPhone());
+        blacklist.setWhatsapp(adwebEnquiry.getWhatsApp());
+        blacklist.setCountryCode(adwebEnquiry.getCountryCode());
+        blacklist.setCountryName(adwebEnquiry.getCountryName());
+        blacklist.setStatus(1);
+        blacklist.setCreateTime(new Date());
+        adwebEnquiryBlacklistService.save(blacklist);
+
+        UpdateWrapper<AdwebEnquiry> enquiryUpdateWrapper = new UpdateWrapper<>();
+        enquiryUpdateWrapper.eq("id", adwebEnquiry.getId());
+        enquiryUpdateWrapper.set("status", 0);
+        adwebEnquiryService.update(enquiryUpdateWrapper);
+
+        return Result.OK("添加成功!");
+    }
+
+    /**
+     * 编辑
+     *
+     * @param adwebEnquiryBlacklist
+     * @return
+     */
+    @AutoLog(value = "adweb_enquiry_blacklist-编辑")
+	@Operation(summary = "adweb_enquiry_blacklist-编辑")
+    @PutMapping(value = "/edit")
+    public Result<?> edit(@RequestBody AdwebEnquiryBlacklist adwebEnquiryBlacklist) {
+        adwebEnquiryBlacklistService.updateById(adwebEnquiryBlacklist);
+        return Result.OK("编辑成功!");
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "adweb_enquiry_blacklist-通过id删除")
+	@Operation(summary = "adweb_enquiry_blacklist-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        adwebEnquiryBlacklistService.removeById(id);
+        return Result.OK("删除成功!");
+    }
+
+    /**
+     * 移出黑名单
+     *
+     * @param id 黑名单id
+     * @return 操作结果
+     */
+    @GetMapping(value = "/removeBlacklist")
+    public Result<?> removeBlacklist(@RequestParam(name = "id") String id) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        UpdateWrapper<AdwebEnquiryBlacklist> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.in("id", id.split(","));
+        updateWrapper.set("status", 0);
+        adwebEnquiryBlacklistService.update(updateWrapper);
+        return Result.OK("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "adweb_enquiry_blacklist-批量删除")
+	@Operation(summary = "adweb_enquiry_blacklist-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        this.adwebEnquiryBlacklistService.removeByIds(Arrays.asList(ids.split(",")));
+        return Result.OK("批量删除成功!");
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "adweb_enquiry_blacklist-通过id查询")
+	@Operation(summary = "adweb_enquiry_blacklist-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
+        AdwebEnquiryBlacklist adwebEnquiryBlacklist = adwebEnquiryBlacklistService.getById(id);
+        if (adwebEnquiryBlacklist == null) {
+            return Result.error("未找到对应数据");
+        }
+        return Result.OK(adwebEnquiryBlacklist);
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param adwebEnquiryBlacklist
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, AdwebEnquiryBlacklist adwebEnquiryBlacklist) {
+        return super.exportXls(request, adwebEnquiryBlacklist, AdwebEnquiryBlacklist.class, "adweb_enquiry_blacklist");
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, AdwebEnquiryBlacklist.class);
+    }
+
+}

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

@@ -5,16 +5,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import io.swagger.v3.oas.annotations.tags.Tag;
-
 import jakarta.annotation.Resource;
 import jakarta.annotation.Resource;
 import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletResponse;
 import jakarta.servlet.http.HttpServletResponse;
-
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
-
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.SecurityUtils;
@@ -29,19 +25,23 @@ import org.jeecg.modules.adweb.common.constant.AdwebConstant;
 import org.jeecg.modules.adweb.common.util.AwsTranslateUtils;
 import org.jeecg.modules.adweb.common.util.AwsTranslateUtils;
 import org.jeecg.modules.adweb.common.util.DateUtil;
 import org.jeecg.modules.adweb.common.util.DateUtil;
 import org.jeecg.modules.adweb.common.util.ListUtil;
 import org.jeecg.modules.adweb.common.util.ListUtil;
-import org.jeecg.modules.adweb.enquiry.dto.param.AdmpEnquirySearchDto;
+import org.jeecg.modules.adweb.enquiry.constant.EnquirySendStatus;
+import org.jeecg.modules.adweb.enquiry.dto.param.EnquirySearchDto;
+import org.jeecg.modules.adweb.enquiry.dto.param.EffectiveEnquiryParamDto;
 import org.jeecg.modules.adweb.enquiry.dto.param.EnquiryListSearchDto;
 import org.jeecg.modules.adweb.enquiry.dto.param.EnquiryListSearchDto;
-import org.jeecg.modules.adweb.enquiry.dto.result.AdmpEnquiryListDto;
+import org.jeecg.modules.adweb.enquiry.dto.result.EnquiryListDto;
 import org.jeecg.modules.adweb.enquiry.dto.result.EnquirySpecialFields;
 import org.jeecg.modules.adweb.enquiry.dto.result.EnquirySpecialFields;
 import org.jeecg.modules.adweb.enquiry.entity.AdwebEnquiry;
 import org.jeecg.modules.adweb.enquiry.entity.AdwebEnquiry;
+import org.jeecg.modules.adweb.enquiry.entity.EnquiryEmailMessage;
 import org.jeecg.modules.adweb.enquiry.mapper.AdwebEnquiryMapper;
 import org.jeecg.modules.adweb.enquiry.mapper.AdwebEnquiryMapper;
 import org.jeecg.modules.adweb.enquiry.service.IAdwebEnquiryService;
 import org.jeecg.modules.adweb.enquiry.service.IAdwebEnquiryService;
 import org.jeecg.modules.adweb.site.entity.AdwebSite;
 import org.jeecg.modules.adweb.site.entity.AdwebSite;
 import org.jeecg.modules.adweb.site.service.IAdwebSiteService;
 import org.jeecg.modules.adweb.site.service.IAdwebSiteService;
 import org.jeecg.modules.adweb.site.service.ISiteUserPermissionService;
 import org.jeecg.modules.adweb.site.service.ISiteUserPermissionService;
 import org.jeecg.modules.adweb.system.service.SysAdwebApi;
 import org.jeecg.modules.adweb.system.service.SysAdwebApi;
+import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.service.ISysDictService;
 import org.jeecg.modules.system.service.ISysDictService;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.jeecg.modules.system.service.ISysUserService;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -96,6 +96,9 @@ public class AdwebEnquiryController extends JeecgController<AdwebEnquiry, IAdweb
     @Resource
     @Resource
     private AwsTranslateUtils awsTranslateUtils;
     private AwsTranslateUtils awsTranslateUtils;
 
 
+    @Resource
+    private ISysUserService sysUserService;
+
     /**
     /**
      * 分页列表查询
      * 分页列表查询
      *
      *
@@ -117,7 +120,7 @@ public class AdwebEnquiryController extends JeecgController<AdwebEnquiry, IAdweb
             return Result.OK(new Page<>());
             return Result.OK(new Page<>());
         }
         }
 
 
-        Page<AdmpEnquirySearchDto> page = new Page<> (pageNo, pageSize);
+        Page<EnquirySearchDto> page = new Page<> (pageNo, pageSize);
 		LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
 		LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
 
 
 		List<String> codeList = null;
 		List<String> codeList = null;
@@ -174,7 +177,7 @@ public class AdwebEnquiryController extends JeecgController<AdwebEnquiry, IAdweb
 		String userEfftecive = "(" + searchDto.getUserEffective() + ")";
 		String userEfftecive = "(" + searchDto.getUserEffective() + ")";
 
 
 
 
-        IPage<AdmpEnquiryListDto> pageList = adwebEnquiryMapper.selectAdmpEnquiryList(page, codeList, userEfftecive, searchDto.getWasteEnquiryType(),
+        IPage<EnquiryListDto> pageList = adwebEnquiryMapper.selectAdmpEnquiryList(page, codeList, userEfftecive, searchDto.getWasteEnquiryType(),
                 searchDto.getSearchText(), searchDto.getSearchContent(), start, end, searchDto.getWhatsApp(), searchDto.getReadStatus(), principalUid, selfPrincipalUid);
                 searchDto.getSearchText(), searchDto.getSearchContent(), start, end, searchDto.getWhatsApp(), searchDto.getReadStatus(), principalUid, selfPrincipalUid);
 
 
         if (ListUtil.notEmpty(pageList.getRecords())) {
         if (ListUtil.notEmpty(pageList.getRecords())) {
@@ -187,7 +190,7 @@ public class AdwebEnquiryController extends JeecgController<AdwebEnquiry, IAdweb
      * 处理询盘列表结果集
      * 处理询盘列表结果集
      * @param enquiryList
      * @param enquiryList
      */
      */
-    private void dealInfo(List<AdmpEnquiryListDto> enquiryList) {
+    private void dealInfo(List<EnquiryListDto> enquiryList) {
         if (ListUtil.isEmpty(enquiryList)) {
         if (ListUtil.isEmpty(enquiryList)) {
             return;
             return;
         }
         }
@@ -545,6 +548,130 @@ public class AdwebEnquiryController extends JeecgController<AdwebEnquiry, IAdweb
     }
     }
 
 
     /**
     /**
+     * 更改询盘用户有效性
+     */
+    @PostMapping("/update/user/effective")
+    public Result<?> updateUserEffective(EffectiveEnquiryParamDto effectiveEnquiryParamDto) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        boolean res = adwebEnquiryService.updateUserEffective(effectiveEnquiryParamDto);
+        if (res) {
+            return Result.OK("ok");
+        }
+        return Result.error("fail");
+    }
+
+    /**
+     * 转发询盘
+     */
+    @AutoLog(value = "转发询盘")
+    @GetMapping(value = "/setForward")
+    public Result<?> setForward(@RequestParam String ids, @RequestParam String uid, @RequestParam String code) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        SysUser user = sysUserService.getById(uid);
+        if (StringUtils.isEmpty(user.getEmail())){
+            return Result.error("该账户未设置邮箱!");
+        }
+        List<String> idList = Arrays.asList(ids.split(","));
+        UpdateWrapper<AdwebEnquiry> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.in("id", idList);
+        updateWrapper.set("principal_uid", uid);
+        updateWrapper.set("principal_type", 1);
+        adwebEnquiryService.update(updateWrapper);
+
+        QueryWrapper<AdwebEnquiry> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in("id", idList);
+        List<AdwebEnquiry> list = adwebEnquiryService.list(queryWrapper);
+        //获取站点
+        QueryWrapper<AdwebSite> adwebSiteQueryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("code",code);
+        AdwebSite adwebSite = adwebSiteService.getOne(adwebSiteQueryWrapper);
+        adwebEnquiryService.specialSendEmail(list, adwebSite);
+        //返回跟进人名称
+        for (String id: idList) {
+            AdwebEnquiry adwebEnquiry = adwebEnquiryService.getById(id);
+            if (adwebEnquiry != null && StringUtils.isNotBlank(adwebEnquiry.getRecordId())) {
+                adwebEnquiryService.returnSalesperson(code, adwebEnquiry.getRecordId(), user.getUsername());
+            }
+        }
+        return Result.OK();
+    }
+
+    /**
+     * 回收站列表接口
+     */
+    @AutoLog(value = "adweb_enquiry-分页列表查询")
+    @GetMapping(value = "/queryWasteEnquiryList")
+    public Result<?> queryWasteEnquiryList(Integer siteId,
+                                           String searchText,
+                                           String enquiryType,
+                                           @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                           @RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize) {
+        if (sysAdwebApi.isNotOwnSite(siteId)) {
+            return Result.OK(new Page<>());
+        }
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        Page<EnquirySearchDto> page = new Page<>(pageNo, pageSize);
+        List<String> codeList = null;
+        List<String> uidList = null;
+
+        if (sysAdwebApi.isAdmin()) {
+        } else if (sysAdwebApi.isOem()) {
+            uidList = sysAdwebApi.getOemGroupUids();
+        } else {
+            uidList = new ArrayList<>();
+            uidList.add(sysUser.getId());
+        }
+
+        List<String> siteCodeList = null;
+        if(ListUtil.notEmpty(uidList)){
+            siteCodeList = siteUserPermissionService.getSiteCodeListByUids(uidList);
+        }
+
+        codeList = adwebSiteService.list(new LambdaQueryWrapper<AdwebSite>()
+                .eq(siteId != null, AdwebSite::getId, siteId)
+                .in(!sysAdwebApi.isAdmin(), AdwebSite::getCode, siteCodeList)
+                .ne(AdwebSite::getStatus, 0)).stream().map(AdwebSite::getCode).collect(Collectors.toList());
+
+        String principalUid = null;
+        if (sysAdwebApi.isAdwebSubVip()) {
+            principalUid = sysUser.getId();
+        }
+        if (StringUtils.isNotBlank(searchText)) {
+            searchText = searchText.trim();
+        }
+        enquiryType = "(" + enquiryType + ")";
+        IPage<EnquiryListDto> pageList = adwebEnquiryMapper.queryWasteEnquiryList(page, codeList, "", enquiryType, searchText, null, null, null, principalUid);
+        if (ListUtil.isEmpty(pageList.getRecords())) {
+            dealInfo(pageList.getRecords());
+            return Result.OK(pageList);
+        }
+        dealInfo(pageList.getRecords());
+        return Result.OK(pageList);
+    }
+
+
+    /**
+     * 根据询盘信息创建邮件发送记录
+     * @param adwebEnquiry      询盘信息
+     * @param email             接收邮箱
+     * @return
+     */
+    private static EnquiryEmailMessage newEmail(AdwebEnquiry adwebEnquiry, String email) {
+        EnquiryEmailMessage enquiryEmailMessage = new EnquiryEmailMessage();
+        enquiryEmailMessage.setEnquiryId(adwebEnquiry.getId());
+        enquiryEmailMessage.setEmail(email);
+        enquiryEmailMessage.setFromEmail(adwebEnquiry.getFromEmail());
+        enquiryEmailMessage.setCreateTime(new Date());
+        enquiryEmailMessage.setSiteCode(adwebEnquiry.getSiteCode());
+        enquiryEmailMessage.setSendStatus(EnquirySendStatus.WAIT_SEND);
+        enquiryEmailMessage.setSendErrorNum(0);
+
+        return enquiryEmailMessage;
+    }
+
+    /**
      * 特殊时间数据处理
      * 特殊时间数据处理
      *
      *
      * @param dateType 时间
      * @param dateType 时间
@@ -575,4 +702,5 @@ public class AdwebEnquiryController extends JeecgController<AdwebEnquiry, IAdweb
         return map;
         return map;
     }
     }
 
 
+
 }
 }

+ 1 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/dto/param/AdmpEnquirySearchDto.java → jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/dto/param/EnquirySearchDto.java

@@ -3,7 +3,7 @@ package org.jeecg.modules.adweb.enquiry.dto.param;
 import lombok.Data;
 import lombok.Data;
 
 
 @Data
 @Data
-public class AdmpEnquirySearchDto {
+public class EnquirySearchDto {
     //询盘模块类型
     //询盘模块类型
     private String modular;
     private String modular;
     //阶段
     //阶段

+ 1 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/dto/result/AdmpEnquiryListDto.java → jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/dto/result/EnquiryListDto.java

@@ -8,7 +8,7 @@ import java.util.Date;
 import java.util.List;
 import java.util.List;
 
 
 @Data
 @Data
-public class AdmpEnquiryListDto {
+public class EnquiryListDto {
     @JsonSerialize(using= ToStringSerializer.class)
     @JsonSerialize(using= ToStringSerializer.class)
     private Long id;
     private Long id;
     //询盘编号(系统生成)
     //询盘编号(系统生成)

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

@@ -304,4 +304,10 @@ public class AdwebEnquiry implements Serializable {
      * */
      * */
     @TableField(exist = false)
     @TableField(exist = false)
     private String isEnquirySync;
     private String isEnquirySync;
+
+    /**
+     * 用于判断是否是·联系我们询盘·
+     * */
+    @TableField(exist = false)
+    private Integer existContactEnquiry;
 }
 }

+ 34 - 14
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/mapper/AdwebEnquiryMapper.java

@@ -5,8 +5,8 @@ import java.util.List;
 
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
-import org.jeecg.modules.adweb.enquiry.dto.param.AdmpEnquirySearchDto;
-import org.jeecg.modules.adweb.enquiry.dto.result.AdmpEnquiryListDto;
+import org.jeecg.modules.adweb.enquiry.dto.param.EnquirySearchDto;
+import org.jeecg.modules.adweb.enquiry.dto.result.EnquiryListDto;
 import org.jeecg.modules.adweb.enquiry.entity.AdwebEnquiry;
 import org.jeecg.modules.adweb.enquiry.entity.AdwebEnquiry;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 
@@ -26,21 +26,41 @@ public interface AdwebEnquiryMapper extends BaseMapper<AdwebEnquiry> {
      * @param ctimeEnd
      * @param ctimeEnd
      * @return
      * @return
      */
      */
-    IPage<AdmpEnquiryListDto> selectAdmpEnquiryList(IPage<AdmpEnquirySearchDto> page,
-                                                    @Param("codeList") List<String> codeList,
-                                                    @Param("userEffective") String userEffective,
-                                                    @Param("wasteEnquiryType") String wasteEnquiryType,
-                                                    @Param("searchText") String searchText,
-                                                    @Param("searchContent") String searchContent,
-                                                    @Param("ctimeBegin") Date ctimeBegin,
-                                                    @Param("ctimeEnd") Date ctimeEnd,
-                                                    @Param("whatsApp") String whatsApp,
-                                                    @Param("readStatus") Integer readStatus,
-                                                    @Param("principalUid") String principalUid,
-                                                    @Param("selfPrincipalUid") String selfPrincipalUid);
+    IPage<EnquiryListDto> selectAdmpEnquiryList(IPage<EnquirySearchDto> page,
+                                                @Param("codeList") List<String> codeList,
+                                                @Param("userEffective") String userEffective,
+                                                @Param("wasteEnquiryType") String wasteEnquiryType,
+                                                @Param("searchText") String searchText,
+                                                @Param("searchContent") String searchContent,
+                                                @Param("ctimeBegin") Date ctimeBegin,
+                                                @Param("ctimeEnd") Date ctimeEnd,
+                                                @Param("whatsApp") String whatsApp,
+                                                @Param("readStatus") Integer readStatus,
+                                                @Param("principalUid") String principalUid,
+                                                @Param("selfPrincipalUid") String selfPrincipalUid);
 
 
     /**
     /**
      * 根据地区更新询盘跟进人
      * 根据地区更新询盘跟进人
      */
      */
     void updatePrincipalUidByRegion(Integer siteId, List<Integer> siteIds);
     void updatePrincipalUidByRegion(Integer siteId, List<Integer> siteIds);
+
+    /**
+     * @param page
+     * @param siteId
+     * @param userEffective
+     * @param searchText
+     * @param ctimeBegin
+     * @param ctimeEnd
+     * @return
+     */
+    IPage<EnquiryListDto> queryWasteEnquiryList(IPage<EnquirySearchDto> page,
+                                                @Param("codeList") List<String> codeList,
+                                                @Param("siteId") String siteId,
+                                                @Param("userEffective") String userEffective,
+                                                @Param("searchText") String searchText,
+                                                @Param("ctimeBegin") String ctimeBegin,
+                                                @Param("ctimeEnd") String ctimeEnd,
+                                                @Param("whatsApp") String whatsApp,
+                                                @Param("principalUid") String principalUid);
+
 }
 }

+ 88 - 2
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/mapper/xml/AdwebEnquiryMapper.xml

@@ -2,8 +2,8 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!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.AdwebEnquiryMapper">
 <mapper namespace="org.jeecg.modules.adweb.enquiry.mapper.AdwebEnquiryMapper">
 
 
-    <select id="selectAdmpEnquiryList" parameterType="org.jeecg.modules.adweb.enquiry.dto.param.AdmpEnquirySearchDto"
-            resultType="org.jeecg.modules.adweb.enquiry.dto.result.AdmpEnquiryListDto">
+    <select id="selectAdmpEnquiryList" parameterType="org.jeecg.modules.adweb.enquiry.dto.param.EnquirySearchDto"
+            resultType="org.jeecg.modules.adweb.enquiry.dto.result.EnquiryListDto">
         SELECT
         SELECT
         t1.id,
         t1.id,
         t2.`name` AS siteName,
         t2.`name` AS siteName,
@@ -109,6 +109,92 @@
         t1.record_ctime DESC
         t1.record_ctime DESC
     </select>
     </select>
 
 
+    <select id="queryWasteEnquiryList" parameterType="org.jeecg.modules.adweb.enquiry.dto.param.EnquirySearchDto"
+            resultType="org.jeecg.modules.adweb.enquiry.dto.result.EnquiryListDto">
+        SELECT
+        t1.id,
+        t2.`name` AS siteName,
+        t1.`no`,
+        t1.no_out AS noOut,
+        t1.modular,
+        t1.record_ctime AS recordCtime,
+        t1.from_email AS fromEmail,
+        t1.country,
+        t1.site_host AS siteHost,
+        t1.uid,
+        t1.STATUS,
+        t1.tracker,
+        t1.site_code AS siteCode,
+        t1.phase,
+        t1.track_status AS trackStatus,
+        t1.replay_status AS replayStatus,
+        t1.sys_effective AS sysEffective,
+        t1.user_effective AS userEffective,
+        t1.sensitive_message AS sensitiveMessage,
+        t1.company_id AS companyId,
+        t1.contact_ids AS contactIds,
+        t1.trans_content AS transContent,
+        t1.whats_app AS whatsApp,
+        t1.name contact,
+        t1.phone,
+        t1.company formCompany,
+        t1.from_page,
+        t1.message context,
+        t1.from_page path,
+        t1.country_name as countryName,
+        t1.country_code as countryCode,
+        t1.from_ip fromIp
+        FROM
+        adweb_enquiry t1,
+        adweb_site t2
+        <where>
+            t1.site_code = t2.`code`
+            AND t2.`status` != 0 AND t1.status = 0
+            <if test="codeList != null">
+                <choose>
+                    <when test="codeList.size() != 0">
+                        AND t1.site_code IN
+                        <foreach collection="codeList" item="code" open="(" close=")" separator=",">
+                            #{code}
+                        </foreach>
+                    </when>
+                    <otherwise>
+                        AND t1.id = -1
+                    </otherwise>
+                </choose>
+            </if>
+            <if test="null != siteId and '' != siteId">
+                and t2.id in (${siteId})
+            </if>
+            <if test="null != searchText and '' != searchText">
+                and (t1.from_email like CONCAT('%', #{searchText}, '%')
+                or t1.no like CONCAT('%', #{searchText}, '%')
+                or t1.country like CONCAT('%', #{searchText}, '%')
+                or t1.site_host like CONCAT('%', #{searchText}, '%')
+                or t1.no_out like CONCAT('%', #{searchText}, '%')
+                or t2.name like CONCAT('%', #{searchText}, '%')
+                )
+            </if>
+            <if test="userEffective != null and userEffective != '' and userEffective != 'undefined'">
+                AND t1.user_effective IN ${userEffective}
+            </if>
+            <if test="null != ctimeBegin">
+                and t1.record_ctime >= #{ctimeBegin}
+            </if>
+            <if test="null != ctimeEnd">
+                and #{ctimeEnd} > t1.record_ctime
+            </if>
+            <if test="null != whatsApp and '' != whatsApp">
+                and t1.whats_app = #{whatsApp}
+            </if>
+            <if test="principalUid != null and principalUid != ''">
+                AND (t1.principal_uid = #{principalUid} OR t1.principal_uid = 'ALL')
+            </if>
+        </where>
+        ORDER BY
+        t1.record_ctime DESC
+    </select>
+
     <update id="updatePrincipalUidByRegion">
     <update id="updatePrincipalUidByRegion">
         update
         update
         adweb_enquiry t1,
         adweb_enquiry t1,

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

@@ -1,11 +1,13 @@
 package org.jeecg.modules.adweb.enquiry.service;
 package org.jeecg.modules.adweb.enquiry.service;
 
 
 import org.jeecg.modules.adweb.enquiry.dto.EnquiryDTO;
 import org.jeecg.modules.adweb.enquiry.dto.EnquiryDTO;
+import org.jeecg.modules.adweb.enquiry.dto.param.EffectiveEnquiryParamDto;
 import org.jeecg.modules.adweb.enquiry.entity.AdwebEnquiry;
 import org.jeecg.modules.adweb.enquiry.entity.AdwebEnquiry;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.adweb.site.entity.AdwebSite;
 import org.jeecg.modules.adweb.site.entity.AdwebSite;
 
 
 import java.util.List;
 import java.util.List;
+import java.util.Map;
 
 
 /**
 /**
  * @Description: 询盘信息存储表单
  * @Description: 询盘信息存储表单
@@ -26,4 +28,13 @@ public interface IAdwebEnquiryService extends IService<AdwebEnquiry> {
      * 根据地区更新询盘跟进人
      * 根据地区更新询盘跟进人
      */
      */
     void updatePrincipalUidByRegion(Integer siteId);
     void updatePrincipalUidByRegion(Integer siteId);
+
+    /**
+     * 更改询盘用户有效性
+     *
+     * @return
+     */
+    boolean updateUserEffective(EffectiveEnquiryParamDto effectiveEnquiryParamDto);
+
+    void specialSendEmail(List<AdwebEnquiry> enquiryList, AdwebSite adwebSite);
 }
 }

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

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -12,6 +13,7 @@ import jakarta.annotation.Resource;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.constant.CacheConstant;
 import org.jeecg.common.constant.CacheConstant;
+import org.jeecg.common.system.vo.DictModel;
 import org.jeecg.common.system.vo.DictPropertyModel;
 import org.jeecg.common.system.vo.DictPropertyModel;
 import org.jeecg.common.util.FastJsonUtil;
 import org.jeecg.common.util.FastJsonUtil;
 import org.jeecg.modules.adweb.common.constant.NumConstant;
 import org.jeecg.modules.adweb.common.constant.NumConstant;
@@ -282,7 +284,7 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
         //特殊站点发送邮件
         //特殊站点发送邮件
         List<DictPropertyModel> siteRes = sysAdwebApiImpl.queryDictInfoByDictCode("turn_inquiry_site_code");
         List<DictPropertyModel> siteRes = sysAdwebApiImpl.queryDictInfoByDictCode("turn_inquiry_site_code");
         if (ListUtil.notEmpty(siteRes) && siteRes.get(0).getValue().equals(adwebSite.getCode())) {
         if (ListUtil.notEmpty(siteRes) && siteRes.get(0).getValue().equals(adwebSite.getCode())) {
-            specialSendEmail(enquiryList, adwebSite, principalEmailMap);
+            specialSendEmail(enquiryList, adwebSite);
         } else {
         } else {
             String emailStr = adwebSite.getEnquiryEmailList();
             String emailStr = adwebSite.getEnquiryEmailList();
             if (StringUtil.isEmpty(emailStr)) {
             if (StringUtil.isEmpty(emailStr)) {
@@ -456,7 +458,7 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
                     }
                     }
                 }
                 }
             }
             }
-            log.info("=======发送询盘邮件======");
+
             log.info("=======发送询盘邮件======");
             log.info("=======发送询盘邮件======");
             enquiryEmailMessageList.forEach(e -> System.out.println(e.getEmail()));
             enquiryEmailMessageList.forEach(e -> System.out.println(e.getEmail()));
             log.info("需要添加的询盘邮件:{}", FastJsonUtil.toJSONString(enquiryEmailMessageList));
             log.info("需要添加的询盘邮件:{}", FastJsonUtil.toJSONString(enquiryEmailMessageList));
@@ -495,9 +497,8 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
      *
      *
      * @param enquiryList
      * @param enquiryList
      * @param adwebSite
      * @param adwebSite
-     * @param principalEmailMap
      */
      */
-    private void specialSendEmail(List<AdwebEnquiry> enquiryList, AdwebSite adwebSite, Map<String, String> principalEmailMap) {
+    public void specialSendEmail(List<AdwebEnquiry> enquiryList, AdwebSite adwebSite) {
         //通过主账号id获取子账号id集合
         //通过主账号id获取子账号id集合
         List<String> idList = masterSubAccountRelationService.getSubAccountIdByMaster(adwebSite.getUid());
         List<String> idList = masterSubAccountRelationService.getSubAccountIdByMaster(adwebSite.getUid());
 
 
@@ -1768,4 +1769,107 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
         List<Integer> siteIds = adwebSiteService.getAllSiteIdByParentId(siteId);
         List<Integer> siteIds = adwebSiteService.getAllSiteIdByParentId(siteId);
         adwebEnquiryMapper.updatePrincipalUidByRegion(siteId, siteIds);
         adwebEnquiryMapper.updatePrincipalUidByRegion(siteId, siteIds);
     }
     }
+
+    /**
+     * 更改询盘用户有效性
+     *
+     * @return
+     */
+    @Override
+    public boolean updateUserEffective(EffectiveEnquiryParamDto effectiveEnquiryParamDto) {
+        String id = effectiveEnquiryParamDto.getId();
+        Integer userEffective = effectiveEnquiryParamDto.getUserEffective();
+        if (userEffective == null || StringUtil.isEmpty(id)) {
+            return false;
+        }
+
+        List<String> idList = Arrays.asList(id.split(","));
+        if (ListUtil.isEmpty(idList)) {
+            return false;
+        }
+
+        UpdateWrapper<AdwebEnquiry> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.in("id", idList);
+        // 用户有效性  0:无效 1:有效   2 : 待定 取自字典表
+        updateWrapper.set("user_effective", userEffective);
+        // 0:不是;1:是
+        if (userEffective.equals(0)) {  // 垃圾询盘
+            String wasteEnquiryType = effectiveEnquiryParamDto.getWasteEnquiryType();
+            String wasteEnquirySeason = effectiveEnquiryParamDto.getWasteEnquirySeason();
+            updateWrapper.set("waste_enquiry", 1);
+            updateWrapper.set("waste_enquiry_type", wasteEnquiryType);
+
+            //特殊处理垃圾询盘是邮箱或者ip
+            if(wasteEnquiryType.equals("ip")){
+                updateWrapper.set("effective_reason", "人工操作-ip-" + wasteEnquirySeason);
+                adwebSiteBlackIpService.addBlackIpByContent(effectiveEnquiryParamDto);
+            }
+            if(wasteEnquiryType.equals("email")){
+                updateWrapper.set("effective_reason", "人工操作-邮箱-" + wasteEnquirySeason);
+                enquirySiteBlackEmailService.addBlackEmailByContent(effectiveEnquiryParamDto);
+            }
+            if(wasteEnquiryType.equals("keyword")){
+                updateWrapper.set("effective_reason", "人工操作-关键词-" + wasteEnquirySeason);
+                adwebSiteEnquiryRuleService.addBlackKeywordByContent(effectiveEnquiryParamDto);
+            }
+            if(wasteEnquiryType.equals("other")){
+                updateWrapper.set("effective_reason", "人工操作-其他-" + wasteEnquirySeason);
+            }
+        } else {  // 有效询盘
+            updateWrapper.set("waste_enquiry", 0);
+            updateWrapper.set("effective_reason", "人工操作");
+            updateWrapper.set("waste_enquiry_type", "");
+        }
+        this.update(updateWrapper);
+
+        if (userEffective.equals(0)) {
+            return true;
+        }
+
+        // 有效询盘发送邮件
+        try {
+            List<AdwebEnquiry> enquiryList = this.list(new LambdaQueryWrapper<AdwebEnquiry>().in(AdwebEnquiry::getId, idList));
+            if (ListUtil.notEmpty(enquiryList)) {
+                AdwebSite adwebSite = adwebSiteService.getOne(new QueryWrapper<AdwebSite>().eq("code", enquiryList.get(0).getSiteCode()));
+                if (adwebSite != null) {
+
+                    Map<String, String> principalEmailMap = new HashMap<>();
+
+                    //判断是否为产品询盘
+                    for (AdwebEnquiry adwebEnquiry : enquiryList) {
+                        if(StringUtils.isNotBlank(adwebEnquiry.getCartItems())){
+                            adwebEnquiry.setExistProductEnquiry(1);  // 产品询盘
+                        }
+                    }
+
+                    // 判断是否为联系我们询盘
+                    for (AdwebEnquiry adwebEnquiry : enquiryList) {
+                        List<DictModel> contactEnquiryWebsites = dictService.queryDictItemsByCode("send_contact_enquiry_website");
+                        List<String> contactEnquiryCodes = contactEnquiryWebsites.stream().map(DictModel::getValue).collect(Collectors.toList());
+                        if (contactEnquiryCodes.contains(adwebSite.getCode())) {
+                            if (StringUtils.isNotBlank(adwebEnquiry.getFromPage()) && adwebEnquiry.getFromPage().contains("contact")) {
+                                adwebEnquiry.setExistContactEnquiry(1);
+                            }
+                        }
+                    }
+
+                    //获取子账户
+                    List<String> subAccountIdList = masterSubAccountRelationService.getSubAccountIdByMaster(String.valueOf(adwebSite.getUid()));
+                    log.info("获取的子账户id:{}", FastJsonUtil.toJSONString(subAccountIdList));
+                    if (ListUtil.notEmpty(subAccountIdList)) {
+                        subAccountIdList.add(String.valueOf(adwebSite.getUid()));
+                        List<SysUser> principalEmailList = sysUserService.list(new QueryWrapper<SysUser>().in("id", subAccountIdList).eq("del_flag", 0).isNotNull("email").ne("email","").select("id", "email"));
+                        if (ListUtil.notEmpty(principalEmailList)) {
+                            principalEmailMap = principalEmailList.stream().collect(Collectors.toMap(SysUser::getId, SysUser::getEmail));
+
+                        }
+                    }
+                    sendValidateEmail(enquiryList, adwebSite, principalEmailMap);
+                }
+            }
+        } catch (Exception e) {
+            log.error("推送发送询盘邮件的消息失败", e);
+        }
+        return true;
+    }
 }
 }

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

@@ -45,5 +45,13 @@ public interface IAdwebSiteService extends IService<AdwebSite> {
      */
      */
     List<Integer> getAllSiteIdBySiteId(Integer siteId);
     List<Integer> getAllSiteIdBySiteId(Integer siteId);
 
 
-    public String getSiteNameByCode(String siteCode);
+    String getSiteNameByCode(String siteCode);
+
+    /**
+     * 根据用户id查询所有未删除的站点
+     *
+     * @param uid 用户id
+     * @return 站点id
+     */
+    List<Integer> getAllSiteIdByUid(String uid);
 }
 }

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

@@ -17,6 +17,7 @@ import org.jeecg.modules.adweb.site.entity.AdwebSite;
 import org.jeecg.modules.adweb.site.entity.AdwebUserWpsite;
 import org.jeecg.modules.adweb.site.entity.AdwebUserWpsite;
 import org.jeecg.modules.adweb.site.mapper.AdwebSiteMapper;
 import org.jeecg.modules.adweb.site.mapper.AdwebSiteMapper;
 import org.jeecg.modules.adweb.site.service.IAdwebSiteService;
 import org.jeecg.modules.adweb.site.service.IAdwebSiteService;
+import org.jeecg.modules.adweb.site.service.ISiteUserPermissionService;
 import org.jeecg.modules.system.mapper.SysUserRoleMapper;
 import org.jeecg.modules.system.mapper.SysUserRoleMapper;
 import org.jeecg.modules.adweb.site.service.IAdwebUserWpsiteService;
 import org.jeecg.modules.adweb.site.service.IAdwebUserWpsiteService;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
@@ -44,6 +45,9 @@ public class AdwebSiteServiceImpl extends ServiceImpl<AdwebSiteMapper, AdwebSite
     @Autowired
     @Autowired
     private IAdwebUserWpsiteService adwebUserWpsiteService;
     private IAdwebUserWpsiteService adwebUserWpsiteService;
 
 
+    @Autowired
+    private ISiteUserPermissionService siteUserPermissionService;
+
     private final RedisUtil redisUtil;
     private final RedisUtil redisUtil;
 
 
     public AdwebSiteServiceImpl(RedisUtil redisUtil) {
     public AdwebSiteServiceImpl(RedisUtil redisUtil) {
@@ -196,4 +200,28 @@ public class AdwebSiteServiceImpl extends ServiceImpl<AdwebSiteMapper, AdwebSite
         }
         }
         return "";
         return "";
     }
     }
+
+    /**
+     * 根据用户id查询所有未删除的站点
+     *
+     * @param uid 用户id
+     * @return 站点id
+     */
+    @Override
+    public List<Integer> getAllSiteIdByUid(String uid) {
+        List<AdwebSite> siteList = null;
+        try {
+            List<String> codeList = siteUserPermissionService.getSiteCodeList(uid);
+            siteList = this.list(new LambdaQueryWrapper<AdwebSite>()
+                    .ne(AdwebSite::getStatus, 0).in(AdwebSite::getCode, codeList));
+        } catch (Exception e) {
+            log.error("查询用户站点失败");
+        }
+
+        List<Integer> siteIds = new ArrayList<>();
+        for (AdwebSite site : siteList) {
+            siteIds.add(site.getId());
+        }
+        return siteIds;
+    }
 }
 }

+ 0 - 37
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/userCountry/controller/AdwebUserCountryController.java

@@ -187,43 +187,6 @@ public class AdwebUserCountryController extends JeecgController<AdwebUserCountry
     }
     }
 
 
     /**
     /**
-     * 获取转发子账户列表
-     */
-    @GetMapping(value = "/otherSubAccounts/options")
-    public Result<?> otherSubAccounts(Integer siteId) {
-        LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        // 获取主账户uid
-        if (siteId == null) {
-            return Result.OK(new ArrayList<SubUser>());
-        }
-        AdwebSite site = adwebSiteService.getById(siteId);
-        String uid = site.getUid();
-
-        // 获取子账户列表
-        List<SubUser> list = adwebUserCountryMapper.getSubUserOptions(uid);
-        // 如果子账户不为空,将主账户也加进去作为选项
-        if (ListUtil.notEmpty(list)) {
-            SysUser masterAccount = sysUserService.getById(uid);
-            SubUser user = new SubUser();
-            user.setId(masterAccount.getId());
-            user.setUsername(masterAccount.getRealname());
-            list.add(0, user);
-        }
-
-
-        return Result.OK(list);
-    }
-    /**
-     * 获取子账户列表
-     */
-    @GetMapping(value = "/subAccounts/optionswithoutself")
-    public Result<?> optionswithoutself() {
-        LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        List<SubUser> list = adwebUserCountryMapper.getSubUserOptions(loginUser.getId());
-        return Result.OK(list);
-    }
-
-    /**
      * 获取子账户负责的国家
      * 获取子账户负责的国家
      */
      */
     @GetMapping(value = "/country/charge")
     @GetMapping(value = "/country/charge")