From 93ab7329ea23a25224e8f0058ef4cebfae457f9a Mon Sep 17 00:00:00 2001
From: wujianwei <wjw@11.com>
Date: 星期二, 12 八月 2025 13:57:45 +0800
Subject: [PATCH] 新增定时任务

---
 quartz/src/main/java/com/ruoyi/quartz/task/SettlementTask.java                              |   83 +++++++++++
 service/src/main/resources/mapper/cwgl/EstimatedReceivableMapper.xml                        |    2 
 quartz/pom.xml                                                                              |    4 
 service/src/main/java/com/ruoyi/cwgl/domain/ReceivableLineTruckPriceRule.java               |   42 ++++++
 service/src/main/java/com/ruoyi/cwgl/domain/PendingSettlementBusiness.java                  |    6 
 service/src/main/java/com/ruoyi/cwgl/mapper/PendingSettlementBusinessMapper.java            |   13 +
 service/src/main/java/com/ruoyi/cwgl/service/impl/PendingSettlementBusinessServiceImpl.java |   44 ++++++
 service/src/main/resources/mapper/cwgl/PendingSettlementBusinessMapper.xml                  |  143 ++++++++++++++++++++
 service/src/main/java/com/ruoyi/cwgl/domain/EstimatedReceivable.java                        |    2 
 service/src/main/java/com/ruoyi/cwgl/service/IPendingSettlementBusinessService.java         |   31 ++++
 10 files changed, 365 insertions(+), 5 deletions(-)

diff --git a/quartz/pom.xml b/quartz/pom.xml
index 8954d9a..433cc58 100644
--- a/quartz/pom.xml
+++ b/quartz/pom.xml
@@ -35,6 +35,10 @@
             <artifactId>common</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>com.ruoyi</groupId>
+            <artifactId>service</artifactId>
+        </dependency>
     </dependencies>
 
 </project>
