Commit 892714ab 892714ab5f7b228f31e85375628f99b6c9e004d1 by xianghan

1.优化

1 parent 4d95d9c6
...@@ -37,8 +37,6 @@ public class MemberProfileController { ...@@ -37,8 +37,6 @@ public class MemberProfileController {
37 37
38 log.info("memberProfile ==>> update ==>> resources ===>> [{}]",resources); 38 log.info("memberProfile ==>> update ==>> resources ===>> [{}]",resources);
39 MemberProfileDTO memberProfileDTO = this.memberProfileOperationService.updateMemberProfileAndMember(resources); 39 MemberProfileDTO memberProfileDTO = this.memberProfileOperationService.updateMemberProfileAndMember(resources);
40 log.info("memberProfile ==>> update ==>> result ===>> [{}]",memberProfileDTO);
41
42 return ResultInfo.success(memberProfileDTO); 40 return ResultInfo.success(memberProfileDTO);
43 } 41 }
44 42
...@@ -47,6 +45,7 @@ public class MemberProfileController { ...@@ -47,6 +45,7 @@ public class MemberProfileController {
47 @AnonymousAccess 45 @AnonymousAccess
48 public ResultInfo updateMemberProfileAndMember(@Validated @RequestBody MemberProfile resources) { 46 public ResultInfo updateMemberProfileAndMember(@Validated @RequestBody MemberProfile resources) {
49 log.info("MemberProfileServiceImpl ==>> update ==>> resources ===>> [{}]",resources); 47 log.info("MemberProfileServiceImpl ==>> update ==>> resources ===>> [{}]",resources);
48
50 MemberProfileDTO memberProfileDTO = this.memberProfileOperationService.updateMemberProfileAndMember(resources); 49 MemberProfileDTO memberProfileDTO = this.memberProfileOperationService.updateMemberProfileAndMember(resources);
51 return ResultInfo.success(memberProfileDTO); 50 return ResultInfo.success(memberProfileDTO);
52 } 51 }
...@@ -58,9 +57,8 @@ public class MemberProfileController { ...@@ -58,9 +57,8 @@ public class MemberProfileController {
58 public ResultInfo create(@Validated(value = {CreateGroup.class}) @RequestBody MemberProfile resources) { 57 public ResultInfo create(@Validated(value = {CreateGroup.class}) @RequestBody MemberProfile resources) {
59 58
60 log.info("memberProfile ==>> update ==>> resources ===>> [{}]",resources); 59 log.info("memberProfile ==>> update ==>> resources ===>> [{}]",resources);
61 MemberProfileDTO memberProfileDTO = this.memberProfileOperationService.createMemberProfileAndSyncMember(resources);
62 log.info("memberProfile ==>> update ==>> result ===>> [{}]",memberProfileDTO);
63 60
61 MemberProfileDTO memberProfileDTO = this.memberProfileOperationService.createMemberProfileAndSyncMember(resources);
64 return ResultInfo.success(memberProfileDTO); 62 return ResultInfo.success(memberProfileDTO);
65 } 63 }
66 } 64 }
......
...@@ -222,7 +222,7 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -222,7 +222,7 @@ public class UserOperationServiceImpl implements UserOperationService {
222 String headimgurl = resources.getHeadimgurl(); 222 String headimgurl = resources.getHeadimgurl();
223 Integer sex = resources.getSex(); 223 Integer sex = resources.getSex();
224 224
225 // 账户和会员都存在 225 // 小屏账号
226 UserWeixinDTO userWeixinDTO = this.findFirstByAppIdAndOpenId(appId, openId); 226 UserWeixinDTO userWeixinDTO = this.findFirstByAppIdAndOpenId(appId, openId);
227 if (Objects.nonNull(userWeixinDTO.getId()) && Objects.nonNull(userWeixinDTO.getMemberId())) { 227 if (Objects.nonNull(userWeixinDTO.getId()) && Objects.nonNull(userWeixinDTO.getMemberId())) {
228 log.error("createWeixinUserAndMember ==>> result ==>> [{}]", userWeixinDTO); 228 log.error("createWeixinUserAndMember ==>> result ==>> [{}]", userWeixinDTO);
...@@ -306,12 +306,33 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -306,12 +306,33 @@ public class UserOperationServiceImpl implements UserOperationService {
306 // 当前用户的任意微信app,因为同一unionId的会员是唯一的 306 // 当前用户的任意微信app,因为同一unionId的会员是唯一的
307 UserWeixinDTO _userWeixinDTO = this.findFirstByUnionId(unionId); 307 UserWeixinDTO _userWeixinDTO = this.findFirstByUnionId(unionId);
308 if (Objects.nonNull(_userWeixinDTO.getId())) { 308 if (Objects.nonNull(_userWeixinDTO.getId())) {
309 Long memberId = _userWeixinDTO.getMemberId();
310 if (Objects.nonNull(memberId)) {
309 311
310 Assert.notNull(_userWeixinDTO.getMemberId(), GlobeExceptionMsg.MEMBER_ID_IS_NULL); 312 // 小屏会员
313 MemberDTO memberDTO = this.findMemberById(memberId);
314 if (Objects.nonNull(memberDTO.getId())) {
311 315
312 // 小屏会员 316 resources.setMemberId(_userWeixinDTO.getMemberId());
313 MemberDTO memberDTO = this.findMemberById(_userWeixinDTO.getMemberId()); 317 UserWeixin userWeixin = UserWeixinBuilder.build(resources);
314 if (Objects.nonNull(memberDTO)) { 318 UserWeixinDTO weixinDTO = this.createWeixinUser(userWeixin, memberDTO.getId(), memberDTO.getCode());
319 weixinDTO.setMemberCode(memberDTO.getCode());
320
321 // 同步至iptv
322 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncWeixin(weixinDTO);
323
324 return weixinDTO;
325
326 }
327
328 } else {
329
330 // 新建会员
331 Member _member =
332 MemberBuilder.build(LocalConstants.MEMBER_PLATFORM_TYPE_WEIXIN,
333 headimgurl, nickname, vip, sex);
334
335 MemberDTO memberDTO = this.createMember(_member);
315 336
316 resources.setMemberId(_userWeixinDTO.getMemberId()); 337 resources.setMemberId(_userWeixinDTO.getMemberId());
317 UserWeixin userWeixin = UserWeixinBuilder.build(resources); 338 UserWeixin userWeixin = UserWeixinBuilder.build(resources);
...@@ -322,11 +343,8 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -322,11 +343,8 @@ public class UserOperationServiceImpl implements UserOperationService {
322 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncWeixin(weixinDTO); 343 ((UserOperationServiceImpl)AopContext.currentProxy()).asyncWeixin(weixinDTO);
323 344
324 return weixinDTO; 345 return weixinDTO;
325
326 } 346 }
327 347
328 throw new EntityNotFoundException(MemberDTO.class, "code", GlobeExceptionMsg.MEMBER_CODE_IS_NULL);
329
330 } else { 348 } else {
331 349
332 // 新建会员 350 // 新建会员
...@@ -598,6 +616,7 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -598,6 +616,7 @@ public class UserOperationServiceImpl implements UserOperationService {
598 } 616 }
599 } 617 }
600 data = json.toJSONString(); 618 data = json.toJSONString();
619
601 } catch (Exception e) { 620 } catch (Exception e) {
602 log.info("头像解析失败!!!"); 621 log.info("头像解析失败!!!");
603 e.printStackTrace(); 622 e.printStackTrace();
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
2 spring: 2 spring:
3 datasource: 3 datasource:
4 # 测试/演示库url: 4 # 测试/演示库url:
5 # url: jdbc:log4jdbc:mysql://139.196.192.242:3306/tj_user_0819?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false 5 # url: jdbc:log4jdbc:mysql://122.112.214.149:3306/tj_user_admin?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
6 # username: root 6 # username: root
7 # password: Tjlh@2017 7 # password: root
8 url: jdbc:log4jdbc:mysql://122.112.214.149:3306/tj_user_admin?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false 8 url: jdbc:log4jdbc:mysql://139.196.145.150:3306/ucs-small-sichuan?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
9 username: root 9 username: root
10 password: root 10 password: Tjlh@2021
11 11
12 driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy 12 driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
13 #Druid 13 #Druid
......