1.修改app登录时app账号和第三方账号同时存在时头像和昵称无法同步的问题
Showing
6 changed files
with
34 additions
and
3 deletions
... | @@ -192,8 +192,8 @@ public class MemberProfileServiceImpl implements MemberProfileService { | ... | @@ -192,8 +192,8 @@ public class MemberProfileServiceImpl implements MemberProfileService { |
192 | } else { | 192 | } else { |
193 | member.setBirthday(memberDTO.getBirthday()); | 193 | member.setBirthday(memberDTO.getBirthday()); |
194 | } | 194 | } |
195 | if(StringUtils.isNotBlank(memberProfileDTO.getAvatarUrl())) { | 195 | if(StringUtils.isNotBlank(resources.getAvatarUrl())) { |
196 | member.setAvatarUrl(memberProfileDTO.getAvatarUrl()); | 196 | member.setAvatarUrl(resources.getAvatarUrl()); |
197 | } else { | 197 | } else { |
198 | member.setAvatarUrl(memberDTO.getAvatarUrl()); | 198 | member.setAvatarUrl(memberDTO.getAvatarUrl()); |
199 | } | 199 | } | ... | ... |
... | @@ -28,6 +28,8 @@ public class UserAppBind implements Serializable { | ... | @@ -28,6 +28,8 @@ public class UserAppBind implements Serializable { |
28 | 28 | ||
29 | @Transient | 29 | @Transient |
30 | private String password; | 30 | private String password; |
31 | @Transient | ||
32 | private String headImgUrl; | ||
31 | 33 | ||
32 | // 主键 | 34 | // 主键 |
33 | @Id | 35 | @Id | ... | ... |
... | @@ -104,7 +104,16 @@ public class UserAppServiceImpl implements UserAppService { | ... | @@ -104,7 +104,16 @@ public class UserAppServiceImpl implements UserAppService { |
104 | @Transactional(rollbackFor = Exception.class) | 104 | @Transactional(rollbackFor = Exception.class) |
105 | public UserAppSimpleDTO updateAppInfo(UserApp resources) { | 105 | public UserAppSimpleDTO updateAppInfo(UserApp resources) { |
106 | 106 | ||
107 | if (this.userAppRepository.updateAppInfo(resources) > 0) { | 107 | Long id = resources.getId(); |
108 | UserApp userApp = this.userAppRepository.findById(id).orElseGet(UserApp::new); | ||
109 | if (Objects.isNull(userApp.getId())) { | ||
110 | log.error("修改app信息失败,app账号信息不存在[updateAppInfo#]"); | ||
111 | return new UserAppSimpleDTO(); | ||
112 | } | ||
113 | |||
114 | userApp.copy(resources); | ||
115 | |||
116 | if (this.userAppRepository.updateAppInfo(userApp) > 0) { | ||
108 | UserAppSimple userAppSimple = this.userAppSimpleRepository.findById(resources.getId()).orElseGet(UserAppSimple::new); | 117 | UserAppSimple userAppSimple = this.userAppSimpleRepository.findById(resources.getId()).orElseGet(UserAppSimple::new); |
109 | if (Objects.nonNull(userAppSimple.getId())) { | 118 | if (Objects.nonNull(userAppSimple.getId())) { |
110 | MemberDTO memberDTO = this.memberService.findById(userAppSimple.getMemberId()); | 119 | MemberDTO memberDTO = this.memberService.findById(userAppSimple.getMemberId()); | ... | ... |
... | @@ -29,4 +29,7 @@ public class TempPoints extends TempRights { | ... | @@ -29,4 +29,7 @@ public class TempPoints extends TempRights { |
29 | @Transient | 29 | @Transient |
30 | protected Long rewardPointsExpireTime; | 30 | protected Long rewardPointsExpireTime; |
31 | 31 | ||
32 | @Transient | ||
33 | protected String description; | ||
34 | |||
32 | } | 35 | } | ... | ... |
... | @@ -544,6 +544,8 @@ public class PointsOperationServiceImpl implements PointsOperationService { | ... | @@ -544,6 +544,8 @@ public class PointsOperationServiceImpl implements PointsOperationService { |
544 | String description = tempPoints.getDescription(); | 544 | String description = tempPoints.getDescription(); |
545 | if (StringUtils.isEmpty(description)) { | 545 | if (StringUtils.isEmpty(description)) { |
546 | pointsDetail.setDescription("#"); | 546 | pointsDetail.setDescription("#"); |
547 | }else { | ||
548 | pointsDetail.setDescription(description); | ||
547 | } | 549 | } |
548 | 550 | ||
549 | // 保存积分流水 | 551 | // 保存积分流水 | ... | ... |
... | @@ -173,11 +173,26 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -173,11 +173,26 @@ public class UserOperationServiceImpl implements UserOperationService { |
173 | @Transactional(rollbackFor = Exception.class) | 173 | @Transactional(rollbackFor = Exception.class) |
174 | public boolean appBindThirdAccount(UserAppBind resources) { | 174 | public boolean appBindThirdAccount(UserAppBind resources) { |
175 | String username = resources.getUsername(); | 175 | String username = resources.getUsername(); |
176 | String headImgUrl = resources.getHeadImgUrl(); | ||
177 | String nickname = resources.getNickname(); | ||
178 | |||
176 | UserAppDTO userAppDTO = this.userAppService.findByUsername(username); | 179 | UserAppDTO userAppDTO = this.userAppService.findByUsername(username); |
177 | if (Objects.isNull(userAppDTO.getId())) { | 180 | if (Objects.isNull(userAppDTO.getId())) { |
178 | return false; | 181 | return false; |
179 | } | 182 | } |
180 | 183 | ||
184 | if (Objects.isNull(userAppDTO.getHeadimgurl())) { | ||
185 | UserApp userApp = new UserApp(); | ||
186 | userApp.setUsername(username); | ||
187 | if (StringUtils.isNotBlank(headImgUrl) && StringUtils.isNotBlank(nickname)) { | ||
188 | if (headImgUrl.contains("http") || headImgUrl.contains("https")) { | ||
189 | String image = this.downloadWeixinImgeFromAppEngine(headImgUrl); | ||
190 | userApp.setHeadimgurl(image); | ||
191 | } | ||
192 | userApp.setNickname(nickname); | ||
193 | this.userAppService.updateAppLastActiveTimeAndNicknameAndHeadImg(userApp); | ||
194 | } | ||
195 | } | ||
181 | String account = resources.getAccount(); | 196 | String account = resources.getAccount(); |
182 | Integer accountType = resources.getAccountType(); | 197 | Integer accountType = resources.getAccountType(); |
183 | UserAppBindDTO userAppBindDTO = this.userAppBindService.findFirstByAccountAndAccountType(account, accountType); | 198 | UserAppBindDTO userAppBindDTO = this.userAppBindService.findFirstByAccountAndAccountType(account, accountType); | ... | ... |
-
Please register or sign in to post a comment