Commit 1b7ce5265cc730ade9cced2ee25f12c4791f3c01

Authored by 张志伟
1 parent 93c90933

:zap: feat(*): 升级和对接新版会员

- 升级和对接新版会员
fw-hestia-domain/src/main/java/cn/fw/hestia/domain/vo/HistoryQuery.java
... ... @@ -18,7 +18,4 @@ import lombok.ToString;
18 18 public class HistoryQuery extends BasePageQuery {
19 19 @PassportContextField(PassportContextField.Name.MEMBER_ID)
20 20 private Long memberId;
21   -
22   - @PassportContextField(PassportContextField.Name.ACCOUNT_ID)
23   - private Long accId;
24 21 }
... ...
fw-hestia-rpc/src/main/java/cn/fw/hestia/rpc/member/MemberRpcService.java
... ... @@ -6,26 +6,17 @@ import cn.fw.hestia.common.constant.Constant;
6 6 import cn.fw.hestia.rpc.member.dto.MemberUserDTO;
7 7 import cn.fw.member.sdk.api.FunctionApi;
8 8 import cn.fw.member.sdk.api.MemberApi;
9   -import cn.fw.member.sdk.vo.BatchUserParam;
  9 +import cn.fw.member.sdk.vo.MemberInfoVo;
10 10 import cn.fw.member.sdk.vo.MobileLocation;
11   -import cn.fw.member.sdk.vo.UserBaseInfoVO;
12   -import cn.fw.member.sdk.vo.UserRegistryVO;
13 11 import lombok.extern.slf4j.Slf4j;
14 12 import org.apache.commons.lang3.StringUtils;
15 13 import org.springframework.beans.BeanUtils;
16 14 import org.springframework.beans.factory.annotation.Autowired;
17 15 import org.springframework.cache.annotation.Cacheable;
18 16 import org.springframework.stereotype.Service;
19   -import org.springframework.util.CollectionUtils;
20 17  
21   -import java.util.ArrayList;
22   -import java.util.Collections;
23   -import java.util.List;
24 18 import java.util.Objects;
25 19  
26   -import static org.apache.commons.lang3.Validate.isTrue;
27   -import static org.apache.commons.lang3.Validate.notNull;
28   -
29 20 /**
30 21 * 会员服务
31 22 *
... ... @@ -62,12 +53,12 @@ public class MemberRpcService {
62 53 return null;
63 54 }
64 55 try {
65   - final Message<UserBaseInfoVO> msg = memberApi.queryUserByuserId(userId);
  56 + final Message<MemberInfoVo> msg = memberApi.getMemberById(userId);
66 57 if (!msg.isSuccess()) {
67 58 log.warn("调用Member[根据会员ID[{}]获取会员信息]系统失败, 原因:{}", userId, msg.getResult());
68 59 return null;
69 60 }
70   - final UserBaseInfoVO user = msg.getData();
  61 + final MemberInfoVo user = msg.getData();
71 62 if (user != null) {
72 63 final MemberUserDTO userDTO = new MemberUserDTO();
73 64 BeanUtils.copyProperties(user, userDTO);
... ... @@ -79,86 +70,6 @@ public class MemberRpcService {
79 70 return null;
80 71 }
81 72  
82   - /**
83   - * 根据会员ID集合获取会员列表
84   - *
85   - * @param userIds 会员ID集合
86   - * @return 会员列表
87   - */
88   - public List<MemberUserDTO> users(final List<Long> userIds) {
89   - if (CollectionUtils.isEmpty(userIds)) {
90   - return Collections.emptyList();
91   - }
92   - try {
93   - final BatchUserParam param = new BatchUserParam();
94   - param.setUserIdList(userIds);
95   - final Message<List<UserBaseInfoVO>> msg = memberApi.batchUserByUserId(param);
96   - if (!msg.isSuccess()) {
97   - log.warn("调用Member[根据会员ID集合[{}]获取会员列表]系统失败, 原因:{}", userIds, msg.getResult());
98   - return Collections.emptyList();
99   - }
100   - final List<UserBaseInfoVO> users = msg.getData();
101   - if (!CollectionUtils.isEmpty(users)) {
102   - final List<MemberUserDTO> members = new ArrayList<>();
103   - users.forEach(item -> {
104   - final MemberUserDTO userDTO = new MemberUserDTO();
105   - BeanUtils.copyProperties(item, userDTO);
106   - members.add(userDTO);
107   - });
108   - return members;
109   - }
110   - } catch (Exception e) {
111   - log.error("调用Member[根据会员ID集合[{}]获取会员列表]系统失败", userIds, e);
112   - }
113   - return Collections.emptyList();
114   - }
115   -
116   - /**
117   - * 根据手机号查询会员信息
118   - *
119   - * @param mobile 手机号
120   - * @return 会员信息
121   - */
122   - @Cacheable(cacheNames = Constant.MEMBER_INFO_MOBILE_CACHE, key = "#mobile", unless = "#result == null ")
123   - public MemberUserDTO queryByMobile(final String mobile) {
124   - if (StringUtils.isBlank(mobile)) {
125   - return null;
126   - }
127   - try {
128   - final Message<UserBaseInfoVO> msg = memberApi.queryUserByMobile(mobile);
129   - isTrue(msg.isSuccess(), String.format("调用Member系统失败: [根据会员手机号[%s]获取会员信息]", mobile));
130   - final UserBaseInfoVO user = msg.getData();
131   - if (Objects.isNull(user)) {
132   - return null;
133   - }
134   - final MemberUserDTO userDTO = new MemberUserDTO();
135   - BeanUtils.copyProperties(user, userDTO);
136   - return userDTO;
137   - } catch (Exception e) {
138   - log.error("调用Member系统根据会员手机号[{}]获取会员信息失败", mobile, e);
139   - }
140   - return null;
141   - }
142   -
143   - /**
144   - * 注册会员
145   - *
146   - * @param memberUser 注册信息
147   - * @return 会员
148   - */
149   - public MemberUserDTO register(final MemberUserDTO memberUser) {
150   - notNull(memberUser, "会员注册信息不能为空");
151   - UserRegistryVO vo = new UserRegistryVO();
152   - BeanUtils.copyProperties(memberUser, vo);
153   - vo.setNickName(StringUtils.isNotBlank(memberUser.getNickName()) ? memberUser.getNickName() : memberUser.getRealName());
154   - final Message<UserBaseInfoVO> msg = memberApi.register(vo);
155   - isTrue(msg.isSuccess(), String.format("调用Member[注册会员[%s]]系统失败", vo));
156   - final UserBaseInfoVO user = msg.getData();
157   - notNull(user, String.format("调用Member[注册会员[%s]]系统失败,返回会员信息为空", vo));
158   - final MemberUserDTO userDTO = new MemberUserDTO();
159   - BeanUtils.copyProperties(user, userDTO);
160   - return userDTO;
161   - }
162 73  
163 74 /**
164 75 * 查询手机号归属地
... ...
fw-hestia-rpc/src/main/java/cn/fw/hestia/rpc/member/dto/MemberUserDTO.java
... ... @@ -17,27 +17,15 @@ public class MemberUserDTO implements Serializable {
17 17 /**
18 18 * 用户Id
19 19 */
20   - private Long userId;
21   -
22   - /**
23   - * 真实姓名
24   - */
25   - private String realName;
26   -
27   - /**
28   - * 会员昵称
29   - */
30   - private String nickName;
31   -
  20 + private Long id;