diff --git a/quartz/src/main/java/com/ruoyi/quartz/task/SettlementTask.java b/quartz/src/main/java/com/ruoyi/quartz/task/SettlementTask.java
new file mode 100644
index 0000000..3b95939
--- /dev/null
+++ b/quartz/src/main/java/com/ruoyi/quartz/task/SettlementTask.java
@@ -0,0 +1,83 @@
+package com.ruoyi.quartz.task;
+
+import cn.hutool.core.collection.CollectionUtil;
+import com.ruoyi.common.utils.RandomUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.cwgl.domain.EstimatedReceivable;
+import com.ruoyi.cwgl.domain.PendingSettlementBusiness;
+import com.ruoyi.cwgl.domain.ReceivableLineTruckPriceRule;
+import com.ruoyi.cwgl.service.IEstimatedReceivableService;
+import com.ruoyi.cwgl.service.IPendingSettlementBusinessService;
+import com.ruoyi.cwgl.service.impl.ExactPricingRuleMatcher;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 瀹氭椂浠诲姟璋冨害娴嬭瘯
+ * 
+ * @author ruoyi
+ */
+@Component("settlementTask")
+public class SettlementTask
+{
+
+    @Autowired
+    private IPendingSettlementBusinessService pendingSettlementBusinessService;
+    @Autowired
+    private IEstimatedReceivableService estimatedReceivableService;
+
+    public void insertPendingSettlement()
+    {
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyMMdd");
+        Date date = new Date();
+        String datePart = dateFormat.format(date);
+
+        List<PendingSettlementBusiness> pendingSettlementBusinesses = pendingSettlementBusinessService.selectPendingSettlement2Cw();
+
+        //搴旀敹瑙勫垯
+        List<ReceivableLineTruckPriceRule> receivableLineTruckPriceRules = pendingSettlementBusinessService.selectReceivableLineTruckPriceRule();
+
+        //搴斾粯瑙勫垯
+        List<ReceivableLineTruckPriceRule> payableLineTruckPriceRules= pendingSettlementBusinessService.selectPayableLineTruckPriceRule();
+
+        List<EstimatedReceivable> estimatedReceivables = new ArrayList<>();
+        for (PendingSettlementBusiness pendingSettlementBusiness : pendingSettlementBusinesses) {
+            ReceivableLineTruckPriceRule exactMatchingRule = ExactPricingRuleMatcher.findExactMatchingRule(receivableLineTruckPriceRules, pendingSettlementBusiness.getCustomerName(), pendingSettlementBusiness.getDepartureLocation(), pendingSettlementBusiness.getArrivalLocation(), pendingSettlementBusiness.getVehicleType());
+            if (exactMatchingRule!=null) {
+                pendingSettlementBusiness.setEstimatedTotalIncome(exactMatchingRule.getFreight());
+                pendingSettlementBusiness.setCreateTime(date);
+                EstimatedReceivable estimatedReceivable = new EstimatedReceivable();
+                estimatedReceivable.setFeeSystemNo("YS"+datePart+RandomUtils.random(5));
+                estimatedReceivable.setDispatchNo(pendingSettlementBusiness.getDispatchNo());
+                estimatedReceivable.setCustomerName(pendingSettlementBusiness.getCustomerName());
+                estimatedReceivable.setProjectName(pendingSettlementBusiness.getProjectName());
+                estimatedReceivable.setOrderDate(pendingSettlementBusiness.getCreatedTime());
+                estimatedReceivable.setFeeName("杩愯垂");
+                estimatedReceivable.setEstimatedAmount(exactMatchingRule.getFreight());
+                estimatedReceivable.setCurrency("浜烘皯甯�");
+                estimatedReceivable.setIsConfirmed(1);
+
+                estimatedReceivables.add(estimatedReceivable);
+            }
+            ReceivableLineTruckPriceRule exactMatchingRule2 = ExactPricingRuleMatcher.findExactMatchingRule(payableLineTruckPriceRules, pendingSettlementBusiness.getCarrierName(), pendingSettlementBusiness.getDepartureLocation(), pendingSettlementBusiness.getArrivalLocation(), pendingSettlementBusiness.getVehicleType());
+            if (exactMatchingRule2!=null) {
+                pendingSettlementBusiness.setEstimatedTotalCost(exactMatchingRule2.getFreight());
+            }
+        }
+        if (CollectionUtil.isNotEmpty(estimatedReceivables)){
+            estimatedReceivableService.insertEstimatedReceivableBatch(estimatedReceivables);
+        }
+        pendingSettlementBusinessService.insertPendingSettlement(pendingSettlementBusinesses);
+    }
+
+
+
+}
+
+
diff --git a/service/src/main/java/com/ruoyi/cwgl/domain/EstimatedReceivable.java b/service/src/main/java/com/ruoyi/cwgl/domain/EstimatedReceivable.java
index 4e8b456..81cf126 100644
--- a/service/src/main/java/com/ruoyi/cwgl/domain/EstimatedReceivable.java
+++ b/service/src/main/java/com/ruoyi/cwgl/domain/EstimatedReceivable.java
@@ -69,7 +69,7 @@
     @Excel(name = "棰勪及璐圭敤閲戦")
 
         @TableField("estimated_amount")
-    private BigDecimal estimatedAmount;
+    private Long estimatedAmount;
 
 
     /** 甯佸埗 */
diff --git a/service/src/main/java/com/ruoyi/cwgl/domain/PendingSettlementBusiness.java b/service/src/main/java/com/ruoyi/cwgl/domain/PendingSettlementBusiness.java
index 8609cf5..6f580d0 100644
--- a/service/src/main/java/com/ruoyi/cwgl/domain/PendingSettlementBusiness.java
+++ b/service/src/main/java/com/ruoyi/cwgl/domain/PendingSettlementBusiness.java
@@ -167,21 +167,21 @@
     @Excel(name = "棰勪及鎬绘敹鍏�")
 
         @TableField("estimated_total_income")
-    private BigDecimal estimatedTotalIncome;
+    private Long estimatedTotalIncome;
 
 
     /** 棰勪及鎬绘垚鏈� */
     @Excel(name = "棰勪及鎬绘垚鏈�")
 
         @TableField("estimated_total_cost")
-    private BigDecimal estimatedTotalCost;
+    private Long estimatedTotalCost;
 
 
     /** 棰勪及鍒╂鼎 */
     @Excel(name = "棰勪及鍒╂鼎")
 
         @TableField("estimated_profit")
-    private BigDecimal estimatedProfit;
+    private Long estimatedProfit;
 
 
     /** 鐢靛瓙閿� */
