From 969878a168bd5424120474d39c9aab454298bd4b Mon Sep 17 00:00:00 2001
From: wujianwei <wjw@11.com>
Date: 星期二, 12 八月 2025 14:15:35 +0800
Subject: [PATCH] 新增定时任务

---
 quartz/src/main/java/com/ruoyi/quartz/task/SettlementTask.java             |   17 ++++++++++++++++-
 service/src/main/resources/mapper/cwgl/EstimatedReceivableMapper.xml       |   12 +++++++++---
 service/src/main/resources/mapper/cwgl/PendingSettlementBusinessMapper.xml |    6 +++---
 service/src/main/java/com/ruoyi/cwgl/domain/EstimatedReceivable.java       |    6 ++++++
 4 files changed, 34 insertions(+), 7 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..398a4c4 100644
--- a/quartz/src/main/java/com/ruoyi/quartz/task/SettlementTask.java
+++ b/quartz/src/main/java/com/ruoyi/quartz/task/SettlementTask.java
@@ -50,6 +50,7 @@
         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();
@@ -62,12 +63,26 @@
                 estimatedReceivable.setEstimatedAmount(exactMatchingRule.getFreight());
                 estimatedReceivable.setCurrency("浜烘皯甯�");
                 estimatedReceivable.setIsConfirmed(1);
