|
@@ -19,6 +19,7 @@ import org.jeecg.common.constant.WebsocketConst;
|
|
|
import org.jeecg.common.system.vo.DictModel;
|
|
|
import org.jeecg.common.system.vo.DictPropertyModel;
|
|
|
import org.jeecg.common.util.FastJsonUtil;
|
|
|
+import org.jeecg.modules.adweb.common.Jedis.ObjectUtil;
|
|
|
import org.jeecg.modules.adweb.common.constant.NumConstant;
|
|
|
import org.jeecg.modules.adweb.common.dto.CountryAreaApiDto;
|
|
|
import org.jeecg.modules.adweb.common.service.FeishuService;
|
|
@@ -139,6 +140,9 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
|
|
|
@Resource
|
|
|
private EnquiryRedisService enquiryRedisService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private ISubUserEmailService subUserEmailService;
|
|
|
+
|
|
|
private static final byte[] redisKey = EnquiryConstants.ENQUIRY_EMAIL.getBytes();
|
|
|
|
|
|
private static final byte[] siteRedisKey = EnquiryConstants.ENQUIRY_SITE.getBytes();
|
|
@@ -476,37 +480,39 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
|
|
|
emailSet.add(e);
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- log.info("=======发送询盘邮件======");
|
|
|
- enquiryEmailMessageList.forEach(e -> System.out.println(e.getEmail()));
|
|
|
- log.info("需要添加的询盘邮件:{}", FastJsonUtil.toJSONString(enquiryEmailMessageList));
|
|
|
- if (CollectionUtils.isNotEmpty(enquiryEmailMessageList)) {
|
|
|
- QueryWrapper<EnquiryEmailMessage> enquiryEmailMessageQueryWrapper = new QueryWrapper<>();
|
|
|
- enquiryEmailMessageQueryWrapper.eq("site_code", adwebSite.getCode());
|
|
|
- List<EnquiryEmailMessage> enquiryEmailMessages = enquiryEmailMessageService.list(enquiryEmailMessageQueryWrapper);
|
|
|
- List<EnquiryEmailMessage> sameEnquiryEmailMessageList = new ArrayList<>();
|
|
|
- if (CollectionUtils.isNotEmpty(enquiryEmailMessages)) {
|
|
|
- for (EnquiryEmailMessage enquiryEmailMessage : enquiryEmailMessages) {
|
|
|
- for (EnquiryEmailMessage enquiryEmailMessage1 : enquiryEmailMessageList) {
|
|
|
- if (enquiryEmailMessage.getEnquiryId().equals(enquiryEmailMessage1.getEnquiryId()) && enquiryEmailMessage.getEmail().equals(enquiryEmailMessage1.getEmail())) {
|
|
|
- sameEnquiryEmailMessageList.add(enquiryEmailMessage1);
|
|
|
+ log.info("=======发送询盘邮件======");
|
|
|
+ enquiryEmailMessageList.forEach(e -> System.out.println(e.getEmail()));
|
|
|
+ log.info("需要添加的询盘邮件:{}", FastJsonUtil.toJSONString(enquiryEmailMessageList));
|
|
|
+ if (CollectionUtils.isNotEmpty(enquiryEmailMessageList)) {
|
|
|
+ QueryWrapper<EnquiryEmailMessage> enquiryEmailMessageQueryWrapper = new QueryWrapper<>();
|
|
|
+ enquiryEmailMessageQueryWrapper.eq("site_code", adwebSite.getCode());
|
|
|
+ List<EnquiryEmailMessage> enquiryEmailMessages = enquiryEmailMessageService.list(enquiryEmailMessageQueryWrapper);
|
|
|
+ List<EnquiryEmailMessage> sameEnquiryEmailMessageList = new ArrayList<>();
|
|
|
+ if (CollectionUtils.isNotEmpty(enquiryEmailMessages)) {
|
|
|
+ for (EnquiryEmailMessage enquiryEmailMessage : enquiryEmailMessages) {
|
|
|
+ for (EnquiryEmailMessage enquiryEmailMessage1 : enquiryEmailMessageList) {
|
|
|
+ if (enquiryEmailMessage.getEnquiryId().equals(enquiryEmailMessage1.getEnquiryId()) && enquiryEmailMessage.getEmail().equals(enquiryEmailMessage1.getEmail())) {
|
|
|
+ sameEnquiryEmailMessageList.add(enquiryEmailMessage1);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ enquiryEmailMessageList.removeAll(sameEnquiryEmailMessageList);
|
|
|
}
|
|
|
- enquiryEmailMessageList.removeAll(sameEnquiryEmailMessageList);
|
|
|
- }
|
|
|
- log.info("最终添加的询盘邮件:{}", FastJsonUtil.toJSONString(enquiryEmailMessageList));
|
|
|
- enquiryEmailMessageService.saveBatch(enquiryEmailMessageList);
|
|
|
- try {
|
|
|
- for (EnquiryEmailMessage message : enquiryEmailMessageList) {
|
|
|
- ObjectMapper objectMapper = new ObjectMapper();
|
|
|
- JedisUtil.lpush(redisKey, objectMapper.writeValueAsBytes(message.getEnquiryId()));
|
|
|
- JedisUtil.publishMsg(EnquiryConstants.ENQUIRY_EMAIL_CHANNEL, EnquiryConstants.ENQUIRY_EMAIL);
|
|
|
+ log.info("最终添加的询盘邮件:{}", FastJsonUtil.toJSONString(enquiryEmailMessageList));
|
|
|
+ enquiryEmailMessageService.saveBatch(enquiryEmailMessageList);
|
|
|
+ try {
|
|
|
+ for (EnquiryEmailMessage message : enquiryEmailMessageList) {
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
+ JedisUtil.lpush(redisKey, objectMapper.writeValueAsBytes(message.getEnquiryId()));
|
|
|
+ JedisUtil.publishMsg(EnquiryConstants.ENQUIRY_EMAIL_CHANNEL, EnquiryConstants.ENQUIRY_EMAIL);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("推送发送询盘邮件的消息失败", e);
|
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
- log.info("推送发送询盘邮件的消息失败", e);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ log.info("=======该垃圾询盘不发送询盘邮件======{}", adwebEnquiry.getId());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -544,10 +550,46 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
|
|
|
if (mainUser != null && StringUtils.isNotBlank(mainUser.getEmail())) {
|
|
|
enquiryEmailMessageList.add(newEmail(adwebEnquiry, mainUser.getEmail()));
|
|
|
}
|
|
|
+ } else {
|
|
|
+ //轮流发送邮件逻辑处理
|
|
|
+ List<SubUserEmail> list = subUserEmailService.list();
|
|
|
+ if (CollectionUtils.isEmpty(list)) {
|
|
|
+ sysUser = sysUsers.get(0);
|
|
|
+ } else {
|
|
|
+ SubUserEmail subUserEmail = list.get(0);
|
|
|
+ subUserEmailService.removeAll();
|
|
|
+
|
|
|
+ SysUser user = sysUserService.getById(subUserEmail.getId());
|
|
|
+ int index = sysUsers.indexOf(user);
|
|
|
+ if (index == -1 || index == sysUsers.size() - 1) {
|
|
|
+ sysUser = sysUsers.get(0);
|
|
|
+ } else {
|
|
|
+ sysUser = sysUsers.get(index + 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SubUserEmail subUserEmail = new SubUserEmail();
|
|
|
+ subUserEmail.setId(sysUser.getId());
|
|
|
+ subUserEmail.setSid(adwebSite.getId());
|
|
|
+ subUserEmail.setUsername(sysUser.getUsername());
|
|
|
+ subUserEmail.setRealname(sysUser.getRealname());
|
|
|
+ subUserEmailService.save(subUserEmail);
|
|
|
+ //子账号邮件信息添加
|
|
|
+ enquiryEmailMessageList.add(newEmail(adwebEnquiry, sysUser.getEmail()));
|
|
|
+
|
|
|
+ //修改询盘信息的跟进人信息
|
|
|
+ adwebEnquiry.setPrincipalUid(sysUser.getId());
|
|
|
+ adwebEnquiryMapper.updateById(adwebEnquiry);
|
|
|
+
|
|
|
+ //获取主账号
|
|
|
+ SysUser mainUser = sysUserService.getById(adwebSite.getUid());
|
|
|
+ //主账号邮件信息添加
|
|
|
+ if (mainUser != null && StringUtils.isNotBlank(mainUser.getEmail())) {
|
|
|
+ enquiryEmailMessageList.add(newEmail(adwebEnquiry, mainUser.getEmail()));
|
|
|
+ }
|
|
|
}
|
|
|
+ log.info("=======发送询盘邮件======");
|
|
|
|
|
|
enquiryEmailMessageList.forEach(e -> System.out.println(e.getEmail()));
|
|
|
-
|
|
|
log.info("需要添加的询盘邮件:{}", FastJsonUtil.toJSONString(enquiryEmailMessageList));
|
|
|
if (CollectionUtils.isNotEmpty(enquiryEmailMessageList)) {
|
|
|
QueryWrapper<EnquiryEmailMessage> enquiryEmailMessageQueryWrapper = new QueryWrapper<>();
|
|
@@ -568,8 +610,7 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
|
|
|
enquiryEmailMessageService.saveBatch(enquiryEmailMessageList);
|
|
|
try {
|
|
|
for (EnquiryEmailMessage message : enquiryEmailMessageList) {
|
|
|
- ObjectMapper objectMapper = new ObjectMapper();
|
|
|
- JedisUtil.lpush(redisKey, objectMapper.writeValueAsBytes(message.getEnquiryId()));
|
|
|
+ JedisUtil.lpush(redisKey, ObjectUtil.object2Bytes(message.getEnquiryId()));
|
|
|
JedisUtil.publishMsg(EnquiryConstants.ENQUIRY_EMAIL_CHANNEL, EnquiryConstants.ENQUIRY_EMAIL);
|
|
|
}
|
|
|
SysUser user = sysUserService.getById(adwebEnquiry.getPrincipalUid());
|
|
@@ -577,10 +618,12 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
|
|
|
returnSalesperson(adwebSite.getCode(), adwebEnquiry.getRecordId(), user.getUsername());
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- log.info("推送发送询盘邮件的消息失败", e);
|
|
|
+ log.error("推送发送询盘邮件的消息失败", e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ } else {
|
|
|
+ log.info("=======该垃圾询盘在特殊站点中不发送询盘邮件======{}", adwebEnquiry.getId());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -889,8 +932,10 @@ public class AdwebEnquiryServiceImpl extends ServiceImpl<AdwebEnquiryMapper, Adw
|
|
|
HashSet<String> blackEmailHashSet = new HashSet<String>(allBlackEmailList);
|
|
|
blackEmailList = new ArrayList<>(blackEmailHashSet);
|
|
|
}
|
|
|
- log.info("公共邮箱黑名单:" + publicBlackEmailList.size());
|
|
|
- log.info("站点邮箱黑名单:" + siteBlackEmailList.size());
|
|
|
+
|
|
|
+
|
|
|
+ log.info("公共邮箱黑名单:{}", publicBlackEmailList.size());
|
|
|
+ log.info("站点邮箱黑名单:{}", siteBlackEmailList.size());
|
|
|
|
|
|
//邮箱 白名单
|
|
|
//先获取对应站点的邮箱白名单
|