From 5627248e473253b3f10615d6be8b27bb7cc7c4f7 Mon Sep 17 00:00:00 2001
From: sen <sen@qq.com>
Date: 星期五, 10 四月 2026 14:49:48 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/yagwly_fa_master' into yagwly_fa_master

---
 tms/src/main/java/com/ruoyi/tms/service/ITmsDispatchOrderService.java         |    4 
 tms/src/main/java/com/ruoyi/tms/service/impl/TmsApBillServiceImpl.java        |   80 ++++++++++++
 tms/src/main/resources/mapper/tms/TmsArBillMapper.xml                         |   12 +
 tms/src/main/java/com/ruoyi/tms/controller/TmsApBillController.java           |   12 ++
 tms/src/main/java/com/ruoyi/tms/controller/TmsArBillController.java           |   12 ++
 tms/src/main/java/com/ruoyi/tms/service/impl/TmsReceivableFeeServiceImpl.java |   13 ++
 tms/src/main/java/com/ruoyi/tms/domain/TmsApBill.java                         |    6 
 tms/src/main/java/com/ruoyi/tms/service/impl/TmsPayableFeeServiceImpl.java    |   12 ++
 tms/src/main/java/com/ruoyi/tms/service/ITmsApBillService.java                |    8 +
 tms/src/main/java/com/ruoyi/tms/service/impl/TmsDispatchOrderServiceImpl.java |   67 ++++++-----
 tms/src/main/java/com/ruoyi/tms/controller/TmsDispatchOrderController.java    |    8 
 tms/src/main/java/com/ruoyi/tms/service/ITmsArBillService.java                |    8 +
 tms/src/main/java/com/ruoyi/tms/service/impl/TmsArBillServiceImpl.java        |   77 ++++++++++++
 tms/src/main/java/com/ruoyi/tms/domain/TmsArBill.java                         |    6 
 tms/src/main/resources/mapper/tms/TmsApBillMapper.xml                         |   12 +
 15 files changed, 286 insertions(+), 51 deletions(-)

diff --git a/tms/src/main/java/com/ruoyi/tms/controller/TmsApBillController.java b/tms/src/main/java/com/ruoyi/tms/controller/TmsApBillController.java
index c9ea6ac..d9b8d01 100644
--- a/tms/src/main/java/com/ruoyi/tms/controller/TmsApBillController.java
+++ b/tms/src/main/java/com/ruoyi/tms/controller/TmsApBillController.java
@@ -119,6 +119,18 @@
     }
 
     /**
+     * 鎵嬪姩鎺ㄩ�佸簲浠樿处鍗曚綔搴熷埌澶栭儴绯荤粺
+     */
+    @PreAuthorize("@ss.hasPermi('tms:tmsApBill:edit')")
+    @Log(title = "搴斾粯璐﹀崟", businessType = BusinessType.UPDATE)
+    @PostMapping("/cancelPush/{id}")
+    public AjaxResult cancelPush(@PathVariable("id") Integer id)
+    {
+        tmsApBillService.cancelPushToExternalSystem(id);
+        return AjaxResult.success("浣滃簾鎺ㄩ�佽姹傚凡鎻愪氦锛岃绋嶅悗鏌ョ湅鎺ㄩ�佺姸鎬�");
+    }
+
+    /**
      * 鎺ユ敹澶栭儴绯荤粺鎺ㄩ�佺姸鎬�
      */
     @PostMapping("/updatePushStatus")
diff --git a/tms/src/main/java/com/ruoyi/tms/controller/TmsArBillController.java b/tms/src/main/java/com/ruoyi/tms/controller/TmsArBillController.java
index 2dda6ca..4d37eab 100644
--- a/tms/src/main/java/com/ruoyi/tms/controller/TmsArBillController.java
+++ b/tms/src/main/java/com/ruoyi/tms/controller/TmsArBillController.java
@@ -142,6 +142,18 @@
     }
 
     /**
+     * 鎵嬪姩鎺ㄩ�佸簲鏀惰处鍗曚綔搴熷埌澶栭儴绯荤粺
+     */
+    @PreAuthorize("@ss.hasPermi('tms:tmsArBill:edit')")
+    @Log(title = "搴旀敹璐﹀崟", businessType = BusinessType.UPDATE)
+    @PostMapping("/cancelPush/{id}")
+    public AjaxResult cancelPush(@PathVariable("id") Integer id)
+    {
+        tmsArBillService.cancelPushToExternalSystem(id);
+        return AjaxResult.success("浣滃簾鎺ㄩ�佽姹傚凡鎻愪氦锛岃绋嶅悗鏌ョ湅鎺ㄩ�佺姸鎬�");
+    }
+
+    /**
      * 鎺ユ敹澶栭儴绯荤粺鎺ㄩ�佺姸鎬�
      */
     @PostMapping("/updatePushStatus")
diff --git a/tms/src/main/java/com/ruoyi/tms/controller/TmsDispatchOrderController.java b/tms/src/main/java/com/ruoyi/tms/controller/TmsDispatchOrderController.java
index 5e30f2d..c1e01bd 100644
--- a/tms/src/main/java/com/ruoyi/tms/controller/TmsDispatchOrderController.java
+++ b/tms/src/main/java/com/ruoyi/tms/controller/TmsDispatchOrderController.java
@@ -155,15 +155,15 @@
 
     @PreAuthorize("@ss.hasPermi('tms:tmsDispatchOrder:customsOrder')")
     @PostMapping(value = "/customsOrder")
