1.优化
Showing
3 changed files
with
21 additions
and
8 deletions
| ... | @@ -205,7 +205,6 @@ public class UserOperationController { | ... | @@ -205,7 +205,6 @@ public class UserOperationController { |
| 205 | subscribeBean.setSourceInfo(sourceInfo); | 205 | subscribeBean.setSourceInfo(sourceInfo); |
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | String headimgurl = iptvUserInfo.get("headimgurl").toString(); | ||
| 209 | String nickname = iptvUserInfo.get("nickname").toString(); | 208 | String nickname = iptvUserInfo.get("nickname").toString(); |
| 210 | if (StringUtils.isNotBlank(nickname)) { | 209 | if (StringUtils.isNotBlank(nickname)) { |
| 211 | String nicknameDecode = URLDecoder.decode(nickname, "UTF-8"); | 210 | String nicknameDecode = URLDecoder.decode(nickname, "UTF-8"); |
| ... | @@ -213,10 +212,16 @@ public class UserOperationController { | ... | @@ -213,10 +212,16 @@ public class UserOperationController { |
| 213 | subscribeBean.setNickname(nicknameEncode); | 212 | subscribeBean.setNickname(nicknameEncode); |
| 214 | } | 213 | } |
| 215 | 214 | ||
| 215 | String headimgurl = iptvUserInfo.get("headimgurl").toString(); | ||
| 216 | log.info("parseSubscribe ==>> headimgurl ==>> {}", headimgurl); | ||
| 216 | if (StringUtils.isNotBlank(headimgurl)) { | 217 | if (StringUtils.isNotBlank(headimgurl)) { |
| 217 | String headimgurlDecode = URLDecoder.decode(headimgurl, "UTF-8"); | 218 | String headimgurlDecode = URLDecoder.decode(headimgurl, "UTF-8"); |
| 218 | String headImgUrl = this.downloadWeixinImge(headimgurlDecode); | 219 | if (StringUtils.isNotBlank(headimgurlDecode)) { |
| 219 | subscribeBean.setHeadimgurl(headImgUrl); | 220 | if (headimgurl.contains("https") || headimgurl.contains("http")) { |
| 221 | headimgurl = this.downloadWeixinImge(headimgurlDecode); | ||
| 222 | } | ||
| 223 | subscribeBean.setHeadimgurl(headimgurl); | ||
| 224 | } | ||
| 220 | } | 225 | } |
| 221 | 226 | ||
| 222 | } else { | 227 | } else { |
| ... | @@ -224,10 +229,10 @@ public class UserOperationController { | ... | @@ -224,10 +229,10 @@ public class UserOperationController { |
| 224 | // headimgurl | 229 | // headimgurl |
| 225 | String headimgurl = subscribeBean.getHeadimgurl(); | 230 | String headimgurl = subscribeBean.getHeadimgurl(); |
| 226 | if (StringUtils.isNotBlank(headimgurl)) { | 231 | if (StringUtils.isNotBlank(headimgurl)) { |
| 227 | 232 | if (headimgurl.contains("https") || headimgurl.contains("http")) { | |
| 228 | String headImgUrl = this.downloadWeixinImge(headimgurl); | 233 | String headImgUrl = this.downloadWeixinImge(headimgurl); |
| 229 | subscribeBean.setHeadimgurl(headImgUrl); | 234 | subscribeBean.setHeadimgurl(headImgUrl); |
| 230 | 235 | } | |
| 231 | } | 236 | } |
| 232 | 237 | ||
| 233 | } | 238 | } |
| ... | @@ -357,6 +362,9 @@ public class UserOperationController { | ... | @@ -357,6 +362,9 @@ public class UserOperationController { |
| 357 | 362 | ||
| 358 | try { | 363 | try { |
| 359 | String headimgurl = iptvUserInfo.get("headimgurl").toString(); | 364 | String headimgurl = iptvUserInfo.get("headimgurl").toString(); |
| 365 | |||
| 366 | log.info("headimgurl ==>> {}", headimgurl); | ||
| 367 | |||
| 360 | String nickname = iptvUserInfo.get("nickname").toString(); | 368 | String nickname = iptvUserInfo.get("nickname").toString(); |
| 361 | if (StringUtils.isNotBlank(nickname)) { | 369 | if (StringUtils.isNotBlank(nickname)) { |
| 362 | String nicknameDecode = URLDecoder.decode(nickname, "UTF-8"); | 370 | String nicknameDecode = URLDecoder.decode(nickname, "UTF-8"); |
| ... | @@ -365,12 +373,16 @@ public class UserOperationController { | ... | @@ -365,12 +373,16 @@ public class UserOperationController { |
| 365 | } | 373 | } |
| 366 | 374 | ||
| 367 | if (StringUtils.isNotBlank(headimgurl)) { | 375 | if (StringUtils.isNotBlank(headimgurl)) { |
| 376 | |||
| 377 | if(headimgurl.contains("https")||headimgurl.contains("http")) { | ||
| 368 | String headimgurlDecode = URLDecoder.decode(headimgurl, "UTF-8"); | 378 | String headimgurlDecode = URLDecoder.decode(headimgurl, "UTF-8"); |
| 369 | String imageEncode = Base64Util.encode(headimgurlDecode); | 379 | // String imageEncode = Base64Util.encode(headimgurlDecode); |
| 370 | String image = RestTemplateClient.netImage(headimgurlDecode); | 380 | String image = RestTemplateClient.netImage(headimgurlDecode); |
| 371 | memberDTO.setAvatarUrl(StringUtils.isNotBlank(image) == true ? image:headimgurlDecode); | 381 | memberDTO.setAvatarUrl(StringUtils.isNotBlank(image) == true ? image:headimgurlDecode); |
| 372 | } | 382 | } |
| 373 | 383 | ||
| 384 | } | ||
| 385 | |||
| 374 | } catch (Exception e) { | 386 | } catch (Exception e) { |
| 375 | log.info("头像解析失败!!!"); | 387 | log.info("头像解析失败!!!"); |
| 376 | e.printStackTrace(); | 388 | e.printStackTrace(); | ... | ... |
| ... | @@ -245,7 +245,6 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -245,7 +245,6 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
| 245 | this.grantRight(tempRightsMap); | 245 | this.grantRight(tempRightsMap); |
| 246 | 246 | ||
| 247 | } | 247 | } |
| 248 | System.out.println(taskList); | ||
| 249 | return ResultInfo.success(); | 248 | return ResultInfo.success(); |
| 250 | 249 | ||
| 251 | } | 250 | } | ... | ... |
| ... | @@ -418,7 +418,7 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -418,7 +418,7 @@ public class UserOperationServiceImpl implements UserOperationService { |
| 418 | Objects.isNull(_userWeixinDTO.getMemberId())) { | 418 | Objects.isNull(_userWeixinDTO.getMemberId())) { |
| 419 | 419 | ||
| 420 | UserWeixin userWeixin = new UserWeixin(); | 420 | UserWeixin userWeixin = new UserWeixin(); |
| 421 | BeanUtils.copyProperties(resources,userWeixin); | 421 | BeanUtils.copyProperties(resources, userWeixin); |
| 422 | userWeixin.setStatus(SUBSCRIBE_STATUS); | 422 | userWeixin.setStatus(SUBSCRIBE_STATUS); |
| 423 | 423 | ||
| 424 | // 创建小屏账户同时创建会员 | 424 | // 创建小屏账户同时创建会员 |
| ... | @@ -591,10 +591,12 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -591,10 +591,12 @@ public class UserOperationServiceImpl implements UserOperationService { |
| 591 | String headimgurl = json.get("headimgurl").toString(); | 591 | String headimgurl = json.get("headimgurl").toString(); |
| 592 | if (StringUtils.isNotBlank(headimgurl)) { | 592 | if (StringUtils.isNotBlank(headimgurl)) { |
| 593 | String headimgurlDecode = URLDecoder.decode(headimgurl, "UTF-8"); | 593 | String headimgurlDecode = URLDecoder.decode(headimgurl, "UTF-8"); |
| 594 | if (headimgurlDecode.contains("http") || headimgurlDecode.contains("https")) { | ||
| 594 | String image = this.downloadWeixinImgeFromAppEngine(headimgurlDecode); | 595 | String image = this.downloadWeixinImgeFromAppEngine(headimgurlDecode); |
| 595 | if (StringUtils.isNotBlank(image)) | 596 | if (StringUtils.isNotBlank(image)) |
| 596 | json.put("headimgurl",image); | 597 | json.put("headimgurl",image); |
| 597 | } | 598 | } |
| 599 | } | ||
| 598 | data = json.toJSONString(); | 600 | data = json.toJSONString(); |
| 599 | } catch (Exception e) { | 601 | } catch (Exception e) { |
| 600 | log.info("头像解析失败!!!"); | 602 | log.info("头像解析失败!!!"); | ... | ... |
-
Please register or sign in to post a comment