Commit b6348764 authored by 唐峰's avatar 唐峰

fixed 消费地图用户转换问题

parent 60fcbb06
...@@ -178,11 +178,14 @@ public class LoginContext { ...@@ -178,11 +178,14 @@ public class LoginContext {
userIdWechatMapQuery = wechatUserInfoListQuery.stream().collect(Collectors.toMap(WechatUserInfo::getUserId, Function.identity(), (k1, k2) -> k1)); userIdWechatMapQuery = wechatUserInfoListQuery.stream().collect(Collectors.toMap(WechatUserInfo::getUserId, Function.identity(), (k1, k2) -> k1));
} }
List<UserInfoEntity> userInfoEntityListNew = Lists.newArrayList();
List<WechatUserInfo> wechatUserInfoListNew = Lists.newArrayList();
for (User user : registerUserList) { for (User user : registerUserList) {
UserInfoEntity userInfoEntity = phoneUserEntityMap.get(user.getPhoneNo()); UserInfoEntity userInfoEntity = phoneUserEntityMap.get(user.getPhoneNo());
if (userInfoEntity != null && userIdEntityMapQuery.get(user.getId()) == null) { if (userInfoEntity != null && userIdEntityMapQuery.get(user.getId()) == null) {
userInfoEntity.setUserId(user.getId()); userInfoEntity.setUserId(user.getId());
userInfoEntity.setTenantId(req.getTenantId()); userInfoEntity.setTenantId(req.getTenantId());
userInfoEntityListNew.add(userInfoEntity);
} else if (userInfoEntity != null && userIdEntityMapQuery.get(user.getId()) != null) { } else if (userInfoEntity != null && userIdEntityMapQuery.get(user.getId()) != null) {
log.info("用户扩展信息已存在,userId:{},用户信息:{}", user.getId(), JSONObject.toJSONString(userInfoEntity)); log.info("用户扩展信息已存在,userId:{},用户信息:{}", user.getId(), JSONObject.toJSONString(userInfoEntity));
} }
...@@ -193,19 +196,20 @@ public class LoginContext { ...@@ -193,19 +196,20 @@ public class LoginContext {
if (wechatUserInfo != null && userIdWechatMapQuery.get(user.getId()) == null) { if (wechatUserInfo != null && userIdWechatMapQuery.get(user.getId()) == null) {
wechatUserInfo.setUserId(user.getId()); wechatUserInfo.setUserId(user.getId());
wechatUserInfo.setTenantId(req.getTenantId()); wechatUserInfo.setTenantId(req.getTenantId());
} else if (wechatUserInfo != null && userIdWechatMapQuery.get(user.getId()) == null) { wechatUserInfoListNew.add(wechatUserInfo);
} else if (wechatUserInfo != null && userIdWechatMapQuery.get(user.getId()) != null) {
log.info("用户微信信息已存在,userId:{},用户信息:{}", user.getId(), JSONObject.toJSONString(wechatUserInfo)); log.info("用户微信信息已存在,userId:{},用户信息:{}", user.getId(), JSONObject.toJSONString(wechatUserInfo));
} }
} }
Collection<WechatUserInfo> wechatUserInfos = phoneWechatUserMap.values();
if (CollectionUtils.isNotEmpty(wechatUserInfos)) { if (CollectionUtils.isNotEmpty(wechatUserInfoListNew)) {
weChatUserRepository.save(wechatUserInfos); weChatUserRepository.save(wechatUserInfoListNew);
} }
Collection<UserInfoEntity> entities = phoneUserEntityMap.values();
if (CollectionUtils.isNotEmpty(entities)) { if (CollectionUtils.isNotEmpty(userInfoEntityListNew)) {
userInfoRepository.save(entities); userInfoRepository.save(userInfoEntityListNew);
} }
List<ShopMapRsp> shopMapRsps = new ArrayList<>(); List<ShopMapRsp> shopMapRsps = new ArrayList<>();
for (User user : registerUserList) { for (User user : registerUserList) {
......
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