Commit 744a359e by 朱亚洁

广告发送

parent d06426dc
......@@ -572,14 +572,26 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
}
List<AdvertisingDistributionBook> list = new ArrayList<>();
Map<Long, Long> agentIdMap = new HashMap<>();
for (DistributionWechatGroup group : bookGroups) {
//机器人不存在,不投放广告
GroupQrcode groupQrcode = groupQrcodeDao.getById(group.getQrcodeId());
String altId = wechatGroupConsr.getSendAdRobotByGroupId(groupQrcode.getWeixinGroupId());
if (StringUtil.isEmpty(altId)) {
bookGroups.remove(group);
continue;
//过滤无机器人的群
for (int i = 0; i < bookGroups.size() && null != bookGroups; i++) {
DistributionWechatGroup wechatGroup = bookGroups.get(i);
if (null != wechatGroup) {
//机器人不存在,不投放广告
GroupQrcode groupQrcode = groupQrcodeDao.getById(wechatGroup.getQrcodeId());
if (null != groupQrcode) {
String altId = wechatGroupConsr.getSendAdRobotByGroupId(groupQrcode.getWeixinGroupId());
if (StringUtil.isEmpty(altId)) {
LOGGER.info("机器人不在微信群,广告投放失败" + wechatGroup);
bookGroups.remove(wechatGroup);
}
}
}
}
if (ListUtils.isEmpty(bookGroups)){
LOGGER.info("微信群为空,广告投放失败");
return;
}
for (DistributionWechatGroup group : bookGroups) {
AdvertisingDistributionBook distributionBook = new AdvertisingDistributionBook();
distributionBook.setAdId(book.getAdId());
distributionBook.setBookId(group.getBookId());
......@@ -598,10 +610,6 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
distributionBook.setIsBookGroup(true);
list.add(distributionBook);
}
if (ListUtils.isEmpty(bookGroups)) {
LOGGER.info("微信群为空或机器人不在微信群,广告投放失败" + book.getGroups());
return;
}
advertisingDistributionBookDao.batchInsert(list);
//发送微信群消息
SEND_MESSAGE_THREAD_POOL.execute(() -> {
......@@ -719,8 +727,8 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
WxGroupSDK.sendPicMessage(sendPicMessageVO);
}
try {
Thread.sleep(1000);
LOGGER.info("发送微信消息-线程休眠1秒");
Thread.sleep(4000);
LOGGER.info("发送微信消息-线程休眠4秒");
} catch (InterruptedException e) {
LOGGER.error("线程休眠失败" + e.getMessage());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment