Bladeren bron

小图商品接口

wanglang 1 maand geleden
bovenliggende
commit
1eadc21285

+ 62 - 43
trade-client/src/main/resources/data/init/wl-trade-client.sql

@@ -143,25 +143,26 @@ CREATE TABLE `sales_contract`
 (
     `id`                       bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
     `customer_user_id`         BIGINT UNSIGNED DEFAULT 0 COMMENT '客户id',
-    `contract_no`              varchar(64)  default '' comment '合同编号',
-    `contract_name`            varchar(300) default '' comment '合同名称',
-    `importer_cert_no`         VARCHAR(32)  DEFAULT '' COMMENT '进口商统一社会信用代码/注册号',
-    `importer_enterprise_name` VARCHAR(300) DEFAULT NULL COMMENT '进口商企业名称',
-    `agency_cert_no`           VARCHAR(32)  DEFAULT '' COMMENT '代理公司统一社会信用代码/注册号',
-    `agency_enterprise_name`   VARCHAR(300) DEFAULT NULL COMMENT '代理公司企业名称',
-    `trade_terms`              varchar(4)   DEFAULT '' COMMENT '贸易术语',
-    `port_departure`           varchar(255) DEFAULT '' comment '起运港',
-    `port_destination`         varchar(255) DEFAULT '' comment '目的港',
+    `contract_no`              varchar(64)     default '' comment '合同编号',
+    `contract_name`            varchar(300)    default '' comment '合同名称',
+    `importer_cert_no`         VARCHAR(32)     DEFAULT '' COMMENT '进口商统一社会信用代码/注册号',
+    `importer_enterprise_name` VARCHAR(300)    DEFAULT NULL COMMENT '进口商企业名称',
+    `agency_cert_no`           VARCHAR(32)     DEFAULT '' COMMENT '代理公司统一社会信用代码/注册号',
+    `agency_enterprise_name`   VARCHAR(300)    DEFAULT NULL COMMENT '代理公司企业名称',
+    `trade_terms`              varchar(4)      DEFAULT '' COMMENT '贸易术语',
+    `port_departure`           varchar(255)    DEFAULT '' comment '起运港',
+    `port_destination`         varchar(255)    DEFAULT '' comment '目的港',
     `template_type`            TINYINT(2) DEFAULT null COMMENT '模板类型1长银0自有',
-    `sign_date`                DATETIME     DEFAULT null COMMENT '签署日期',
-    `submit_status`            varchar(4)   DEFAULT '' COMMENT '提交状态1草稿2正式',
-    `contract_status`          varchar(4)   DEFAULT '' COMMENT '合同状态1草稿2生效3待上传6已完成',
-    `audit_status`             varchar(4)   DEFAULT '' COMMENT '审核状态1待审核2风控审核通过3法务审核通过4风控审核不通过5法务审核不通过',
+    `sign_date`                DATETIME        DEFAULT null COMMENT '签署日期',
+    `exchange_rate`            DECIMAL(17, 10) DEFAULT 0 COMMENT '汇率',
+    `submit_status`            varchar(4)      DEFAULT '' COMMENT '提交状态1草稿2正式',
+    `contract_status`          varchar(4)      DEFAULT '' COMMENT '合同状态1草稿2生效3待上传6已完成',
+    `audit_status`             varchar(4)      DEFAULT '' COMMENT '审核状态1待审核2风控审核通过3法务审核通过4风控审核不通过5法务审核不通过',
     `deleted`                  TINYINT(1) DEFAULT 0 COMMENT '删除标识',
-    `create_by`                varchar(64)  default '' comment '创建者',
-    `update_by`                varchar(64)  default '' comment '更新者',
-    `gmt_create`               TIMESTAMP    DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
-    `gmt_modified`             TIMESTAMP    DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+    `create_by`                varchar(64)     default '' comment '创建者',
+    `update_by`                varchar(64)     default '' comment '更新者',
+    `gmt_create`               TIMESTAMP       DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+    `gmt_modified`             TIMESTAMP       DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
     PRIMARY KEY (`id`),
     UNIQUE INDEX uk_contract_No (`contract_No`),
     INDEX                      idx_cui (`customer_user_id`)
@@ -274,11 +275,13 @@ CREATE TABLE `purchase_order`
     `sales_order_id`       BIGINT UNSIGNED DEFAULT 0 COMMENT '销售订单主键',
     `order_no`             VARCHAR(64)    DEFAULT '' COMMENT '订单编号',
     `entity_no`            VARCHAR(64)    DEFAULT '' COMMENT '供应商编号',
+    `agency_cert_no`       VARCHAR(32)    DEFAULT '' COMMENT '代理公司统一社会信用代码/注册号',
     `purchase_contract_no` VARCHAR(64)    DEFAULT '' COMMENT '采购合同编号',
     `invoice_type`         VARCHAR(2)     DEFAULT '' COMMENT '发票类型1增值税专用发票2增值税普通发票',
     `currency`             VARCHAR(3)     DEFAULT 'CNY' COMMENT '币种',
     `amount_total`         DECIMAL(17, 4) DEFAULT '0' COMMENT '订单总额',
     `tax_amount_total`     DECIMAL(17, 4) DEFAULT '0' COMMENT '订单税额',
+    `settlement_cycle`     INT            DEFAULT NULL COMMENT '结算周期单位天',
     `deleted`              TINYINT(1) DEFAULT 0 COMMENT '删除标识',
     `gmt_create`           TIMESTAMP      DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
     `gmt_modified`         TIMESTAMP      DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
@@ -293,38 +296,54 @@ CREATE TABLE `purchase_order`
 DROP TABLE IF EXISTS `purchase_order_commodity`;
 CREATE TABLE `purchase_order_commodity`
 (
-    `id`                BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
-    `purchase_order_id` BIGINT(20) UNSIGNED NOT NULL COMMENT '采购订单id',
-    `hs_code`           VARCHAR(32)        DEFAULT '' COMMENT '商品编码',
-    `name`              VARCHAR(32)        DEFAULT '' COMMENT '商品名称',
-    `measurement_unit`  VARCHAR(32)        DEFAULT '' COMMENT '计量单位',
-    `pack_spec`         VARCHAR(300)       DEFAULT '' COMMENT '包装规格',
-    `number`            INT                DEFAULT 0 comment '数量',
-    `price_unit`        DECIMAL(17, 2)     DEFAULT '0' COMMENT '采购单价 (不含税) ',
-    `tax_refund_rate`   DECIMAL(8, 6)      DEFAULT '0' COMMENT '增值税税率',
-    `currency`          VARCHAR(3)         DEFAULT 'CNY' COMMENT '币种',
-    `amount`            DECIMAL(17, 4)     DEFAULT '0' COMMENT '商品金额',
-    `model`             VARCHAR(64)        DEFAULT '' COMMENT '型号',
-    `deleted`           TINYINT(1) DEFAULT 0 COMMENT '删除标识',
-    `gmt_create`        TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
-    `gmt_modified`      TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+    `id`                 BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
+    `purchase_order_id`  BIGINT(20) UNSIGNED NOT NULL COMMENT '采购订单id',
+    `sales_commodity_id` BIGINT(20) UNSIGNED NOT NULL COMMENT '销售商品id',
+    `hs_code`            VARCHAR(32)        DEFAULT '' COMMENT '商品编码',
+    `name`               VARCHAR(32)        DEFAULT '' COMMENT '商品名称',
+    `measurement_unit`   VARCHAR(32)        DEFAULT '' COMMENT '计量单位',
+    `pack_spec`          VARCHAR(300)       DEFAULT '' COMMENT '包装规格',
+    `number`             INT                DEFAULT 0 comment '数量',
+    `price_unit`         DECIMAL(17, 2)     DEFAULT '0' COMMENT '采购单价 (不含税) ',
+    `tax_refund_rate`    DECIMAL(8, 6)      DEFAULT '0' COMMENT '增值税税率',
+    `currency`           VARCHAR(3)         DEFAULT 'CNY' COMMENT '币种',
+    `amount`             DECIMAL(17, 4)     DEFAULT '0' COMMENT '商品金额',
+    `model`              VARCHAR(64)        DEFAULT '' COMMENT '型号',
+    `deleted`            TINYINT(1) DEFAULT 0 COMMENT '删除标识',
+    `gmt_create`         TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+    `gmt_modified`       TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
     PRIMARY KEY (`id`)
 )ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT='采购订单-关联商品';
 
 DROP TABLE IF EXISTS `purchase_order_logistics`;
 CREATE TABLE `purchase_order_logistics`
 (
-    `id`                            BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
-    `purchase_order_id`             BIGINT(20) UNSIGNED NOT NULL COMMENT '采购订单id',
-    `company_name`                  VARCHAR(300)       DEFAULT '' COMMENT '物流公司名称',
-    `logistics_order_number`        VARCHAR(32)        DEFAULT '' COMMENT '物流单号',
-    `delivery_time`                 DATETIME           DEFAULT NULL COMMENT '发货时间',
-    `arrive_time`                   DATETIME           DEFAULT NULL COMMENT '送达时间',
-    `transport_certificate_file_id` BIGINT(20) UNSIGNED NOT NULL COMMENT '运输证明文件id',
-    `remark`                        varchar(512)       DEFAULT '' COMMENT '备注',
-    `deleted`                       TINYINT(1) DEFAULT 0 COMMENT '删除标识',
-    `gmt_create`                    TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
-    `gmt_modified`                  TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+    `id`                     BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
+    `purchase_order_id`      BIGINT(20) UNSIGNED NOT NULL COMMENT '采购订单id',
+    `company_name`           VARCHAR(300)       DEFAULT '' COMMENT '物流公司名称',
+    `logistics_order_number` VARCHAR(32)        DEFAULT '' COMMENT '物流单号',
+    `delivery_time`          DATETIME           DEFAULT NULL COMMENT '发货时间',
+    `arrive_time`            DATETIME           DEFAULT NULL COMMENT '送达时间',
+    -- `transport_certificate_file_id` BIGINT(20) UNSIGNED NOT NULL COMMENT '运输证明文件id',
+    `remark`                 varchar(512)       DEFAULT '' COMMENT '备注',
+    `deleted`                TINYINT(1) DEFAULT 0 COMMENT '删除标识',
+    `gmt_create`             TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+    `gmt_modified`           TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
     PRIMARY KEY (`id`)
 )ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT='采购订单-关联商品';
 
+-- 采购订单-发票信息
+DROP TABLE IF EXISTS `purchase_order_invoice`;
+CREATE TABLE `purchase_order_invoice`
+(
+    `id`           BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
+    `order_id`     BIGINT(20) UNSIGNED NOT NULL COMMENT '采购订单id',
+    `invoice_no`   VARCHAR(32)        DEFAULT '' COMMENT '发票号码',
+    `amount`       DECIMAL(17, 2)     DEFAULT '0' COMMENT '发票金额',
+    `file_id`      BIGINT(20) UNSIGNED NOT NULL COMMENT '发票文件id',
+    `deleted`      TINYINT(1) DEFAULT 0 COMMENT '删除标识',
+    `gmt_create`   TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+    `gmt_modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
+    PRIMARY KEY (`id`)
+)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT='采购订单-发票信息';
+

+ 21 - 2
trade-service/src/main/java/com/trade/service/TransStruct.java

@@ -23,6 +23,7 @@ import com.trade.service.tradingPlatform.domain.TradingPlatformQualification;
 import com.trade.service.tradingPlatform.dto.TradingPlatformQualificationDto;
 import org.mapstruct.*;
 
+import java.math.BigDecimal;
 import java.util.Arrays;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -49,8 +50,6 @@ public interface TransStruct {
 
     SalesOrderPayInfoVO transContractTerms2SalesOrderPayInfoVO(ContractTerms contractTerms);
 
-    List<PurchaseOrderCommodityTL> transPurchaseOrderCommodityForTLList(List<PurchaseOrderCommodity> commodities);
-
     @Mapping(source = "authorizationFile.id", target = "authorizationFile")
     Enterprise transDto2Enterprise(EnterpriseDto enterpriseDto);
 
@@ -91,5 +90,25 @@ public interface TransStruct {
             }
             return null;
         }
+
+        public static String concatenate(String hsCode, String name) {
+            return hsCode + "+" + name;
+        }
+
+        public static String getTaxAmount(BigDecimal amount, BigDecimal taxRefundRate) {
+            return amount.multiply(taxRefundRate).toPlainString();
+        }
     }
+
+    @IterableMapping(qualifiedByName = "transPurchaseOrderCommodityForTLList")
+    List<PurchaseOrderCommodityTL> transPurchaseOrderCommodityForTLList(List<PurchaseOrderCommodity> commodities);
+
+    @Mappings({
+            @Mapping(target = "hsCodeAndName", expression = "java(MapStruct.concatenate(commodity.getHsCode(), commodity.getName()))"),
+            @Mapping(source = "number", target = "count"), @Mapping(source = "priceUnit", target = "price"),
+            @Mapping(source = "taxRefundRate", target = "addedTaxRate"),
+            @Mapping(target = "taxAmount", expression = "java(MapStruct.getTaxAmount(commodity.getAmount(), commodity.getTaxRefundRate()))"),
+    })
+    @Named("transPurchaseOrderCommodityForTLList")
+    PurchaseOrderCommodityTL transPurchaseOrderCommodityForTL(PurchaseOrderCommodity commodity);
 }

+ 26 - 0
trade-service/src/main/java/com/trade/service/thirdparty/xiaotu/dto/CommodityRequest.java

@@ -0,0 +1,26 @@
+package com.trade.service.thirdparty.xiaotu.dto;
+
+import lombok.Data;
+
+/**
+ * @description: 商品请求参数
+ * @Author: wanglang
+ * @Date: 2024/9/18
+ * @Version: 1.0
+ */
+@Data
+public class CommodityRequest {
+
+    /**
+     * 商品名称/商品代码 是
+     */
+    private String ckspdm;
+    /**
+     * 出口商品特殊商品类型代码 否 1 禁止出口/出口不退税商品 2 免税商品 3-其他(除 1 和 2 外)
+     */
+    private String cksptssplxDm;
+    /**
+     * 税种 否 V 是增值税,C 是消费税
+     */
+    private String sz;
+}

+ 60 - 0
trade-service/src/main/java/com/trade/service/thirdparty/xiaotu/dto/CommodityResponse.java

@@ -0,0 +1,60 @@
+package com.trade.service.thirdparty.xiaotu.dto;
+
+import com.alibaba.fastjson2.annotation.JSONField;
+import lombok.Data;
+
+/**
+ * @description: 商品响应
+ * @Author: wanglang
+ * @Date: 2024/9/18
+ * @Version: 1.0
+ */
+@Data
+public class CommodityResponse {
+
+    /**
+     * 商品 ID
+     */
+    @JSONField(name = "SPID")
+    private String spid;
+    /**
+     * 出口商品代码
+     */
+    @JSONField(name = "CKSP_DM")
+    private String ckspDm;
+    /**
+     * 出口商品名称
+     */
+    @JSONField(name = "CKSPMC")
+    private String ckspmc;
+    /**
+     * 税种, V 是增值税,C 是消费税
+     */
+    @JSONField(name = "SZ")
+    private String sz;
+    /**
+     * 退税率
+     */
+    @JSONField(name = "TSL")
+    private String tsl;
+    /**
+     * 海关计量单位名称
+     */
+    @JSONField(name = "HGJLDWMC")
+    private String hgjldwmc;
+    /**
+     * 海关计量单位代码
+     */
+    @JSONField(name = "HGJLDW_DM")
+    private String hgjldwDm;
+    /**
+     * "出口商品特殊商品类型代码, 1 禁止出口/出口不退税商品 2 免税商品
+     */
+    @JSONField(name = "CKSPTSSPLX_DM")
+    private String cksptssplxDm;
+    /**
+     * 征税税率集合
+     */
+    @JSONField(name = "ZSSLJH")
+    private String zssljh;
+}

+ 45 - 0
trade-service/src/main/java/com/trade/service/thirdparty/xiaotu/dto/InvoiceQueryRequset.java

@@ -0,0 +1,45 @@
+package com.trade.service.thirdparty.xiaotu.dto;
+
+import lombok.Data;
+
+/**
+ * @description: 发票查询请求
+ * @Author: wanglang
+ * @Date: 2024/9/19
+ * @Version: 1.0
+ */
+@Data
+public class InvoiceQueryRequset {
+
+    // 字符 发票号集合 否
+    private String pfphms;
+    // 字符 数电发票号码集合 否
+    private String sdfphms;
+    // 字符 是否认证 否
+    // Y:已认证
+    // N:未认证
+    // 不传:全部
+    private String rzxfzzszyfpbz;
+    // 字符 开票日期起(yyyy-MM-dd)
+    // 否
+    // 开票日期起、止条件必须同时传入或
+    // 都不传
+    private String kprqQ;
+    // 字符 开票日期止(yyyy-MM-dd)
+    // 否
+    // 开票日期起、止条件必须同时传入或
+    // 都不传
+    private String kprqZ;
+    /**
+     * 字符 销方纳税人税号 否
+     */
+    private String xhfnsrsbh;
+    /**
+     * 数值 页面条数 是
+     */
+    private String pageSize;
+    /**
+     * 数值 页数
+     */
+    private String page;
+}