diff --git a/service/src/main/java/com/ruoyi/cwgl/domain/ReceivableLineTruckPriceRule.java b/service/src/main/java/com/ruoyi/cwgl/domain/ReceivableLineTruckPriceRule.java
new file mode 100644
index 0000000..f546ba4
--- /dev/null
+++ b/service/src/main/java/com/ruoyi/cwgl/domain/ReceivableLineTruckPriceRule.java
@@ -0,0 +1,42 @@
+package com.ruoyi.cwgl.domain;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 搴旀敹绾胯矾鏁磋溅浠锋牸瑙勫垯瀹炰綋绫�
+ */
+@Data
+public class ReceivableLineTruckPriceRule {
+    
+    private Long id; // 瑙勫垯ID
+    private String feeType; // 璐圭敤绫诲瀷
+    private String customerName; // 瀹㈡埛鍚嶇О
+    private String departureCity; // 鍙戣揣甯傚悕绉�
+    private String departureDistrict; // 鍙戣揣鍖哄悕绉�
+    private String arrivalCity; // 鏀惰揣甯傚悕绉�
+    private String arrivalDistrict; // 鏀惰揣鍖哄悕绉�
+    private String vehicleType; // 杞﹀瀷鍚嶇О
+    private Long freight; // 杩愯垂
+    private Date createdTime; // 鍒涘缓鏃堕棿
+
+
+
+    @Override
+    public String toString() {
+        return "ReceivableLineTruckPriceRule{" +
+                "id=" + id +
+                ", feeType='" + feeType + '\'' +
+                ", customerName='" + customerName + '\'' +
+                ", departureCity='" + departureCity + '\'' +
+                ", departureDistrict='" + departureDistrict + '\'' +
+                ", arrivalCity='" + arrivalCity + '\'' +
+                ", arrivalDistrict='" + arrivalDistrict + '\'' +
+                ", vehicleType='" + vehicleType + '\'' +
+                ", freight=" + freight +
+                ", createdTime=" + createdTime +
+                '}';
+    }
+}
\ No newline at end of file
diff --git a/service/src/main/java/com/ruoyi/cwgl/mapper/PendingSettlementBusinessMapper.java b/service/src/main/java/com/ruoyi/cwgl/mapper/PendingSettlementBusinessMapper.java
index aab25fa..985b908 100644
--- a/service/src/main/java/com/ruoyi/cwgl/mapper/PendingSettlementBusinessMapper.java
+++ b/service/src/main/java/com/ruoyi/cwgl/mapper/PendingSettlementBusinessMapper.java
@@ -3,6 +3,7 @@
 import java.util.List;
 import com.ruoyi.cwgl.domain.PendingSettlementBusiness;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.cwgl.domain.ReceivableLineTruckPriceRule;
 
 
 /**
@@ -84,4 +85,16 @@
      * @return 缁撴灉
      */
     public int deletePendingSettlementBusinessByIds(Integer[] ids);
+    /**
+     * 鏌ヨ璐㈠姟搴撳叆璐︽暟鎹簱鏁版嵁
+     * @return
+     */
+    List<PendingSettlementBusiness> selectPendingSettlement2Cw();
+
+    int updeteCwData(Integer[] ids);
+
+    List<ReceivableLineTruckPriceRule> selectReceivableLineTruckPriceRule();
+
+    List<ReceivableLineTruckPriceRule> selectPayableLineTruckPriceRule();
+
 }
diff --git a/service/src/main/java/com/ruoyi/cwgl/service/IPendingSettlementBusinessService.java b/service/src/main/java/com/ruoyi/cwgl/service/IPendingSettlementBusinessService.java
index e52250a..54d2454 100644
--- a/service/src/main/java/com/ruoyi/cwgl/service/IPendingSettlementBusinessService.java
+++ b/service/src/main/java/com/ruoyi/cwgl/service/IPendingSettlementBusinessService.java
@@ -3,6 +3,8 @@
 import java.util.List;
 import com.ruoyi.cwgl.domain.PendingSettlementBusiness;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.cwgl.domain.ReceivableLineTruckPriceRule;
+
 /**
  * 寰呭叆璐︿笟鍔ervice鎺ュ彛
  * 
@@ -99,4 +101,33 @@
      * @return 缁撴灉
      */
     public int deletePendingSettlementBusinessById(Integer id);
