1.优化
Showing
2 changed files
with
48 additions
and
17 deletions
... | @@ -1522,10 +1522,15 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -1522,10 +1522,15 @@ public class UserOperationServiceImpl implements UserOperationService { |
1522 | String appId = resources.getAppid(); | 1522 | String appId = resources.getAppid(); |
1523 | String openId = resources.getOpenid(); | 1523 | String openId = resources.getOpenid(); |
1524 | String unionId = resources.getUnionid(); | 1524 | String unionId = resources.getUnionid(); |
1525 | String nickname = resources.getNickname(); | ||
1526 | String headimgurl = resources.getHeadimgurl(); | ||
1525 | 1527 | ||
1526 | // 检查账户是否存在 | 1528 | // 检查账户是否存在 |
1527 | UserWeixinDTO userWeixinDTO = this.findFirstByUnionIdAndAppIdAndOpenId(unionId,appId, openId); | 1529 | // UserWeixinDTO userWeixinDTO = this.findFirstByUnionIdAndAppIdAndOpenId(unionId,appId, openId); |
1528 | if (Objects.nonNull(userWeixinDTO.getId())) | 1530 | |
1531 | UserWeixinDTO userWeixinDTO = this.findUserWeiXinByOpenIdAndAppId(appId, openId); | ||
1532 | if (Objects.nonNull(userWeixinDTO.getId()) && StringUtils.isNotBlank(userWeixinDTO.getUnionid()) && | ||
1533 | Objects.nonNull(userWeixinDTO.getMemberId())) | ||
1529 | return userWeixinDTO; | 1534 | return userWeixinDTO; |
1530 | 1535 | ||
1531 | // 当前用户的任意微信app | 1536 | // 当前用户的任意微信app |
... | @@ -1547,22 +1552,48 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -1547,22 +1552,48 @@ public class UserOperationServiceImpl implements UserOperationService { |
1547 | 1552 | ||
1548 | } | 1553 | } |
1549 | 1554 | ||
1550 | userWeixinDTO1.setId(null); | 1555 | if (Objects.nonNull(userWeixinDTO.getId())) { |
1551 | userWeixinDTO1.setAppid(appId); | 1556 | String unionid = userWeixinDTO.getUnionid(); |
1552 | userWeixinDTO1.setOpenid(openId); | 1557 | if (StringUtils.isBlank(unionid)) { |
1553 | userWeixinDTO1.setUnionid(unionId); | 1558 | userWeixinDTO.setUnionid(unionId); |
1554 | log.info("createWeixinUserAndCreateMember ==>> [{}]",userWeixinDTO1); | 1559 | } |
1555 | // 保存微信账户 | 1560 | String nickname_ = userWeixinDTO.getNickname(); |
1556 | userWeixinDTO1 = this.doCreateUserWeiXin(userWeixinDTO1,memberId); | 1561 | if (StringUtils.isBlank(nickname_)) { |
1562 | userWeixinDTO.setNickname(nickname); | ||
1563 | } | ||
1564 | String headimgurl_ = userWeixinDTO.getHeadimgurl(); | ||
1565 | if (StringUtils.isBlank(headimgurl_)) { | ||
1566 | userWeixinDTO.setHeadimgurl(headimgurl); | ||
1567 | } | ||
1568 | |||
1569 | UserWeixinDTO userWeixinDTO_ = this.doCreateUserWeiXin(userWeixinDTO,memberId); | ||
1570 | MemberProfileDTO memberProfileDTO = this.memberProfileService.findByMemberId(memberId); | ||
1571 | if (Objects.isNull(memberProfileDTO)) | ||
1572 | // 创建会员属性信息 | ||
1573 | this.createMemberProfile(userWeixinDTO_); | ||
1557 | 1574 | ||
1558 | log.info("userWeixinDTO1 ==>> [{}]",userWeixinDTO1); | 1575 | return userWeixinDTO; |
1559 | 1576 | ||
1560 | MemberProfileDTO memberProfileDTO = this.memberProfileService.findByMemberId(memberId); | 1577 | } else { |
1561 | if (Objects.isNull(memberProfileDTO)) | 1578 | |
1562 | // 创建会员属性信息 | 1579 | userWeixinDTO1.setId(null); |
1563 | this.createMemberProfile(userWeixinDTO1); | 1580 | userWeixinDTO1.setAppid(appId); |
1581 | userWeixinDTO1.setOpenid(openId); | ||
1582 | userWeixinDTO1.setUnionid(unionId); | ||
1583 | log.info("createWeixinUserAndCreateMember ==>> [{}]",userWeixinDTO1); | ||
1584 | // 保存微信账户 | ||
1585 | userWeixinDTO1 = this.doCreateUserWeiXin(userWeixinDTO1,memberId); | ||
1564 | 1586 | ||
1565 | return userWeixinDTO1; | 1587 | log.info("userWeixinDTO1 ==>> [{}]",userWeixinDTO1); |
1588 | |||
1589 | MemberProfileDTO memberProfileDTO = this.memberProfileService.findByMemberId(memberId); | ||
1590 | if (Objects.isNull(memberProfileDTO)) | ||
1591 | // 创建会员属性信息 | ||
1592 | this.createMemberProfile(userWeixinDTO1); | ||
1593 | |||
1594 | return userWeixinDTO1; | ||
1595 | |||
1596 | } | ||
1566 | } | 1597 | } |
1567 | 1598 | ||
1568 | @Override | 1599 | @Override | ... | ... |
... | @@ -2,9 +2,9 @@ | ... | @@ -2,9 +2,9 @@ |
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://139.196.145.150:3306/ucs_test?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false |
6 | username: root | 6 | username: root |
7 | password: Tjlh@2017 | 7 | password: Tjlh@2021 |
8 | 8 | ||
9 | driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy | 9 | driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy |
10 | #Druid | 10 | #Druid | ... | ... |
-
Please register or sign in to post a comment