整理代码

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

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

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

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

Loading…
Cancel
Save