+
+    /**
+     * 鏂板寰呭叆璐︽暟鎹�
+     */
+    void insertPendingSettlement(List<PendingSettlementBusiness> pendingSettlementBusinesses );
+
+    /**
+     * 鏌ヨ璐㈠姟搴撳叆璐︽暟鎹�
+     * @return
+     */
+    List<PendingSettlementBusiness> selectPendingSettlement2Cw();
+
+    /**
+     * 淇敼璐㈠姟鏁版嵁搴撴暟鎹负宸插悓姝�
+     * @param ids
+     * @return
+     */
+    int updateCwData(Integer [] ids);
+
+    /**
+     * 搴旀敹绾胯矾鏁磋溅浠锋牸
+     * @return
+     */
+    List<ReceivableLineTruckPriceRule> selectReceivableLineTruckPriceRule();
+    /**
+     * 搴斾粯绾胯矾鏁磋溅浠锋牸
+     * @return
+     */
+    List<ReceivableLineTruckPriceRule> selectPayableLineTruckPriceRule();
 }
diff --git a/service/src/main/java/com/ruoyi/cwgl/service/impl/PendingSettlementBusinessServiceImpl.java b/service/src/main/java/com/ruoyi/cwgl/service/impl/PendingSettlementBusinessServiceImpl.java
index 385875d..e174d1a 100644
--- a/service/src/main/java/com/ruoyi/cwgl/service/impl/PendingSettlementBusinessServiceImpl.java
+++ b/service/src/main/java/com/ruoyi/cwgl/service/impl/PendingSettlementBusinessServiceImpl.java
@@ -2,8 +2,11 @@
 
 import java.util.List;
 
+import cn.hutool.core.collection.CollectionUtil;
 import com.ruoyi.common.utils.DateUtils;
 import javax.annotation.Resource;
+
+import com.ruoyi.cwgl.domain.ReceivableLineTruckPriceRule;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.stereotype.Service;
 import org.springframework.scheduling.annotation.Async;
@@ -179,4 +182,45 @@
     {
         return pendingSettlementBusinessMapper.deletePendingSettlementBusinessById(id);
     }
+
+    @Override
+    public void insertPendingSettlement(List<PendingSettlementBusiness> pendingSettlementBusinesses ) {
+
+        if (CollectionUtil.isNotEmpty(pendingSettlementBusinesses)) {
+            pendingSettlementBusinessMapper.insertPendingSettlementBusinessBatch(pendingSettlementBusinesses);
+
+        }
+        
+    }
+
+    @DataSource(DataSourceType.CWSJ)
+    @Override
+    public List<PendingSettlementBusiness> selectPendingSettlement2Cw() {
+        List<PendingSettlementBusiness> pendingSettlementBusinesses = pendingSettlementBusinessMapper.selectPendingSettlement2Cw();
+        //鏇存柊鍚屾鐘舵�佺敤
+       /*     Integer[] ids = pendingSettlementBusinesses.stream().map(PendingSettlementBusiness::getServiceId).toArray(Integer[]::new);
+            int i = pendingSettlementBusinessMapper.updeteCwData(ids);
+            if (i>0){
+                logger.info("鍚屾鐘舵�佹洿鏂版垚鍔�");
+            }*/
+        return pendingSettlementBusinesses;
+    }
+
+    @DataSource(DataSourceType.CWSJ)
+    @Override
+    public int updateCwData(Integer[] ids) {
+        return pendingSettlementBusinessMapper.updeteCwData(ids);
+    }
+
+    @DataSource(DataSourceType.CWSJ)
+    @Override
+    public List<ReceivableLineTruckPriceRule> selectReceivableLineTruckPriceRule() {
+        return pendingSettlementBusinessMapper.selectReceivableLineTruckPriceRule();
+    }
+
+    @DataSource(DataSourceType.CWSJ)
+    @Override
+    public List<ReceivableLineTruckPriceRule> selectPayableLineTruckPriceRule() {
+        return pendingSettlementBusinessMapper.selectPayableLineTruckPriceRule();
+    }
 }
diff --git a/service/src/main/resources/mapper/cwgl/EstimatedReceivableMapper.xml b/service/src/main/resources/mapper/cwgl/EstimatedReceivableMapper.xml
index dbe1a56..002b531 100644
--- a/service/src/main/resources/mapper/cwgl/EstimatedReceivableMapper.xml
+++ b/service/src/main/resources/mapper/cwgl/EstimatedReceivableMapper.xml
@@ -119,7 +119,7 @@
          </trim>
     </insert>
 
-    <insert id="insertEstimatedReceivableBatch" parameterType="java.util.List"  useGeneratedKeys="true" keyProperty="id">
+    <insert id="insertEstimatedReceivableBatch" parameterType="java.util.List"  >
         insert into estimated_receivable
         <trim prefix="(" suffix=") values" suffixOverrides=",">
             id,fee_system_no,dispatch_no,customer_name,project_name,order_date,fee_name,estimated_amount,currency,related_bill_name,related_bill_status,is_confirmed,confirm_by,confirm_time,remark,create_by,update_by,create_time,update_time,deleted,
