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