优化计费逻辑

This commit is contained in:
wuweihua
2026-10-17 01:37:33 +08:00
parent 52f714c760
commit db6f5e882a
29 changed files with 1460 additions and 145 deletions
@@ -150,4 +150,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update_time = sysdate()
where task_id = #{taskId}
</update>
<delete id="deleteByTransferNo">
delete from prc_billing_task
where transfer_no = #{transferNo}
</delete>
</mapper>
@@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="redlineAmount" column="redline_amount" />
<result property="salesAmount" column="sales_amount" />
<result property="incomeTotal" column="income_total" />
<result property="refundStatus" column="refund_status" />
<result property="belongSaler" column="belong_saler" />
<result property="belongSalerCode" column="belong_saler_code" />
<result property="settlementMan" column="settlement_man" />
@@ -24,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectPrcIncomeBillVo">
select income_bill_id, bill_id, currency, product_amount, redline_amount,
sales_amount, income_total,
sales_amount, income_total, refund_status,
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
create_by, create_time, update_by, update_time
from prc_income_bill
@@ -51,12 +52,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertPrcIncomeBill" parameterType="PrcIncomeBill">
insert into prc_income_bill (
income_bill_id, bill_id, currency, product_amount, redline_amount,
sales_amount, income_total,
sales_amount, income_total, refund_status,
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
create_by, create_time
) values (
#{incomeBillId}, #{billId}, #{currency}, #{productAmount}, #{redlineAmount},
#{salesAmount}, #{incomeTotal},
#{salesAmount}, #{incomeTotal}, #{refundStatus},
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode},
#{createBy}, sysdate()
)
@@ -69,6 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
redline_amount = #{redlineAmount},
sales_amount = #{salesAmount},
income_total = #{incomeTotal},
refund_status = #{refundStatus},
belong_saler = #{belongSaler},
belong_saler_code = #{belongSalerCode},
settlement_man = #{settlementMan},
@@ -81,12 +83,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="upsertPrcIncomeBill" parameterType="PrcIncomeBill">
insert into prc_income_bill (
income_bill_id, bill_id, currency, product_amount, redline_amount,
sales_amount, income_total,
sales_amount, income_total, refund_status,
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
create_by, create_time
) values (
#{incomeBillId}, #{billId}, #{currency}, #{productAmount}, #{redlineAmount},
#{salesAmount}, #{incomeTotal},
#{salesAmount}, #{incomeTotal}, #{refundStatus},
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode},
#{createBy}, sysdate()
)
@@ -96,6 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
redline_amount = values(redline_amount),
sales_amount = values(sales_amount),
income_total = values(income_total),
refund_status = values(refund_status),
belong_saler = values(belong_saler),
belong_saler_code = values(belong_saler_code),
settlement_man = values(settlement_man),
@@ -72,6 +72,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="creditArrearsStatus" column="credit_arrears_status" />
<result property="refundStatus" column="refund_status" />
<result property="billingFailStatus" column="billing_fail_status" />
<result property="errorMessage" column="error_message" />
<result property="orderStatus" column="order_status" />
<result property="blPickup" column="bl_pickup" />
<result property="pickupDate" column="pickup_date" />
<result property="roundMode" column="round_mode" />
<result property="createBy" column="created_by" />
<result property="createTime" column="create_time" />
@@ -95,7 +99,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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,
customer_active_status, credit_arrears_status, refund_status, billing_fail_status, round_mode,
customer_active_status, credit_arrears_status, refund_status, billing_fail_status, error_message,
order_status, bl_pickup, pickup_date, round_mode,
created_by, create_time, updated_by, update_time
from prc_order_bill p
</sql>
@@ -106,7 +111,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
p.belong_saler, p.belong_saler_code, p.settlement_man, p.settlement_man_code, p.service_man, p.service_man_code,
p.customer_id, p.customer_code, p.customer_name,
p.pieces, p.actual_weight, p.receive_weight, p.volume, p.volume_weight, p.pkg_length, p.pkg_width, p.pkg_height,
p.shipper_name, p.consignee_name, p.dest_postcode, p.warehouse_code, p.order_time, e.pickup_date, p.order_remark,
p.shipper_name, p.consignee_name, p.dest_postcode, p.warehouse_code, p.order_time, p.order_status, p.bl_pickup, p.pickup_date, p.order_remark,
p.product_code, p.product_name, p.country_code, p.country_name, p.weight, p.biz_date, p.tms_id,
p.match_source, p.match_message, p.price_set_id, p.price_set_code, p.price_set_name,
p.set_type, p.bind_priority, p.customer_priceset_id, p.psv_id, p.psd_id, p.product_country_id,
@@ -118,10 +123,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where f.bill_id = p.bill_id
and f.ar_bill_status = #{feeArBillStatus}) as income_total,
p.pay_total, p.currency, p.ar_bill_status,
p.customer_active_status, p.credit_arrears_status, p.refund_status, p.billing_fail_status, p.round_mode,
p.customer_active_status, p.credit_arrears_status, p.refund_status, p.billing_fail_status, p.error_message, p.round_mode,
p.created_by, p.create_time, p.updated_by, p.update_time
from prc_order_bill p
left join prc_order_bill_ext e on e.bill_id = p.bill_id
</sql>
<select id="selectPrcOrderBillByOrderNo" parameterType="String" resultMap="PrcOrderBillResult">
@@ -281,6 +285,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{rno}
</foreach>
</if>
<if test="orderIdentifiers != null and orderIdentifiers.size() > 0">
AND (
p.order_no IN
<foreach collection="orderIdentifiers" item="idn" open="(" separator="," close=")">
#{idn}
</foreach>
OR p.tracking_no IN
<foreach collection="orderIdentifiers" item="idn" open="(" separator="," close=")">
#{idn}
</foreach>
OR p.transfer_no IN
<foreach collection="orderIdentifiers" item="idn" open="(" separator="," close=")">
#{idn}
</foreach>
)
</if>
<if test="customerActiveStatus != null and customerActiveStatus != ''">
AND p.customer_active_status = #{customerActiveStatus}
</if>
@@ -544,28 +564,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
belong_saler, belong_saler_code, settlement_man, settlement_man_code, service_man, service_man_code,
customer_id, customer_code, customer_name,
pieces, actual_weight, receive_weight, volume, volume_weight, pkg_length, pkg_width, pkg_height,
shipper_name, consignee_name, dest_postcode, warehouse_code, order_time, order_remark,
shipper_name, consignee_name, dest_postcode, warehouse_code, order_time, order_status, bl_pickup, pickup_date, order_remark,
product_code, product_name, country_code, country_name, weight, biz_date, tms_id,
match_source, match_message, price_set_id, price_set_code, price_set_name,
set_type, bind_priority, customer_priceset_id, psv_id, psd_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,
customer_active_status, credit_arrears_status, refund_status, billing_fail_status, round_mode,
customer_active_status, credit_arrears_status, refund_status, billing_fail_status, error_message, round_mode,
create_time
) values (
#{billId}, #{billKey}, #{orderNo}, #{trackingNo}, #{transferNo},
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode}, #{serviceMan}, #{serviceManCode},
#{customerId}, #{customerCode}, #{customerName},
#{pieces}, #{actualWeight}, #{receiveWeight}, #{volume}, #{volumeWeight}, #{pkgLength}, #{pkgWidth}, #{pkgHeight},
#{shipperName}, #{consigneeName}, #{destPostcode}, #{warehouseCode}, #{orderTime}, #{orderRemark},
#{shipperName}, #{consigneeName}, #{destPostcode}, #{warehouseCode}, #{orderTime}, #{orderStatus}, #{blPickup}, #{pickupDate}, #{orderRemark},
#{productCode}, #{productName}, #{countryCode}, #{countryName}, #{weight}, #{bizDate}, #{tmsId},
#{matchSource}, #{matchMessage}, #{priceSetId}, #{priceSetCode}, #{priceSetName},
#{setType}, #{bindPriority}, #{customerPricesetId}, #{psvId}, #{psdId}, #{productCountryId},
#{weightMin}, #{weightMax}, #{weightLabel}, #{effectiveDate}, #{chargeWeight},
#{freightRate}, #{baseFreightRate}, #{discountPercent}, #{registrationFee},
#{freightAmount}, #{surchargeAmount}, #{incomeTotal}, #{payTotal}, #{currency}, #{arBillStatus},
#{customerActiveStatus}, #{creditArrearsStatus}, #{refundStatus}, #{billingFailStatus}, #{roundMode},
#{customerActiveStatus}, #{creditArrearsStatus}, #{refundStatus}, #{billingFailStatus}, #{errorMessage}, #{roundMode},
sysdate()
)
</insert>
@@ -597,6 +617,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
dest_postcode = #{destPostcode},
warehouse_code = #{warehouseCode},
order_time = #{orderTime},
order_status = #{orderStatus},
bl_pickup = #{blPickup},
pickup_date = #{pickupDate},
order_remark = #{orderRemark},
product_code = #{productCode},
product_name = #{productName},
@@ -636,6 +659,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
credit_arrears_status = #{creditArrearsStatus},
refund_status = #{refundStatus},
billing_fail_status = #{billingFailStatus},
error_message = #{errorMessage},
round_mode = #{roundMode},
update_time = sysdate()
where bill_id = #{billId}