整理代码

20230922-ljl-fixBug
qiushengjie 1 year ago
parent b1c296fda8
commit a0fcdabfdf

@ -24,8 +24,6 @@ public class TestSignService implements ExtensionServiceHandler<ItemDTO, String>
@Override @Override
public BaseResponse<String> handle(BaseRequest<ItemDTO> req) { public BaseResponse<String> handle(BaseRequest<ItemDTO> req) {
log.info("");
HashMap<String, Object> params = new HashMap<>(); HashMap<String, Object> params = new HashMap<>();
// List<String> arrayString = new ArrayList<>(); // List<String> arrayString = new ArrayList<>();

@ -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);
} }
} }

@ -68,9 +68,12 @@ public class DsJsonRequestTemplate {
sb.append(dsToken); sb.append(dsToken);
for (String s : keyArray) { for (String s : keyArray) {
sb.append(s).append(JSON.toJSONString(params.get(s))); sb.append(s).append(JSON.toJSONString(params.get(s)));
// sb.append(s).append(params.get(s));
} }
sb.append(dsToken); sb.append(dsToken);
log.info("row sign sb:" + sb);
String sign = SecureUtil.md5(sb.toString()); String sign = SecureUtil.md5(sb.toString());
log.info("sign:" + sign);
headers.set("x-dd-micro-app-sign", sign); headers.set("x-dd-micro-app-sign", sign);
return cloudRequestTemplate.executePost(dsHost + url, JSON.toJSONString(params), headers); return cloudRequestTemplate.executePost(dsHost + url, JSON.toJSONString(params), headers);

Loading…
Cancel
Save