-    public AjaxResult customsOrder(@RequestBody TmsDispatchOrder tmsDispatchOrder)
+    public AjaxResult customsOrder(@RequestBody List<TmsDispatchOrder> tmsDispatchOrders)
     {
-        return toAjax(tmsDispatchOrderService.customsOrder(tmsDispatchOrder));
+        return toAjax(tmsDispatchOrderService.customsOrder(tmsDispatchOrders));
     }
     @PreAuthorize("@ss.hasPermi('tms:tmsDispatchOrder:loadingOrder')")
     @PostMapping(value = "/loadingOrder")
-    public AjaxResult loadingOrder(@RequestBody TmsDispatchOrder tmsDispatchOrder)
+    public AjaxResult loadingOrder(@RequestBody List<TmsDispatchOrder> tmsDispatchOrders)
     {
-        return toAjax(tmsDispatchOrderService.loadingOrder(tmsDispatchOrder));
+        return toAjax(tmsDispatchOrderService.loadingOrder(tmsDispatchOrders));
     }
 
     /**
diff --git a/tms/src/main/java/com/ruoyi/tms/domain/TmsApBill.java b/tms/src/main/java/com/ruoyi/tms/domain/TmsApBill.java
index 359bdba..11248ed 100644
--- a/tms/src/main/java/com/ruoyi/tms/domain/TmsApBill.java
+++ b/tms/src/main/java/com/ruoyi/tms/domain/TmsApBill.java
@@ -148,7 +148,11 @@
     @TableField("push_time")
     private Date pushTime;
 
-
+    /**
+     * 鏉ユ簮绯荤粺id
+     */
+    @TableField("source_system_id")
+    private Integer sourceSystemId;
 
     /**
      *
diff --git a/tms/src/main/java/com/ruoyi/tms/domain/TmsArBill.java b/tms/src/main/java/com/ruoyi/tms/domain/TmsArBill.java
index 7dbccdd..76db9a3 100644
--- a/tms/src/main/java/com/ruoyi/tms/domain/TmsArBill.java
+++ b/tms/src/main/java/com/ruoyi/tms/domain/TmsArBill.java
@@ -160,7 +160,11 @@
     @TableField("push_time")
     private Date pushTime;
 
-
+    /**
+     * 鏉ユ簮绯荤粺id
+     */
+    @TableField("source_system_id")
+    private Integer sourceSystemId;
 
     @TableField(exist = false)
     private List<TmsReceivableFee> tmsReceivableFees;
