tao.mo

manager-server | 修改 |

FCL登录获取ean信息
mt
2025年5月27日17:10:40
...@@ -16,6 +16,12 @@ public class PropertiesConfig { ...@@ -16,6 +16,12 @@ public class PropertiesConfig {
16 @Value("${fcl.interface.userinfo}") 16 @Value("${fcl.interface.userinfo}")
17 private String userInfoUrl; 17 private String userInfoUrl;
18 18
19 + @Value("${fcl.interface.account}")
20 + private String userAccountUrl;
21 +
22 + @Value("${fcl.interface.shippingaccounts}")
23 + private String userShippingaccountsUrl;
24 +
19 @Value("${fcl.login.redjrectLogin}") 25 @Value("${fcl.login.redjrectLogin}")
20 private String redjrectLogin; 26 private String redjrectLogin;
21 27
......
...@@ -140,6 +140,7 @@ public class SysAuthController extends BaseController implements ISysAuthControl ...@@ -140,6 +140,7 @@ public class SysAuthController extends BaseController implements ISysAuthControl
140 if (loginUser == null){ 140 if (loginUser == null){
141 //如果用户不存在,则创建FCL用户信息 141 //如果用户不存在,则创建FCL用户信息
142 SysUserDto dto = new SysUserDto(fcl_uuid, fcl_contactname); 142 SysUserDto dto = new SysUserDto(fcl_uuid, fcl_contactname);
143 + sysUserService.initUserInfo(fclInfoDto,dto);
143 loginUser = sysUserService.save(dto); 144 loginUser = sysUserService.save(dto);
144 } else { 145 } else {
145 //首先对用户中的姓名进行解密 146 //首先对用户中的姓名进行解密
...@@ -158,6 +159,7 @@ public class SysAuthController extends BaseController implements ISysAuthControl ...@@ -158,6 +159,7 @@ public class SysAuthController extends BaseController implements ISysAuthControl
158 loginUser.setUserName(StringUtils.trimToEmpty(fcl_contactname)); 159 loginUser.setUserName(StringUtils.trimToEmpty(fcl_contactname));
159 } 160 }
160 loginUser.setModifyTime(new Date()); 161 loginUser.setModifyTime(new Date());
162 + sysUserService.initUserInfo(fclInfoDto,loginUser);
161 sysUserService.update(loginUser); 163 sysUserService.update(loginUser);
162 } 164 }
163 } 165 }
......
...@@ -18,7 +18,9 @@ public class FclInfoDto { ...@@ -18,7 +18,9 @@ public class FclInfoDto {
18 //用户名称 18 //用户名称
19 String fclContactname; 19 String fclContactname;
20 //用户登录账号 20 //用户登录账号
21 - private String userId; 21 + String userId;
22 //用户邮箱 22 //用户邮箱
23 - private String emailAddress; 23 + String emailAddress;
24 + //用户计费账号
25 + String shipperAccounts;
24 } 26 }
......
1 +package com.fedex.connect.manager.data.vo;
2 +
3 +import lombok.Data;
4 +
5 +@Data
6 +public class EanTwoVo {
7 + private String defaultEanInfo;
8 + private String accountNumberInfo;
9 +}
1 +package com.fedex.connect.manager.data.vo;
2 +
3 +
4 +import lombok.Data;
5 +
6 +import java.io.Serializable;
7 +import java.util.List;
8 +
9 +/**
10 + * @Author mt
11 + * @Description FCL接口获取用户信息-响应数据对象
12 + * @Date 2025/5/27
13 + */
14 +@Data
15 +public class FCLAccountsResponseVo implements Serializable {
16 +
17 + private String transactionId;
18 + private OutPut output;
19 +
20 + @Data
21 + public static class OutPut implements Serializable{
22 + List<FCLCustomerAccount> customerAccountList;
23 + }
24 +
25 + @Data
26 + public static class FCLCustomerAccount implements Serializable{
27 + private Account account;
28 + private List<ActiveAppRoleInfo> activeAppRoleInfos;
29 + }
30 +
31 + /**
32 + * 账号信息
33 + */
34 + @Data
35 + public static class Account implements Serializable{
36 + private AccountIdentifier accountIdentifier;
37 + }
38 + @Data
39 + public static class ActiveAppRoleInfo implements Serializable{
40 + private String appName;
41 + private String roleCode;
42 + private Integer roleLevelCode;
43 + }
44 + @Data
45 + public static class AccountIdentifier implements Serializable{
46 + /**
47 + * 账号对应EAN信息
48 + */
49 + private AccountNumber accountNumber;
50 + private String accountNickname;
51 + private String displayName;
52 + private Boolean meterNumberAvailable;
53 + }
54 + @Data
55 + public static class AccountNumber implements Serializable{
56 + private String value;
57 + private String key;
58 + }
59 +}
60 +
...@@ -3,8 +3,10 @@ package com.fedex.connect.manager.data.vo; ...@@ -3,8 +3,10 @@ package com.fedex.connect.manager.data.vo;
3 import lombok.Data; 3 import lombok.Data;
4 4
5 /** 5 /**
6 - * FCL接口获取token响应对象 6 + * @Author mt
7 - */ 7 + * @Description FCL接口获取token响应对象
8 + * @Date 2025/5/27
9 + */
8 @Data 10 @Data
9 public class FCLTokenResponseVo { 11 public class FCLTokenResponseVo {
10 12
......
...@@ -13,7 +13,7 @@ import java.util.List; ...@@ -13,7 +13,7 @@ import java.util.List;
13 * @Date 2025/5/26 13 * @Date 2025/5/26
14 */ 14 */
15 @Data 15 @Data
16 -public class FCLUserInfoVo implements Serializable { 16 +public class FCLUserInfoResponseVo implements Serializable {
17 17
18 private String transactionId; 18 private String transactionId;
19 private OutPut output; 19 private OutPut output;
......
1 +package com.fedex.connect.manager.data.vo;
2 +
3 +import lombok.Data;
4 +
5 +import java.io.Serializable;
6 +import java.util.List;
7 +
8 +@Data
9 +public class FclEanTwoResponseVo implements Serializable{
10 +
11 + private String transactionId;
12 + private Output output;
13 +
14 + @Data
15 + public static class Output implements Serializable {
16 +
17 + private Boolean success;
18 + private List<AccountInfoVO> accountInfoVOs;
19 + }
20 +
21 + @Data
22 + public static class AccountInfoVO implements Serializable {
23 +
24 + private DefaultAccount defaultAccount;
25 + private List<AssociatedAccount> associatedAccountList;
26 + }
27 +
28 + @Data
29 + public static class DefaultAccount implements Serializable {
30 +
31 + private String value;
32 + private String key;
33 + }
34 +
35 + @Data
36 + public static class AssociatedAccount implements Serializable {
37 +
38 + private AccountNumber accountNumber;
39 + private String accountNickname;
40 + private String accountDisplayName;
41 + }
42 +
43 + @Data
44 + public static class AccountNumber implements Serializable {
45 +
46 + private String value;
47 + private String key;
48 + }
49 +}
...@@ -2,6 +2,7 @@ package com.fedex.connect.manager.service.sys; ...@@ -2,6 +2,7 @@ package com.fedex.connect.manager.service.sys;
2 2
3 import com.fedex.connect.common.model.sys.User; 3 import com.fedex.connect.common.model.sys.User;
4 import com.fedex.connect.manager.data.bo.AddFlagBo; 4 import com.fedex.connect.manager.data.bo.AddFlagBo;
5 +import com.fedex.connect.manager.data.dto.FclInfoDto;
5 import com.fedex.connect.manager.data.dto.SysUserDto; 6 import com.fedex.connect.manager.data.dto.SysUserDto;
6 7
7 import javax.servlet.http.HttpServletRequest; 8 import javax.servlet.http.HttpServletRequest;
...@@ -19,4 +20,24 @@ public interface ISysUserService { ...@@ -19,4 +20,24 @@ public interface ISysUserService {
19 User findById(Long id); 20 User findById(Long id);
20 21
21 void updateAddFlag(User user, AddFlagBo bo); 22 void updateAddFlag(User user, AddFlagBo bo);
23 +
24 + /**
25 + * @Author mt
26 + * @Description 构造用户信息
27 + * @Date 2025/5/27
28 + * @param fclInfoDto
29 + * @param loginUser
30 + * @return void
31 + */
32 + void initUserInfo(FclInfoDto fclInfoDto,SysUserDto loginUser);
33 +
34 + /**
35 + * @Author mt
36 + * @Description 构造用户信息
37 + * @Date 2025/5/27
38 + * @param fclInfoDto
39 + * @param loginUser
40 + * @return void
41 + */
42 + void initUserInfo(FclInfoDto fclInfoDto, User loginUser);
22 } 43 }
......
...@@ -12,6 +12,7 @@ import com.fedex.connect.common.model.sys.User; ...@@ -12,6 +12,7 @@ import com.fedex.connect.common.model.sys.User;
12 import com.fedex.connect.common.model.sys.UserExample; 12 import com.fedex.connect.common.model.sys.UserExample;
13 import com.fedex.connect.manager.config.PropertiesConfig; 13 import com.fedex.connect.manager.config.PropertiesConfig;
14 import com.fedex.connect.manager.data.bo.AddFlagBo; 14 import com.fedex.connect.manager.data.bo.AddFlagBo;
15 +import com.fedex.connect.manager.data.dto.FclInfoDto;
15 import com.fedex.connect.manager.data.dto.SysUserDto; 16 import com.fedex.connect.manager.data.dto.SysUserDto;
16 import com.fedex.connect.manager.data.model.LogShowModel; 17 import com.fedex.connect.manager.data.model.LogShowModel;
17 import com.fedex.connect.manager.service.base.BaseService; 18 import com.fedex.connect.manager.service.base.BaseService;
...@@ -216,5 +217,43 @@ public class SysUserServiceImpl extends BaseService implements ISysUserService { ...@@ -216,5 +217,43 @@ public class SysUserServiceImpl extends BaseService implements ISysUserService {
216 userRepository.updateByPrimaryKeySelective(user); 217 userRepository.updateByPrimaryKeySelective(user);
217 } 218 }
218 219
220 + /**
221 + * @Author mt
222 + * @Description 构造用户信息
223 + * @Date 2025/5/27
224 + * @param fclInfoDto
225 + * @param loginUser
226 + * @return void
227 + */
228 + public void initUserInfo(FclInfoDto fclInfoDto,SysUserDto loginUser){
229 + if (StringUtils.isNotEmpty(fclInfoDto.getUserId())){
230 + loginUser.setLoginName(fclInfoDto.getUserId());
231 + }
232 + if(StringUtils.isNotEmpty(fclInfoDto.getEmailAddress())){
233 + loginUser.setEmail(fclInfoDto.getEmailAddress());
234 + }
235 + if(StringUtils.isNotEmpty(fclInfoDto.getShipperAccounts())){
236 + loginUser.setAccountNo(fclInfoDto.getShipperAccounts());
237 + }
238 + }
219 239
240 + /**
241 + * @Author mt
242 + * @Description 构造用户信息
243 + * @Date 2025/5/27
244 + * @param fclInfoDto
245 + * @param loginUser
246 + * @return void
247 + */
248 + public void initUserInfo(FclInfoDto fclInfoDto,User loginUser){
249 + if (StringUtils.isNotEmpty(fclInfoDto.getUserId())){
250 + loginUser.setLoginName(fclInfoDto.getUserId());
251 + }
252 + if(StringUtils.isNotEmpty(fclInfoDto.getEmailAddress())){
253 + loginUser.setEmail(fclInfoDto.getEmailAddress());
254 + }
255 + if(StringUtils.isNotEmpty(fclInfoDto.getShipperAccounts())){
256 + loginUser.setAccountNo(fclInfoDto.getShipperAccounts());
257 + }
258 + }
220 } 259 }
......
...@@ -4,9 +4,7 @@ import com.alibaba.fastjson.JSON; ...@@ -4,9 +4,7 @@ import com.alibaba.fastjson.JSON;
4 import com.fedex.connect.manager.common.enums.FCLSessionInfoEnum; 4 import com.fedex.connect.manager.common.enums.FCLSessionInfoEnum;
5 import com.fedex.connect.manager.config.PropertiesConfig; 5 import com.fedex.connect.manager.config.PropertiesConfig;
6 import com.fedex.connect.manager.data.dto.FclInfoDto; 6 import com.fedex.connect.manager.data.dto.FclInfoDto;
7 -import com.fedex.connect.manager.data.vo.FCLTokenResponseVo; 7 +import com.fedex.connect.manager.data.vo.*;
8 -import com.fedex.connect.manager.data.vo.FCLUserInfoVo;
9 -import com.fedex.connect.manager.data.vo.UserDataApiVo;
10 import com.google.gson.JsonObject; 8 import com.google.gson.JsonObject;
11 import lombok.extern.slf4j.Slf4j; 9 import lombok.extern.slf4j.Slf4j;
12 import org.apache.commons.lang3.StringUtils; 10 import org.apache.commons.lang3.StringUtils;
...@@ -19,6 +17,7 @@ import org.springframework.web.client.RestTemplate; ...@@ -19,6 +17,7 @@ import org.springframework.web.client.RestTemplate;
19 17
20 import java.net.URLDecoder; 18 import java.net.URLDecoder;
21 import java.util.*; 19 import java.util.*;
20 +import java.util.stream.Collectors;
22 21
23 /** 22 /**
24 * @Author mt 23 * @Author mt
...@@ -36,34 +35,52 @@ public class LoginControllerUtils { ...@@ -36,34 +35,52 @@ public class LoginControllerUtils {
36 @Autowired 35 @Autowired
37 private PropertiesConfig propertiesConfig; 36 private PropertiesConfig propertiesConfig;
38 37
38 + private HttpEntity<String> initHeader(String secretValue,String fdxLogin){
39 + FCLTokenResponseVo fclInterfaceToken = this.getFclInterfaceToken();
40 + HttpHeaders headers = new HttpHeaders();
41 + headers.set("Authorization", fclInterfaceToken.getAuthorization());
42 + List<String> cookieList = new ArrayList<>();
43 + if (StringUtils.isNotBlank(fdxLogin)) {
44 + cookieList.add("fdx_login=" + fdxLogin);
45 + }
46 + if (StringUtils.isNotBlank(secretValue)){
47 + cookieList.add(secretValue);
48 + }
49 + headers.set("Cookie", StringUtils.join(cookieList, ";"));
50 + HttpEntity<String> entity = new HttpEntity("", headers);
51 + log.info("apiExchange | entity: {}", JSON.toJSONString(entity));
52 + return entity;
53 + }
54 +
39 public FclInfoDto getFclInfo(JsonObject tokenInfo){ 55 public FclInfoDto getFclInfo(JsonObject tokenInfo){
40 FclInfoDto fclInfoDto = new FclInfoDto(); 56 FclInfoDto fclInfoDto = new FclInfoDto();
41 String secretValue; 57 String secretValue;
42 String fdxLogin; 58 String fdxLogin;
59 + HttpEntity<String> entity = null;
43 try { 60 try {
61 + /**
62 + * 获取认证oauth
63 + */
44 secretValue = this.getOauthSecret(tokenInfo); 64 secretValue = this.getOauthSecret(tokenInfo);
65 + /**
66 + * 获取fdxInfo信息
67 + */
45 fdxLogin = this.getFdxLogin(tokenInfo); 68 fdxLogin = this.getFdxLogin(tokenInfo);
46 - FCLTokenResponseVo fclInterfaceToken = this.getFclInterfaceToken(); 69 + /**
47 - HttpHeaders headers = new HttpHeaders(); 70 + * 构造请求头
48 - headers.set("Authorization", fclInterfaceToken.getAuthorization()); 71 + */
49 - List<String> cookieList = new ArrayList<>(); 72 + entity = this.initHeader(secretValue,fdxLogin);
50 - if (StringUtils.isNotBlank(fdxLogin)) {
51 - cookieList.add("fdx_login=" + fdxLogin);
52 - }
53 - if (StringUtils.isNotBlank(secretValue)){
54 - cookieList.add(secretValue);
55 - }
56 - headers.set("Cookie", StringUtils.join(cookieList, ";"));
57 - HttpEntity<String> entity = new HttpEntity("", headers);
58 - log.info("apiExchange | entity: {}", JSON.toJSONString(entity));
59 ResponseEntity<String> resp = restTemplate.exchange(propertiesConfig.getUserInfoUrl(), HttpMethod.GET, entity, String.class); 73 ResponseEntity<String> resp = restTemplate.exchange(propertiesConfig.getUserInfoUrl(), HttpMethod.GET, entity, String.class);
60 log.info("apiExchange | resp: {}", JSON.toJSONString(resp)); 74 log.info("apiExchange | resp: {}", JSON.toJSONString(resp));
61 String body = resp.getBody(); 75 String body = resp.getBody();
62 - FCLUserInfoVo fclUserInfoResponse = JSON.parseObject(body, FCLUserInfoVo.class); 76 + FCLUserInfoResponseVo fclUserInfoResponse = JSON.parseObject(body, FCLUserInfoResponseVo.class);
63 //获取email和userId 77 //获取email和userId
64 UserDataApiVo userDataApiVo = this.createUserDataApiVo(fclUserInfoResponse); 78 UserDataApiVo userDataApiVo = this.createUserDataApiVo(fclUserInfoResponse);
65 fclInfoDto.setFclContactname(userDataApiVo.getUserName()); 79 fclInfoDto.setFclContactname(userDataApiVo.getUserName());
66 String fcl_uuid = this.getUuid(tokenInfo,userDataApiVo.getUuid()); 80 String fcl_uuid = this.getUuid(tokenInfo,userDataApiVo.getUuid());
81 + /**
82 + * 对用户名进行解码处理
83 + */
67 String fcl_contactname = this.decodeMultiLevelUrl(this.getFclContactName(tokenInfo,userDataApiVo.getUserName())); 84 String fcl_contactname = this.decodeMultiLevelUrl(this.getFclContactName(tokenInfo,userDataApiVo.getUserName()));
68 fclInfoDto.setFclUuid(fcl_uuid); 85 fclInfoDto.setFclUuid(fcl_uuid);
69 fclInfoDto.setFclContactname(fcl_contactname); 86 fclInfoDto.setFclContactname(fcl_contactname);
...@@ -72,45 +89,200 @@ public class LoginControllerUtils { ...@@ -72,45 +89,200 @@ public class LoginControllerUtils {
72 fclInfoDto.setUserId(userDataApiVo.getUserId()); 89 fclInfoDto.setUserId(userDataApiVo.getUserId());
73 fclInfoDto.setEmailAddress(userDataApiVo.getEmailAddress()); 90 fclInfoDto.setEmailAddress(userDataApiVo.getEmailAddress());
74 }catch(Exception ex){ 91 }catch(Exception ex){
75 - log.error("apiExchange | fdxLogin: {}, secretValue: {} url: {}, userId: {} |具体原因: " 92 + log.error("getFclInfo | fdxLogin: {}, secretValue: {} url: {}, userId: {} |具体原因: "
76 , fclInfoDto.getFdxLogin(), fclInfoDto.getOAuthSecret(), propertiesConfig.getUserInfoUrl(),fclInfoDto.getUserId()); 93 , fclInfoDto.getFdxLogin(), fclInfoDto.getOAuthSecret(), propertiesConfig.getUserInfoUrl(),fclInfoDto.getUserId());
77 ex.printStackTrace(); 94 ex.printStackTrace();
95 + }finally{
96 + /**
97 + * 获取用户计费账号
98 + */
99 + String shipperAccount = this.getShipperAccount(entity,fclInfoDto);
100 + fclInfoDto.setShipperAccounts(shipperAccount);
78 } 101 }
79 return fclInfoDto; 102 return fclInfoDto;
80 } 103 }
81 104
82 /** 105 /**
83 * @Author mt 106 * @Author mt
107 + * @Description 调用接口获取用户计费账号
108 + * @Date 2025/5/27
109 + * @param entity
110 + * @param fclInfoDto
111 + * @return java.lang.String
112 + */
113 + private String getShipperAccount(HttpEntity<String> entity,FclInfoDto fclInfoDto){
114 + if(Objects.isNull(entity)){
115 + return "";
116 + }
117 + /**
118 + * 将连个接口的EAN拆分后去重再合并
119 + */
120 + String shipperAccountApi1 = null;
121 + String shipperAccountApi2 = null;
122 + /**
123 + * 获取shipperAccount接口1: /administration/v1/users/shippingaccounts
124 + */
125 + try{
126 + ResponseEntity<String> resp = restTemplate.exchange(propertiesConfig.getUserShippingaccountsUrl(), HttpMethod.GET, entity, String.class);
127 + FclEanTwoResponseVo fclAccountsResponse = JSON.parseObject(resp.getBody(), FclEanTwoResponseVo.class);
128 + EanTwoVo eanInfo = this.getEanByEanTwoApi(fclAccountsResponse);
129 + String ext1 = eanInfo.getDefaultEanInfo();
130 + String ext2 = eanInfo.getAccountNumberInfo();
131 + shipperAccountApi1 = (StringUtils.isNotEmpty(ext1) && StringUtils.isNotEmpty(ext2)) ? ext1 + "," + ext2 :
132 + (StringUtils.isNotEmpty(ext1) ? ext1 : (StringUtils.isNotEmpty(ext2) ? ext2 : ""));
133 + }catch(Exception ex){
134 + log.error("getShipperAccount api1 | fdxLogin: {}, secretValue: {} url: {}, userId: {} |具体原因: "
135 + , fclInfoDto.getFdxLogin(), fclInfoDto.getOAuthSecret(), propertiesConfig.getUserInfoUrl(),fclInfoDto.getUserId());
136 + ex.printStackTrace();
137 + }
138 + /**
139 + * 补偿shipperAccount
140 + * 获取shipperAccount接口2:/user/v2/accounts
141 + */
142 + try{
143 + ResponseEntity<String> resp = restTemplate.exchange(propertiesConfig.getUserAccountUrl(), HttpMethod.GET, entity, String.class);
144 + FCLAccountsResponseVo fclAccountsResponseVo = JSON.parseObject(resp.getBody(), FCLAccountsResponseVo.class);
145 + shipperAccountApi2 = this.getEANInfo(fclAccountsResponseVo);
146 + }catch(Exception ex){
147 + log.error("getShipperAccount api2 | fdxLogin: {}, secretValue: {} url: {}, userId: {} |具体原因: "
148 + , fclInfoDto.getFdxLogin(), fclInfoDto.getOAuthSecret(), propertiesConfig.getUserInfoUrl(),fclInfoDto.getUserId());
149 + ex.printStackTrace();
150 + }
151 +
152 + /**
153 + * 将连个接口的EAN拆分后去重再合并
154 + */
155 + String userEANNumber = this.getUniqueStr(shipperAccountApi1,shipperAccountApi2);
156 + return userEANNumber;
157 + }
158 +
159 + /**
160 + * @Author mt
161 + * @Description 将拼接好的两个EAN结果分割后去重再拼接
162 + * @Date 2025/5/27
163 + * @param eanOneExt1
164 + * @param eanTwoExt1
165 + * @return java.lang.String
166 + */
167 + public String getUniqueStr(String eanOneExt1,String eanTwoExt1){
168 + String userEANNumber = null;
169 + try {
170 + // 创建一个Set用于去重
171 + Set<String> uniqueElements = new HashSet<>();
172 + // 将eanOneExt1按逗号分割并添加到Set中
173 + if (StringUtils.isNotEmpty(eanOneExt1)) {
174 + String[] eanOneElements = eanOneExt1.split(",");
175 + for (String element : eanOneElements) {
176 + uniqueElements.add(element.trim());
177 + }
178 + }
179 + // 将eanTwoExt1按逗号分割并添加到Set中
180 + if (StringUtils.isNotEmpty(eanTwoExt1)) {
181 + String[] eanTwoElements = eanTwoExt1.split(",");
182 + for (String element : eanTwoElements) {
183 + uniqueElements.add(element.trim());
184 + }
185 + }
186 + // 将List中的元素用逗号分隔符拼接成一个字符串
187 + userEANNumber = String.join(",", uniqueElements);
188 + }catch (Exception e){
189 + log.error("getUniqueStr | eanOneExt1 : {} | eanTwoExt1 : {} | 具体原因: ", eanOneExt1, eanTwoExt1,e);
190 + }
191 + return userEANNumber;
192 + }
193 +
194 + /**
195 + * @Author mt
196 + * @Description 获取用户EAN信息-合并返回
197 + * @Date 2025/5/27
198 + * @param fclAccountsResponseVo
199 + * @return java.lang.String
200 + */
201 + private String getEANInfo(FCLAccountsResponseVo fclAccountsResponseVo){
202 + List<String> eanNumberList = new ArrayList();
203 + FCLAccountsResponseVo.OutPut output = fclAccountsResponseVo.getOutput();
204 + List<FCLAccountsResponseVo.FCLCustomerAccount> customerAccountList = output.getCustomerAccountList();
205 + for (int i = 0, maxi = customerAccountList.size(); i < maxi; i++) {
206 + FCLAccountsResponseVo.FCLCustomerAccount fclCustomerAccount = customerAccountList.get(i);
207 + String eanNumber = fclCustomerAccount.getAccount().getAccountIdentifier().getAccountNumber().getValue();
208 + if(StringUtils.isNotEmpty(eanNumber)){
209 + eanNumberList.add(eanNumber);
210 + }
211 + }
212 + return StringUtils.join(eanNumberList, ",");
213 + }
214 +
215 + /**
216 + * @Author mt
217 + * @Description 根据EAN2号接口返回值获取EAN number
218 + * @Date 2025/5/27
219 + * @param body
220 + * @return EanTwoVo
221 + */
222 + public EanTwoVo getEanByEanTwoApi(FclEanTwoResponseVo body) {
223 + EanTwoVo eanTwoVo = new EanTwoVo();
224 + String defaultEanInfo = null;
225 + String accountNumberInfo = null;
226 +
227 + FclEanTwoResponseVo.Output output = body != null ? body.getOutput() : null;
228 + if (output != null) {
229 + List<FclEanTwoResponseVo.AccountInfoVO> accountInfoVOs = output.getAccountInfoVOs();
230 + if (accountInfoVOs != null && !accountInfoVOs.isEmpty()) {
231 + FclEanTwoResponseVo.AccountInfoVO accountInfoVO = accountInfoVOs.get(0);
232 + //defaultEanInfo
233 + FclEanTwoResponseVo.DefaultAccount defaultAccount = accountInfoVO.getDefaultAccount();
234 + if (defaultAccount != null) {
235 + defaultEanInfo = defaultAccount.getValue();
236 + }
237 + //accountNumberInfo
238 + List<FclEanTwoResponseVo.AssociatedAccount> associatedAccountList = accountInfoVO.getAssociatedAccountList();
239 + if (associatedAccountList != null && !associatedAccountList.isEmpty()) {
240 + accountNumberInfo = associatedAccountList.stream()
241 + .map(FclEanTwoResponseVo.AssociatedAccount::getAccountNumber)
242 + .filter(Objects::nonNull)
243 + .map(FclEanTwoResponseVo.AccountNumber::getValue)
244 + .filter(value -> StringUtils.isNotEmpty(value))
245 + .collect(Collectors.joining(","));
246 + }
247 + }
248 + }
249 + eanTwoVo.setDefaultEanInfo(defaultEanInfo);
250 + eanTwoVo.setAccountNumberInfo(accountNumberInfo);
251 + return eanTwoVo;
252 + }
253 +
254 + /**
255 + * @Author mt
84 * @Description 构建获取用户信息Vo 256 * @Description 构建获取用户信息Vo
85 * @Date 2025/5/26 257 * @Date 2025/5/26
86 * @param fclUserInfoResponse 258 * @param fclUserInfoResponse
87 * @return com.fedex.connect.manager.data.vo.UserDataApiVo 259 * @return com.fedex.connect.manager.data.vo.UserDataApiVo
88 */ 260 */
89 - public UserDataApiVo createUserDataApiVo(FCLUserInfoVo fclUserInfoResponse) { 261 + public UserDataApiVo createUserDataApiVo(FCLUserInfoResponseVo fclUserInfoResponse) {
90 - FCLUserInfoVo.UserProfile userProfile = fclUserInfoResponse.getOutput().getUserProfile(); 262 + FCLUserInfoResponseVo.UserProfile userProfile = fclUserInfoResponse.getOutput().getUserProfile();
91 Optional<String> userId = Optional.ofNullable(userProfile) 263 Optional<String> userId = Optional.ofNullable(userProfile)
92 - .map(FCLUserInfoVo.UserProfile::getLoginInformation) 264 + .map(FCLUserInfoResponseVo.UserProfile::getLoginInformation)
93 - .map(FCLUserInfoVo.LoginInformation::getUserId); 265 + .map(FCLUserInfoResponseVo.LoginInformation::getUserId);
94 266
95 Optional<String> emailAddress = Optional.ofNullable(userProfile) 267 Optional<String> emailAddress = Optional.ofNullable(userProfile)
96 - .map(FCLUserInfoVo.UserProfile::getUserProfileAddress) 268 + .map(FCLUserInfoResponseVo.UserProfile::getUserProfileAddress)
97 - .map(FCLUserInfoVo.UserProfileAddress::getContact) 269 + .map(FCLUserInfoResponseVo.UserProfileAddress::getContact)
98 - .map(FCLUserInfoVo.Contact::getEmailAddress) 270 + .map(FCLUserInfoResponseVo.Contact::getEmailAddress)
99 .filter(email -> !email.isEmpty()); 271 .filter(email -> !email.isEmpty());
100 272
101 Optional<String> uuid = Optional.ofNullable(userProfile) 273 Optional<String> uuid = Optional.ofNullable(userProfile)
102 - .map(FCLUserInfoVo.UserProfile :: getUuid); 274 + .map(FCLUserInfoResponseVo.UserProfile :: getUuid);
103 275
104 Optional<String> firstNameOpt = Optional.ofNullable(userProfile) 276 Optional<String> firstNameOpt = Optional.ofNullable(userProfile)
105 - .map(FCLUserInfoVo.UserProfile::getUserProfileAddress) 277 + .map(FCLUserInfoResponseVo.UserProfile::getUserProfileAddress)
106 - .map(FCLUserInfoVo.UserProfileAddress::getContact) 278 + .map(FCLUserInfoResponseVo.UserProfileAddress::getContact)
107 - .map(FCLUserInfoVo.Contact::getPersonName) 279 + .map(FCLUserInfoResponseVo.Contact::getPersonName)
108 .map(personName -> personName.getFirstName()); 280 .map(personName -> personName.getFirstName());
109 281
110 Optional<String> lastNameOpt = Optional.ofNullable(userProfile) 282 Optional<String> lastNameOpt = Optional.ofNullable(userProfile)
111 - .map(FCLUserInfoVo.UserProfile::getUserProfileAddress) 283 + .map(FCLUserInfoResponseVo.UserProfile::getUserProfileAddress)
112 - .map(FCLUserInfoVo.UserProfileAddress::getContact) 284 + .map(FCLUserInfoResponseVo.UserProfileAddress::getContact)
113 - .map(FCLUserInfoVo.Contact::getPersonName) 285 + .map(FCLUserInfoResponseVo.Contact::getPersonName)
114 .map(personName -> personName.getLastName()); 286 .map(personName -> personName.getLastName());
115 String userName = null; 287 String userName = null;
116 if (firstNameOpt.isPresent() && lastNameOpt.isPresent()){ 288 if (firstNameOpt.isPresent() && lastNameOpt.isPresent()){
......
...@@ -47,5 +47,7 @@ fcl: ...@@ -47,5 +47,7 @@ fcl:
47 scope: oob 47 scope: oob
48 account: 48 account:
49 url: /user/v2/accounts 49 url: /user/v2/accounts
50 + shippingaccounts:
51 + url: /administration/v1/users/shippingaccounts
50 userinfo: 52 userinfo:
51 url: /user/v2/users/userinfo 53 url: /user/v2/users/userinfo
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -40,5 +40,7 @@ fcl: ...@@ -40,5 +40,7 @@ fcl:
40 scope: oob 40 scope: oob
41 account: 41 account:
42 url: /user/v2/accounts 42 url: /user/v2/accounts
43 + shippingaccounts:
44 + url: /administration/v1/users/shippingaccounts
43 userinfo: 45 userinfo:
44 url: /user/v2/users/userinfo 46 url: /user/v2/users/userinfo
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -41,5 +41,7 @@ fcl: ...@@ -41,5 +41,7 @@ fcl:
41 scope: oob 41 scope: oob
42 account: 42 account:
43 url: /user/v2/accounts 43 url: /user/v2/accounts
44 + shippingaccounts:
45 + url: /administration/v1/users/shippingaccounts
44 userinfo: 46 userinfo:
45 url: /user/v2/users/userinfo 47 url: /user/v2/users/userinfo
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -40,5 +40,7 @@ fcl: ...@@ -40,5 +40,7 @@ fcl:
40 scope: oob 40 scope: oob
41 account: 41 account:
42 url: /user/v2/accounts 42 url: /user/v2/accounts
43 + shippingaccounts:
44 + url: /administration/v1/users/shippingaccounts
43 userinfo: 45 userinfo:
44 url: /user/v2/users/userinfo 46 url: /user/v2/users/userinfo
...\ No newline at end of file ...\ No newline at end of file
......