提交 afc92a10 作者: 沈振路

客服消息修改用户分组 & 添加debug日志控制

上级 47515fdf
......@@ -3,6 +3,7 @@ package com.yaoyaozw.customer.service.wechat.service;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.yaoyaozw.customer.constants.CustomerCommonConstant;
import com.yaoyaozw.customer.constants.RabbitCommonNameConstant;
import com.yaoyaozw.customer.dto.customer.CustomerMessageTransferDTO;
......@@ -134,15 +135,17 @@ public class WeChatServiceImpl implements WeChatService{
List<ReferralEntityVo> referralEntityVo) {
//构建请求参数(文本/图文)
WeChatCustomerRequestEntity customerRequest = buildCustomerRequest(customerGraphics,referralEntityVo);
// 判断缓存中是否存在 CUSTOMER_MESSAGE_SEND_DEBUG 这个key,如果有的话,打印入参
if (Boolean.TRUE.equals(redisTemplate.hasKey("CUSTOMER_MESSAGE_SEND_DEBUG"))) {
log.info("CUSTOMER_MESSAGE_SEND_DEBUG: {}", JSONUtil.toJsonStr(openidList));
}
if (customerRequest!=null){
//计数器
CountDownLatch latch = new CountDownLatch(openidList.size());
for (int i = 0; i < openidList.size(); i+=THREAD_SIZE) {
List<CrowdPackageUserVO> subOpenidList = openidList.subList(i, Math.min(i + THREAD_SIZE, openidList.size()));
List<List<CrowdPackageUserVO>> userPartitionList = Lists.partition(openidList, THREAD_SIZE);
for (List<CrowdPackageUserVO> subOpenidList : userPartitionList) {
EXECUTOR.execute(()->{
for (CrowdPackageUserVO crowdPackageUserVO : subOpenidList) {
......@@ -155,6 +158,10 @@ public class WeChatServiceImpl implements WeChatService{
customerMessageTransferDTO.setCustomerRequestEntity(customerRequest);
rabbitTemplate.convertAndSend(RabbitCommonNameConstant.CUSTOMER_SERVICE_EXCHANGE, RabbitCommonNameConstant.CUSTOMER_MESSAGE_ROUTE_KEY,JSONObject.toJSONString(customerMessageTransferDTO));
if (Boolean.TRUE.equals(redisTemplate.hasKey("CUSTOMER_MESSAGE_SEND_DEBUG"))) {
log.info("发送消息:{} ", JSONUtil.toJsonStr(customerMessageTransferDTO));
}
} finally {
latch.countDown();
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论