应付配置的附加费调整

This commit is contained in:
liuminghui
2026-11-18 13:34:00 +08:00
parent ccfb05bf50
commit a72417b2c1
30 changed files with 1338 additions and 107 deletions
@@ -370,28 +370,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by product_id, sort_no, band_id
</select>
<sql id="surchargeColumns">
s.surcharge_id as surchargeId, s.product_id as productId, s.term_id as termId, s.version_no as versionNo,
s.section_name as sectionName, s.fee_name as feeName, s.sc_id as scId, s.zone_name as zoneName,
s.charge_text as chargeText, s.amount, s.currency, s.price_unit as priceUnit, s.fee_desc as feeDesc,
s.period_text as periodText, s.effective_start as effectiveStart, s.effective_end as effectiveEnd,
s.charge_timing as chargeTiming, s.calc_rule as calcRule, s.calc_param as calcParam,
s.weight_min as weightMin, s.weight_max as weightMax, s.postcode_param as postcodeParam,
cfg.length_cm as lengthCm, cfg.width_cm as widthCm, cfg.height_cm as heightCm,
cfg.over_weight_kg as overWeightKg, cfg.extra_weight_kg as extraWeightKg, cfg.postcode_text as postcodeText,
s.sort_no as sortNo
</sql>
<select id="selectSurcharges" resultType="com.bms.price.domain.PaySurcharge">
select surcharge_id as surchargeId, product_id as productId, term_id as termId, version_no as versionNo, section_name as sectionName, fee_name as feeName,
sc_id as scId, zone_name as zoneName, charge_text as chargeText, amount, currency, price_unit as priceUnit, fee_desc as feeDesc,
period_text as periodText, effective_start as effectiveStart, effective_end as effectiveEnd,
charge_timing as chargeTiming, calc_rule as calcRule, calc_param as calcParam,
weight_min as weightMin, weight_max as weightMax, postcode_param as postcodeParam, sort_no as sortNo
from pay_surcharge
where product_id in
select <include refid="surchargeColumns"/>
from pay_surcharge s
left join prc_surcharge cfg on cfg.sc_id = s.sc_id and s.section_name = '附加费配置' and ifnull(cfg.is_del, '0') = '0'
where s.product_id in
<foreach collection="productIds" item="id" open="(" separator="," close=")">#{id}</foreach>
order by product_id, sort_no, surcharge_id
order by s.product_id, s.sort_no, s.surcharge_id
</select>
<select id="selectSurchargesByTerm" resultType="com.bms.price.domain.PaySurcharge">
select surcharge_id as surchargeId, product_id as productId, term_id as termId, version_no as versionNo, section_name as sectionName, fee_name as feeName,
sc_id as scId, zone_name as zoneName, charge_text as chargeText, amount, currency, price_unit as priceUnit, fee_desc as feeDesc,
period_text as periodText, effective_start as effectiveStart, effective_end as effectiveEnd,
charge_timing as chargeTiming, calc_rule as calcRule, calc_param as calcParam,
weight_min as weightMin, weight_max as weightMax, postcode_param as postcodeParam, sort_no as sortNo
from pay_surcharge
where term_id in
select <include refid="surchargeColumns"/>
from pay_surcharge s
left join prc_surcharge cfg on cfg.sc_id = s.sc_id and s.section_name = '附加费配置' and ifnull(cfg.is_del, '0') = '0'
where s.term_id in
<foreach collection="termIds" item="id" open="(" separator="," close=")">#{id}</foreach>
order by product_id, sort_no, surcharge_id
order by s.product_id, s.sort_no, s.surcharge_id
</select>
<select id="selectExtraLines" resultType="com.bms.price.domain.PayExtraLine">
@@ -418,6 +424,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delete from pay_surcharge where term_id in
<foreach collection="termIds" item="id" open="(" separator="," close=")">#{id}</foreach>
</delete>
<delete id="deleteSurchargesByTermSection">
delete from pay_surcharge
where term_id = #{termId}
and section_name = #{sectionName}
</delete>
<update id="refreshSurchargeCount">
update pay_product
set surcharge_count = (
select count(1) from pay_surcharge where product_id = #{productId}
) + (
select count(1) from prc_surcharge_bind where product_id = #{productId}
),
update_time = sysdate()
where product_id = #{productId}
</update>
<delete id="deleteExtraLinesByTerm">
delete from pay_extra_line where term_id in
<foreach collection="termIds" item="id" open="(" separator="," close=")">#{id}</foreach>
@@ -0,0 +1,60 @@
<?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.bms.price.mapper.PrcSurchargeBindMapper">
<sql id="bindColumns">
b.bind_id as bindId, b.product_id as productId, b.product_type as productType, b.sc_id as scId, b.sort_no as sortNo,
b.created_by as createdBy, b.create_time as createTime, b.updated_by as updatedBy, b.update_time as updateTime,
c.sc_name as scName, c.charge_type as chargeType, c.charge_value as chargeValue, c.currency, c.ss_code as ssCode,
c.block_title as blockTitle, c.sc_note as scNote,
c.length_cm as lengthCm, c.width_cm as widthCm, c.height_cm as heightCm,
c.over_weight_kg as overWeightKg, c.extra_weight_kg as extraWeightKg, c.postcode_text as postcodeText
</sql>
<select id="selectByProduct" resultType="com.bms.price.domain.PrcSurchargeBind">
select <include refid="bindColumns"/>
from prc_surcharge_bind b
inner join prc_surcharge c on c.sc_id = b.sc_id and ifnull(c.is_del, '0') = '0'
where b.product_id = #{productId}
and b.product_type = #{productType}
order by b.sort_no, b.bind_id
</select>
<select id="selectByProductIds" resultType="com.bms.price.domain.PrcSurchargeBind">
select <include refid="bindColumns"/>
from prc_surcharge_bind b
inner join prc_surcharge c on c.sc_id = b.sc_id and ifnull(c.is_del, '0') = '0'
where b.product_id in
<foreach collection="productIds" item="id" open="(" separator="," close=")">#{id}</foreach>
order by b.product_id, b.sort_no, b.bind_id
</select>
<delete id="deleteByProduct">
delete from prc_surcharge_bind
where product_id = #{productId}
and product_type = #{productType}
</delete>
<delete id="deleteByProductIds">
delete from prc_surcharge_bind
where product_id in
<foreach collection="productIds" item="id" open="(" separator="," close=")">#{id}</foreach>
</delete>
<insert id="insertBinds">
insert into prc_surcharge_bind (product_id, product_type, sc_id, sort_no, created_by, create_time)
values
<foreach collection="list" item="row" separator=",">
(#{row.productId}, #{row.productType}, #{row.scId}, ifnull(#{row.sortNo}, 0), #{row.createdBy}, sysdate())
</foreach>
</insert>
<update id="rebindScId">
update prc_surcharge_bind
set sc_id = #{newScId}, update_time = sysdate()
where sc_id = #{oldScId}
</update>
</mapper>
@@ -11,6 +11,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="chargeType" column="charge_type" />
<result property="dictValue" column="dict_value" />
<result property="chargeValue" column="charge_value" />
<result property="lengthCm" column="length_cm" />
<result property="widthCm" column="width_cm" />
<result property="heightCm" column="height_cm" />
<result property="overWeightKg" column="over_weight_kg" />
<result property="extraWeightKg" column="extra_weight_kg" />
<result property="postcodeText" column="postcode_text" />
<result property="currency" column="currency" />
<result property="roundMode" column="round_mode" />
<result property="ssCode" column="ss_code" />
@@ -26,7 +32,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectPrcSurchargeVo">
select sc_id, sc_name, fee_type, charge_type, dict_value, charge_value, currency, round_mode,
select sc_id, sc_name, fee_type, charge_type, dict_value, charge_value,
length_cm, width_cm, height_cm, over_weight_kg, extra_weight_kg, postcode_text, currency, round_mode,
ss_code, is_del, country_code, block_title, sc_note, tms_id, created_by, create_time, updated_by, update_time
from prc_surcharge
</sql>
@@ -92,6 +99,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="chargeType != null and chargeType != ''">charge_type,</if>
<if test="dictValue != null">dict_value,</if>
<if test="chargeValue != null">charge_value,</if>
<if test="lengthCm != null">length_cm,</if>
<if test="widthCm != null">width_cm,</if>
<if test="heightCm != null">height_cm,</if>
<if test="overWeightKg != null">over_weight_kg,</if>
<if test="extraWeightKg != null">extra_weight_kg,</if>
<if test="postcodeText != null">postcode_text,</if>
<if test="currency != null and currency != ''">currency,</if>
<if test="roundMode != null and roundMode != ''">round_mode,</if>
<if test="ssCode != null and ssCode != ''">ss_code,</if>
@@ -108,6 +121,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="chargeType != null and chargeType != ''">#{chargeType},</if>
<if test="dictValue != null">#{dictValue},</if>
<if test="chargeValue != null">#{chargeValue},</if>
<if test="lengthCm != null">#{lengthCm},</if>
<if test="widthCm != null">#{widthCm},</if>
<if test="heightCm != null">#{heightCm},</if>
<if test="overWeightKg != null">#{overWeightKg},</if>
<if test="extraWeightKg != null">#{extraWeightKg},</if>
<if test="postcodeText != null">#{postcodeText},</if>
<if test="currency != null and currency != ''">#{currency},</if>
<if test="roundMode != null and roundMode != ''">#{roundMode},</if>
<if test="ssCode != null and ssCode != ''">#{ssCode},</if>
@@ -132,4 +151,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</update>
<update id="rebindPayConfig">
update pay_surcharge
set sc_id = #{newScId},
fee_name = #{feeName},
zone_name = #{zoneName},
amount = #{amount},
currency = ifnull(#{currency}, currency),
fee_desc = #{feeDesc},
calc_rule = #{calcRule},
charge_text = #{chargeText},
price_unit = ifnull(#{priceUnit}, price_unit)
where sc_id = #{oldScId}
and section_name = '附加费配置'
</update>
</mapper>