32 21 /**
33   - * 手机号
  22 + * 最后一个账号id
34 23 */
35   - private String phone;
36   -
  24 + private Long latestAccountId;
37 25 /**
38   - * 用户头像URL
  26 + * 真实姓名
39 27 */
40   - private String avatarUrl;
  28 + private String realName;
41 29  
42 30 /**
43 31 * 证件类型
... ... @@ -50,13 +38,15 @@ public class MemberUserDTO implements Serializable {
50 38 private String credentNo;
51 39  
52 40 /**
53   - * 性别
54   - */
55   - private Integer sex;
56   -
57   - /**
58 41 * 生日
59 42 */
60 43 private Date birthday;
61 44  
  45 + public Long getUserId() {
  46 + return id;
  47 + }
  48 +
  49 + public Long getMemberId() {
  50 + return id;
  51 + }
62 52 }
... ...
fw-hestia-service/src/main/java/cn/fw/hestia/component/AttentionConsumer.java deleted
1   -package cn.fw.hestia.component;
2   -
3   -import cn.fw.hestia.service.buz.MessageCenterBizService;
4   -import cn.fw.passport.sdk.enums.SubScribeEventEnum;
5   -import cn.fw.passport.sdk.mq.SubscribeEvent;
6   -import com.alibaba.fastjson.JSON;
7   -import lombok.extern.slf4j.Slf4j;
8   -import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
9   -import org.apache.rocketmq.spring.core.RocketMQListener;
10   -import org.springframework.beans.factory.annotation.Autowired;
11   -import org.springframework.stereotype.Component;
12   -
13   -
14   -/**
15   - * 监听关注公众号mq
16   - *
17   - * @author kurisu
18   - */
19   -@Slf4j
20   -@Component
21   -@RocketMQMessageListener(topic = "subs_event", consumerGroup = "${spring.application.name}" + "-subs_event")
22   -public class AttentionConsumer implements RocketMQListener<SubscribeEvent> {
23   - private final MessageCenterBizService messageCenterBizService;
24   -
25   - @Autowired
26   - public AttentionConsumer(final MessageCenterBizService messageCenterBizService) {
27   - this.messageCenterBizService = messageCenterBizService;
28   - }
29   -
30   - @Override
31   - public void onMessage(SubscribeEvent t) {
32   - log.info("监听关注公众号mq: SubscribeEvent=[{}]", t);
33   - SubScribeEventEnum eventType = t.getEventType();
34   - try {
35   - if (eventType.equals(SubScribeEventEnum.SUBSCRIBE)) {
36   - messageCenterBizService.onAttention(t.getUserId());
37   - }
38   - } catch (Exception ex) {
39   - log.error("消费关注公众号mq失败,原因:{}", JSON.toJSONString(ex));
40   - }
41   - }
42   -}
43 0 \ No newline at end of file
... ... @@ -36,10 +36,10 @@
36 36 <rocketmq-spring-boot-starter.version>2.1.0</rocketmq-spring-boot-starter.version>
37 37 <redis.spring.boot.starter>1.0</redis.spring.boot.starter>
38 38 <fastjson>1.2.51</fastjson>
39   - <fw-passport-sdk.version>2.2.0</fw-passport-sdk.version>
  39 + <fw-passport-sdk.version>3.0.0</fw-passport-sdk.version>
40 40 <yitter.idgenerator>1.0.6</yitter.idgenerator>
41 41 <hutool.version>5.2.5</hutool.version>
42   - <fw-member-sdk.version>2.0</fw-member-sdk.version>
  42 + <fw-member-sdk.version>3.0.0</fw-member-sdk.version>
43 43 </properties>
44 44  
45 45 <dependencyManagement>
... ...