wanglang дней назад: 6
Родитель
Сommit
16c1b65908

+ 5 - 1
trade-admin/src/main/java/com/trade/admin/job/PurchaseInvoiceSchedule.java

@@ -152,7 +152,11 @@ public class PurchaseInvoiceSchedule {
                 businessCommonRequest.setXtUid(invoiceVo.getXtUserId());
                 businessCommonRequest.setCustomerId(invoiceVo.getCustomerUserId());
                 InvoiceQueryRequset invoiceQueryRequset = new InvoiceQueryRequset();
-                invoiceQueryRequset.setXhfnsrsbh(invoiceVo.getTaxNum());
+                if (StringUtils.isNotEmpty(invoiceVo.getTaxNum())) {
+                    invoiceQueryRequset.setXhfnsrsbh(invoiceVo.getTaxNum());
+                } else {
+                    invoiceQueryRequset.setXhfnsrsbh(invoiceVo.getCertNo());
+                }
                 invoiceQueryRequset.setPage(1);
                 invoiceQueryRequset.setPageSize(30);
                 List<PurchaseOrderInvoice> purchaseOrderInvoices = purchaseOrderInvoiceService

+ 4 - 0
trade-service/src/main/java/com/trade/service/trade/purchaseorder/vo/TradingPlatformInvoiceVo.java

@@ -41,4 +41,8 @@ public class TradingPlatformInvoiceVo {
      * 客户id
      */
     private Long customerUserId;
+    /**
+     * 证件号
+     */
+    private String certNo;
 }

+ 6 - 3
trade-service/src/main/resources/mapper/trade/purchaseorder/PurchaseOrderMapper.xml

@@ -65,6 +65,7 @@
         <id column="xt_user_id" property="xtUserId"/>
         <id column="xt_eid" property="xtEid"/>
         <id column="customer_user_id" property="customerUserId"/>
+        <id column="cert_no" property="certNo"/>
     </resultMap>
     <sql id="Base_Column_List">
         amount_total
@@ -144,12 +145,12 @@
                  left join vendor_entity v on v.entity_no = t.entity_no
                  left join trading_platform p on t.agency_cert_no = p.cert_no
                  left join sales_order s on t.sales_order_id = s.id
-                 left join purchase_contract pc on t.purchase_contract_no = pc.contract_no
+                 left join purchase_contract pc on (t.purchase_contract_no = pc.contract_no and pc.customer_user_id = t.customer_user_id)
         where t.id = #{id}
     </select>
 
     <select id="selectCustTaxNum" resultMap="VoInvoiceResultMap">
-        SELECT e.tax_no as tax_num, p.xt_user_id, p.xt_eid, t.customer_user_id, t.id, t.order_no, t.amount_total
+        SELECT e.tax_no as tax_num, e.cert_no, p.xt_user_id, p.xt_eid, t.customer_user_id, t.id, t.order_no, t.amount_total
         FROM purchase_order t
         left join enterprise e on t.customer_user_id = e.customer_id
         left join trading_platform p on t.agency_cert_no = p.cert_no
@@ -167,9 +168,11 @@
     </select>
 
     <select id="selectClientTaxNum" resultMap="VoInvoiceResultMap">
-        SELECT e.tax_no as tax_num, c.xt_uid as xt_user_id, e.xt_eid, t.customer_user_id, t.id, t.order_no, t.amount_total
+        SELECT v.vat_no as tax_num, v.cert_no, c.xt_uid as xt_user_id, e.xt_eid, t.customer_user_id, t.id, t.order_no, t.amount_total
         FROM purchase_order t
         left join enterprise e on t.customer_user_id = e.customer_id
+        left join purchase_contract pc on (t.purchase_contract_no = pc.contract_no and pc.customer_user_id = t.customer_user_id)
+        left join vendor_entity v on v.entity_no = pc.vendor_entity_no
         left join customer_user c on t.customer_user_id = c.id
         WHERE (t.agency_cert_no is null or t.agency_cert_no = '')
         AND t.deleted = 0