|
@@ -35,6 +35,13 @@ public class XiaotuRequestServiceImpl implements XiaotuRequestService {
|
|
|
.other("gatewaAppKey", xiaotuConfiguration.getAccessClientId());
|
|
|
}
|
|
|
|
|
|
+ private HttpHeader getBusinessCommonHeader(String xtUid, String xtEid) {
|
|
|
+ return HttpHeader.custom().other("accessClientId", xiaotuConfiguration.getAccessClientId())
|
|
|
+ .other("ftype", xiaotuConfiguration.getFtype())
|
|
|
+ .other("gatewaAppKey", xiaotuConfiguration.getAccessClientId())
|
|
|
+ .other("accessToken", getAccessToken(xtUid, xtEid));
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取小图accessToken 和小图约定token的有效期为20分钟
|
|
|
*
|
|
@@ -101,4 +108,35 @@ public class XiaotuRequestServiceImpl implements XiaotuRequestService {
|
|
|
}
|
|
|
return JSON.parseObject(JSON.parseObject(resp).getString("body"), RegisterEnterpriseResponse.class);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public CommodityResponse taxRefundRateInquiry(CommodityRequest commodityRequest,
|
|
|
+ BusinessCommonRequest businessCommonRequest) {
|
|
|
+ String request = JSON.toJSONString(commodityRequest);
|
|
|
+ String resp = HttpClientUtils.post(HttpConfig.custom()
|
|
|
+ .headers(getBusinessCommonHeader(businessCommonRequest.getXtUid(), businessCommonRequest.getXtEid())
|
|
|
+ .contentType(CONTENT_TYPE_JSON).build())
|
|
|
+ .json(JSON.toJSONString(commodityRequest)).url(xiaotuConfiguration.getTsslcxUrl()));
|
|
|
+ CommonResponse<CommodityResponse> commonResponse = JSON.parseObject(resp, CommonResponse.class);
|
|
|
+ if (commonResponse != null && !commonResponse.isSuccess()) {
|
|
|
+ logger.error("小图:退税税率查询接口,req={},resp={}", request, resp);
|
|
|
+ throw new RuntimeException("小图:退税税率查询接口失败");
|
|
|
+ }
|
|
|
+ return commonResponse.getBody();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public CommodityCustomsTariffRespose commodityCustomsTariffInquiry(String spid,
|
|
|
+ BusinessCommonRequest businessCommonRequest) {
|
|
|
+ String resp = HttpClientUtils.post(HttpConfig.custom()
|
|
|
+ .headers(getBusinessCommonHeader(businessCommonRequest.getXtUid(), businessCommonRequest.getXtEid())
|
|
|
+ .contentType(CONTENT_TYPE_JSON).build())
|
|
|
+ .json(JSON.toJSONString(spid)).url(xiaotuConfiguration.getHgszcxUrl()));
|
|
|
+ CommonResponse<CommodityCustomsTariffRespose> commonResponse = JSON.parseObject(resp, CommonResponse.class);
|
|
|
+ if (commonResponse != null && !commonResponse.isSuccess()) {
|
|
|
+ logger.error("小图:海关税则查询接口,req={},resp={}", spid, resp);
|
|
|
+ throw new RuntimeException("小图:海关税则查询接口失败");
|
|
|
+ }
|
|
|
+ return commonResponse.getBody();
|
|
|
+ }
|
|
|
}
|