-
+                estimatedReceivable.setFeeType(0);
                 estimatedReceivables.add(estimatedReceivable);
             }
             ReceivableLineTruckPriceRule exactMatchingRule2 = ExactPricingRuleMatcher.findExactMatchingRule(payableLineTruckPriceRules, pendingSettlementBusiness.getCarrierName(), pendingSettlementBusiness.getDepartureLocation(), pendingSettlementBusiness.getArrivalLocation(), pendingSettlementBusiness.getVehicleType());
             if (exactMatchingRule2!=null) {
                 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(0);
+                estimatedReceivables.add(estimatedReceivable);
             }
         }
         if (CollectionUtil.isNotEmpty(estimatedReceivables)){
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 81cf126..122b176 100644
--- a/service/src/main/java/com/ruoyi/cwgl/domain/EstimatedReceivable.java
+++ b/service/src/main/java/com/ruoyi/cwgl/domain/EstimatedReceivable.java
@@ -64,6 +64,12 @@
         @TableField("fee_name")
     private String feeName;
 
+    /** 璐圭敤绫诲瀷 */
+//    @Excel(name = "璐圭敤绫诲瀷")
+
+        @TableField("fee_type")
+    private Integer feeType;
+
 
     /** 棰勪及璐圭敤閲戦 */
     @Excel(name = "棰勪及璐圭敤閲戦")
diff --git a/service/src/main/resources/mapper/cwgl/EstimatedReceivableMapper.xml b/service/src/main/resources/mapper/cwgl/EstimatedReceivableMapper.xml
index 002b531..709ed55 100644
--- a/service/src/main/resources/mapper/cwgl/EstimatedReceivableMapper.xml
+++ b/service/src/main/resources/mapper/cwgl/EstimatedReceivableMapper.xml
@@ -25,10 +25,11 @@
         <result property="createTime"    column="create_time"    />
         <result property="updateTime"    column="update_time"    />
         <result property="deleted"    column="deleted"    />
+        <result property="feeType"    column="fee_type"    />
     </resultMap>
 
     <sql id="selectEstimatedReceivableVo">
-        select thisTab.id, thisTab.fee_system_no, thisTab.dispatch_no, thisTab.customer_name, thisTab.project_name, thisTab.order_date, thisTab.fee_name, thisTab.estimated_amount, thisTab.currency, thisTab.related_bill_name, thisTab.related_bill_status, thisTab.is_confirmed, thisTab.confirm_by, thisTab.confirm_time, thisTab.remark, thisTab.create_by, thisTab.update_by, thisTab.create_time, thisTab.update_time, thisTab.deleted from estimated_receivable AS thisTab
+        select thisTab.id, thisTab.fee_system_no, thisTab.dispatch_no, thisTab.customer_name, thisTab.project_name, thisTab.order_date, thisTab.fee_name, thisTab.estimated_amount, thisTab.currency, thisTab.related_bill_name, thisTab.related_bill_status, thisTab.is_confirmed, thisTab.confirm_by, thisTab.confirm_time, thisTab.remark, thisTab.create_by, thisTab.update_by, thisTab.create_time, thisTab.update_time, thisTab.deleted , thisTab.fee_type from estimated_receivable AS thisTab
     </sql>
     <sql id="selectEstimatedReceivableVoCount">
         select count(0) from estimated_receivable as thisTab
@@ -49,6 +50,7 @@
         <if test="confirmBy != null  and confirmBy != ''"> and thisTab.confirm_by = #{confirmBy}</if>
         <if test="confirmTime != null "> and thisTab.confirm_time = #{confirmTime}</if>
         <if test="deleted != null "> and thisTab.deleted = #{deleted}</if>
+        <if test="feeType != null "> and thisTab.fee_type = #{feeType}</if>
     </sql>
 
     <!--鏌ヨ-->
@@ -95,6 +97,7 @@
             <if test="createTime != null">create_time,</if>
             <if test="updateTime != null">update_time,</if>
             <if test="deleted != null">deleted,</if>
+            <if test="feeType != null">fee_type,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="feeSystemNo != null and feeSystemNo != ''">#{feeSystemNo},</if>
@@ -116,17 +119,18 @@
             <if test="createTime != null">#{createTime},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="deleted != null">#{deleted},</if>
+            <if test="feeType != null">#{feeType},</if>
          </trim>
     </insert>
 
     <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,
+           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,fee_type,
         </trim>
         <foreach item="item" index="index" collection="list" separator=",">
             <trim prefix="(" suffix=") " suffixOverrides=",">
-                #{item.id},#{item.feeSystemNo},#{item.dispatchNo},#{item.customerName},#{item.projectName},#{item.orderDate},#{item.feeName},#{item.estimatedAmount},#{item.currency},#{item.relatedBillName},#{item.relatedBillStatus},#{item.isConfirmed},#{item.confirmBy},#{item.confirmTime},#{item.remark},#{item.createBy},#{item.updateBy},#{item.createTime},#{item.updateTime},#{item.deleted},
+                #{item.feeSystemNo},#{item.dispatchNo},#{item.customerName},#{item.projectName},#{item.orderDate},#{item.feeName},#{item.estimatedAmount},#{item.currency},#{item.relatedBillName},#{item.relatedBillStatus},#{item.isConfirmed},#{item.confirmBy},#{item.confirmTime},#{item.remark},#{item.createBy},#{item.updateBy},#{item.createTime},#{item.updateTime},#{item.deleted},#{item.feeType},
             </trim>
         </foreach>
     </insert>
@@ -154,6 +158,7 @@
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="deleted != null">deleted = #{deleted},</if>
+            <if test="feeType != null">fee_type = #{feeType},</if>
         </trim>
         where id = #{id}
     </update>
@@ -181,6 +186,7 @@
                 <if test="item.createTime != null">create_time = #{item.createTime},</if>
                 <if test="item.updateTime != null">update_time = #{item.updateTime},</if>
                 <if test="item.deleted != null">deleted = #{item.deleted},</if>
+                <if test="item.feeType != null">fee_type = #{item.feeType},</if>
             </trim>
         where id = #{item.id}
         </foreach>
diff --git a/service/src/main/resources/mapper/cwgl/PendingSettlementBusinessMapper.xml b/service/src/main/resources/mapper/cwgl/PendingSettlementBusinessMapper.xml
index ea4823d..8532055 100644
--- a/service/src/main/resources/mapper/cwgl/PendingSettlementBusinessMapper.xml
+++ b/service/src/main/resources/mapper/cwgl/PendingSettlementBusinessMapper.xml
@@ -369,14 +369,14 @@
          </trim>
     </insert>
 
-    <insert id="insertPendingSettlementBusinessBatch" parameterType="java.util.List"  useGeneratedKeys="true" keyProperty="id">
+    <insert id="insertPendingSettlementBusinessBatch" parameterType="java.util.List">
         insert into pending_settlement_business
         <trim prefix="(" suffix=") values" suffixOverrides=",">
-            id,booking_no,customer_id,carrier_id,project_name,dispatch_no,created_time,transport_mode,product_id,customer_name,operation_mode,carrier_name,departure_location,arrival_location,vehicle_id,license_plate_number,vehicle_type,main_driver,assistant_driver,point_num,business_contact,estimated_total_income,estimated_total_cost,estimated_profit,electronic_lock,re_weighing_weight,quantity,actual_departure_time,required_arrival_time,actual_arrival_time,be_return,dispatch_quantity,dispatch_weight,dispatch_volume,empty_mileage,empty_fuel,heavy_mileage,heavy_fuel,be_scheduled,tracking_no,seal_no,schedule_no,transport_status,estimated_bill_id,settlement_bill_id,settlement_status,create_time,update_time,
+            booking_no,customer_id,carrier_id,project_name,dispatch_no,created_time,transport_mode,product_id,customer_name,operation_mode,carrier_name,departure_location,arrival_location,vehicle_id,license_plate_number,vehicle_type,main_driver,assistant_driver,point_num,business_contact,estimated_total_income,estimated_total_cost,estimated_profit,electronic_lock,re_weighing_weight,quantity,actual_departure_time,required_arrival_time,actual_arrival_time,be_return,dispatch_quantity,dispatch_weight,dispatch_volume,empty_mileage,empty_fuel,heavy_mileage,heavy_fuel,be_scheduled,tracking_no,seal_no,schedule_no,transport_status,estimated_bill_id,settlement_bill_id,settlement_status,create_time,update_time,
         </trim>
         <foreach item="item" index="index" collection="list" separator=",">
             <trim prefix="(" suffix=") " suffixOverrides=",">
-                #{item.id},#{item.bookingNo},#{item.customerId},#{item.carrierId},#{item.projectName},#{item.dispatchNo},#{item.createdTime},#{item.transportMode},#{item.productId},#{item.customerName},#{item.operationMode},#{item.carrierName},#{item.departureLocation},#{item.arrivalLocation},#{item.vehicleId},#{item.licensePlateNumber},#{item.vehicleType},#{item.mainDriver},#{item.assistantDriver},#{item.pointNum},#{item.businessContact},#{item.estimatedTotalIncome},#{item.estimatedTotalCost},#{item.estimatedProfit},#{item.electronicLock},#{item.reWeighingWeight},#{item.quantity},#{item.actualDepartureTime},#{item.requiredArrivalTime},#{item.actualArrivalTime},#{item.beReturn},#{item.dispatchQuantity},#{item.dispatchWeight},#{item.dispatchVolume},#{item.emptyMileage},#{item.emptyFuel},#{item.heavyMileage},#{item.heavyFuel},#{item.beScheduled},#{item.trackingNo},#{item.sealNo},#{item.scheduleNo},#{item.transportStatus},#{item.estimatedBillId},#{item.settlementBillId},#{item.settlementStatus},#{item.createTime},#{item.updateTime},
+                #{item.bookingNo},#{item.customerId},#{item.carrierId},#{item.projectName},#{item.dispatchNo},#{item.createdTime},#{item.transportMode},#{item.productId},#{item.customerName},#{item.operationMode},#{item.carrierName},#{item.departureLocation},#{item.arrivalLocation},#{item.vehicleId},#{item.licensePlateNumber},#{item.vehicleType},#{item.mainDriver},#{item.assistantDriver},#{item.pointNum},#{item.businessContact},#{item.estimatedTotalIncome},#{item.estimatedTotalCost},#{item.estimatedProfit},#{item.electronicLock},#{item.reWeighingWeight},#{item.quantity},#{item.actualDepartureTime},#{item.requiredArrivalTime},#{item.actualArrivalTime},#{item.beReturn},#{item.dispatchQuantity},#{item.dispatchWeight},#{item.dispatchVolume},#{item.emptyMileage},#{item.emptyFuel},#{item.heavyMileage},#{item.heavyFuel},#{item.beScheduled},#{item.trackingNo},#{item.sealNo},#{item.scheduleNo},#{item.transportStatus},#{item.estimatedBillId},#{item.settlementBillId},#{item.settlementStatus},#{item.createTime},#{item.updateTime},
             </trim>
         </foreach>
     </insert>

--
Gitblit v1.8.0