diff --git a/tms/src/main/java/com/ruoyi/tms/service/ITmsApBillService.java b/tms/src/main/java/com/ruoyi/tms/service/ITmsApBillService.java
index 9d0851b..5ef1ccc 100644
--- a/tms/src/main/java/com/ruoyi/tms/service/ITmsApBillService.java
+++ b/tms/src/main/java/com/ruoyi/tms/service/ITmsApBillService.java
@@ -109,6 +109,14 @@
     public void manualPushToExternalSystem(Integer id);
     
     /**
+     * 鎵嬪姩鎺ㄩ�佸簲浠樿处鍗曚綔搴熷埌澶栭儴绯荤粺
+     * 
+     * @param id 搴斾粯璐﹀崟ID
+     * @return 缁撴灉
+     */
+    public void cancelPushToExternalSystem(Integer id);
+    
+    /**
      * 鏇存柊鎺ㄩ�佺姸鎬�
      *
      * @param id 搴斾粯璐﹀崟ID
diff --git a/tms/src/main/java/com/ruoyi/tms/service/ITmsArBillService.java b/tms/src/main/java/com/ruoyi/tms/service/ITmsArBillService.java
index 02f81ab..6c50989 100644
--- a/tms/src/main/java/com/ruoyi/tms/service/ITmsArBillService.java
+++ b/tms/src/main/java/com/ruoyi/tms/service/ITmsArBillService.java
@@ -120,6 +120,14 @@
     public void manualPushToExternalSystem(Integer id);
     
     /**
+     * 鎵嬪姩鎺ㄩ�佸簲鏀惰处鍗曚綔搴熷埌澶栭儴绯荤粺
+     * 
+     * @param id 搴旀敹璐﹀崟ID
+     * @return 缁撴灉
+     */
+    public void cancelPushToExternalSystem(Integer id);
+    
+    /**
      * 鏇存柊鎺ㄩ�佺姸鎬�
      *
      * @param id 搴旀敹璐﹀崟ID
diff --git a/tms/src/main/java/com/ruoyi/tms/service/ITmsDispatchOrderService.java b/tms/src/main/java/com/ruoyi/tms/service/ITmsDispatchOrderService.java
index ac700d0..ade2be5 100644
--- a/tms/src/main/java/com/ruoyi/tms/service/ITmsDispatchOrderService.java
+++ b/tms/src/main/java/com/ruoyi/tms/service/ITmsDispatchOrderService.java
@@ -32,8 +32,8 @@
     public AjaxResult close(Integer id);
     public AjaxResult connectHang(TmsDriverDispatch driverDispatch);
     public AjaxResult closeOrder(TmsDispatchOrder order);
-    public int customsOrder(TmsDispatchOrder tmsDispatchOrder);
-    public int loadingOrder(TmsDispatchOrder tmsDispatchOrder);
+    public int customsOrder(List<TmsDispatchOrder> tmsDispatchOrders);
+    public int loadingOrder(List<TmsDispatchOrder> tmsDispatchOrders);
 
 
     /**
diff --git a/tms/src/main/java/com/ruoyi/tms/service/impl/TmsApBillServiceImpl.java b/tms/src/main/java/com/ruoyi/tms/service/impl/TmsApBillServiceImpl.java
index a78df45..5854e4e 100644
--- a/tms/src/main/java/com/ruoyi/tms/service/impl/TmsApBillServiceImpl.java
+++ b/tms/src/main/java/com/ruoyi/tms/service/impl/TmsApBillServiceImpl.java
@@ -2,6 +2,7 @@
 
 import java.util.List;
 
+import com.alibaba.fastjson2.JSONObject;
 import com.ruoyi.common.utils.DateUtils;
 import javax.annotation.Resource;
 
@@ -253,6 +254,69 @@
         executor.execute(() -> pushPayableToExternalSystem(tmsApBill, tmsPayableFeeList));
     }
 
+    @Override
+    public void cancelPushToExternalSystem(Integer id) {
+        TmsApBill tmsApBill = tmsApBillMapper.selectTmsApBillById(id);
+        if (tmsApBill == null) {
+            throw new RuntimeException("搴斾粯璐﹀崟涓嶅瓨鍦�");
+        }
+
+        // 寮傛鎺ㄩ�佷綔搴熻姹�
+        AsyncTaskExecutor executor = new SimpleAsyncTaskExecutor();
+        executor.execute(() -> pushCancelToExternalSystem(tmsApBill));
+    }
+
+    /**
+     * 鍚戝閮ㄧ郴缁熸帹閫佸簲浠樻暟鎹綔搴�
+     * @param tmsApBill 搴斾粯璐﹀崟
+     */
+    @Async
+    protected void pushCancelToExternalSystem(TmsApBill tmsApBill) {
+        java.util.Map<String, Object> requestBody = new java.util.HashMap<>();
+        try {
+          
+
+            // 鏋勫缓璇锋眰浣�
+            String apiUrl = url+"/cancelPayableBill";
+
+            // 鏋勫缓璇锋眰浣擄紝鍙渶瑕乻ourceSystemId
+            requestBody.put("sourceSystemId", tmsApBill.getSourceSystemId());
+
+            // 璁剧疆HTTP澶�
+            HttpHeaders headers = new HttpHeaders();
+            headers.setContentType(MediaType.APPLICATION_JSON);
+            HttpEntity<String> entity = new HttpEntity<>(JSON.toJSONString(requestBody), headers);
+
+            // 鍙戦�丄PI璇锋眰
+            ResponseEntity<String> response = restTemplate.exchange(apiUrl, HttpMethod.POST, entity, String.class);
+            logger.info("鎺ㄩ�佸簲浠樻暟鎹綔搴熷埌澶栭儴绯荤粺鎴愬姛锛屽搷搴�: {}", response.getBody());
+
+            // 鏇存柊鎺ㄩ�佺姸鎬佷负鎴愬姛
+            tmsApBill.setPushStatus(2);
+            tmsApBill.setStatus(3); // 璁剧疆璐﹀崟鐘舵�佷负浣滃簾
+            tmsApBill.setPushTime(DateUtils.getNowDate());
+            tmsApBillMapper.updateTmsApBill(tmsApBill);
+
+            // 閲嶇疆鍏宠仈鐨勫簲浠樿垂鐢ㄧ姸鎬佷负寰呯‘璁�
+            tmsPayableFeeMapper.update(new com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper<TmsPayableFee>()
+                    .set(TmsPayableFee::getStatus, 0)
+                    .set(TmsPayableFee::getBillPayableId, null)
+                    .set(TmsPayableFee::getBillPayableNo, null)
+                    .eq(TmsPayableFee::getBillPayableId, tmsApBill.getId())
+            );
+            logger.info("閲嶇疆搴斾粯璐圭敤鐘舵�佹垚鍔燂紝璐﹀崟ID: {}", tmsApBill.getId());
+        } catch (Exception e) {
+            logger.error("鎺ㄩ�佸簲浠樻暟鎹綔搴熷埌澶栭儴绯荤粺澶辫触锛岃处鍗旾D: {}, 渚涘簲鍟�: {}", 
+                tmsApBill.getId(), tmsApBill.getServiceProviderName(), e);
+            logger.debug("鎺ㄩ�佸け璐ョ殑璇锋眰鏁版嵁: {}", JSON.toJSONString(requestBody));
+
+            // 鏇存柊鎺ㄩ�佺姸鎬佷负澶辫触
+            tmsApBill.setPushStatus(3);
+            tmsApBill.setPushTime(DateUtils.getNowDate());
+            tmsApBillMapper.updateTmsApBill(tmsApBill);
+        }
+    }
+
     /**
      * 鏇存柊鎺ㄩ�佺姸鎬�
      *
@@ -288,10 +352,7 @@
     protected void pushPayableToExternalSystem(TmsApBill tmsApBill, List<TmsPayableFee> tmsPayableFeeList) {
         java.util.Map<String, Object> requestBody = new java.util.HashMap<>();
         try {
-            // 鏇存柊鎺ㄩ�佺姸鎬佷负鎺ㄩ�佷腑
-            tmsApBill.setPushStatus(1);
-            tmsApBill.setPushTime(DateUtils.getNowDate());
-            tmsApBillMapper.updateTmsApBill(tmsApBill);
+
 
             // 鏋勫缓璇锋眰浣�
             String apiUrl = url+"/addPayableBill";
@@ -391,6 +452,17 @@
             ResponseEntity<String> response = restTemplate.exchange(apiUrl, HttpMethod.POST, entity, String.class);
             logger.info("鎺ㄩ�佸簲浠樻暟鎹埌澶栭儴绯荤粺鎴愬姛锛屽搷搴�: {}", response.getBody());
 
+            // 瑙f瀽鍝嶅簲锛岃幏鍙杝ourceSystemId
+            try {
+                JSONObject result = JSONObject.parseObject(response.getBody());
+                String sourceSystemId = result.getString("sourceSystemId");
+                if (sourceSystemId != null) {
+                    tmsApBill.setSourceSystemId(Integer.parseInt(sourceSystemId));
+                }
+            } catch (Exception e) {
+                logger.error("瑙f瀽澶栭儴绯荤粺鍝嶅簲澶辫触: {}", e.getMessage());
+            }
+
             // 鏇存柊鎺ㄩ�佺姸鎬佷负鎴愬姛
             tmsApBill.setPushStatus(2);
             tmsApBill.setPushTime(DateUtils.getNowDate());
diff --git a/tms/src/main/java/com/ruoyi/tms/service/impl/TmsArBillServiceImpl.java b/tms/src/main/java/com/ruoyi/tms/service/impl/TmsArBillServiceImpl.java
index ef9b24c..f75c835 100644
--- a/tms/src/main/java/com/ruoyi/tms/service/impl/TmsArBillServiceImpl.java
+++ b/tms/src/main/java/com/ruoyi/tms/service/impl/TmsArBillServiceImpl.java
@@ -1,7 +1,5 @@
 package com.ruoyi.tms.service.impl;
 
-import java.util.List;
-
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.redis.RedisCache;
@@ -47,6 +45,7 @@
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.client.RestTemplate;
 import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
 
 /**
  * 搴旀敹璐﹀崟Service涓氬姟灞傚鐞�
@@ -291,6 +290,69 @@
         executor.execute(() -> pushToExternalSystem(tmsArBill, tmsReceivableFees));
     }
 
+    @Override
+    public void cancelPushToExternalSystem(Integer id) {
+        TmsArBill tmsArBill = tmsArBillMapper.selectTmsArBillById(id);
+        if (tmsArBill == null) {
+            throw new RuntimeException("搴旀敹璐﹀崟涓嶅瓨鍦�");
+        }
+
+        // 寮傛鎺ㄩ�佷綔搴熻姹�
+        AsyncTaskExecutor executor = new SimpleAsyncTaskExecutor();
+        executor.execute(() -> pushCancelToExternalSystem(tmsArBill));
+    }
+
+    /**
+     * 鍚戝閮ㄧ郴缁熸帹閫佸簲鏀舵暟鎹綔搴�
+     * @param tmsArBill 搴旀敹璐﹀崟
+     */
+    @Async
+    protected void pushCancelToExternalSystem(TmsArBill tmsArBill) {
+        java.util.Map<String, Object> requestBody = new java.util.HashMap<>();
+        try {
+    ;
+
+            // 鏋勫缓璇锋眰浣�
+            String apiUrl = url+"/cancelBill";
+
+            // 鏋勫缓璇锋眰浣擄紝鍙渶瑕乻ourceSystemId
+            requestBody.put("sourceSystemId", tmsArBill.getSourceSystemId());
+
+            // 璁剧疆HTTP澶�
+            HttpHeaders headers = new HttpHeaders();
+            headers.setContentType(MediaType.APPLICATION_JSON);
+            HttpEntity<String> entity = new HttpEntity<>(JSON.toJSONString(requestBody), headers);
+
+            // 鍙戦�丄PI璇锋眰
+            ResponseEntity<String> response = restTemplate.exchange(apiUrl, HttpMethod.POST, entity, String.class);
+            logger.info("鎺ㄩ�佸簲鏀舵暟鎹綔搴熷埌澶栭儴绯荤粺鎴愬姛锛屽搷搴�: {}", response.getBody());
+
+            // 鏇存柊鎺ㄩ�佺姸鎬佷负鎴愬姛
+        
+            tmsArBill.setStatus(3); // 璁剧疆璐﹀崟鐘舵�佷负浣滃簾
+    
+            tmsArBillMapper.updateTmsArBill(tmsArBill);
+
+            // 閲嶇疆鍏宠仈鐨勫簲鏀惰垂鐢ㄧ姸鎬佷负寰呯‘璁�
+            tmsReceivableFeeMapper.update(new com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper<TmsReceivableFee>()
+                    .set(TmsReceivableFee::getStatus, 0)
+                    .set(TmsReceivableFee::getBillRelationId, null)
+                    .set(TmsReceivableFee::getBillRelationNo, null)
+                    .eq(TmsReceivableFee::getBillRelationId, tmsArBill.getId())
+            );
+            logger.info("閲嶇疆搴旀敹璐圭敤鐘舵�佹垚鍔燂紝璐﹀崟ID: {}", tmsArBill.getId());
+        } catch (Exception e) {
+            logger.error("鎺ㄩ�佸簲鏀舵暟鎹綔搴熷埌澶栭儴绯荤粺澶辫触锛岃处鍗旾D: {}, 瀹㈡埛: {}", 
+                tmsArBill.getId(), tmsArBill.getCustomerName(), e);
+            logger.debug("鎺ㄩ�佸け璐ョ殑璇锋眰鏁版嵁: {}", JSON.toJSONString(requestBody));
+
+            // 鏇存柊鎺ㄩ�佺姸鎬佷负澶辫触
+            tmsArBill.setPushStatus(3);
+            tmsArBill.setPushTime(DateUtils.getNowDate());
+            tmsArBillMapper.updateTmsArBill(tmsArBill);
+        }
+    }
+
     /**
      * 鏇存柊鎺ㄩ�佺姸鎬�
      *
@@ -430,6 +492,17 @@
             ResponseEntity<String> response = restTemplate.exchange(apiUrl, HttpMethod.POST, entity, String.class);
             logger.info("鎺ㄩ�佹暟鎹埌澶栭儴绯荤粺鎴愬姛锛屽搷搴�: {}", response.getBody());
 
+    
+            // 瑙f瀽鍝嶅簲锛岃幏鍙杝ourceSystemId
+            try {
+                JSONObject result = JSONObject.parseObject(response.getBody());
+                String sourceSystemId = result.getString("sourceSystemId");
+                if (sourceSystemId != null) {
+                    tmsArBill.setSourceSystemId(Integer.parseInt(sourceSystemId));
+                }
+            } catch (Exception e) {
+                logger.error("瑙f瀽澶栭儴绯荤粺鍝嶅簲澶辫触: {}", e.getMessage());
+            }
             // 鏇存柊鎺ㄩ�佺姸鎬佷负鎴愬姛
             tmsArBill.setPushStatus(2);
             tmsArBill.setPushTime(DateUtils.getNowDate());
diff --git a/tms/src/main/java/com/ruoyi/tms/service/impl/TmsDispatchOrderServiceImpl.java b/tms/src/main/java/com/ruoyi/tms/service/impl/TmsDispatchOrderServiceImpl.java
index 7ec417b..4770312 100644
--- a/tms/src/main/java/com/ruoyi/tms/service/impl/TmsDispatchOrderServiceImpl.java
+++ b/tms/src/main/java/com/ruoyi/tms/service/impl/TmsDispatchOrderServiceImpl.java
@@ -300,47 +300,52 @@
 
     //濉啓濮旀墭鎶ュ叧淇℃伅
     @Override
-    public int customsOrder(TmsDispatchOrder tmsDispatchOrder) {
-        int result = tmsDispatchOrderMapper.update(new LambdaUpdateWrapper<TmsDispatchOrder>()
-                .eq(TmsDispatchOrder::getId, tmsDispatchOrder.getId())
-                .set(TmsDispatchOrder::getCustomsServiceProviderId, tmsDispatchOrder.getCustomsServiceProviderId())
-                .set(TmsDispatchOrder::getCustomsServiceProviderName, tmsDispatchOrder.getCustomsServiceProviderName())
-        );
+    public int customsOrder(List<TmsDispatchOrder> tmsDispatchOrders) {
+        int totalResult = 0;
+        for (TmsDispatchOrder tmsDispatchOrder : tmsDispatchOrders) {
+            int result = tmsDispatchOrderMapper.update(new LambdaUpdateWrapper<TmsDispatchOrder>()
+                    .eq(TmsDispatchOrder::getId, tmsDispatchOrder.getId())
+                    .set(TmsDispatchOrder::getCustomsServiceProviderId, tmsDispatchOrder.getCustomsServiceProviderId())
+                    .set(TmsDispatchOrder::getCustomsServiceProviderName, tmsDispatchOrder.getCustomsServiceProviderName())
+            );
+            totalResult += result;
 
-        if (result > 0) {
-            TmsDispatchOrderLog log = new TmsDispatchOrderLog();
-            log.setHeadId(tmsDispatchOrder.getId());
-            log.setCreateBy(SecurityUtils.getUsername());
-            log.setCreateTime(DateUtils.getNowDate());
-            log.setNode("濉啓濮旀墭鎶ュ叧淇℃伅");
+            if (result > 0) {
+                TmsDispatchOrderLog log = new TmsDispatchOrderLog();
+                log.setHeadId(tmsDispatchOrder.getId());
+                log.setCreateBy(SecurityUtils.getUsername());
+                log.setCreateTime(DateUtils.getNowDate());
+                log.setNode("濉啓濮旀墭鎶ュ叧淇℃伅");
 
-            tmsDispatchOrderLogService.insertTmsDispatchOrderLog(log);
+                tmsDispatchOrderLogService.insertTmsDispatchOrderLog(log);
+            }
         }
-
-        return result;
+        return totalResult;
     }
 
     //濉啓濮旀墭瑁呭嵏淇℃伅
     @Override
-    public int loadingOrder(TmsDispatchOrder tmsDispatchOrder) {
-        int result = tmsDispatchOrderMapper.update(new LambdaUpdateWrapper<TmsDispatchOrder>()
-                .eq(TmsDispatchOrder::getId, tmsDispatchOrder.getId())
-                .set(TmsDispatchOrder::getLoadingServiceProviderId, tmsDispatchOrder.getLoadingServiceProviderId())
-                .set(TmsDispatchOrder::getLoadingServiceProviderName, tmsDispatchOrder.getLoadingServiceProviderName())
-        );
+    public int loadingOrder(List<TmsDispatchOrder> tmsDispatchOrders) {
+        int totalResult = 0;
+        for (TmsDispatchOrder tmsDispatchOrder : tmsDispatchOrders) {
+            int result = tmsDispatchOrderMapper.update(new LambdaUpdateWrapper<TmsDispatchOrder>()
+                    .eq(TmsDispatchOrder::getId, tmsDispatchOrder.getId())
+                    .set(TmsDispatchOrder::getLoadingServiceProviderId, tmsDispatchOrder.getLoadingServiceProviderId())
+                    .set(TmsDispatchOrder::getLoadingServiceProviderName, tmsDispatchOrder.getLoadingServiceProviderName())
+            );
+            totalResult += result;
 
-        if (result > 0) {
-            TmsDispatchOrderLog log = new TmsDispatchOrderLog();
-            log.setHeadId(tmsDispatchOrder.getId());
-            log.setCreateBy(SecurityUtils.getUsername());
-            log.setCreateTime(DateUtils.getNowDate());
-            log.setNode("濉啓濮旀墭瑁呭嵏淇℃伅");
+            if (result > 0) {
+                TmsDispatchOrderLog log = new TmsDispatchOrderLog();
+                log.setHeadId(tmsDispatchOrder.getId());
+                log.setCreateBy(SecurityUtils.getUsername());
+                log.setCreateTime(DateUtils.getNowDate());
+                log.setNode("濉啓濮旀墭瑁呭嵏淇℃伅");
 
-
-            tmsDispatchOrderLogService.insertTmsDispatchOrderLog(log);
+                tmsDispatchOrderLogService.insertTmsDispatchOrderLog(log);
+            }
         }
-
-        return result;
+        return totalResult;
     }
 
     @Override
diff --git a/tms/src/main/java/com/ruoyi/tms/service/impl/TmsPayableFeeServiceImpl.java b/tms/src/main/java/com/ruoyi/tms/service/impl/TmsPayableFeeServiceImpl.java
index 6c6f7cc..f1982db 100644
--- a/tms/src/main/java/com/ruoyi/tms/service/impl/TmsPayableFeeServiceImpl.java
+++ b/tms/src/main/java/com/ruoyi/tms/service/impl/TmsPayableFeeServiceImpl.java
@@ -34,6 +34,7 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
 import com.ruoyi.common.utils.PageUtils;
 import com.ruoyi.common.constant.Constants;
 import com.ruoyi.common.annotation.DataSource;
@@ -444,6 +445,17 @@
             ResponseEntity<String> response = restTemplate.exchange(apiUrl, HttpMethod.POST, entity, String.class);
             logger.info("鎺ㄩ�佸簲浠樻暟鎹埌澶栭儴绯荤粺鎴愬姛锛屽搷搴�: {}", response.getBody());
             
+     
+            // 瑙f瀽鍝嶅簲锛岃幏鍙杝ourceSystemId
+            try {
+                JSONObject result = JSONObject.parseObject(response.getBody());
+                String sourceSystemId = result.getString("sourceSystemId");
+                if (sourceSystemId != null) {
+                    tmsApBill.setSourceSystemId(Integer.parseInt(sourceSystemId));
+                }
+            } catch (Exception e) {
+                logger.error("瑙f瀽澶栭儴绯荤粺鍝嶅簲澶辫触: {}", e.getMessage());
+            }
             // 鏇存柊鎺ㄩ�佺姸鎬佷负鎴愬姛
             tmsApBill.setPushStatus(2);
             tmsApBill.setPushTime(DateUtils.getNowDate());
diff --git a/tms/src/main/java/com/ruoyi/tms/service/impl/TmsReceivableFeeServiceImpl.java b/tms/src/main/java/com/ruoyi/tms/service/impl/TmsReceivableFeeServiceImpl.java
index 922e5f8..0eaae24 100644
--- a/tms/src/main/java/com/ruoyi/tms/service/impl/TmsReceivableFeeServiceImpl.java
+++ b/tms/src/main/java/com/ruoyi/tms/service/impl/TmsReceivableFeeServiceImpl.java
@@ -13,6 +13,7 @@
 import java.util.Set;
 import java.util.stream.Collectors;
 
+import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.redis.RedisCache;
@@ -483,6 +484,18 @@
             ResponseEntity<String> response = restTemplate.exchange(apiUrl, HttpMethod.POST, entity, String.class);
             logger.info("鎺ㄩ�佹暟鎹埌澶栭儴绯荤粺鎴愬姛锛屽搷搴�: {}", response.getBody());
             
+            // 瑙f瀽鍝嶅簲锛岃幏鍙杝ourceSystemId
+            try {
+                JSONObject result = JSONObject.parseObject(response.getBody());
+                String sourceSystemId = result.getString("sourceSystemId");
+                if (sourceSystemId != null) {
+                    tmsArBill.setSourceSystemId(Integer.parseInt(sourceSystemId));
+                }
+            } catch (Exception e) {
+                logger.error("瑙f瀽澶栭儴绯荤粺鍝嶅簲澶辫触: {}", e.getMessage());
+            }
+
+            
             // 鏇存柊鎺ㄩ�佺姸鎬佷负鎴愬姛
             tmsArBill.setPushStatus(2);
             tmsArBill.setPushTime(DateUtils.getNowDate());
diff --git a/tms/src/main/resources/mapper/tms/TmsApBillMapper.xml b/tms/src/main/resources/mapper/tms/TmsApBillMapper.xml
index 2280199..d843312 100644
--- a/tms/src/main/resources/mapper/tms/TmsApBillMapper.xml
+++ b/tms/src/main/resources/mapper/tms/TmsApBillMapper.xml
@@ -25,10 +25,11 @@
         <result property="serviceProviderType"    column="service_provider_type"    />
         <result property="pushStatus"    column="push_status"    />
         <result property="pushTime"    column="push_time"    />
+        <result property="sourceSystemId"    column="source_system_id"    />
     </resultMap>
 
     <sql id="selectTmsApBillVo">
-        select thisTab.id, thisTab.system_no, thisTab.bill_name, thisTab.settle_amount, thisTab.settle_rate, thisTab.dispatch_count, thisTab.settled_amount, thisTab.invoice_status, thisTab.status, thisTab.create_by, thisTab.create_time, thisTab.update_by, thisTab.update_time,  thisTab.deduction_amount, thisTab.actual_settlement_amount, thisTab.service_provider_id, thisTab.service_provider_name, thisTab.service_provider_type, thisTab.push_status, thisTab.push_time from tms_ap_bill AS thisTab
+        select thisTab.id, thisTab.system_no, thisTab.bill_name, thisTab.settle_amount, thisTab.settle_rate, thisTab.dispatch_count, thisTab.settled_amount, thisTab.invoice_status, thisTab.status, thisTab.create_by, thisTab.create_time, thisTab.update_by, thisTab.update_time,  thisTab.deduction_amount, thisTab.actual_settlement_amount, thisTab.service_provider_id, thisTab.service_provider_name, thisTab.service_provider_type, thisTab.push_status, thisTab.push_time, thisTab.source_system_id from tms_ap_bill AS thisTab
     </sql>
     <sql id="selectTmsApBillVoCount">
         select count(0) from tms_ap_bill as thisTab
@@ -49,6 +50,7 @@
         <if test="deductionAmount != null "> and thisTab.deduction_amount = #{deductionAmount}</if>
         <if test="actualSettlementAmount != null "> and thisTab.actual_settlement_amount = #{actualSettlementAmount}</if>
         <if test="pushStatus != null "> and thisTab.push_status = #{pushStatus}</if>
+        <if test="sourceSystemId != null "> and thisTab.source_system_id = #{sourceSystemId}</if>
     </sql>
 
     <!--鏌ヨ-->
@@ -95,6 +97,7 @@
             <if test="serviceProviderType != null and serviceProviderType != ''">service_provider_type,</if>
             <if test="pushStatus != null">push_status,</if>
             <if test="pushTime != null">push_time,</if>
+            <if test="sourceSystemId != null">source_system_id,</if>
 
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -117,6 +120,7 @@
             <if test="serviceProviderType != null and serviceProviderType != ''">#{serviceProviderType},</if>
             <if test="pushStatus != null">#{pushStatus},</if>
             <if test="pushTime != null">#{pushTime},</if>
+            <if test="sourceSystemId != null">#{sourceSystemId},</if>
 
         </trim>
     </insert>
@@ -124,11 +128,11 @@
     <insert id="insertTmsApBillBatch" parameterType="java.util.List"  useGeneratedKeys="true" keyProperty="id">
         insert into tms_ap_bill
         <trim prefix="(" suffix=") values" suffixOverrides=",">
-            system_no,bill_name,settle_amount,settle_rate,dispatch_count,settled_amount,invoice_status,status,create_by,create_time,update_by,update_time,deduction_amount,actual_settlement_amount,push_status,push_time,
+            system_no,bill_name,settle_amount,settle_rate,dispatch_count,settled_amount,invoice_status,status,create_by,create_time,update_by,update_time,deduction_amount,actual_settlement_amount,push_status,push_time,source_system_id,
         </trim>
         <foreach item="item" index="index" collection="list" separator=",">
             <trim prefix="(" suffix=") " suffixOverrides=",">
-                #{item.systemNo},#{item.billName},#{item.settleAmount},#{item.settleRate},#{item.dispatchCount},#{item.settledAmount},#{item.invoiceStatus},#{item.status},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.deductionAmount},#{item.actualSettlementAmount},#{item.pushStatus},#{item.pushTime},
+                #{item.systemNo},#{item.billName},#{item.settleAmount},#{item.settleRate},#{item.dispatchCount},#{item.settledAmount},#{item.invoiceStatus},#{item.status},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.deductionAmount},#{item.actualSettlementAmount},#{item.pushStatus},#{item.pushTime},#{item.sourceSystemId},
             </trim>
         </foreach>
     </insert>
@@ -156,6 +160,7 @@
             <if test="serviceProviderType != null and serviceProviderType != ''">service_provider_type = #{serviceProviderType},</if>
             <if test="pushStatus != null">push_status = #{pushStatus},</if>
             <if test="pushTime != null">push_time = #{pushTime},</if>
+            <if test="sourceSystemId != null">source_system_id = #{sourceSystemId},</if>
 
         </trim>
         where id = #{id}
@@ -184,6 +189,7 @@
                 <if test="item.serviceProviderType != null and item.serviceProviderType != ''">service_provider_type = #{item.serviceProviderType},</if>
                 <if test="item.pushStatus != null">push_status = #{item.pushStatus},</if>
                 <if test="item.pushTime != null">push_time = #{item.pushTime},</if>
+                <if test="item.sourceSystemId != null">source_system_id = #{item.sourceSystemId},</if>
 
             </trim>
         where id = #{item.id}
diff --git a/tms/src/main/resources/mapper/tms/TmsArBillMapper.xml b/tms/src/main/resources/mapper/tms/TmsArBillMapper.xml
index 89e45fc..0268376 100644
--- a/tms/src/main/resources/mapper/tms/TmsArBillMapper.xml
+++ b/tms/src/main/resources/mapper/tms/TmsArBillMapper.xml
@@ -24,10 +24,11 @@
         <result property="actualSettlementAmount"    column="actual_settlement_amount"    />
         <result property="pushStatus"    column="push_status"    />
         <result property="pushTime"    column="push_time"    />
+        <result property="sourceSystemId"    column="source_system_id"    />
     </resultMap>
 
     <sql id="selectTmsArBillVo">
-        select thisTab.id, thisTab.system_no, thisTab.bill_name, thisTab.customer_id, thisTab.customer_name, thisTab.settle_amount, thisTab.settle_rate, thisTab.dispatch_count, thisTab.settled_amount, thisTab.invoice_status, thisTab.status, thisTab.create_by, thisTab.create_time, thisTab.update_by, thisTab.update_time, thisTab.deduction_amount, thisTab.actual_settlement_amount, thisTab.push_status, thisTab.push_time from tms_ar_bill AS thisTab
+        select thisTab.id, thisTab.system_no, thisTab.bill_name, thisTab.customer_id, thisTab.customer_name, thisTab.settle_amount, thisTab.settle_rate, thisTab.dispatch_count, thisTab.settled_amount, thisTab.invoice_status, thisTab.status, thisTab.create_by, thisTab.create_time, thisTab.update_by, thisTab.update_time, thisTab.deduction_amount, thisTab.actual_settlement_amount, thisTab.push_status, thisTab.push_time, thisTab.source_system_id from tms_ar_bill AS thisTab
     </sql>
     <sql id="selectTmsArBillVoCount">
         select count(0) from tms_ar_bill as thisTab
@@ -47,6 +48,7 @@
         <if test="deductionAmount != null "> and thisTab.deduction_amount = #{deductionAmount}</if>
         <if test="actualSettlementAmount != null "> and thisTab.actual_settlement_amount = #{actualSettlementAmount}</if>
         <if test="pushStatus != null "> and thisTab.push_status = #{pushStatus}</if>
+        <if test="sourceSystemId != null "> and thisTab.source_system_id = #{sourceSystemId}</if>
     </sql>
 
     <!--鏌ヨ-->
@@ -92,6 +94,7 @@
             <if test="actualSettlementAmount != null">actual_settlement_amount,</if>
             <if test="pushStatus != null">push_status,</if>
             <if test="pushTime != null">push_time,</if>
+            <if test="sourceSystemId != null">source_system_id,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="systemNo != null and systemNo != ''">#{systemNo},</if>
@@ -112,17 +115,18 @@
             <if test="actualSettlementAmount != null">#{actualSettlementAmount},</if>
             <if test="pushStatus != null">#{pushStatus},</if>
             <if test="pushTime != null">#{pushTime},</if>
+            <if test="sourceSystemId != null">#{sourceSystemId},</if>
          </trim>
     </insert>
 
     <insert id="insertTmsArBillBatch" parameterType="java.util.List"  useGeneratedKeys="true" keyProperty="id">
         insert into tms_ar_bill
         <trim prefix="(" suffix=") values" suffixOverrides=",">
-            id,system_no,bill_name,customer_name,settle_amount,settle_rate,dispatch_count,settled_amount,invoice_status,status,create_by,create_time,update_by,update_time,customer_id,deduction_amount,actual_settlement_amount,push_status,push_time,
+            id,system_no,bill_name,customer_name,settle_amount,settle_rate,dispatch_count,settled_amount,invoice_status,status,create_by,create_time,update_by,update_time,customer_id,deduction_amount,actual_settlement_amount,push_status,push_time,source_system_id,
         </trim>
         <foreach item="item" index="index" collection="list" separator=",">
             <trim prefix="(" suffix=") " suffixOverrides=",">
-                #{item.id},#{item.systemNo},#{item.billName},#{item.customerName},#{item.settleAmount},#{item.settleRate},#{item.dispatchCount},#{item.settledAmount},#{item.invoiceStatus},#{item.status},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.customerId},#{item.deductionAmount},#{item.actualSettlementAmount},#{item.pushStatus},#{item.pushTime},
+                #{item.id},#{item.systemNo},#{item.billName},#{item.customerName},#{item.settleAmount},#{item.settleRate},#{item.dispatchCount},#{item.settledAmount},#{item.invoiceStatus},#{item.status},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.customerId},#{item.deductionAmount},#{item.actualSettlementAmount},#{item.pushStatus},#{item.pushTime},#{item.sourceSystemId},
             </trim>
         </foreach>
     </insert>
@@ -149,6 +153,7 @@
             <if test="actualSettlementAmount != null">actual_settlement_amount = #{actualSettlementAmount},</if>
             <if test="pushStatus != null">push_status = #{pushStatus},</if>
             <if test="pushTime != null">push_time = #{pushTime},</if>
+            <if test="sourceSystemId != null">source_system_id = #{sourceSystemId},</if>
         </trim>
         where id = #{id}
     </update>
@@ -175,6 +180,7 @@
                 <if test="item.actualSettlementAmount != null">actual_settlement_amount = #{item.actualSettlementAmount},</if>
                 <if test="item.pushStatus != null">push_status = #{item.pushStatus},</if>
                 <if test="item.pushTime != null">push_time = #{item.pushTime},</if>
+                <if test="item.sourceSystemId != null">source_system_id = #{item.sourceSystemId},</if>
             </trim>
         where id = #{item.id}
         </foreach>

--
Gitblit v1.8.0