Commit e8c49f10 by 吕明尚

修改定时任务,自动更新用户openId

parent 97a22e60
......@@ -749,14 +749,7 @@ public class RedisTask {
@XxlJob("AutoUpdateOpenid")
public void AutoUpdateOpenid() {
logger.debug("AutoUpdateOpenid:自动更新用户unionid开始");
List<SConsumerToken> sConsumerTokenList = sConsumerTokenService.list(new LambdaQueryWrapper<SConsumerToken>().isNotNull(SConsumerToken::getUnionId).isNull(SConsumerToken::getOpenId));
if (CollectionUtils.isEmpty(sConsumerTokenList)) {
return;
}
List<String> list = new ArrayList<>();
if (sConsumerTokenList.size() > 100) {
sConsumerTokenList = sConsumerTokenList.subList(0, 100);
}
List<String> wechatUSERList = wechatNewService.getWechatUSERList(list, "");
Map<String, String> openIdMap = new ConcurrentHashMap<>();
// 使用IntStream优化分批逻辑,并行处理各批次数据
......@@ -771,6 +764,11 @@ public class RedisTask {
logger.error("处理微信用户信息失败", e);
}
});
//获取openIdMap所有的键
List<SConsumerToken> sConsumerTokenList = sConsumerTokenService.list(new LambdaQueryWrapper<SConsumerToken>().in(SConsumerToken::getUnionId, openIdMap.keySet()).isNull(SConsumerToken::getOpenId));
if (CollectionUtils.isEmpty(sConsumerTokenList)) {
return;
}
sConsumerTokenList.forEach(item -> {
String openId = openIdMap.get(item.getUnionId());
if (openId != null) {
......
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