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

---
 service/src/main/resources/mapper/cwgl/PendingSettlementBusinessMapper.xml |  149 ++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 146 insertions(+), 3 deletions(-)

diff --git a/service/src/main/resources/mapper/cwgl/PendingSettlementBusinessMapper.xml b/service/src/main/resources/mapper/cwgl/PendingSettlementBusinessMapper.xml
index 55c70ec..8532055 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">
@@ -234,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>
@@ -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