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