|
@@ -147,7 +147,7 @@ public class WechatServiceImpl implements IWechatService { |
|
@@ -147,7 +147,7 @@ public class WechatServiceImpl implements IWechatService { |
147
|
logger.info("enter sendWechatCustomMsg with sceneKey is {},msgBO is {}",customMsgBO.getSendKey(),customMsgBO.getSendContent());
|
147
|
logger.info("enter sendWechatCustomMsg with sceneKey is {},msgBO is {}",customMsgBO.getSendKey(),customMsgBO.getSendContent());
|
148
|
|
148
|
|
149
|
if(CollectionUtils.isEmpty(customMsgBO.getOpenIdList())){
|
149
|
if(CollectionUtils.isEmpty(customMsgBO.getOpenIdList())){
|
150
|
- logger.warn("sendWechatCustomMsg with sendOpenIds null, sceneKey is {}",customMsgBO.getSendKey());
|
150
|
+ logger.warn("sendWechatCustomMsg with sendOpenIds null, sceneKey is {}", customMsgBO.getSendKey());
|
151
|
return;
|
151
|
return;
|
152
|
}
|
152
|
}
|
153
|
String sceneKey = customMsgBO.getSendKey();
|
153
|
String sceneKey = customMsgBO.getSendKey();
|
|
@@ -155,10 +155,14 @@ public class WechatServiceImpl implements IWechatService { |
|
@@ -155,10 +155,14 @@ public class WechatServiceImpl implements IWechatService { |
155
|
logger.info("sendWechatCustomMsg with sceneKey is {},send origin size is {}",sceneKey,openIdSet.size());
|
155
|
logger.info("sendWechatCustomMsg with sceneKey is {},send origin size is {}",sceneKey,openIdSet.size());
|
156
|
//根据过滤条件进行过滤
|
156
|
//根据过滤条件进行过滤
|
157
|
if(customMsgBO.getFilterDays() != 0){
|
157
|
if(customMsgBO.getFilterDays() != 0){
|
158
|
- getDaysFilter(customMsgBO,openIdSet);
|
158
|
+ getDaysFilter(customMsgBO, openIdSet);
|
159
|
}
|
159
|
}
|
160
|
//组装发送
|
160
|
//组装发送
|
161
|
- List<String> sendSuccessList = customMsgSend(customMsgBO,openIdSet);
|
161
|
+ List<String> sendSuccessList = customMsgSend(customMsgBO, openIdSet);
|
|
|
162
|
+ if(CollectionUtils.isEmpty(sendSuccessList)){
|
|
|
163
|
+ logger.warn("sendWechatCustomMsg with sendSuccess size is 0,sceneKey is {}",customMsgBO.getSendKey());
|
|
|
164
|
+ return;
|
|
|
165
|
+ }
|
162
|
logger.info("end sendWechatCustomMsg with sceneKey is {},successSize is {}",customMsgBO.getSendKey(),sendSuccessList.size());
|
166
|
logger.info("end sendWechatCustomMsg with sceneKey is {},successSize is {}",customMsgBO.getSendKey(),sendSuccessList.size());
|
163
|
//成功记录存redis
|
167
|
//成功记录存redis
|
164
|
String nowDate = DateUtil.getToday(DATE_ID_FORMAT);
|
168
|
String nowDate = DateUtil.getToday(DATE_ID_FORMAT);
|
|
@@ -183,7 +187,7 @@ public class WechatServiceImpl implements IWechatService { |
|
@@ -183,7 +187,7 @@ public class WechatServiceImpl implements IWechatService { |
183
|
Calendar calendar = Calendar.getInstance();
|
187
|
Calendar calendar = Calendar.getInstance();
|
184
|
calendar.add(Calendar.DATE, -filterDayReal);
|
188
|
calendar.add(Calendar.DATE, -filterDayReal);
|
185
|
String startDate = DateUtil.dateToString(calendar.getTime(), DATE_ID_FORMAT);
|
189
|
String startDate = DateUtil.dateToString(calendar.getTime(), DATE_ID_FORMAT);
|
186
|
- Date date = DateUtil.stringToDate(startDate,"DATE_ID_FORMAT");
|
190
|
+ Date date = DateUtil.stringToDate(startDate,DATE_ID_FORMAT);
|
187
|
Calendar c = Calendar.getInstance();
|
191
|
Calendar c = Calendar.getInstance();
|
188
|
c.setTime(date);
|
192
|
c.setTime(date);
|
189
|
int day = c.get(Calendar.DATE);
|
193
|
int day = c.get(Calendar.DATE);
|
|
@@ -195,12 +199,19 @@ public class WechatServiceImpl implements IWechatService { |
|
@@ -195,12 +199,19 @@ public class WechatServiceImpl implements IWechatService { |
195
|
String redisKeyStr = RedisCacheKeyConstant.WECAHT_CUSTOM_SEND_KEY + customMsgBO.getPublicNumCode() + '_' + nowDate;
|
199
|
String redisKeyStr = RedisCacheKeyConstant.WECAHT_CUSTOM_SEND_KEY + customMsgBO.getPublicNumCode() + '_' + nowDate;
|
196
|
pushRedisService.getSetFilter(openIdSet,redisKeyStr);
|
200
|
pushRedisService.getSetFilter(openIdSet,redisKeyStr);
|
197
|
logger.info("sendWechatCustomMsg with day filter,sceneKey is {},redisKeyStr is {},nowSize is {}",customMsgBO.getSendKey(),redisKeyStr,openIdSet.size());
|
201
|
logger.info("sendWechatCustomMsg with day filter,sceneKey is {},redisKeyStr is {},nowSize is {}",customMsgBO.getSendKey(),redisKeyStr,openIdSet.size());
|
|
|
202
|
+ if(openIdSet.size() == 0){
|
|
|
203
|
+ break;
|
|
|
204
|
+ }
|
198
|
}
|
205
|
}
|
199
|
}
|
206
|
}
|
200
|
|
207
|
|
201
|
|
208
|
|
202
|
private List<String> customMsgSend(WechatCustomMsgBO customMsgBO,Set<String> openIdSet){
|
209
|
private List<String> customMsgSend(WechatCustomMsgBO customMsgBO,Set<String> openIdSet){
|
203
|
logger.info("begin customMsgSend with sceneKey is {},send openId size is {}",customMsgBO.getSendKey(),openIdSet.size());
|
210
|
logger.info("begin customMsgSend with sceneKey is {},send openId size is {}",customMsgBO.getSendKey(),openIdSet.size());
|
|
|
211
|
+ if(CollectionUtils.isEmpty(openIdSet)){
|
|
|
212
|
+ logger.warn("customMsgSend with openIdSet is null,sceneKey is {}",customMsgBO.getSendKey());
|
|
|
213
|
+ return new ArrayList<>();
|
|
|
214
|
+ }
|
204
|
// 获取token 和接口url
|
215
|
// 获取token 和接口url
|
205
|
AccessToken accessToken = weixinAccessTokenService.queryWeixinAccessToken(customMsgBO.getPublicNumCode());
|
216
|
AccessToken accessToken = weixinAccessTokenService.queryWeixinAccessToken(customMsgBO.getPublicNumCode());
|
206
|
//若仍未获取到 token 则返回
|
217
|
//若仍未获取到 token 则返回
|