瀏覽代碼

商品相关接口

wanglang 1 月之前
父節點
當前提交
05d37247c8

+ 1 - 1
trade-service/src/main/java/com/trade/service/sales/service/impl/SalesContractServiceImpl.java

@@ -83,7 +83,7 @@ public class SalesContractServiceImpl extends ServiceImpl<SalesContractMapper, S
             fileStorage = localFileService.getFileById(contractFile.getUnsignFileStorageId());
             contractFileDto.setFileId(contractFile.getSignedFileStorageId());
         }
-        contractFileDto.setPath(fileStorage.getPath());
+        contractFileDto.setPath(fileStorage.getOriginalName());
         salesContractInfoVo.setContractFile(contractFileDto);
         ContractTermsDto contractTermsDto = contractTermsService.getDetailByContractIdAndType(contractId,
                 ConstantUtil.SALES_CONTRACT_NO_PREFIX);

+ 20 - 0
trade-service/src/main/java/com/trade/service/thirdparty/xiaotu/configuration/XiaotuConfiguration.java

@@ -18,6 +18,10 @@ public class XiaotuConfiguration {
     private String updateUserUrl;
     // 新增用户企业关系的url
     private String registerEnterpriseUrl;
+    // 退税税率查询接口
+    private String tsslcxUrl;
+    // 海关税则查询接口
+    private String hgszcxUrl;
 
     public String getGatewayAppKey() {
         return gatewayAppKey;
@@ -74,4 +78,20 @@ public class XiaotuConfiguration {
     public void setRegisterEnterpriseUrl(String registerEnterpriseUrl) {
         this.registerEnterpriseUrl = registerEnterpriseUrl;
     }
+
+    public String getTsslcxUrl() {
+        return tsslcxUrl;
+    }
+
+    public void setTsslcxUrl(String tsslcxUrl) {
+        this.tsslcxUrl = tsslcxUrl;
+    }
+
+    public String getHgszcxUrl() {
+        return hgszcxUrl;
+    }
+
+    public void setHgszcxUrl(String hgszcxUrl) {
+        this.hgszcxUrl = hgszcxUrl;
+    }
 }

+ 23 - 0
trade-service/src/main/java/com/trade/service/thirdparty/xiaotu/dto/BusinessCommonRequest.java

@@ -0,0 +1,23 @@
+package com.trade.service.thirdparty.xiaotu.dto;
+
+import lombok.Data;
+
+/**
+ * @description: 业务请求公共参数
+ * @Author: wanglang
+ * @Date: 2024/9/19
+ * @Version: 1.0
+ */
+@Data
+public class BusinessCommonRequest {
+
+    private Long customerId;
+    /**
+     * 小图企业uuid
+     */
+    private String xtEid;
+    /**
+     * 小图用户id
+     */
+    private String xtUid;
+}

+ 105 - 0
trade-service/src/main/java/com/trade/service/thirdparty/xiaotu/dto/CommodityCustomsTariffRespose.java

@@ -0,0 +1,105 @@
+package com.trade.service.thirdparty.xiaotu.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @description: 海关税则查询接口详细
+ * @Author: wanglang
+ * @Date: 2024/9/19
+ * @Version: 1.0
+ */
+@Data
+public class CommodityCustomsTariffRespose {
+
+    // 商品 ID
+    private String SPID;
+    // 出口商品代码
+    private String CKSP_DM;
+    // 出口商品名称
+    private String CKSPMC;
+    // 税种, V 是增值税,C 是消费税"
+    private String SZ;
+    // 退税率
+    private String TSL;
+    // 海关计量单位名称
+    private String HGJLDWMC;
+    // 海关计量单位代码
+    private String HGJLDW_DM;
+    // 出口商品特殊商品类型代码, 1 禁止出口/出口不退税商品 2 免税商品
+    private String CKSPTSSPLX_DM;
+    // 征税税率集合
+    private String ZSSLJH;
+    // 有效期起
+    private String YXQQ;
+    // 有效期止
+    private String YXQZ;
+    // 从量定额征税
+    private String CLDEZS;
+    // 从价定率征税
+    private String CJDLZS;
+    // 备注
+    private String BZ;
+    //
+    private Spmgslzpinfo SPMGSLZPINFO;
+    private List<Spmhgszinfo> SPMHGSZINFO;
+
+    @Data
+    public static class Spmgslzpinfo {
+
+        // 大类编号
+        private String BIGCLASSID;
+        // 大类名称
+        private String BIGCLASSNAME;
+        // 品目编号
+        private String CATEGORYID;
+        // 品目名称
+        private String CATEGORYNAME;
+        // 章节编号
+        private String CLASSID;
+        // 章节名称
+        private String CLASSNAME;
+        // 最大章节编号
+        private String MAXCLASSID;
+        // 最小章节编号
+        private String MINCLASSID;
+    }
+
+    @Data
+    public static class Spmhgszinfo {
+
+        // HS 编码
+        private String HSCODE;
+        // 中文描述
+        private String HSNAME;
+        // 英文描述
+        private String HSENGLISH;
+        // CIQ 代码
+        private String CIQ;
+        // 申报要素
+        private String HSSBYS;
+        // 第一单位
+        private String HSDYDW;
+        // 第二单位
+        private String HSDEDW;
+        // 监管条件
+        private String HSHGJGTJ;
+        // 检疫条件
+        private String HSJYYYLB;
+        // 最惠国进口税率
+        private String HSZHGJKSL;
+        // 普通进口税率
+        private String HSPTJKSL;
+        // 暂定进口税率
+        private String HSZDJKSL;
+        // 进口增值税
+        private String HSZZSL;
+        // 进口其他税
+        private String HSJKQTSL;
+        // 对美加征关税
+        private String HSDMJZGSL;
+        // 备注
+        private String NOTE;
+    }
+}

+ 21 - 0
trade-service/src/main/java/com/trade/service/thirdparty/xiaotu/service/XiaotuRequestService.java

@@ -14,6 +14,7 @@ public interface XiaotuRequestService {
 
     /**
      * 用户信息修改
+     * 
      * @param request
      * @return
      */
@@ -26,4 +27,24 @@ public interface XiaotuRequestService {
      * @return
      */
     RegisterEnterpriseResponse registerEnterprise(RegisterEnterpriseRequest request);
+
+    /**
+     * 退税税率查询接口
+     * 
+     * @param commodityRequest
+     * @param businessCommonRequest
+     * @return CommodityResponse
+     */
+    CommodityResponse taxRefundRateInquiry(CommodityRequest commodityRequest,
+            BusinessCommonRequest businessCommonRequest);
+
+    /**
+     * 海关税则查询接口
+     * 
+     * @param spid 商品id
+     * @param businessCommonRequest
+     * @return CommodityCustomsTariffRespose
+     */
+    CommodityCustomsTariffRespose commodityCustomsTariffInquiry(String spid,
+            BusinessCommonRequest businessCommonRequest);
 }

+ 38 - 0
trade-service/src/main/java/com/trade/service/thirdparty/xiaotu/service/impl/XiaotuRequestServiceImpl.java

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