diff --git a/service/src/main/resources/mapper/cwgl/PendingSettlementBusinessMapper.xml b/service/src/main/resources/mapper/cwgl/PendingSettlementBusinessMapper.xml
index 55c70ec..ea4823d 100644
--- a/service/src/main/resources/mapper/cwgl/PendingSettlementBusinessMapper.xml
+++ b/service/src/main/resources/mapper/cwgl/PendingSettlementBusinessMapper.xml
@@ -130,6 +130,141 @@
         </where>
         order by thisTab.id desc
     </select>
+    <select id="selectPendingSettlement2Cw" resultType="com.ruoyi.cwgl.domain.PendingSettlementBusiness">
+SELECT
+-- ord.BOOKING_NO '瀹㈡埛璁㈠崟鍙�',
+-- ord.CUSTOMER_ID,
+-- ts.CARRIER_ID,
+ts.ID as serviceId,
+brd.PROJECT_NAME as projectName,
+ts.DISPATCH_NO as dispatchNo,
+ts.CREATED_TIME as createdTime,
+-- ts.TRANSPORT_MODE '杩愯緭鏂瑰紡',
+-- ts.PRODUCT_ID '鏈嶅姟浜у搧',
+customer.NAME as customerName,
+		case when ts.CARRIER_ID=50 then
+		'鑷惀'
+		else '澶栧崗'
+		end as  operationMode,
+bp.NAME as carrierName,
+location_d.NAME_TREE as departureLocation,
+location_a.NAME_TREE as arrivalLocation,
+-- ts.VEHICLE_ID '杩愯緭宸ュ叿ID',
+vhc.LICENSE_PLATE_NUMBER as licensePlateNumber,
+bvt.NAME as vehicleType,
+driver_m.NAME as mainDriver,
+ts.POINT_NUM as pointNum,
+		ts.CREATOR as businessContact,
+
+-- ts.ELECTRONIC_LOCK '鐢靛瓙閿�',
+-- ts.RE_WEIGHING_WEIGHT '澶嶇閲嶉噺',
+ts.QUANTITY as quantity,
+driver_a.NAME as assistantDriver,
+ts.ACTUAL_DEPARTURE_TIME as actualDepartureTime,
+ts.REQUIRED_ARRIVAL_TIME as requiredArrivalTime,
+ts.ACTUAL_ARRIVAL_TIME as actualArrivalTime,
+ts.BE_RETURN as beReturn,
+ts.DISPATCH_QUANTITY as dispatchQuantity,
+ts.DISPATCH_WEIGHT as dispatchWeight,
+ts.DISPATCH_VOLUME as dispatchVolume,
+-- ts.EMPTY_MILEAGE '绌鸿浇閲岀▼锛堝叕閲岋級',
+-- ts.EMPTY_FUEL '绌鸿浇娌硅�楋紙鍗囷級',
+-- ts.HEAVY_MILEAGE '閲嶈浇閲岀▼锛堝叕閲岋級',
+-- ts.HEAVY_FUEL '閲嶈浇娌硅�楋紙鍗�)',
+-- ts.BE_SCHEDULED '鏄惁鎸夌彮娆�',
+-- ts.TRACKING_NO '蹇�掑崟鍙�',
+-- ts.SEAL_NO '閾呭皝鍙�',
+-- ts.SCHEDULE_NO '鐝鍙�',
+CASE ts.STATUS
+        WHEN 'A' THEN '鐢熸晥'
+        WHEN 'O' THEN '鎵撳紑'
+        WHEN 'J' THEN '宸叉帴鍗�'
+        WHEN 'K' THEN '宸插埌搴�'
+        WHEN 'Z' THEN '宸茶杞�'
+        WHEN 'T' THEN '鍦ㄩ��'
+        WHEN 'F' THEN '宸插纾�'
+        WHEN 'D' THEN '宸茶繍鎶�'
+        ELSE '鏈煡鐘舵��'
+    END AS transportStatus
+
+
+		FROM
+	tms_shipment ts
+-- 璁㈠崟琛�
+ 	LEFT JOIN oms_order ord ON ts.DISPATCH_NO = ord.DISPATCH_CODE
+		-- 瀹㈡埛琛�
+	LEFT join base_customer customer on customer.ID=ord.CUSTOMER_ID
+	-- 杩愯緭宸ュ叿琛�
+	left join tms_vehicle  vhc on ts.VEHICLE_ID=vhc.id
+	-- 杞﹀瀷鏁版嵁琛�
+	LEFT JOIN base_vehicle_type bvt on bvt.ID=vhc.VEHICLE_TYPE_ID
+	-- 鎵胯繍鍟嗚〃
+	left join base_provider bp on bp.ID=ts.CARRIER_ID
+	-- 鍙告満琛�
+	left join tms_driver driver_m on driver_m.ID=ts.MAIN_DRIVER_ID
+-- 鍙告満琛�
+	left join tms_driver driver_a on driver_a.ID=ts.ASSISTANT_DRIVER_ID
+	-- 鍦板尯琛�
+	left join base_location location_a on location_a.ID =ts.ARRIVAL_LOCATION_ID
+	-- 鍦板尯琛�
+	left join base_location location_d on location_d.ID =ts.DEPARTURE_LOCATION_ID
+		-- 璺嚎璇︽儏琛ㄨ〃
+	left join base_plan_road_detail prd on prd.ID =ts.PLAN_ROAD_DETAIL_ID
+		-- 璺嚎琛�
+	LEFT join base_road_survey brd on brd.ID = prd.ROAD_SURVEY_ID
+
+
+	where  ts.STATUS='D'
+	and ts.IS_SYNC = 0
+
+
+
+    </select>
+    <select id="selectReceivableLineTruckPriceRule"
+            resultType="com.ruoyi.cwgl.domain.ReceivableLineTruckPriceRule">
+
+        SELECT
+	rtd.id as id,
+	rtd.REFERENCE1 as feeType,
+	rtd.REFERENCE2 as customerName,
+	rtd.REFERENCE3 as departureCity,
+	rtd.REFERENCE4 as departureDistrict,
+	rtd.REFERENCE5 as arrivalCity,
+	rtd.REFERENCE6 as arrivalDistrict,
+	rtd.REFERENCE7 as vehicleType,
+	rtd.VALUE1 as freight,
+	rtd.CREATED_TIME as createdTime
+FROM
+	thorn_rule_table_detail rtd
+	LEFT JOIN thorn_rule_version rv ON rtd.VERSION_ID = rv.id
+	LEFT JOIN thorn_rule_table rt ON rv.RULE_TABLE_ID = rt.id
+WHERE
+	rt.STATUS = 'ACTIVE'
+	AND rt.NAME = '搴旀敹绾胯矾鏁磋溅浠锋牸' and rtd.REFERENCE1='杩愯垂'
+
+    </select>
+    <select id="selectPayableLineTruckPriceRule"
+            resultType="com.ruoyi.cwgl.domain.ReceivableLineTruckPriceRule">
+
+        SELECT
+	rtd.id as id,
+	rtd.REFERENCE1 as feeType,
+	rtd.REFERENCE2 as customerName,
+	rtd.REFERENCE3 as departureCity,
+	rtd.REFERENCE4 as departureDistrict,
+	rtd.REFERENCE5 as arrivalCity,
+	rtd.REFERENCE6 as arrivalDistrict,
+	rtd.REFERENCE7 as vehicleType,
+	rtd.VALUE1 as freight,
+	rtd.CREATED_TIME as createdTime
+FROM
+	thorn_rule_table_detail rtd
+	LEFT JOIN thorn_rule_version rv ON rtd.VERSION_ID = rv.id
+	LEFT JOIN thorn_rule_table rt ON rv.RULE_TABLE_ID = rt.id
+WHERE
+	rt.STATUS = 'ACTIVE'
+	AND rt.NAME = '搴斾粯绾胯矾鏁磋溅浠锋牸' and rtd.REFERENCE1='杩愯垂'
+    </select>
 
     <!-- 鏂板 -->
     <insert id="insertPendingSettlementBusiness" parameterType="com.ruoyi.cwgl.domain.PendingSettlementBusiness"  useGeneratedKeys="true" keyProperty="id">
@@ -356,6 +491,14 @@
         where id = #{item.id}
         </foreach>
     </update>
+    <update id="updeteCwData">
+        update pending_settlement_business set IS_SYNC = 1
+        where ID in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+
+    </update>
 
     <!--鍒犻櫎-->
     <delete id="deletePendingSettlementBusinessById" parameterType="Integer">

--
Gitblit v1.8.0