|
|
@ -44,23 +44,19 @@ public class SPIBaseService {
|
|
|
|
// 更新信息,根据请求抖店接口的结果,可失败
|
|
|
|
// 更新信息,根据请求抖店接口的结果,可失败
|
|
|
|
if (StringUtils.isEmpty(shop.getShopName())) {
|
|
|
|
if (StringUtils.isEmpty(shop.getShopName())) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
String code = "df020f1c-37ed-41b5-8341-85d3d3b02250";
|
|
|
|
TokenCreateRequest request = new TokenCreateRequest();
|
|
|
|
TokenCreateRequest request = new TokenCreateRequest();
|
|
|
|
TokenCreateParam param = request.getParam();
|
|
|
|
TokenCreateParam param = request.getParam();
|
|
|
|
param.setCode("df020f1c-37ed-41b5-8341-85d3d3b02250");
|
|
|
|
param.setCode(code);
|
|
|
|
param.setGrantType("authorization_code");
|
|
|
|
param.setGrantType("authorization_code");
|
|
|
|
TokenCreateResponse response = request.execute();
|
|
|
|
TokenCreateResponse response = request.execute();
|
|
|
|
log.info("TokenCreateResponse:" + JSON.toJSONString(response));
|
|
|
|
log.info("TokenCreateResponse:" + JSON.toJSONString(response));
|
|
|
|
if (response.isSuccess()) {
|
|
|
|
if (response.isSuccess()) {
|
|
|
|
TokenCreateData data = response.getData();
|
|
|
|
TokenCreateData data = response.getData();
|
|
|
|
Long shopId = data.getShopId();
|
|
|
|
shop.setShopName(data.getShopName());
|
|
|
|
String accessToken = data.getAccessToken();
|
|
|
|
shop.setAccessToken(SecurityTool.encodeByAES(data.getAccessToken())); // 加密
|
|
|
|
Long expiresIn = data.getExpiresIn();
|
|
|
|
shop.setRefreshToken(SecurityTool.encodeByAES(data.getRefreshToken())); // 加密
|
|
|
|
String shopName = data.getShopName();
|
|
|
|
shop.setExpiresIn(data.getExpiresIn().toString()); // TODO 这里使用时间格式
|
|
|
|
String refreshToken = data.getRefreshToken();
|
|
|
|
|
|
|
|
shop.setShopName(shopName);
|
|
|
|
|
|
|
|
shop.setAccessToken(SecurityTool.encodeByAES(accessToken)); // 加密
|
|
|
|
|
|
|
|
shop.setRefreshToken(SecurityTool.encodeByAES(refreshToken)); // 加密
|
|
|
|
|
|
|
|
shop.setExpiresIn(expiresIn.toString()); // TODO 这个可能是时间格式,转成时间
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
shopService.updateByPrimaryKey(shop);
|
|
|
|
shopService.updateByPrimaryKey(shop);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
@ -70,6 +66,5 @@ public class SPIBaseService {
|
|
|
|
|
|
|
|
|
|
|
|
ModelMapper modelMapper = new ModelMapper();
|
|
|
|
ModelMapper modelMapper = new ModelMapper();
|
|
|
|
shopInfo = modelMapper.map(shop, ShopBO.class);
|
|
|
|
shopInfo = modelMapper.map(shop, ShopBO.class);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|