...
|
...
|
@@ -147,7 +147,7 @@ public class WechatServiceImpl implements IWechatService { |
|
|
logger.info("enter sendWechatCustomMsg with sceneKey is {},msgBO is {}",customMsgBO.getSendKey(),customMsgBO.getSendContent());
|
|
|
|
|
|
if(CollectionUtils.isEmpty(customMsgBO.getOpenIdList())){
|
|
|
logger.warn("sendWechatCustomMsg with sendOpenIds null, sceneKey is {}",customMsgBO.getSendKey());
|
|
|
logger.warn("sendWechatCustomMsg with sendOpenIds null, sceneKey is {}", customMsgBO.getSendKey());
|
|
|
return;
|
|
|
}
|
|
|
String sceneKey = customMsgBO.getSendKey();
|
...
|
...
|
@@ -155,10 +155,14 @@ public class WechatServiceImpl implements IWechatService { |
|
|
logger.info("sendWechatCustomMsg with sceneKey is {},send origin size is {}",sceneKey,openIdSet.size());
|
|
|
//根据过滤条件进行过滤
|
|
|
if(customMsgBO.getFilterDays() != 0){
|
|
|
getDaysFilter(customMsgBO,openIdSet);
|
|
|
getDaysFilter(customMsgBO, openIdSet);
|
|
|
}
|
|
|
//组装发送
|
|
|
List<String> sendSuccessList = customMsgSend(customMsgBO,openIdSet);
|
|
|
List<String> sendSuccessList = customMsgSend(customMsgBO, openIdSet);
|
|
|
if(CollectionUtils.isEmpty(sendSuccessList)){
|
|
|
logger.warn("sendWechatCustomMsg with sendSuccess size is 0,sceneKey is {}",customMsgBO.getSendKey());
|
|
|
return;
|
|
|
}
|
|
|
logger.info("end sendWechatCustomMsg with sceneKey is {},successSize is {}",customMsgBO.getSendKey(),sendSuccessList.size());
|
|
|
//成功记录存redis
|
|
|
String nowDate = DateUtil.getToday(DATE_ID_FORMAT);
|
...
|
...
|
@@ -183,7 +187,7 @@ public class WechatServiceImpl implements IWechatService { |
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
calendar.add(Calendar.DATE, -filterDayReal);
|
|
|
String startDate = DateUtil.dateToString(calendar.getTime(), DATE_ID_FORMAT);
|
|
|
Date date = DateUtil.stringToDate(startDate,"DATE_ID_FORMAT");
|
|
|
Date date = DateUtil.stringToDate(startDate,DATE_ID_FORMAT);
|
|
|
Calendar c = Calendar.getInstance();
|
|
|
c.setTime(date);
|
|
|
int day = c.get(Calendar.DATE);
|
...
|
...
|
@@ -195,12 +199,19 @@ public class WechatServiceImpl implements IWechatService { |
|
|
String redisKeyStr = RedisCacheKeyConstant.WECAHT_CUSTOM_SEND_KEY + customMsgBO.getPublicNumCode() + '_' + nowDate;
|
|
|
pushRedisService.getSetFilter(openIdSet,redisKeyStr);
|
|
|
logger.info("sendWechatCustomMsg with day filter,sceneKey is {},redisKeyStr is {},nowSize is {}",customMsgBO.getSendKey(),redisKeyStr,openIdSet.size());
|
|
|
if(openIdSet.size() == 0){
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
private List<String> customMsgSend(WechatCustomMsgBO customMsgBO,Set<String> openIdSet){
|
|
|
logger.info("begin customMsgSend with sceneKey is {},send openId size is {}",customMsgBO.getSendKey(),openIdSet.size());
|
|
|
if(CollectionUtils.isEmpty(openIdSet)){
|
|
|
logger.warn("customMsgSend with openIdSet is null,sceneKey is {}",customMsgBO.getSendKey());
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
// 获取token 和接口url
|
|
|
AccessToken accessToken = weixinAccessTokenService.queryWeixinAccessToken(customMsgBO.getPublicNumCode());
|
|
|
//若仍未获取到 token 则返回
|
...
|
...
|
|