1.兼容历史数据无unionid和memberId的情况
Showing
3 changed files
with
26 additions
and
5 deletions
| ... | @@ -19,6 +19,9 @@ public class UserWeixinDTO implements Serializable { | ... | @@ -19,6 +19,9 @@ public class UserWeixinDTO implements Serializable { |
| 19 | // ID | 19 | // ID |
| 20 | private Long id; | 20 | private Long id; |
| 21 | 21 | ||
| 22 | // memberCode | ||
| 23 | private String memberCode; | ||
| 24 | |||
| 22 | // 用户ID | 25 | // 用户ID |
| 23 | private Long memberId; | 26 | private Long memberId; |
| 24 | 27 | ... | ... |
| ... | @@ -419,6 +419,14 @@ public class UserOperationController { | ... | @@ -419,6 +419,14 @@ public class UserOperationController { |
| 419 | 419 | ||
| 420 | // 保存大小屏信息到redis同时返回小屏信息 | 420 | // 保存大小屏信息到redis同时返回小屏信息 |
| 421 | UserWeixinDTO userWeixinDTO = this.userTvOperationService.saveUserInfo(data); | 421 | UserWeixinDTO userWeixinDTO = this.userTvOperationService.saveUserInfo(data); |
| 422 | if (Objects.isNull(userWeixinDTO.getId())) { | ||
| 423 | result = UNSUBSCRIBE; | ||
| 424 | resultList.add(result); | ||
| 425 | resultList.add(platformAccount1); | ||
| 426 | log.info("saveUserInfo ==>> result ==>> [{}]",resultList); | ||
| 427 | return ResultInfo.success(resultList); | ||
| 428 | } | ||
| 429 | |||
| 422 | // 小屏会员 | 430 | // 小屏会员 |
| 423 | MemberDTO memberDTO = this.memberService.findById(userWeixinDTO.getMemberId()); | 431 | MemberDTO memberDTO = this.memberService.findById(userWeixinDTO.getMemberId()); |
| 424 | // 小屏用户不存在或者关注状态为未关注(0),返回未关注 | 432 | // 小屏用户不存在或者关注状态为未关注(0),返回未关注 | ... | ... |
| ... | @@ -157,7 +157,8 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -157,7 +157,8 @@ public class UserOperationServiceImpl implements UserOperationService { |
| 157 | String headImgUrl = resources.getHeadimgurl(); | 157 | String headImgUrl = resources.getHeadimgurl(); |
| 158 | 158 | ||
| 159 | // 小屏账户 | 159 | // 小屏账户 |
| 160 | UserWeixinDTO userWeixinDTO = this.findFirstByUnionIdAndAppIdAndOpenId(unionId,appId, openId); | 160 | // UserWeixinDTO userWeixinDTO = this.findFirstByUnionIdAndAppIdAndOpenId(unionId, appId, openId); |
| 161 | UserWeixinDTO userWeixinDTO = this.findUserWeiXinByOpenIdAndAppId(appId, openId); | ||
| 161 | 162 | ||
| 162 | if (Objects.isNull(userWeixinDTO.getId())) { | 163 | if (Objects.isNull(userWeixinDTO.getId())) { |
| 163 | 164 | ||
| ... | @@ -172,8 +173,19 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -172,8 +173,19 @@ public class UserOperationServiceImpl implements UserOperationService { |
| 172 | 173 | ||
| 173 | } else { | 174 | } else { |
| 174 | 175 | ||
| 176 | if (Objects.isNull(userWeixinDTO.getUnionid()) && Objects.isNull(userWeixinDTO.getMemberId())) { | ||
| 177 | userWeixinDTO.setUnionid(unionId); | ||
| 178 | Long memberId = this.doCreateMember(userWeixinDTO, 0); | ||
| 179 | userWeixinDTO.setMemberId(memberId); | ||
| 180 | MemberDTO memberDTO = this.memberService.findById(memberId); | ||
| 181 | userWeixinDTO.setMemberCode(memberDTO.getCode()); | ||
| 182 | this.doUpdateUserWeiXinStatus(userWeixinDTO, 1); | ||
| 183 | |||
| 184 | } else { | ||
| 175 | // 修改账户和会员信息 | 185 | // 修改账户和会员信息 |
| 176 | this.doUpdateUserWeiXinAndMember(userWeixinDTO,appId,openId,headImgUrl,nickname); | 186 | this.doUpdateUserWeiXinAndMember(userWeixinDTO,appId,openId,headImgUrl,nickname); |
| 187 | } | ||
| 188 | |||
| 177 | 189 | ||
| 178 | } | 190 | } |
| 179 | 191 | ||
| ... | @@ -440,13 +452,11 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -440,13 +452,11 @@ public class UserOperationServiceImpl implements UserOperationService { |
| 440 | userWeixinDTO.setStatus(status); | 452 | userWeixinDTO.setStatus(status); |
| 441 | 453 | ||
| 442 | UserWeixin userWeixin = new UserWeixin(); | 454 | UserWeixin userWeixin = new UserWeixin(); |
| 443 | BeanUtils.copyProperties(userWeixinDTO,userWeixin); | 455 | BeanUtils.copyProperties(userWeixinDTO, userWeixin); |
| 444 | 456 | userWeixin.setUpdateTime(TimestampUtil.now()); | |
| 445 | this.userWeixinService.update(userWeixin); | 457 | this.userWeixinService.update(userWeixin); |
| 446 | 458 | ||
| 447 | |||
| 448 | return userWeixinDTO; | 459 | return userWeixinDTO; |
| 449 | |||
| 450 | } | 460 | } |
| 451 | 461 | ||
| 452 | /** | 462 | /** | ... | ... |
-
Please register or sign in to post a comment