Commit 5e3fc84b25173213e8c9ded6b524df51a9f26bcd
1 parent
fb57e7eb
feat(*): 升级新版会员
- 升级新版会员
Showing
15 changed files
with
344 additions
and
252 deletions
fw-shirasawa-rpc/pom.xml
... | ... | @@ -26,11 +26,7 @@ |
26 | 26 | <groupId>cn.fw</groupId> |
27 | 27 | <artifactId>fw-oop-sdk</artifactId> |
28 | 28 | </dependency> |
29 | - <!--Passport SDK--> | |
30 | - <dependency> | |
31 | - <groupId>cn.fw</groupId> | |
32 | - <artifactId>fw-passport-sdk</artifactId> | |
33 | - </dependency> | |
29 | + | |
34 | 30 | <dependency> |
35 | 31 | <groupId>cn.fw</groupId> |
36 | 32 | <artifactId>fw-sms-sdk</artifactId> | ... | ... |
fw-shirasawa-rpc/src/main/java/cn/fw/shirasawa/rpc/member/MemberRpcService.java
... | ... | @@ -2,13 +2,16 @@ package cn.fw.shirasawa.rpc.member; |
2 | 2 | |
3 | 3 | import cn.fw.common.util.MobileUtil; |
4 | 4 | import cn.fw.data.base.domain.common.Message; |
5 | +import cn.fw.member.sdk.api.AccountApi; | |
5 | 6 | import cn.fw.member.sdk.api.FunctionApi; |
6 | 7 | import cn.fw.member.sdk.api.MemberApi; |
7 | -import cn.fw.member.sdk.vo.BatchUserParam; | |
8 | +import cn.fw.member.sdk.vo.AccountInfoVo; | |
9 | +import cn.fw.member.sdk.vo.MemberInfoVo; | |
10 | +import cn.fw.member.sdk.vo.MemberPhoneInfoVo; | |
8 | 11 | import cn.fw.member.sdk.vo.MobileLocation; |
9 | -import cn.fw.member.sdk.vo.UserBaseInfoVO; | |
10 | 12 | import cn.fw.shirasawa.rpc.AbsBaseRpcService; |
11 | 13 | import cn.fw.shirasawa.rpc.member.dto.MemberUserDTO; |
14 | +import cn.fw.shirasawa.rpc.member.dto.UserAccountDTO; | |
12 | 15 | import com.alibaba.fastjson.JSONObject; |
13 | 16 | import lombok.RequiredArgsConstructor; |
14 | 17 | import lombok.extern.slf4j.Slf4j; |
... | ... | @@ -16,12 +19,9 @@ import org.apache.commons.lang3.StringUtils; |
16 | 19 | import org.springframework.beans.BeanUtils; |
17 | 20 | import org.springframework.beans.factory.annotation.Value; |
18 | 21 | import org.springframework.cache.annotation.Cacheable; |
22 | +import org.springframework.lang.Nullable; | |
19 | 23 | import org.springframework.stereotype.Service; |
20 | -import org.springframework.util.CollectionUtils; | |
21 | 24 | |
22 | -import java.util.ArrayList; | |
23 | -import java.util.Collections; | |
24 | -import java.util.List; | |
25 | 25 | import java.util.Objects; |
26 | 26 | import java.util.concurrent.CompletableFuture; |
27 | 27 | |
... | ... | @@ -40,6 +40,7 @@ public class MemberRpcService extends AbsBaseRpcService { |
40 | 40 | * 会员服务 |
41 | 41 | */ |
42 | 42 | private final MemberApi memberApi; |
43 | + private final AccountApi accountApi; | |
43 | 44 | private final FunctionApi functionApi; |
44 | 45 | |
45 | 46 | @Value("${spring.cache.custom.global-prefix}:rpc:member") |
... | ... | @@ -55,65 +56,25 @@ public class MemberRpcService extends AbsBaseRpcService { |
55 | 56 | if (userId == null || userId <= 0) { |
56 | 57 | return null; |
57 | 58 | } |
58 | - String key = String.format("%s:member-info:%s", getKeyPrefix(), userId); | |
59 | - MemberUserDTO memberUserDTO = getFromCache(key, MemberUserDTO.class); | |
60 | - if (Objects.nonNull(memberUserDTO)) { | |
61 | - return memberUserDTO; | |
62 | - } | |
63 | 59 | try { |
64 | - final Message<UserBaseInfoVO> msg = memberApi.queryUserByuserId(userId); | |
60 | + final Message<MemberPhoneInfoVo> msg = memberApi.getMemberPhoneById(userId); | |
65 | 61 | if (!msg.isSuccess()) { |
66 | - log.warn("调用Member[根据会员ID[{}]获取会员信息]系统失败, 原因:{}", userId, msg.getResult()); | |
62 | + log.warn("调用Member系统[根据会员ID[{}]获取会员信息]失败, 原因:{}", userId, msg.getResult()); | |
67 | 63 | return null; |
68 | 64 | } |
69 | - final UserBaseInfoVO user = msg.getData(); | |
65 | + final MemberPhoneInfoVo user = msg.getData(); | |
70 | 66 | if (user != null) { |
71 | 67 | final MemberUserDTO userDTO = new MemberUserDTO(); |
72 | 68 | BeanUtils.copyProperties(user, userDTO); |
73 | - setToCache(key, JSONObject.toJSONString(userDTO), 60 * 3); | |
74 | 69 | return userDTO; |
75 | 70 | } |
76 | 71 | } catch (Exception e) { |
77 | - log.warn("调用Member[根据会员ID[{}]获取会员信息]系统失败", userId); | |
72 | + log.error("调用Member系统[根据会员ID[{}]获取会员信息]失败", userId, e); | |
78 | 73 | } |
79 | 74 | return null; |
80 | 75 | } |
81 | 76 | |
82 | 77 | /** |
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.warn("调用Member[根据会员ID集合[{}]获取会员列表]系统失败", userIds); | |
112 | - } | |
113 | - return Collections.emptyList(); | |
114 | - } | |
115 | - | |
116 | - /** | |
117 | 78 | * 根据手机号查询会员信息 |
118 | 79 | * |
119 | 80 | * @param mobile 手机号 |
... | ... | @@ -129,18 +90,50 @@ public class MemberRpcService extends AbsBaseRpcService { |
129 | 90 | return memberUserDTO; |
130 | 91 | } |
131 | 92 | try { |
132 | - final Message<UserBaseInfoVO> msg = memberApi.queryUserByMobile(mobile); | |
93 | + Message<AccountInfoVo> accountMsg = accountApi.getAccountByPhone(mobile); | |
94 | + isTrue(accountMsg.isSuccess(), String.format("调用Member系统失败: [根据会员手机号[%s]获取会员信息: %s]", mobile, accountMsg.getResult())); | |
95 | + AccountInfoVo account = accountMsg.getData(); | |
96 | + if (account == null) { | |
97 | + log.error("手机号[{}]不存在任何账号信息", mobile); | |
98 | + return null; | |
99 | + } | |
100 | + final Message<MemberInfoVo> msg = memberApi.getMemberById(account.getMemberId()); | |
133 | 101 | isTrue(msg.isSuccess(), String.format("调用Member系统失败: [根据会员手机号[%s]获取会员信息]", mobile)); |
134 | - final UserBaseInfoVO user = msg.getData(); | |
102 | + final MemberInfoVo user = msg.getData(); | |
135 | 103 | if (Objects.isNull(user)) { |
136 | 104 | return null; |
137 | 105 | } |
138 | 106 | final MemberUserDTO userDTO = new MemberUserDTO(); |
139 | 107 | BeanUtils.copyProperties(user, userDTO); |
140 | - setToCache(key, JSONObject.toJSONString(userDTO), 60 * 3); | |
108 | + userDTO.setLatestAccountId(account.getId()); | |
109 | + userDTO.setLatestAccountPhone(account.getPhone()); | |
110 | + setToCache(key, JSONObject.toJSONString(userDTO), 15); | |
141 | 111 | return userDTO; |
142 | 112 | } catch (Exception e) { |
143 | - log.warn("调用Member系统根据会员手机号[{}]获取会员信息失败", mobile); | |
113 | + log.error("调用Member系统根据会员手机号[{}]获取会员信息失败", mobile, e); | |
114 | + } | |
115 | + return null; | |
116 | + } | |
117 | + | |
118 | + @Nullable | |
119 | + public UserAccountDTO accountById(final Long accountId) { | |
120 | + if (accountId == null || accountId <= 0) { | |
121 | + return null; | |
122 | + } | |
123 | + try { | |
124 | + final Message<AccountInfoVo> msg = accountApi.getAccountById(accountId); | |
125 | + if (!msg.isSuccess()) { | |
126 | + log.warn("调用Member系统[根据账号ID[{}]获取账号信息]失败, 原因:{}", accountId, msg.getResult()); | |
127 | + return null; | |
128 | + } | |
129 | + final AccountInfoVo account = msg.getData(); | |
130 | + if (account != null) { | |
131 | + final UserAccountDTO accountDTO = new UserAccountDTO(); | |
132 | + BeanUtils.copyProperties(account, accountDTO); | |
133 | + return accountDTO; | |
134 | + } | |
135 | + } catch (Exception e) { | |
136 | + log.error("调用Member系统[根据账号ID[{}]获取账号信息]失败", accountId, e); | |
144 | 137 | } |
145 | 138 | return null; |
146 | 139 | } | ... | ... |
fw-shirasawa-rpc/src/main/java/cn/fw/shirasawa/rpc/member/dto/MemberUserDTO.java
... | ... | @@ -15,27 +15,49 @@ import java.util.Date; |
15 | 15 | @Data |
16 | 16 | public class MemberUserDTO implements Serializable { |
17 | 17 | private static final long serialVersionUID = 2363764577624856885L; |
18 | - private Long userId; | |
19 | - private String cardNo; | |
18 | + /** | |
19 | + * 会员号 | |
20 | + */ | |
21 | + private Long id; | |
22 | + /** | |
23 | + * 账号 | |
24 | + */ | |
25 | + private Long latestAccountId; | |
26 | + /** | |
27 | + * 电话 | |
28 | + */ | |
29 | + private String latestAccountPhone; | |
30 | + /** | |
31 | + * 姓名 | |
32 | + */ | |
20 | 33 | private String realName; |
21 | - private String nickName; | |
22 | - private String phone; | |
23 | - private Integer sex; | |
24 | - private Date birthday; | |
34 | + /** | |
35 | + * 生日 | |
36 | + */ | |
37 | + private Date birthDate; | |
38 | + /** | |
39 | + * 认证资料类型 | |
40 | + */ | |
25 | 41 | private Integer credentType; |
42 | + /** | |
43 | + * 身份证号 | |
44 | + */ | |
26 | 45 | private String credentNo; |
27 | - private Integer education; | |
28 | - private Integer maritalStatus; | |
29 | - private String email; | |
30 | - private Integer registerSrc; | |
31 | - private String province; | |
32 | - private String city; | |
33 | - private String area; | |
34 | - private String detailAddress; | |
35 | - private String zip; | |
36 | - private String image; | |
37 | - private Long dealerId; | |
38 | - private Long groupId; | |
39 | - private Long shopId; | |
40 | - private Date createTime; | |
46 | + | |
47 | + public Long getUserId() { | |
48 | + return id; | |
49 | + } | |
50 | + | |
51 | + public Long getMemberId() { | |
52 | + return id; | |
53 | + } | |
54 | + | |
55 | + public Long getAccountId() { | |
56 | + return latestAccountId; | |
57 | + } | |
58 | + | |
59 | + | |
60 | + public String getPhone() { | |
61 | + return latestAccountPhone; | |
62 | + } | |
41 | 63 | } | ... | ... |
fw-shirasawa-rpc/src/main/java/cn/fw/shirasawa/rpc/member/dto/MemberUserLevelDTO.java deleted
1 | -package cn.fw.shirasawa.rpc.member.dto; | |
2 | - | |
3 | -import lombok.Data; | |
4 | - | |
5 | -/** | |
6 | - * 客户level | |
7 | - * <p> | |
8 | - * create at 2019-05-16 | |
9 | - * | |
10 | - * @author kurisu | |
11 | - */ | |
12 | -@Data | |
13 | -public class MemberUserLevelDTO { | |
14 | - private Long cusId; | |
15 | - private Integer levelType; | |
16 | - private Integer growth; | |
17 | - private String cusName; | |
18 | - private String phone; | |
19 | -} |
fw-shirasawa-rpc/src/main/java/cn/fw/shirasawa/rpc/member/dto/UserAccountDTO.java
0 → 100644
1 | +package cn.fw.shirasawa.rpc.member.dto; | |
2 | + | |
3 | +import lombok.Data; | |
4 | + | |
5 | +import java.util.Date; | |
6 | + | |
7 | +/** | |
8 | + * 会员账号信息 | |
9 | + * | |
10 | + * @author : kurisu | |
11 | + * @version : 2.0 | |
12 | + * @desc : 会员账号信息 | |
13 | + * @date : 2023-12-13 16:00 | |
14 | + */ | |
15 | +@Data | |
16 | +public class UserAccountDTO { | |
17 | + /** | |
18 | + * 账户id | |
19 | + */ | |
20 | + private Long id; | |
21 | + | |
22 | + /** | |
23 | + * 会员id | |
24 | + */ | |
25 | + private Long memberId; | |
26 | + | |
27 | + /** | |
28 | + * 真实姓名 | |
29 | + */ | |
30 | + private String realName; | |
31 | + | |
32 | + /** | |
33 | + * 证件号码 | |
34 | + */ | |
35 | + private String credentNo; | |
36 | + | |
37 | + /** | |
38 | + * 认证时间 | |
39 | + */ | |
40 | + private Date credentTime; | |
41 | + | |
42 | + /** | |
43 | + * 账户昵称 | |
44 | + */ | |
45 | + private String nickName; | |
46 | + | |
47 | + /** | |
48 | + * 手机号 | |
49 | + */ | |
50 | + private String phone; | |
51 | + | |
52 | + /** | |
53 | + * 性别 0 未知 1男 2女 | |
54 | + */ | |
55 | + private Integer sex; | |
56 | + | |
57 | + /** | |
58 | + * 生日 | |
59 | + */ | |
60 | + private Date birthday; | |
61 | + | |
62 | + /** | |
63 | + * 用户头像URL | |
64 | + */ | |
65 | + private String avatarUrl; | |
66 | + | |
67 | + /** | |
68 | + * unionId | |
69 | + */ | |
70 | + private String unionId; | |
71 | + | |
72 | + /** | |
73 | + * 会员状态 0冻结 1正常 | |
74 | + */ | |
75 | + private Integer status; | |
76 | + | |
77 | + /** | |
78 | + * 上次激活时间 | |
79 | + */ | |
80 | + private Date lastActive; | |
81 | + | |
82 | + /** | |
83 | + * 冻结时间 | |
84 | + */ | |
85 | + private Date blockTime; | |
86 | + | |
87 | + /** | |
88 | + * 备注 | |
89 | + */ | |
90 | + private String remark; | |
91 | +} | ... | ... |
fw-shirasawa-rpc/src/main/java/cn/fw/shirasawa/rpc/passport/PassportService.java deleted
1 | -package cn.fw.shirasawa.rpc.passport; | |
2 | - | |
3 | -import cn.fw.common.exception.BusinessException; | |
4 | -import cn.fw.data.base.domain.common.Message; | |
5 | -import cn.fw.passport.sdk.api.MiniQrCodeApi; | |
6 | -import cn.fw.passport.sdk.api.param.WxBCodeParam; | |
7 | -import lombok.extern.slf4j.Slf4j; | |
8 | -import org.springframework.beans.factory.annotation.Autowired; | |
9 | -import org.springframework.stereotype.Service; | |
10 | - | |
11 | -/** | |
12 | - * 会员外部服务 | |
13 | - * | |
14 | - * @author kurisu | |
15 | - */ | |
16 | -@Slf4j | |
17 | -@Service | |
18 | -public class PassportService { | |
19 | - | |
20 | - @Autowired | |
21 | - private MiniQrCodeApi miniQrCodeApi; | |
22 | - | |
23 | - /** | |
24 | - * 获取小程序二维码 | |
25 | - * | |
26 | - * @param param | |
27 | - * @return | |
28 | - */ | |
29 | - public byte[] getWxBCode(WxBCodeParam param) { | |
30 | - try { | |
31 | - Message<byte[]> message = miniQrCodeApi.getWxBCode(param); | |
32 | - if (!message.isSuccess()) { | |
33 | - log.error("调用passport api 生成小程序码业务异常:{}", message.getResult()); | |
34 | - throw new BusinessException(message.getCode(), message.getResult()); | |
35 | - } | |
36 | - return message.getData(); | |
37 | - } catch (Exception e) { | |
38 | - log.error("会员系统调用失败", e); | |
39 | - throw new BusinessException("调用会员系统异常"); | |
40 | - } | |
41 | - } | |
42 | - | |
43 | - | |
44 | -} |
fw-shirasawa-sdk/src/main/java/cn/fw/shirasawa/sdk/param/FollowGenerateDTO.java
... | ... | @@ -32,7 +32,6 @@ import java.util.Objects; |
32 | 32 | @ScriptAssert(lang = "javascript", script = "_this.checkContact()", message = "联系方式不能为空"), |
33 | 33 | @ScriptAssert(lang = "javascript", script = "_this.checkName()", message = "客户名称不能为空"), |
34 | 34 | @ScriptAssert(lang = "javascript", script = "_this.checkCustomerId()", message = "档案id不能为空"), |
35 | - @ScriptAssert(lang = "javascript", script = "_this.checkMemberId()", message = "会员号不能为空"), | |
36 | 35 | @ScriptAssert(lang = "javascript", script = "_this.checkFollowDuration()", message = "必须指定待办的跟进时长"), |
37 | 36 | @ScriptAssert(lang = "javascript", script = "_this.checkActivityNo()", message = "活动编号不能为空"), |
38 | 37 | }) |
... | ... | @@ -151,15 +150,15 @@ public class FollowGenerateDTO { |
151 | 150 | } |
152 | 151 | |
153 | 152 | public boolean checkContact() { |
154 | - if (DataTypeEnum.RC.equals(this.type)) { | |
155 | - return this.contacts != null && !this.contacts.isEmpty(); | |
156 | - } | |
157 | 153 | if (DataTypeEnum.AC.equals(this.type)) { |
158 | 154 | return this.plateNo != null && |
159 | 155 | !this.plateNo.isEmpty() && |
160 | 156 | this.contacts != null && |
161 | 157 | !this.contacts.isEmpty(); |
162 | 158 | } |
159 | + if (Objects.isNull(this.memberId)) { | |
160 | + return this.contacts != null && !this.contacts.isEmpty(); | |
161 | + } | |
163 | 162 | return true; |
164 | 163 | } |
165 | 164 | |
... | ... | @@ -170,12 +169,6 @@ public class FollowGenerateDTO { |
170 | 169 | return true; |
171 | 170 | } |
172 | 171 | |
173 | - public boolean checkMemberId() { | |
174 | - if (BusinessTypeEnum.PS.equals(this.businessType) && !DataTypeEnum.RC.equals(this.type)) { | |
175 | - return Objects.nonNull(this.memberId); | |
176 | - } | |
177 | - return true; | |
178 | - } | |
179 | 172 | |
180 | 173 | public boolean checkFollowDuration() { |
181 | 174 | if (DataTypeEnum.AC.equals(this.type)) { | ... | ... |
fw-shirasawa-server/pom.xml
... | ... | @@ -66,15 +66,7 @@ |
66 | 66 | <groupId>cn.fw</groupId> |
67 | 67 | <artifactId>fw-shirasawa-service</artifactId> |
68 | 68 | </dependency> |
69 | - <!-- fw-remote --> | |
70 | - <dependency> | |
71 | - <groupId>cn.fw</groupId> | |
72 | - <artifactId>fw-auth-client</artifactId> | |
73 | - </dependency> | |
74 | - <dependency> | |
75 | - <groupId>cn.fw</groupId> | |
76 | - <artifactId>fw-fastdfs-client</artifactId> | |
77 | - </dependency> | |
69 | + | |
78 | 70 | <!-- fw-common --> |
79 | 71 | <dependency> |
80 | 72 | <groupId>cn.fw</groupId> | ... | ... |
fw-shirasawa-server/src/main/java/cn/fw/shirasawa/server/controller/app/DebugController.kt
1 | -package cn.fw.shirasawa.server.controller.app; | |
1 | +package cn.fw.shirasawa.server.controller.app | |
2 | 2 | |
3 | -import cn.fw.common.web.annotation.ControllerMethod; | |
4 | -import cn.fw.data.base.domain.common.Message; | |
5 | -import cn.fw.security.auth.client.annotation.Authorization; | |
6 | -import cn.fw.security.auth.client.enums.AuthType; | |
7 | -import cn.fw.shirasawa.service.bus.follow.DebugBizService; | |
8 | -import lombok.RequiredArgsConstructor; | |
9 | -import lombok.extern.slf4j.Slf4j; | |
10 | -import org.springframework.validation.annotation.Validated; | |
11 | -import org.springframework.web.bind.annotation.GetMapping; | |
12 | -import org.springframework.web.bind.annotation.RequestMapping; | |
13 | -import org.springframework.web.bind.annotation.RestController; | |
14 | - | |
15 | -import javax.validation.constraints.NotNull; | |
16 | - | |
17 | -import static cn.fw.common.web.util.ResultBuilder.success; | |
3 | +import cn.fw.common.web.annotation.ControllerMethod | |
4 | +import cn.fw.common.web.util.ResultBuilder.success | |
5 | +import cn.fw.data.base.domain.common.Message | |
6 | +import cn.fw.security.auth.client.annotation.Authorization | |
7 | +import cn.fw.security.auth.client.enums.AuthType | |
8 | +import cn.fw.shirasawa.service.bus.follow.DebugBizService | |
9 | +import org.springframework.validation.annotation.Validated | |
10 | +import org.springframework.web.bind.annotation.* | |
11 | +import javax.validation.constraints.NotNull | |
18 | 12 | |
19 | 13 | /** |
20 | 14 | * debug类 |
... | ... | @@ -26,19 +20,26 @@ import static cn.fw.common.web.util.ResultBuilder.success; |
26 | 20 | * @ignore |
27 | 21 | * @date : 2023-03-23 16:04 |
28 | 22 | */ |
29 | -@Slf4j | |
30 | 23 | @RestController |
31 | 24 | @Authorization(AuthType.NONE) |
32 | 25 | @Validated |
33 | -@RequiredArgsConstructor | |
34 | 26 | @RequestMapping("/app/debug") |
35 | -public class DebugController { | |
36 | - private final DebugBizService debugBizService; | |
27 | +class DebugController(private val debugBizService: DebugBizService) { | |
37 | 28 | |
38 | 29 | @GetMapping("/fix/telstatus") |
39 | 30 | @ControllerMethod("跟进电话数据处理类") |
40 | - public Message<Integer> fixTelStatus(@NotNull(message = "集团id不能为空") final Long groupId) { | |
41 | - int i = debugBizService.fixTelStatus(groupId); | |
42 | - return success(i); | |
31 | + fun fixTelStatus(@NotNull(message = "集团id不能为空") groupId: Long): Message<Int> { | |
32 | + val i = debugBizService.fixTelStatus(groupId) | |
33 | + return success(i) | |
34 | + } | |
35 | + | |
36 | + @PostMapping("/member/telchange") | |
37 | + @ControllerMethod("会员电话变更") | |
38 | + fun memberPhoneChange( | |
39 | + @RequestParam(name = "memberId") memberId: Long, | |
40 | + @RequestParam(name = "accountId") accountId: Long | |
41 | + ): Message<Void> { | |
42 | + debugBizService.memberPhoneChange(memberId, accountId) | |
43 | + return success() | |
43 | 44 | } |
44 | 45 | -} |
46 | +} | |
45 | 47 | \ No newline at end of file | ... | ... |
fw-shirasawa-service/pom.xml
fw-shirasawa-service/src/main/java/cn/fw/shirasawa/component/MemberPhoneChangeConsumer.kt
0 → 100644
1 | +package cn.fw.shirasawa.component | |
2 | + | |
3 | +import cn.fw.member.sdk.event.MemberLatestBindEvent | |
4 | +import cn.fw.shirasawa.domain.db.follow.FollowTask | |
5 | +import cn.fw.shirasawa.domain.enums.TaskStateEnum | |
6 | +import cn.fw.shirasawa.rpc.member.MemberRpcService | |
7 | +import cn.fw.shirasawa.rpc.member.dto.UserAccountDTO | |
8 | +import cn.fw.shirasawa.service.data.FollowTaskService | |
9 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers | |
10 | +import lombok.extern.slf4j.Slf4j | |
11 | +import org.apache.rocketmq.spring.annotation.RocketMQMessageListener | |
12 | +import org.apache.rocketmq.spring.core.RocketMQListener | |
13 | +import org.springframework.stereotype.Component | |
14 | + | |
15 | +/** | |
16 | + * 会员手机变更 | |
17 | + * | |
18 | + * @author : kurisu | |
19 | + * @version : 2.1 | |
20 | + * @description : 会员手机变更 | |
21 | + * @date : 2023-04-07 15:12 | |
22 | + */ | |
23 | +@Slf4j | |
24 | +@Component | |
25 | +@RocketMQMessageListener( | |
26 | + topic = MemberLatestBindEvent.TOPIC, | |
27 | + consumerGroup = "\${spring.application.name}_latest_account" | |
28 | +) | |
29 | +class MemberPhoneChangeConsumer( | |
30 | + private val memberRpcService: MemberRpcService, | |
31 | + private val followTaskService: FollowTaskService | |
32 | +) : | |
33 | + RocketMQListener<MemberLatestBindEvent> { | |
34 | + | |
35 | + override fun onMessage(message: MemberLatestBindEvent?) { | |
36 | + message ?: return | |
37 | + val account: UserAccountDTO = memberRpcService.accountById(message.newBindAccountId) ?: return | |
38 | + with(account) { | |
39 | + val taskList = followTaskService.list( | |
40 | + Wrappers.lambdaQuery<FollowTask?>() | |
41 | + .eq(FollowTask::getMemberId, message.memberId) | |
42 | + .eq(FollowTask::getState, TaskStateEnum.ONGOING) | |
43 | + .ne(FollowTask::getContacts, phone) | |
44 | + ) | |
45 | + if (taskList.isNotEmpty()) { | |
46 | + taskList.forEach { task -> task.contacts = phone } | |
47 | + followTaskService.updateBatchById(taskList) | |
48 | + } | |
49 | + } | |
50 | + } | |
51 | +} | ... | ... |
fw-shirasawa-service/src/main/java/cn/fw/shirasawa/service/bus/follow/DebugBizService.kt
1 | -package cn.fw.shirasawa.service.bus.follow; | |
2 | - | |
3 | -import cn.fw.shirasawa.domain.db.follow.FollowRecord; | |
4 | -import cn.fw.shirasawa.domain.db.other.SecretReportHistory; | |
5 | -import cn.fw.shirasawa.domain.enums.CallStateEnum; | |
6 | -import cn.fw.shirasawa.service.data.FollowRecordService; | |
7 | -import cn.fw.shirasawa.service.data.SecretReportHistoryService; | |
8 | -import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
9 | -import lombok.RequiredArgsConstructor; | |
10 | -import lombok.extern.slf4j.Slf4j; | |
11 | -import org.springframework.stereotype.Service; | |
12 | -import org.springframework.transaction.annotation.Transactional; | |
13 | -import org.springframework.util.CollectionUtils; | |
14 | - | |
15 | -import java.util.List; | |
1 | +package cn.fw.shirasawa.service.bus.follow | |
2 | + | |
3 | +import cn.fw.shirasawa.domain.db.follow.FollowRecord | |
4 | +import cn.fw.shirasawa.domain.db.follow.FollowTask | |
5 | +import cn.fw.shirasawa.domain.db.other.SecretReportHistory | |
6 | +import cn.fw.shirasawa.domain.enums.CallStateEnum | |
7 | +import cn.fw.shirasawa.domain.enums.TaskStateEnum | |
8 | +import cn.fw.shirasawa.rpc.member.MemberRpcService | |
9 | +import cn.fw.shirasawa.rpc.member.dto.UserAccountDTO | |
10 | +import cn.fw.shirasawa.service.data.FollowRecordService | |
11 | +import cn.fw.shirasawa.service.data.FollowTaskService | |
12 | +import cn.fw.shirasawa.service.data.SecretReportHistoryService | |
13 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers | |
14 | +import lombok.extern.slf4j.Slf4j | |
15 | +import org.springframework.stereotype.Service | |
16 | +import org.springframework.transaction.annotation.Transactional | |
16 | 17 | |
17 | 18 | /** |
18 | 19 | * 调试类 |
... | ... | @@ -22,38 +23,65 @@ import java.util.List; |
22 | 23 | * @desc : 调试类 |
23 | 24 | * @date : 2023-08-29 17:27 |
24 | 25 | */ |
25 | -@RequiredArgsConstructor | |
26 | 26 | @Service |
27 | 27 | @Slf4j |
28 | -public class DebugBizService { | |
29 | - private final FollowRecordService followRecordService; | |
30 | - private final SecretReportHistoryService secretReportHistoryService; | |
28 | +class DebugBizService( | |
29 | + private val followRecordService: FollowRecordService, | |
30 | + private val memberRpcService: MemberRpcService, | |
31 | + private val followTaskService: FollowTaskService, | |
32 | + private val secretReportHistoryService: SecretReportHistoryService | |
33 | +) { | |
31 | 34 | |
32 | - @Transactional(rollbackFor = Exception.class) | |
33 | - public int fixTelStatus(Long groupId) { | |
34 | - List<FollowRecord> list = followRecordService.list(Wrappers.<FollowRecord>lambdaQuery() | |
35 | + @Transactional(rollbackFor = [Exception::class]) | |
36 | + fun fixTelStatus(groupId: Long?): Int { | |
37 | + val list = followRecordService.list( | |
38 | + Wrappers.lambdaQuery<FollowRecord>() | |
35 | 39 | .eq(FollowRecord::getGroupId, groupId) |
36 | - .eq(FollowRecord::getYn, Boolean.TRUE) | |
37 | - .eq(FollowRecord::getAddTodo, Boolean.TRUE) | |
40 | + .eq(FollowRecord::getYn, true) | |
41 | + .eq(FollowRecord::getAddTodo, true) | |
38 | 42 | .isNull(FollowRecord::getCalled) |
39 | 43 | .last(" limit 500") |
40 | - ); | |
41 | - if (CollectionUtils.isEmpty(list)) { | |
42 | - return 0; | |
44 | + ) | |
45 | + if (list.isEmpty()) { | |
46 | + return 0 | |
43 | 47 | } |
44 | - for (FollowRecord record : list) { | |
45 | - List<SecretReportHistory> reportHistoryList = secretReportHistoryService.list(Wrappers.<SecretReportHistory>lambdaQuery() | |
48 | + | |
49 | + list.forEach { record -> | |
50 | + val reportHistoryList = secretReportHistoryService.list( | |
51 | + Wrappers.lambdaQuery<SecretReportHistory>() | |
46 | 52 | .eq(SecretReportHistory::getGroupId, groupId) |
47 | - .eq(SecretReportHistory::getFollowRecordId, record.getId()) | |
48 | - ); | |
49 | - if (CollectionUtils.isEmpty(reportHistoryList)) { | |
50 | - record.setCalled(CallStateEnum.WAIT_DIAL); | |
53 | + .eq(SecretReportHistory::getFollowRecordId, record.id) | |
54 | + ) | |
55 | + | |
56 | + if (reportHistoryList.isEmpty()) { | |
57 | + record.called = CallStateEnum.WAIT_DIAL | |
51 | 58 | } else { |
52 | - boolean anyMatch = reportHistoryList.stream().anyMatch(r -> r.getCallDuration() >= 30L); | |
53 | - record.setCalled(anyMatch ? CallStateEnum.EFFECTIVE_DIAL : CallStateEnum.INEFFECTIVE_DIAL); | |
59 | + val anyMatch = reportHistoryList.any { r -> r.callDuration >= 30L } | |
60 | + record.called = if (anyMatch) CallStateEnum.EFFECTIVE_DIAL else CallStateEnum.INEFFECTIVE_DIAL | |
61 | + } | |
62 | + | |
63 | + } | |
64 | + | |
65 | + followRecordService.updateBatchById(list) | |
66 | + return list.size | |
67 | + } | |
68 | + | |
69 | + /** | |
70 | + * 模拟测试会员手机号变更 | |
71 | + */ | |
72 | + fun memberPhoneChange(memberId: Long, accountId: Long) { | |
73 | + val account: UserAccountDTO = memberRpcService.accountById(accountId) ?: return | |
74 | + with(account) { | |
75 | + val taskList = followTaskService.list( | |
76 | + Wrappers.lambdaQuery<FollowTask?>() | |
77 | + .eq(FollowTask::getMemberId, memberId) | |
78 | + .eq(FollowTask::getState, TaskStateEnum.ONGOING) | |
79 | + .ne(FollowTask::getContacts, phone) | |
80 | + ) | |
81 | + if (taskList.isNotEmpty()) { | |
82 | + taskList.forEach { task -> task.contacts = phone } | |
83 | + followTaskService.updateBatchById(taskList) | |
54 | 84 | } |
55 | 85 | } |
56 | - followRecordService.updateBatchById(list); | |
57 | - return list.size(); | |
58 | 86 | } |
59 | 87 | -} |
88 | +} | |
60 | 89 | \ No newline at end of file | ... | ... |
fw-shirasawa-service/src/main/java/cn/fw/shirasawa/service/bus/follow/FollowBizService.java
... | ... | @@ -846,15 +846,16 @@ public class FollowBizService { |
846 | 846 | final FollowRecord record = followRecordService.getById(recordId); |
847 | 847 | BV.notNull(record, () -> "跟进信息不存在"); |
848 | 848 | BV.isTrue(record.getYn(), () -> "跟进信息不存在"); |
849 | + Long memberId = record.getMemberId(); | |
849 | 850 | String contacts = record.getContacts(); |
850 | - if (StringUtils.isEmpty(contacts)) { | |
851 | - MemberUserDTO memberUserDTO = memberRpcService.user(record.getMemberId()); | |
852 | - BV.notNull(memberUserDTO, () -> "档案信息异常,请稍后再试"); | |
851 | + if (Objects.nonNull(memberId) && memberId > 0) { | |
852 | + MemberUserDTO memberUserDTO = memberRpcService.user(memberId); | |
853 | + BV.notNull(memberUserDTO, () -> "客户信息信息异常,请稍后再试"); | |
853 | 854 | contacts = memberUserDTO.getPhone(); |
854 | 855 | record.setContacts(memberUserDTO.getPhone()); |
855 | 856 | followRecordService.updateById(record); |
856 | 857 | } |
857 | - return contacts; | |
858 | + return Optional.ofNullable(contacts).orElse("#"); | |
858 | 859 | } |
859 | 860 | |
860 | 861 | /** |
... | ... | @@ -911,7 +912,7 @@ public class FollowBizService { |
911 | 912 | */ |
912 | 913 | @Transactional(rollbackFor = Exception.class) |
913 | 914 | public void readCallReport2Task(CallReportDTO dto) { |
914 | - if (Objects.isNull(dto.getMemberId()) || dto.getMemberId() < 0) { | |
915 | + if (Objects.isNull(dto.getMemberId()) || dto.getMemberId() <= 0) { | |
915 | 916 | MemberUserDTO memberInfo = memberRpcService.queryByMobile(dto.getPeerNo()); |
916 | 917 | if (Objects.nonNull(memberInfo)) { |
917 | 918 | dto.setMemberId(memberInfo.getUserId()); | ... | ... |
fw-shirasawa-service/src/main/java/cn/fw/shirasawa/service/bus/follow/strategy/AbstractFollowStrategy.java
... | ... | @@ -119,7 +119,7 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { |
119 | 119 | if (FollowTypeEnum.AF.equals(task.getType())) { |
120 | 120 | record.setCompelTel(Boolean.FALSE); |
121 | 121 | } else { |
122 | - record.setCompelTel(ValidationUtils.checkMobile(record.getContacts())); | |
122 | + record.setCompelTel(ValidationUtils.checkMobile(record.getContacts()) || (Objects.nonNull(record.getMemberId()) && record.getMemberId() > 0)); | |
123 | 123 | } |
124 | 124 | } |
125 | 125 | if (StringUtils.isEmpty(record.getContacts())) { |
... | ... | @@ -822,13 +822,16 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { |
822 | 822 | task.setTimes(0); |
823 | 823 | task.setGroupId(originalData.getGroupId()); |
824 | 824 | |
825 | - MemberUserDTO memberUserDTO = memberRpcService.user(originalData.getMemberId()); | |
826 | - if (Objects.nonNull(memberUserDTO)) { | |
827 | - if (StringUtils.isValid(memberUserDTO.getRealName())) { | |
828 | - task.setCustomerName(memberUserDTO.getRealName()); | |
825 | + if (Objects.nonNull(originalData.getMemberId()) && originalData.getMemberId() > 0) { | |
826 | + MemberUserDTO memberUserDTO = memberRpcService.user(originalData.getMemberId()); | |
827 | + if (Objects.nonNull(memberUserDTO)) { | |
828 | + if (StringUtils.isValid(memberUserDTO.getRealName())) { | |
829 | + task.setCustomerName(memberUserDTO.getRealName()); | |
830 | + } | |
831 | + task.setContacts(memberUserDTO.getPhone()); | |
829 | 832 | } |
830 | - task.setContacts(memberUserDTO.getPhone()); | |
831 | 833 | } |
834 | + | |
832 | 835 | return task; |
833 | 836 | } |
834 | 837 | } | ... | ... |
pom.xml
... | ... | @@ -12,7 +12,7 @@ |
12 | 12 | <parent> |
13 | 13 | <groupId>cn.fw</groupId> |
14 | 14 | <artifactId>fw-common-dependencies</artifactId> |
15 | - <version>3.3.2</version> | |
15 | + <version>3.5.0</version> | |
16 | 16 | </parent> |
17 | 17 | |
18 | 18 | <modules> |
... | ... | @@ -36,12 +36,10 @@ |
36 | 36 | <HikariCP.version>3.3.1</HikariCP.version> |
37 | 37 | <!-- fw --> |
38 | 38 | <fw-oop-sdk.version>3.0.0</fw-oop-sdk.version> |
39 | - <fw-member-sdk.version>2.0</fw-member-sdk.version> | |
39 | + <fw-member-sdk.version>3.0.0</fw-member-sdk.version> | |
40 | 40 | <fw-erp-sdk.version>5.0.0</fw-erp-sdk.version> |
41 | 41 | <fw-pstn-sdk.version>2.0.0</fw-pstn-sdk.version> |
42 | - <fw-fastdfs-client.version>2.0</fw-fastdfs-client.version> | |
43 | 42 | <rocketmq-spring-boot-starter.version>2.1.0</rocketmq-spring-boot-starter.version> |
44 | - <fw-passport-sdk.version>2.2.0</fw-passport-sdk.version> | |
45 | 43 | <hanlp.version>portable-1.7.4</hanlp.version> |
46 | 44 | <fw-angel-sdk.version>3.0.0</fw-angel-sdk.version> |
47 | 45 | <redis.spring.boot.starter>1.0</redis.spring.boot.starter> |
... | ... | @@ -120,11 +118,6 @@ |
120 | 118 | </dependency> |
121 | 119 | <dependency> |
122 | 120 | <groupId>cn.fw</groupId> |
123 | - <artifactId>fw-fastdfs-client</artifactId> | |
124 | - <version>${fw-fastdfs-client.version}</version> | |
125 | - </dependency> | |
126 | - <dependency> | |
127 | - <groupId>cn.fw</groupId> | |
128 | 121 | <artifactId>fw-member-sdk</artifactId> |
129 | 122 | <version>${fw-member-sdk.version}</version> |
130 | 123 | </dependency> |
... | ... | @@ -150,11 +143,6 @@ |
150 | 143 | </dependency> |
151 | 144 | <dependency> |
152 | 145 | <groupId>cn.fw</groupId> |
153 | - <artifactId>fw-passport-sdk</artifactId> | |
154 | - <version>${fw-passport-sdk.version}</version> | |
155 | - </dependency> | |
156 | - <dependency> | |
157 | - <groupId>cn.fw</groupId> | |
158 | 146 | <artifactId>fw-valhalla-sdk</artifactId> |
159 | 147 | <version>${fw-valhalla-sdk}</version> |
160 | 148 | </dependency> | ... | ... |