From c0f6fb84a98db212b0780f44430d4e0cdf1b0302 Mon Sep 17 00:00:00 2001
From: wujianwei <wjw@11.com>
Date: 星期三, 10 九月 2025 15:20:57 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/yagwly_fa_master' into yagwly_fa_master

---
 quartz/src/main/java/com/ruoyi/quartz/task/SettlementTask.java |   45 ++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/quartz/src/main/java/com/ruoyi/quartz/task/SettlementTask.java b/quartz/src/main/java/com/ruoyi/quartz/task/SettlementTask.java
index 3b95939..2c8ae47 100644
--- a/quartz/src/main/java/com/ruoyi/quartz/task/SettlementTask.java
+++ b/quartz/src/main/java/com/ruoyi/quartz/task/SettlementTask.java
@@ -3,12 +3,17 @@
 import cn.hutool.core.collection.CollectionUtil;
 import com.ruoyi.common.utils.RandomUtils;
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.reflect.ReflectUtils;
 import com.ruoyi.cwgl.domain.EstimatedReceivable;
 import com.ruoyi.cwgl.domain.PendingSettlementBusiness;
 import com.ruoyi.cwgl.domain.ReceivableLineTruckPriceRule;
+import com.ruoyi.cwgl.mapper.SmartLockerApplicationMapper;
 import com.ruoyi.cwgl.service.IEstimatedReceivableService;
 import com.ruoyi.cwgl.service.IPendingSettlementBusinessService;
+import com.ruoyi.cwgl.service.ISmartLockerApplicationService;
 import com.ruoyi.cwgl.service.impl.ExactPricingRuleMatcher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -26,11 +31,13 @@
 @Component("settlementTask")
 public class SettlementTask
 {
-
+    private static Logger logger = LoggerFactory.getLogger(SettlementTask.class);
     @Autowired
     private IPendingSettlementBusinessService pendingSettlementBusinessService;
     @Autowired
     private IEstimatedReceivableService estimatedReceivableService;
+    @Autowired
+    private ISmartLockerApplicationService smartLockerApplicationService;
 
     public void insertPendingSettlement()
     {
@@ -48,8 +55,14 @@
 
         List<EstimatedReceivable> estimatedReceivables = new ArrayList<>();
         for (PendingSettlementBusiness pendingSettlementBusiness : pendingSettlementBusinesses) {
+            pendingSettlementBusiness.setIsCreate(0);
+            pendingSettlementBusiness.setEstimatedTotalCost(BigDecimal.ZERO);
+
+            pendingSettlementBusiness.setEstimatedTotalIncome(BigDecimal.ZERO);
             ReceivableLineTruckPriceRule exactMatchingRule = ExactPricingRuleMatcher.findExactMatchingRule(receivableLineTruckPriceRules, pendingSettlementBusiness.getCustomerName(), pendingSettlementBusiness.getDepartureLocation(), pendingSettlementBusiness.getArrivalLocation(), pendingSettlementBusiness.getVehicleType());
             if (exactMatchingRule!=null) {
+                //搴旀敹鏁版嵁
+                pendingSettlementBusiness.setIsIncomeMatched(1);
                 pendingSettlementBusiness.setEstimatedTotalIncome(exactMatchingRule.getFreight());
                 pendingSettlementBusiness.setCreateTime(date);
                 EstimatedReceivable estimatedReceivable = new EstimatedReceivable();
@@ -62,20 +75,46 @@
                 estimatedReceivable.setEstimatedAmount(exactMatchingRule.getFreight());
                 estimatedReceivable.setCurrency("浜烘皯甯�");
                 estimatedReceivable.setIsConfirmed(1);
-
+                estimatedReceivable.setFeeType(0);
+                estimatedReceivable.setRelatedBillStatus(0);
                 estimatedReceivables.add(estimatedReceivable);
             }
             ReceivableLineTruckPriceRule exactMatchingRule2 = ExactPricingRuleMatcher.findExactMatchingRule(payableLineTruckPriceRules, pendingSettlementBusiness.getCarrierName(), pendingSettlementBusiness.getDepartureLocation(), pendingSettlementBusiness.getArrivalLocation(), pendingSettlementBusiness.getVehicleType());
             if (exactMatchingRule2!=null) {
+                pendingSettlementBusiness.setIsCostMatched(1);
                 pendingSettlementBusiness.setEstimatedTotalCost(exactMatchingRule2.getFreight());
+                pendingSettlementBusiness.setCreateTime(date);
+
+                EstimatedReceivable estimatedReceivable = new EstimatedReceivable();
+                estimatedReceivable.setFeeSystemNo("YF"+datePart+RandomUtils.random(5));
+                estimatedReceivable.setDispatchNo(pendingSettlementBusiness.getDispatchNo());
+                estimatedReceivable.setCustomerName(pendingSettlementBusiness.getCustomerName());
+                estimatedReceivable.setProjectName(pendingSettlementBusiness.getProjectName());
+                estimatedReceivable.setOrderDate(pendingSettlementBusiness.getCreatedTime());
+                estimatedReceivable.setFeeName("杩愯垂");
+                estimatedReceivable.setEstimatedAmount(exactMatchingRule2.getFreight());
+                estimatedReceivable.setCurrency("浜烘皯甯�");
+                estimatedReceivable.setIsConfirmed(1);
+                estimatedReceivable.setFeeType(1);
+                estimatedReceivables.add(estimatedReceivable);
             }
         }
         if (CollectionUtil.isNotEmpty(estimatedReceivables)){
             estimatedReceivableService.insertEstimatedReceivableBatch(estimatedReceivables);
         }
         pendingSettlementBusinessService.insertPendingSettlement(pendingSettlementBusinesses);
-    }
 
+        //鏇存柊鍚屾鐘舵�佺敤
+        Integer[] ids = pendingSettlementBusinesses.stream().map(PendingSettlementBusiness::getServiceId).toArray(Integer[]::new);
+        int i = pendingSettlementBusinessService.updeteCwData(ids);
+        if (i>0){
+            logger.info("鍚屾鐘舵�佹洿鏂版垚鍔�");
+        }
+
+    }
+    public void checkExpiredApplications() {
+        smartLockerApplicationService.updateExpiredStatus();
+    }
 
 
 }

--
Gitblit v1.8.0