修改订单同步

This commit is contained in:
wuweihua
2026-09-21 10:05:16 +08:00
parent 18ea834a59
commit 974e88715b
37 changed files with 1576 additions and 24 deletions
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.price.mapper.OracleUpstreamOrderMapper">
<!--
Exact-match lookups only (no multi-column OR).
Nested ROWNUM form helps Oracle use indexes on large TAB_ORDER.
-->
<select id="selectByTransferNo" resultType="java.util.HashMap">
SELECT * FROM (
SELECT * FROM ${orderTable} WHERE TRANSFER_ORDER_ID = #{transferNo}
) WHERE ROWNUM &lt;= 1
</select>
<select id="selectByOrderId" resultType="java.util.HashMap">
SELECT * FROM (
SELECT * FROM ${orderTable} WHERE ORDER_ID = #{orderNo}
) WHERE ROWNUM &lt;= 1
</select>
<select id="selectByOrgOrderId" resultType="java.util.HashMap">
SELECT * FROM (
SELECT * FROM ${orderTable} WHERE ORG_ORDER_ID = #{orderNo}
) WHERE ROWNUM &lt;= 1
</select>
<select id="selectByTrackId" resultType="java.util.HashMap">
SELECT * FROM (
SELECT * FROM ${orderTable} WHERE TRACK_ID = #{trackingNo}
) WHERE ROWNUM &lt;= 1
</select>
<select id="selectByBarcode" resultType="java.util.HashMap">
SELECT * FROM (
SELECT * FROM ${orderTable} WHERE BARCODE_NUMBER = #{trackingNo}
) WHERE ROWNUM &lt;= 1
</select>
<select id="selectByCustomerTrackId" resultType="java.util.HashMap">
SELECT * FROM (
SELECT * FROM ${orderTable} WHERE CUSTOMER_TRACK_ID = #{trackingNo}
) WHERE ROWNUM &lt;= 1
</select>
</mapper>
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.price.mapper.PrcBillingTaskMapper">
<resultMap type="PrcBillingTask" id="PrcBillingTaskResult">
<id property="taskId" column="task_id" />
<result property="transferNo" column="transfer_no" />
<result property="trackingNo" column="tracking_no" />
<result property="orderNo" column="order_no" />
<result property="billType" column="bill_type" />
<result property="successStatus" column="success_status" />
<result property="billTime" column="bill_time" />
<result property="billId" column="bill_id" />
<result property="errorMessage" column="error_message" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectPrcBillingTaskVo">
select task_id, transfer_no, tracking_no, order_no, bill_type, success_status,
bill_time, bill_id, error_message, create_by, create_time, update_by, update_time
from prc_billing_task
</sql>
<select id="selectPrcBillingTaskById" parameterType="Long" resultMap="PrcBillingTaskResult">
<include refid="selectPrcBillingTaskVo"/>
where task_id = #{taskId}
</select>
<select id="selectPrcBillingTaskList" parameterType="PrcBillingTask" resultMap="PrcBillingTaskResult">
<include refid="selectPrcBillingTaskVo"/>
<where>
<if test="transferNo != null and transferNo != ''">
AND transfer_no = #{transferNo}
</if>
<if test="trackingNo != null and trackingNo != ''">
AND tracking_no = #{trackingNo}
</if>
<if test="orderNo != null and orderNo != ''">
AND order_no = #{orderNo}
</if>
<if test="billType != null and billType != ''">
AND bill_type = #{billType}
</if>
<if test="successStatus != null and successStatus != ''">
AND success_status = #{successStatus}
</if>
</where>
order by task_id desc
</select>
<insert id="insertPrcBillingTask" parameterType="PrcBillingTask" useGeneratedKeys="true" keyProperty="taskId">
insert into prc_billing_task (
transfer_no, tracking_no, order_no, bill_type, success_status,
bill_time, bill_id, error_message, create_by, create_time
) values (
#{transferNo}, #{trackingNo}, #{orderNo}, #{billType}, #{successStatus},
#{billTime}, #{billId}, #{errorMessage}, #{createBy}, sysdate()
)
</insert>
<update id="updatePrcBillingTask" parameterType="PrcBillingTask">
update prc_billing_task
<trim prefix="SET" suffixOverrides=",">
<if test="transferNo != null">transfer_no = #{transferNo},</if>
<if test="trackingNo != null">tracking_no = #{trackingNo},</if>
<if test="orderNo != null">order_no = #{orderNo},</if>
<if test="billType != null">bill_type = #{billType},</if>
<if test="successStatus != null">success_status = #{successStatus},</if>
<if test="billTime != null">bill_time = #{billTime},</if>
<if test="billId != null">bill_id = #{billId},</if>
<if test="errorMessage != null">error_message = #{errorMessage},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
update_time = sysdate()
</trim>
where task_id = #{taskId}
</update>
<!-- Do not overwrite bill_time: it stores mobile billing time. -->
<update id="updateBillingResult" parameterType="PrcBillingTask">
update prc_billing_task
set success_status = #{successStatus},
bill_id = #{billId},
error_message = #{errorMessage},
order_no = coalesce(#{orderNo}, order_no),
tracking_no = coalesce(#{trackingNo}, tracking_no),
transfer_no = coalesce(#{transferNo}, transfer_no),
update_time = sysdate()
where task_id = #{taskId}
</update>
</mapper>
@@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="billKey" column="bill_key" />
<result property="orderNo" column="order_no" />
<result property="trackingNo" column="tracking_no" />
<result property="transferNo" column="transfer_no" />
<result property="customerId" column="customer_id" />
<result property="customerCode" column="customer_code" />
<result property="customerName" column="customer_name" />
@@ -58,6 +59,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="payTotal" column="pay_total" />
<result property="currency" column="currency" />
<result property="arBillStatus" column="ar_bill_status" />
<result property="customerActiveStatus" column="customer_active_status" />
<result property="creditArrearsStatus" column="credit_arrears_status" />
<result property="roundMode" column="round_mode" />
<result property="createBy" column="created_by" />
<result property="createTime" column="create_time" />
@@ -66,7 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectPrcOrderBillVo">
select bill_id, bill_key, order_no, tracking_no, customer_id, customer_code, customer_name,
select bill_id, bill_key, order_no, tracking_no, transfer_no, customer_id, customer_code, customer_name,
pieces, actual_weight, volume, volume_weight, pkg_length, pkg_width, pkg_height,
shipper_name, consignee_name, dest_postcode, warehouse_code, order_time, order_remark,
product_code, product_name, country_code, country_name, weight, biz_date, tms_id,
@@ -74,7 +77,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
set_type, bind_priority, customer_priceset_id, product_country_id,
weight_min, weight_max, weight_label, effective_date, charge_weight,
freight_rate, base_freight_rate, discount_percent, registration_fee,
freight_amount, surcharge_amount, income_total, pay_total, currency, ar_bill_status, round_mode,
freight_amount, surcharge_amount, income_total, pay_total, currency, ar_bill_status,
customer_active_status, credit_arrears_status, round_mode,
created_by, create_time, updated_by, update_time
from prc_order_bill
</sql>
@@ -84,6 +88,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where order_no = #{orderNo}
</select>
<select id="selectPrcOrderBillByTransferNo" parameterType="String" resultMap="PrcOrderBillResult">
<include refid="selectPrcOrderBillVo"/>
where transfer_no = #{transferNo}
order by create_time desc, bill_id desc
limit 1
</select>
<select id="selectPrcOrderBillById" parameterType="String" resultMap="PrcOrderBillResult">
<include refid="selectPrcOrderBillVo"/>
where bill_id = #{billId}
@@ -117,6 +128,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="trackingNo != null and trackingNo != ''">
AND tracking_no like concat('%', #{trackingNo}, '%')
</if>
<if test="transferNo != null and transferNo != ''">
AND transfer_no like concat('%', #{transferNo}, '%')
</if>
<if test="customerActiveStatus != null and customerActiveStatus != ''">
AND customer_active_status = #{customerActiveStatus}
</if>
<if test="creditArrearsStatus != null and creditArrearsStatus != ''">
AND credit_arrears_status = #{creditArrearsStatus}
</if>
<if test="customerCode != null and customerCode != ''">
AND customer_code like concat('%', #{customerCode}, '%')
</if>
@@ -282,7 +302,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertPrcOrderBill" parameterType="PrcOrderBill">
insert into prc_order_bill (
bill_id, bill_key, order_no, tracking_no, customer_id, customer_code, customer_name,
bill_id, bill_key, order_no, tracking_no, transfer_no, customer_id, customer_code, customer_name,
pieces, actual_weight, volume, volume_weight, pkg_length, pkg_width, pkg_height,
shipper_name, consignee_name, dest_postcode, warehouse_code, order_time, order_remark,
product_code, product_name, country_code, country_name, weight, biz_date, tms_id,
@@ -290,10 +310,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
set_type, bind_priority, customer_priceset_id, product_country_id,
weight_min, weight_max, weight_label, effective_date, charge_weight,
freight_rate, base_freight_rate, discount_percent, registration_fee,
freight_amount, surcharge_amount, income_total, pay_total, currency, ar_bill_status, round_mode,
freight_amount, surcharge_amount, income_total, pay_total, currency, ar_bill_status,
customer_active_status, credit_arrears_status, round_mode,
create_time
) values (
#{billId}, #{billKey}, #{orderNo}, #{trackingNo}, #{customerId}, #{customerCode}, #{customerName},
#{billId}, #{billKey}, #{orderNo}, #{trackingNo}, #{transferNo}, #{customerId}, #{customerCode}, #{customerName},
#{pieces}, #{actualWeight}, #{volume}, #{volumeWeight}, #{pkgLength}, #{pkgWidth}, #{pkgHeight},
#{shipperName}, #{consigneeName}, #{destPostcode}, #{warehouseCode}, #{orderTime}, #{orderRemark},
#{productCode}, #{productName}, #{countryCode}, #{countryName}, #{weight}, #{bizDate}, #{tmsId},
@@ -301,7 +322,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{setType}, #{bindPriority}, #{customerPricesetId}, #{productCountryId},
#{weightMin}, #{weightMax}, #{weightLabel}, #{effectiveDate}, #{chargeWeight},
#{freightRate}, #{baseFreightRate}, #{discountPercent}, #{registrationFee},
#{freightAmount}, #{surchargeAmount}, #{incomeTotal}, #{payTotal}, #{currency}, #{arBillStatus}, #{roundMode},
#{freightAmount}, #{surchargeAmount}, #{incomeTotal}, #{payTotal}, #{currency}, #{arBillStatus},
#{customerActiveStatus}, #{creditArrearsStatus}, #{roundMode},
sysdate()
)
</insert>
@@ -310,6 +332,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update prc_order_bill
set bill_key = #{billKey},
tracking_no = #{trackingNo},
transfer_no = #{transferNo},
customer_id = #{customerId},
customer_code = #{customerCode},
customer_name = #{customerName},
@@ -358,6 +381,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
income_total = #{incomeTotal},
pay_total = #{payTotal},
currency = #{currency},
customer_active_status = #{customerActiveStatus},
credit_arrears_status = #{creditArrearsStatus},
round_mode = #{roundMode},
update_time = sysdate()
where bill_id = #{billId}