|
@@ -4,12 +4,16 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
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.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
@@ -44,35 +48,30 @@ import java.util.stream.Collectors;
|
|
|
@RestController
|
|
|
@RequestMapping("/adweb/enquirySiteBlackEmail")
|
|
|
@Slf4j
|
|
|
-public class AdwebSiteBlackEmailController extends JeecgController<AdwebSiteBlackEmail, IAdwebSiteBlackEmailService> {
|
|
|
-
|
|
|
- @Resource
|
|
|
- private IAdwebSiteBlackEmailService enquirySiteBlackEmailService;
|
|
|
+public class AdwebSiteBlackEmailController
|
|
|
+ extends JeecgController<AdwebSiteBlackEmail, IAdwebSiteBlackEmailService> {
|
|
|
|
|
|
- @Resource
|
|
|
- private AdwebRedisUtil adwebRedisUtil;
|
|
|
+ @Resource private IAdwebSiteBlackEmailService enquirySiteBlackEmailService;
|
|
|
|
|
|
- @Resource
|
|
|
- private SysAdwebApi sysAdwebApi;
|
|
|
+ @Resource private AdwebRedisUtil adwebRedisUtil;
|
|
|
|
|
|
- @Resource
|
|
|
- private IAdwebSiteService adwebSiteService;
|
|
|
- @Resource
|
|
|
- private ISiteUserPermissionService siteUserPermissionService;
|
|
|
- @Resource
|
|
|
- private IAdwebPublicBlackEmailService enquiryPublicBlackEmailService;
|
|
|
- @Resource
|
|
|
- private IAdwebEnquiryBlacklistService adwebEnquiryBlacklistService;
|
|
|
+ @Resource private SysAdwebApi sysAdwebApi;
|
|
|
|
|
|
+ @Resource private IAdwebSiteService adwebSiteService;
|
|
|
+ @Resource private ISiteUserPermissionService siteUserPermissionService;
|
|
|
+ @Resource private IAdwebPublicBlackEmailService enquiryPublicBlackEmailService;
|
|
|
+ @Resource private IAdwebEnquiryBlacklistService adwebEnquiryBlacklistService;
|
|
|
|
|
|
private static final String SiteBlackEmailKey = "SITE_BLACK_EMAIL_LIST";
|
|
|
private static final String SiteWhiteEmailListKey = "SITE_WHITE_EMAIL_LIST";
|
|
|
private static final String SiteEmailTenMinKey = "JUDGE_WASTE_SITE_ENQUIRY_EMAIL_BY_10_MIN::";
|
|
|
private static final String SiteEmailOneDayKey = "JUDGE_WASTE_SITE_ENQUIRY_EMAIL_BY_ONE_DAY::";
|
|
|
- private static final String NotBlackEmailWasteSiteEnquiryKey = "NOT_BLACK_EMAIL_WASTE_SITE_ENQUIRY_MAP::";
|
|
|
+ private static final String NotBlackEmailWasteSiteEnquiryKey =
|
|
|
+ "NOT_BLACK_EMAIL_WASTE_SITE_ENQUIRY_MAP::";
|
|
|
// 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 NotBlackEmailWasteEnquiryKey = "NOT_BLACK_EMAIL_WASTE_ENQUIRY_MAP::";
|
|
|
+ // private static final String EmailOneDayKey = "JUDGE_WASTE_ENQUIRY_EMAIL_BY_ONE_DAY::";
|
|
|
+ // private static final String NotBlackEmailWasteEnquiryKey =
|
|
|
+ // "NOT_BLACK_EMAIL_WASTE_ENQUIRY_MAP::";
|
|
|
private static final String BlackEmailKey = "BLACK_EMAIL_LIST";
|
|
|
|
|
|
/**
|
|
@@ -87,10 +86,11 @@ public class AdwebSiteBlackEmailController extends JeecgController<AdwebSiteBlac
|
|
|
@AutoLog(value = "adweb_site_black_email-分页列表查询")
|
|
|
@Operation(summary = "adweb_site_black_email-分页列表查询")
|
|
|
@GetMapping(value = "/list")
|
|
|
- public Result<?> queryPageList(AdwebSiteBlackEmail enquirySiteBlackEmail,
|
|
|
- @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
- @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
- HttpServletRequest req) {
|
|
|
+ public Result<?> queryPageList(
|
|
|
+ AdwebSiteBlackEmail enquirySiteBlackEmail,
|
|
|
+ @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
Page<AdwebSiteBlackEmail> page = new Page<AdwebSiteBlackEmail>(pageNo, pageSize);
|
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
List<String> codeList = null;
|
|
@@ -112,24 +112,33 @@ public class AdwebSiteBlackEmailController extends JeecgController<AdwebSiteBlac
|
|
|
String siteCode = adwebSiteService.getSiteCodeById(enquirySiteBlackEmail.getSiteId());
|
|
|
if (StringUtils.isNotBlank(siteCode)) {
|
|
|
LambdaQueryWrapper<AdwebSite> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq(AdwebSite::getId, enquirySiteBlackEmail.getSiteId()).or().eq(AdwebSite::getParentGroupCode, siteCode);
|
|
|
+ queryWrapper
|
|
|
+ .eq(AdwebSite::getId, enquirySiteBlackEmail.getSiteId())
|
|
|
+ .or()
|
|
|
+ .eq(AdwebSite::getParentGroupCode, siteCode);
|
|
|
queryWrapper.ne(AdwebSite::getStatus, 0);
|
|
|
queryWrapper.in(!sysAdwebApi.isAdmin(), AdwebSite::getCode, siteCodeList);
|
|
|
- codeList = adwebSiteService.list(queryWrapper).stream().map(AdwebSite::getCode).collect(Collectors.toList());
|
|
|
+ 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<AdwebSiteBlackEmail> pageList = enquirySiteBlackEmailService.pageList(page, enquirySiteBlackEmail, codeList, column, order);
|
|
|
+ IPage<AdwebSiteBlackEmail> pageList =
|
|
|
+ enquirySiteBlackEmailService.pageList(
|
|
|
+ page, enquirySiteBlackEmail, codeList, column, order);
|
|
|
List<AdwebSiteBlackEmail> record = pageList.getRecords();
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(record)) {
|
|
|
for (AdwebSiteBlackEmail enquirySiteBlackEmail1 : record) {
|
|
|
if (enquirySiteBlackEmail1.getType().equals("0")) {
|
|
|
if (enquirySiteBlackEmail1.getWasteGeneralEnquiryNum() != null) {
|
|
|
- enquirySiteBlackEmail1.setWasteEnquiryNum(enquirySiteBlackEmail1.getWasteGeneralEnquiryNum());
|
|
|
+ enquirySiteBlackEmail1.setWasteEnquiryNum(
|
|
|
+ enquirySiteBlackEmail1.getWasteGeneralEnquiryNum());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -153,22 +162,38 @@ public class AdwebSiteBlackEmailController extends JeecgController<AdwebSiteBlac
|
|
|
return Result.error("邮箱不能为空");
|
|
|
}
|
|
|
|
|
|
- //将邮箱转换为小写
|
|
|
+ // 将邮箱转换为小写
|
|
|
enquirySiteBlackEmail.setEmail(enquirySiteBlackEmail.getEmail().trim().toLowerCase());
|
|
|
|
|
|
- int count = (int) enquirySiteBlackEmailService.count(new LambdaQueryWrapper<AdwebSiteBlackEmail>().ne(AdwebSiteBlackEmail::getStatus, 0).eq(AdwebSiteBlackEmail::getEmail, enquirySiteBlackEmail.getEmail())
|
|
|
- .eq(AdwebSiteBlackEmail::getSiteId, enquirySiteBlackEmail.getSiteId()).eq(AdwebSiteBlackEmail::getType, enquirySiteBlackEmail.getType()));
|
|
|
+ int count =
|
|
|
+ (int)
|
|
|
+ enquirySiteBlackEmailService.count(
|
|
|
+ new LambdaQueryWrapper<AdwebSiteBlackEmail>()
|
|
|
+ .ne(AdwebSiteBlackEmail::getStatus, 0)
|
|
|
+ .eq(
|
|
|
+ AdwebSiteBlackEmail::getEmail,
|
|
|
+ enquirySiteBlackEmail.getEmail())
|
|
|
+ .eq(
|
|
|
+ AdwebSiteBlackEmail::getSiteId,
|
|
|
+ enquirySiteBlackEmail.getSiteId())
|
|
|
+ .eq(
|
|
|
+ AdwebSiteBlackEmail::getType,
|
|
|
+ enquirySiteBlackEmail.getType()));
|
|
|
|
|
|
if (count > 0) {
|
|
|
return Result.error("邮箱已存在");
|
|
|
}
|
|
|
|
|
|
- //判断站点询盘黑名单是否存在添加进来的黑名单
|
|
|
- LambdaQueryWrapper<AdwebEnquiryBlacklist> adwebEnquiryBlacklistQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- adwebEnquiryBlacklistQueryWrapper.eq(AdwebEnquiryBlacklist::getSiteId, enquirySiteBlackEmail.getSiteId());
|
|
|
+ // 判断站点询盘黑名单是否存在添加进来的黑名单
|
|
|
+ LambdaQueryWrapper<AdwebEnquiryBlacklist> adwebEnquiryBlacklistQueryWrapper =
|
|
|
+ new LambdaQueryWrapper<>();
|
|
|
+ adwebEnquiryBlacklistQueryWrapper.eq(
|
|
|
+ AdwebEnquiryBlacklist::getSiteId, enquirySiteBlackEmail.getSiteId());
|
|
|
adwebEnquiryBlacklistQueryWrapper.eq(AdwebEnquiryBlacklist::getStatus, 1);
|
|
|
- adwebEnquiryBlacklistQueryWrapper.eq(AdwebEnquiryBlacklist::getEmail, enquirySiteBlackEmail.getEmail());
|
|
|
- List<AdwebEnquiryBlacklist> enquiryBlacklists = adwebEnquiryBlacklistService.list(adwebEnquiryBlacklistQueryWrapper);
|
|
|
+ adwebEnquiryBlacklistQueryWrapper.eq(
|
|
|
+ AdwebEnquiryBlacklist::getEmail, enquirySiteBlackEmail.getEmail());
|
|
|
+ List<AdwebEnquiryBlacklist> enquiryBlacklists =
|
|
|
+ adwebEnquiryBlacklistService.list(adwebEnquiryBlacklistQueryWrapper);
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(enquiryBlacklists)) {
|
|
|
return Result.error("在拒收的邮箱黑名单中已存在!");
|
|
@@ -178,20 +203,28 @@ public class AdwebSiteBlackEmailController extends JeecgController<AdwebSiteBlac
|
|
|
enquirySiteBlackEmail.setCreateTime(new Date());
|
|
|
enquirySiteBlackEmailService.save(enquirySiteBlackEmail);
|
|
|
|
|
|
- Map<String, List<String>> enquirySiteBlackEmailListMap = enquirySiteBlackEmailService.getSiteBlackEmailListBySiteId(enquirySiteBlackEmail.getSiteId());
|
|
|
+ Map<String, List<String>> enquirySiteBlackEmailListMap =
|
|
|
+ enquirySiteBlackEmailService.getSiteBlackEmailListBySiteId(
|
|
|
+ enquirySiteBlackEmail.getSiteId());
|
|
|
List<String> emailList = enquirySiteBlackEmailListMap.get("black");
|
|
|
List<String> whiteEmailList = enquirySiteBlackEmailListMap.get("white");
|
|
|
|
|
|
- //处理对应站点的黑名单
|
|
|
+ // 处理对应站点的黑名单
|
|
|
if (CollectionUtils.isNotEmpty(emailList)) {
|
|
|
- adwebRedisUtil.set(SiteBlackEmailKey + "::" + enquirySiteBlackEmail.getSiteId(), emailList, 60 * 60 * 24);
|
|
|
+ adwebRedisUtil.set(
|
|
|
+ SiteBlackEmailKey + "::" + enquirySiteBlackEmail.getSiteId(),
|
|
|
+ emailList,
|
|
|
+ 60 * 60 * 24);
|
|
|
} else {
|
|
|
adwebRedisUtil.del(SiteBlackEmailKey + "::" + enquirySiteBlackEmail.getSiteId());
|
|
|
}
|
|
|
|
|
|
- //处理对应站点的白名单
|
|
|
+ // 处理对应站点的白名单
|
|
|
if (CollectionUtils.isNotEmpty(whiteEmailList)) {
|
|
|
- adwebRedisUtil.set(SiteWhiteEmailListKey + "::" + enquirySiteBlackEmail.getSiteId(), whiteEmailList, 60 * 60 * 24);
|
|
|
+ adwebRedisUtil.set(
|
|
|
+ SiteWhiteEmailListKey + "::" + enquirySiteBlackEmail.getSiteId(),
|
|
|
+ whiteEmailList,
|
|
|
+ 60 * 60 * 24);
|
|
|
} else {
|
|
|
adwebRedisUtil.del(SiteWhiteEmailListKey + "::" + enquirySiteBlackEmail.getSiteId());
|
|
|
}
|
|
@@ -214,32 +247,60 @@ public class AdwebSiteBlackEmailController extends JeecgController<AdwebSiteBlac
|
|
|
return Result.error("邮箱不能为空");
|
|
|
}
|
|
|
|
|
|
- //将邮箱转换为小写
|
|
|
+ // 将邮箱转换为小写
|
|
|
enquirySiteBlackEmail.setEmail(enquirySiteBlackEmail.getEmail().trim().toLowerCase());
|
|
|
|
|
|
- int count = (int) enquirySiteBlackEmailService.count(new LambdaQueryWrapper<AdwebSiteBlackEmail>().ne(AdwebSiteBlackEmail::getStatus, 0).eq(AdwebSiteBlackEmail::getEmail, enquirySiteBlackEmail.getEmail()).eq(AdwebSiteBlackEmail::getSiteId, enquirySiteBlackEmail.getSiteId()).eq(AdwebSiteBlackEmail::getBlackOrWhite, enquirySiteBlackEmail.getBlackOrWhite()).ne(AdwebSiteBlackEmail::getId, enquirySiteBlackEmail.getId()));
|
|
|
+ int count =
|
|
|
+ (int)
|
|
|
+ enquirySiteBlackEmailService.count(
|
|
|
+ new LambdaQueryWrapper<AdwebSiteBlackEmail>()
|
|
|
+ .ne(AdwebSiteBlackEmail::getStatus, 0)
|
|
|
+ .eq(
|
|
|
+ AdwebSiteBlackEmail::getEmail,
|
|
|
+ enquirySiteBlackEmail.getEmail())
|
|
|
+ .eq(
|
|
|
+ AdwebSiteBlackEmail::getSiteId,
|
|
|
+ enquirySiteBlackEmail.getSiteId())
|
|
|
+ .eq(
|
|
|
+ AdwebSiteBlackEmail::getBlackOrWhite,
|
|
|
+ enquirySiteBlackEmail.getBlackOrWhite())
|
|
|
+ .ne(
|
|
|
+ AdwebSiteBlackEmail::getId,
|
|
|
+ enquirySiteBlackEmail.getId()));
|
|
|
|
|
|
if (count > 0) {
|
|
|
return Result.error("邮箱已存在");
|
|
|
}
|
|
|
|
|
|
- //判断站点询盘黑名单是否存在添加进来的黑名单
|
|
|
- LambdaQueryWrapper<AdwebEnquiryBlacklist> adwebEnquiryBlacklistQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- adwebEnquiryBlacklistQueryWrapper.eq(AdwebEnquiryBlacklist::getSiteId, enquirySiteBlackEmail.getSiteId());
|
|
|
+ // 判断站点询盘黑名单是否存在添加进来的黑名单
|
|
|
+ LambdaQueryWrapper<AdwebEnquiryBlacklist> adwebEnquiryBlacklistQueryWrapper =
|
|
|
+ new LambdaQueryWrapper<>();
|
|
|
+ adwebEnquiryBlacklistQueryWrapper.eq(
|
|
|
+ AdwebEnquiryBlacklist::getSiteId, enquirySiteBlackEmail.getSiteId());
|
|
|
adwebEnquiryBlacklistQueryWrapper.eq(AdwebEnquiryBlacklist::getStatus, 1);
|
|
|
- adwebEnquiryBlacklistQueryWrapper.eq(AdwebEnquiryBlacklist::getEmail, enquirySiteBlackEmail.getEmail());
|
|
|
- List<AdwebEnquiryBlacklist> enquiryBlacklists = adwebEnquiryBlacklistService.list(adwebEnquiryBlacklistQueryWrapper);
|
|
|
+ adwebEnquiryBlacklistQueryWrapper.eq(
|
|
|
+ AdwebEnquiryBlacklist::getEmail, enquirySiteBlackEmail.getEmail());
|
|
|
+ List<AdwebEnquiryBlacklist> enquiryBlacklists =
|
|
|
+ adwebEnquiryBlacklistService.list(adwebEnquiryBlacklistQueryWrapper);
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(enquiryBlacklists)) {
|
|
|
return Result.error("在拒收的邮箱黑名单中已存在!");
|
|
|
}
|
|
|
|
|
|
- AdwebSiteBlackEmail oldAdwebSiteBlackEmail = enquirySiteBlackEmailService.getById(enquirySiteBlackEmail.getId());
|
|
|
+ AdwebSiteBlackEmail oldAdwebSiteBlackEmail =
|
|
|
+ enquirySiteBlackEmailService.getById(enquirySiteBlackEmail.getId());
|
|
|
|
|
|
- //判断公共询盘缓存的是否包含历史的黑名单数据
|
|
|
+ // 判断公共询盘缓存的是否包含历史的黑名单数据
|
|
|
if (!oldAdwebSiteBlackEmail.getEmail().equals(enquirySiteBlackEmail.getEmail())) {
|
|
|
- List<AdwebPublicBlackEmail> emailList = enquiryPublicBlackEmailService.list(new LambdaQueryWrapper<AdwebPublicBlackEmail>().eq(AdwebPublicBlackEmail::getStatus, 1).eq(AdwebPublicBlackEmail::getBlackOrWhite, 0));
|
|
|
- List<String> pubicBlackEmailList = emailList.stream().map(AdwebPublicBlackEmail::getEmail).collect(Collectors.toList());
|
|
|
+ List<AdwebPublicBlackEmail> emailList =
|
|
|
+ enquiryPublicBlackEmailService.list(
|
|
|
+ new LambdaQueryWrapper<AdwebPublicBlackEmail>()
|
|
|
+ .eq(AdwebPublicBlackEmail::getStatus, 1)
|
|
|
+ .eq(AdwebPublicBlackEmail::getBlackOrWhite, 0));
|
|
|
+ List<String> pubicBlackEmailList =
|
|
|
+ emailList.stream()
|
|
|
+ .map(AdwebPublicBlackEmail::getEmail)
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
|
List<String> publicBlackList = (List<String>) adwebRedisUtil.get(BlackEmailKey);
|
|
|
|
|
@@ -263,53 +324,72 @@ public class AdwebSiteBlackEmailController extends JeecgController<AdwebSiteBlac
|
|
|
enquirySiteBlackEmail.setUpdateTime(new Date());
|
|
|
enquirySiteBlackEmailService.updateById(enquirySiteBlackEmail);
|
|
|
|
|
|
- LambdaQueryWrapper<AdwebSiteBlackEmail> siteAllEmailQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ LambdaQueryWrapper<AdwebSiteBlackEmail> siteAllEmailQueryWrapper =
|
|
|
+ new LambdaQueryWrapper<>();
|
|
|
siteAllEmailQueryWrapper.ne(AdwebSiteBlackEmail::getStatus, 0);
|
|
|
- siteAllEmailQueryWrapper.eq(AdwebSiteBlackEmail::getSiteId, enquirySiteBlackEmail.getSiteId());
|
|
|
- List<AdwebSiteBlackEmail> allEmailList = enquirySiteBlackEmailService.list(siteAllEmailQueryWrapper);
|
|
|
+ siteAllEmailQueryWrapper.eq(
|
|
|
+ AdwebSiteBlackEmail::getSiteId, enquirySiteBlackEmail.getSiteId());
|
|
|
+ List<AdwebSiteBlackEmail> allEmailList =
|
|
|
+ enquirySiteBlackEmailService.list(siteAllEmailQueryWrapper);
|
|
|
if (CollectionUtils.isEmpty(allEmailList)) {
|
|
|
log.info("未获取到对应站点的黑白名单数据");
|
|
|
}
|
|
|
|
|
|
- Map<String, List<String>> enquirySiteBlackEmailListMap = enquirySiteBlackEmailService.getSiteBlackEmailListBySiteId(enquirySiteBlackEmail.getSiteId());
|
|
|
+ Map<String, List<String>> enquirySiteBlackEmailListMap =
|
|
|
+ enquirySiteBlackEmailService.getSiteBlackEmailListBySiteId(
|
|
|
+ enquirySiteBlackEmail.getSiteId());
|
|
|
List<String> emailList = enquirySiteBlackEmailListMap.get("black");
|
|
|
List<String> whiteEmailList = enquirySiteBlackEmailListMap.get("white");
|
|
|
|
|
|
- //处理对应站点的黑名单
|
|
|
+ // 处理对应站点的黑名单
|
|
|
if (CollectionUtils.isNotEmpty(emailList)) {
|
|
|
- adwebRedisUtil.set(SiteBlackEmailKey + "::" + enquirySiteBlackEmail.getSiteId(), emailList, 60 * 60 * 24);
|
|
|
+ adwebRedisUtil.set(
|
|
|
+ SiteBlackEmailKey + "::" + enquirySiteBlackEmail.getSiteId(),
|
|
|
+ emailList,
|
|
|
+ 60 * 60 * 24);
|
|
|
} else {
|
|
|
adwebRedisUtil.del(SiteBlackEmailKey + "::" + enquirySiteBlackEmail.getSiteId());
|
|
|
}
|
|
|
|
|
|
- //处理对应站点的白名单
|
|
|
+ // 处理对应站点的白名单
|
|
|
if (CollectionUtils.isNotEmpty(whiteEmailList)) {
|
|
|
- adwebRedisUtil.set(SiteWhiteEmailListKey + "::" + enquirySiteBlackEmail.getSiteId(), whiteEmailList, 60 * 60 * 24);
|
|
|
+ adwebRedisUtil.set(
|
|
|
+ SiteWhiteEmailListKey + "::" + enquirySiteBlackEmail.getSiteId(),
|
|
|
+ whiteEmailList,
|
|
|
+ 60 * 60 * 24);
|
|
|
} else {
|
|
|
adwebRedisUtil.del(SiteWhiteEmailListKey + "::" + enquirySiteBlackEmail.getSiteId());
|
|
|
}
|
|
|
|
|
|
- //处理站点改变的数据缓存
|
|
|
+ // 处理站点改变的数据缓存
|
|
|
if (!oldAdwebSiteBlackEmail.getSiteId().equals(enquirySiteBlackEmail.getSiteId())) {
|
|
|
- Map<String, List<String>> oldAdwebSiteBlackEmailListMap = enquirySiteBlackEmailService.getSiteBlackEmailListBySiteId(oldAdwebSiteBlackEmail.getSiteId());
|
|
|
+ Map<String, List<String>> oldAdwebSiteBlackEmailListMap =
|
|
|
+ enquirySiteBlackEmailService.getSiteBlackEmailListBySiteId(
|
|
|
+ oldAdwebSiteBlackEmail.getSiteId());
|
|
|
List<String> oldEmailList = oldAdwebSiteBlackEmailListMap.get("black");
|
|
|
List<String> oldWhiteEmailList = oldAdwebSiteBlackEmailListMap.get("white");
|
|
|
- //处理对应站点的黑名单
|
|
|
+ // 处理对应站点的黑名单
|
|
|
if (CollectionUtils.isNotEmpty(oldEmailList)) {
|
|
|
- adwebRedisUtil.set(SiteBlackEmailKey + "::" + oldAdwebSiteBlackEmail.getSiteId(), oldEmailList, 60 * 60 * 24);
|
|
|
+ adwebRedisUtil.set(
|
|
|
+ SiteBlackEmailKey + "::" + oldAdwebSiteBlackEmail.getSiteId(),
|
|
|
+ oldEmailList,
|
|
|
+ 60 * 60 * 24);
|
|
|
} else {
|
|
|
adwebRedisUtil.del(SiteBlackEmailKey + "::" + oldAdwebSiteBlackEmail.getSiteId());
|
|
|
}
|
|
|
|
|
|
- //处理对应站点的白名单
|
|
|
+ // 处理对应站点的白名单
|
|
|
if (CollectionUtils.isNotEmpty(oldWhiteEmailList)) {
|
|
|
- adwebRedisUtil.set(SiteWhiteEmailListKey + "::" + oldAdwebSiteBlackEmail.getSiteId(), oldWhiteEmailList, 60 * 60 * 24);
|
|
|
+ adwebRedisUtil.set(
|
|
|
+ SiteWhiteEmailListKey + "::" + oldAdwebSiteBlackEmail.getSiteId(),
|
|
|
+ oldWhiteEmailList,
|
|
|
+ 60 * 60 * 24);
|
|
|
} else {
|
|
|
- adwebRedisUtil.del(SiteWhiteEmailListKey + "::" + oldAdwebSiteBlackEmail.getSiteId());
|
|
|
+ adwebRedisUtil.del(
|
|
|
+ SiteWhiteEmailListKey + "::" + oldAdwebSiteBlackEmail.getSiteId());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
return Result.OK("编辑成功!");
|
|
|
}
|
|
|
|
|
@@ -333,9 +413,16 @@ public class AdwebSiteBlackEmailController extends JeecgController<AdwebSiteBlac
|
|
|
return Result.error("未找到对应数据");
|
|
|
}
|
|
|
|
|
|
- //判断公共询盘缓存的是否包含历史的黑名单数据
|
|
|
- List<AdwebPublicBlackEmail> pubicEmailList = enquiryPublicBlackEmailService.list(new LambdaQueryWrapper<AdwebPublicBlackEmail>().eq(AdwebPublicBlackEmail::getStatus, 1).eq(AdwebPublicBlackEmail::getBlackOrWhite, 0));
|
|
|
- List<String> pubicBlackEmailList = pubicEmailList.stream().map(AdwebPublicBlackEmail::getEmail).collect(Collectors.toList());
|
|
|
+ // 判断公共询盘缓存的是否包含历史的黑名单数据
|
|
|
+ List<AdwebPublicBlackEmail> pubicEmailList =
|
|
|
+ enquiryPublicBlackEmailService.list(
|
|
|
+ new LambdaQueryWrapper<AdwebPublicBlackEmail>()
|
|
|
+ .eq(AdwebPublicBlackEmail::getStatus, 1)
|
|
|
+ .eq(AdwebPublicBlackEmail::getBlackOrWhite, 0));
|
|
|
+ List<String> pubicBlackEmailList =
|
|
|
+ pubicEmailList.stream()
|
|
|
+ .map(AdwebPublicBlackEmail::getEmail)
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
|
List<String> publicBlackList = (List<String>) adwebRedisUtil.get(BlackEmailKey);
|
|
|
|
|
@@ -362,14 +449,29 @@ public class AdwebSiteBlackEmailController extends JeecgController<AdwebSiteBlac
|
|
|
enquirySiteBlackEmail.setUpdateTime(new Date());
|
|
|
enquirySiteBlackEmailService.updateById(enquirySiteBlackEmail);
|
|
|
|
|
|
- adwebRedisUtil.del(SiteEmailTenMinKey + enquirySiteBlackEmail.getSiteId() + "::" + enquirySiteBlackEmail.getEmail());
|
|
|
- adwebRedisUtil.del(SiteEmailOneDayKey + enquirySiteBlackEmail.getSiteId() + "::" + enquirySiteBlackEmail.getEmail());
|
|
|
- adwebRedisUtil.del(NotBlackEmailWasteSiteEnquiryKey + enquirySiteBlackEmail.getSiteId() + "::" + enquirySiteBlackEmail.getEmail());
|
|
|
-
|
|
|
- LambdaQueryWrapper<AdwebSiteBlackEmail> siteAllEmailQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ adwebRedisUtil.del(
|
|
|
+ SiteEmailTenMinKey
|
|
|
+ + enquirySiteBlackEmail.getSiteId()
|
|
|
+ + "::"
|
|
|
+ + enquirySiteBlackEmail.getEmail());
|
|
|
+ adwebRedisUtil.del(
|
|
|
+ SiteEmailOneDayKey
|
|
|
+ + enquirySiteBlackEmail.getSiteId()
|
|
|
+ + "::"
|
|
|
+ + enquirySiteBlackEmail.getEmail());
|
|
|
+ adwebRedisUtil.del(
|
|
|
+ NotBlackEmailWasteSiteEnquiryKey
|
|
|
+ + enquirySiteBlackEmail.getSiteId()
|
|
|
+ + "::"
|
|
|
+ + enquirySiteBlackEmail.getEmail());
|
|
|
+
|
|
|
+ LambdaQueryWrapper<AdwebSiteBlackEmail> siteAllEmailQueryWrapper =
|
|
|
+ new LambdaQueryWrapper<>();
|
|
|
siteAllEmailQueryWrapper.ne(AdwebSiteBlackEmail::getStatus, 0);
|
|
|
- siteAllEmailQueryWrapper.eq(AdwebSiteBlackEmail::getSiteId, enquirySiteBlackEmail.getSiteId());
|
|
|
- List<AdwebSiteBlackEmail> allEmailList = enquirySiteBlackEmailService.list(siteAllEmailQueryWrapper);
|
|
|
+ siteAllEmailQueryWrapper.eq(
|
|
|
+ AdwebSiteBlackEmail::getSiteId, enquirySiteBlackEmail.getSiteId());
|
|
|
+ List<AdwebSiteBlackEmail> allEmailList =
|
|
|
+ enquirySiteBlackEmailService.list(siteAllEmailQueryWrapper);
|
|
|
if (CollectionUtils.isEmpty(allEmailList)) {
|
|
|
log.info("未获取到对应站点的黑白名单数据");
|
|
|
}
|
|
@@ -393,16 +495,22 @@ public class AdwebSiteBlackEmailController extends JeecgController<AdwebSiteBlac
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- //处理对应站点的黑名单
|
|
|
+ // 处理对应站点的黑名单
|
|
|
if (CollectionUtils.isNotEmpty(emailList)) {
|
|
|
- adwebRedisUtil.set(SiteBlackEmailKey + "::" + enquirySiteBlackEmail.getSiteId(), emailList, 60 * 60 * 24);
|
|
|
+ adwebRedisUtil.set(
|
|
|
+ SiteBlackEmailKey + "::" + enquirySiteBlackEmail.getSiteId(),
|
|
|
+ emailList,
|
|
|
+ 60 * 60 * 24);
|
|
|
} else {
|
|
|
adwebRedisUtil.del(SiteBlackEmailKey + "::" + enquirySiteBlackEmail.getSiteId());
|
|
|
}
|
|
|
|
|
|
- //处理对应站点的白名单
|
|
|
+ // 处理对应站点的白名单
|
|
|
if (CollectionUtils.isNotEmpty(whiteEmailList)) {
|
|
|
- adwebRedisUtil.set(SiteWhiteEmailListKey + "::" + enquirySiteBlackEmail.getSiteId(), whiteEmailList, 60 * 60 * 24);
|
|
|
+ adwebRedisUtil.set(
|
|
|
+ SiteWhiteEmailListKey + "::" + enquirySiteBlackEmail.getSiteId(),
|
|
|
+ whiteEmailList,
|
|
|
+ 60 * 60 * 24);
|
|
|
} else {
|
|
|
adwebRedisUtil.del(SiteWhiteEmailListKey + "::" + enquirySiteBlackEmail.getSiteId());
|
|
|
}
|
|
@@ -428,21 +536,36 @@ public class AdwebSiteBlackEmailController extends JeecgController<AdwebSiteBlac
|
|
|
|
|
|
List<String> idList = Arrays.asList(ids.split(","));
|
|
|
|
|
|
- List<AdwebSiteBlackEmail> list = enquirySiteBlackEmailService.list(new LambdaQueryWrapper<AdwebSiteBlackEmail>().in(AdwebSiteBlackEmail::getId, idList).ne(AdwebSiteBlackEmail::getStatus, 0));
|
|
|
+ List<AdwebSiteBlackEmail> list =
|
|
|
+ enquirySiteBlackEmailService.list(
|
|
|
+ new LambdaQueryWrapper<AdwebSiteBlackEmail>()
|
|
|
+ .in(AdwebSiteBlackEmail::getId, idList)
|
|
|
+ .ne(AdwebSiteBlackEmail::getStatus, 0));
|
|
|
|
|
|
if (list.isEmpty()) {
|
|
|
return Result.error("未找到对应数据");
|
|
|
}
|
|
|
|
|
|
- boolean update = enquirySiteBlackEmailService.update(new LambdaUpdateWrapper<AdwebSiteBlackEmail>().in(AdwebSiteBlackEmail::getId, idList).set(AdwebSiteBlackEmail::getStatus, 0));
|
|
|
+ boolean update =
|
|
|
+ enquirySiteBlackEmailService.update(
|
|
|
+ new LambdaUpdateWrapper<AdwebSiteBlackEmail>()
|
|
|
+ .in(AdwebSiteBlackEmail::getId, idList)
|
|
|
+ .set(AdwebSiteBlackEmail::getStatus, 0));
|
|
|
|
|
|
HashSet<Integer> siteList = new HashSet<>();
|
|
|
- //删除redis中的数据
|
|
|
+ // 删除redis中的数据
|
|
|
for (AdwebSiteBlackEmail enquirySiteBlackEmail : list) {
|
|
|
|
|
|
- //判断公共询盘缓存的是否包含历史的黑名单数据
|
|
|
- List<AdwebPublicBlackEmail> pubicEmailList = enquiryPublicBlackEmailService.list(new LambdaQueryWrapper<AdwebPublicBlackEmail>().eq(AdwebPublicBlackEmail::getStatus, 1).eq(AdwebPublicBlackEmail::getBlackOrWhite, 0));
|
|
|
- List<String> pubicBlackEmailList = pubicEmailList.stream().map(AdwebPublicBlackEmail::getEmail).collect(Collectors.toList());
|
|
|
+ // 判断公共询盘缓存的是否包含历史的黑名单数据
|
|
|
+ List<AdwebPublicBlackEmail> pubicEmailList =
|
|
|
+ enquiryPublicBlackEmailService.list(
|
|
|
+ new LambdaQueryWrapper<AdwebPublicBlackEmail>()
|
|
|
+ .eq(AdwebPublicBlackEmail::getStatus, 1)
|
|
|
+ .eq(AdwebPublicBlackEmail::getBlackOrWhite, 0));
|
|
|
+ List<String> pubicBlackEmailList =
|
|
|
+ pubicEmailList.stream()
|
|
|
+ .map(AdwebPublicBlackEmail::getEmail)
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
|
List<String> publicBlackList = (List<String>) adwebRedisUtil.get(BlackEmailKey);
|
|
|
|
|
@@ -466,18 +589,31 @@ public class AdwebSiteBlackEmailController extends JeecgController<AdwebSiteBlac
|
|
|
adwebRedisUtil.set(BlackEmailKey, pubicBlackEmailList, 60 * 60 * 24);
|
|
|
}
|
|
|
|
|
|
- adwebRedisUtil.del(SiteEmailTenMinKey + enquirySiteBlackEmail.getSiteId() + "::" + enquirySiteBlackEmail.getEmail());
|
|
|
- adwebRedisUtil.del(SiteEmailOneDayKey + enquirySiteBlackEmail.getSiteId() + "::" + enquirySiteBlackEmail.getEmail());
|
|
|
- adwebRedisUtil.del(NotBlackEmailWasteSiteEnquiryKey + enquirySiteBlackEmail.getSiteId() + "::" + enquirySiteBlackEmail.getEmail());
|
|
|
+ adwebRedisUtil.del(
|
|
|
+ SiteEmailTenMinKey
|
|
|
+ + enquirySiteBlackEmail.getSiteId()
|
|
|
+ + "::"
|
|
|
+ + enquirySiteBlackEmail.getEmail());
|
|
|
+ adwebRedisUtil.del(
|
|
|
+ SiteEmailOneDayKey
|
|
|
+ + enquirySiteBlackEmail.getSiteId()
|
|
|
+ + "::"
|
|
|
+ + enquirySiteBlackEmail.getEmail());
|
|
|
+ adwebRedisUtil.del(
|
|
|
+ NotBlackEmailWasteSiteEnquiryKey
|
|
|
+ + enquirySiteBlackEmail.getSiteId()
|
|
|
+ + "::"
|
|
|
+ + enquirySiteBlackEmail.getEmail());
|
|
|
siteList.add(enquirySiteBlackEmail.getSiteId());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
for (Integer siteId : siteList) {
|
|
|
- LambdaQueryWrapper<AdwebSiteBlackEmail> siteAllEmailQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ LambdaQueryWrapper<AdwebSiteBlackEmail> siteAllEmailQueryWrapper =
|
|
|
+ new LambdaQueryWrapper<>();
|
|
|
siteAllEmailQueryWrapper.ne(AdwebSiteBlackEmail::getStatus, 0);
|
|
|
siteAllEmailQueryWrapper.eq(AdwebSiteBlackEmail::getSiteId, siteId);
|
|
|
- List<AdwebSiteBlackEmail> allEmailList = enquirySiteBlackEmailService.list(siteAllEmailQueryWrapper);
|
|
|
+ List<AdwebSiteBlackEmail> allEmailList =
|
|
|
+ enquirySiteBlackEmailService.list(siteAllEmailQueryWrapper);
|
|
|
if (CollectionUtils.isEmpty(allEmailList)) {
|
|
|
log.info("未获取到对应站点的黑白名单数据");
|
|
|
}
|
|
@@ -501,16 +637,17 @@ public class AdwebSiteBlackEmailController extends JeecgController<AdwebSiteBlac
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- //处理对应站点的黑名单
|
|
|
+ // 处理对应站点的黑名单
|
|
|
if (CollectionUtils.isNotEmpty(emailList)) {
|
|
|
adwebRedisUtil.set(SiteBlackEmailKey + "::" + siteId, emailList, 60 * 60 * 24);
|
|
|
} else {
|
|
|
adwebRedisUtil.del(SiteBlackEmailKey + "::" + siteId);
|
|
|
}
|
|
|
|
|
|
- //处理对应站点的白名单
|
|
|
+ // 处理对应站点的白名单
|
|
|
if (CollectionUtils.isNotEmpty(whiteEmailList)) {
|
|
|
- adwebRedisUtil.set(SiteWhiteEmailListKey + "::" + siteId, whiteEmailList, 60 * 60 * 24);
|
|
|
+ adwebRedisUtil.set(
|
|
|
+ SiteWhiteEmailListKey + "::" + siteId, whiteEmailList, 60 * 60 * 24);
|
|
|
} else {
|
|
|
adwebRedisUtil.del(SiteWhiteEmailListKey + "::" + siteId);
|
|
|
}
|
|
@@ -542,8 +679,13 @@ public class AdwebSiteBlackEmailController extends JeecgController<AdwebSiteBlac
|
|
|
* @param enquirySiteBlackEmail
|
|
|
*/
|
|
|
@RequestMapping(value = "/exportXls")
|
|
|
- public ModelAndView exportXls(HttpServletRequest request, AdwebSiteBlackEmail enquirySiteBlackEmail) {
|
|
|
- return super.exportXls(request, enquirySiteBlackEmail, AdwebSiteBlackEmail.class, "adweb_site_black_email");
|
|
|
+ public ModelAndView exportXls(
|
|
|
+ HttpServletRequest request, AdwebSiteBlackEmail enquirySiteBlackEmail) {
|
|
|
+ return super.exportXls(
|
|
|
+ request,
|
|
|
+ enquirySiteBlackEmail,
|
|
|
+ AdwebSiteBlackEmail.class,
|
|
|
+ "adweb_site_black_email");
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -557,5 +699,4 @@ public class AdwebSiteBlackEmailController extends JeecgController<AdwebSiteBlac
|
|
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
|
|
return super.importExcel(request, response, AdwebSiteBlackEmail.class);
|
|
|
}
|
|
|
-
|
|
|
}
|