Enhance price set import functionality with preview options and update handling. Added new endpoints for previewing product library pulls and Excel imports, along with support for update-only imports. Updated internationalization messages for import success and error scenarios.
This commit is contained in:
@@ -185,6 +185,66 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
order by p.product_code asc, c.country_name asc, c.zone_code asc, c.weight_min asc, c.detail_id asc
|
||||
</insert>
|
||||
|
||||
<select id="selectFixedDetailsFromLibrary" resultMap="PrcPriceSetDetailResult">
|
||||
select
|
||||
null as psd_id,
|
||||
null as price_set_id,
|
||||
null as psv_id,
|
||||
null as psp_id,
|
||||
p.product_code,
|
||||
p.product_name,
|
||||
c.country_code,
|
||||
c.country_name,
|
||||
c.zone_id,
|
||||
c.zone_code,
|
||||
c.zone_name,
|
||||
null as zd_id,
|
||||
null as wsd_id,
|
||||
case
|
||||
when c.weight_min is null and c.weight_max is null then null
|
||||
else concat(
|
||||
ifnull(trim(trailing '0' from trim(trailing '.' from cast(c.weight_min as char))), ''),
|
||||
'<W≤',
|
||||
ifnull(trim(trailing '0' from trim(trailing '.' from cast(c.weight_max as char))), '')
|
||||
)
|
||||
end as weight_label,
|
||||
c.weight_min,
|
||||
c.weight_max,
|
||||
c.detail_id as product_country_id,
|
||||
c.freight_price as fv_value,
|
||||
c.registration_fee as fv_registration_fee,
|
||||
null as base_freight_price,
|
||||
null as base_registration_fee,
|
||||
null as discount_value,
|
||||
'HALF_UP' as round_mode,
|
||||
null as pr_id,
|
||||
c.effective_date,
|
||||
c.expire_date,
|
||||
null as create_time,
|
||||
null as update_time
|
||||
from product_country c
|
||||
inner join product p on p.product_id = c.product_id
|
||||
<where>
|
||||
and p.status = '1'
|
||||
and p.product_id = (
|
||||
select max(p2.product_id) from product p2
|
||||
where p2.product_code = p.product_code and p2.status = '1'
|
||||
)
|
||||
and ifnull(c.status, '1') <> '2'
|
||||
<choose>
|
||||
<when test="openOnly">
|
||||
and (c.effective_date is null or date(c.effective_date) <= curdate())
|
||||
and (c.expire_date is null or date(c.expire_date) > curdate())
|
||||
</when>
|
||||
<otherwise>
|
||||
and date(c.effective_date) <= date(#{asOf})
|
||||
and (c.expire_date is null or date(c.expire_date) > date(#{asOf}))
|
||||
</otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
order by p.product_code asc, c.country_name asc, c.zone_code asc, c.weight_min asc, c.detail_id asc
|
||||
</select>
|
||||
|
||||
<insert id="insertDiscountDetailsFromLibrary">
|
||||
insert ignore into prc_price_set_detail (
|
||||
price_set_id, psv_id, product_code, product_name, round_mode, create_time
|
||||
@@ -261,6 +321,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertPrcPriceSetDetailBatch" useGeneratedKeys="true" keyProperty="psdId">
|
||||
insert into prc_price_set_detail (
|
||||
price_set_id, psv_id, psp_id, product_code, product_name,
|
||||
country_code, country_name, zone_id, zone_code, zone_name,
|
||||
zd_id, wsd_id, weight_label, weight_min, weight_max, product_country_id,
|
||||
fv_value, fv_registration_fee, discount_value, round_mode, pr_id,
|
||||
effective_date, expire_date, create_time
|
||||
) values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.priceSetId}, #{item.psvId}, #{item.pspId}, #{item.productCode}, #{item.productName},
|
||||
#{item.countryCode}, #{item.countryName}, #{item.zoneId}, #{item.zoneCode}, #{item.zoneName},
|
||||
#{item.zdId}, #{item.wsdId}, #{item.weightLabel}, #{item.weightMin}, #{item.weightMax}, #{item.productCountryId},
|
||||
#{item.fvValue}, #{item.fvRegistrationFee}, #{item.discountValue},
|
||||
ifnull(#{item.roundMode}, 'HALF_UP'), #{item.prId},
|
||||
#{item.effectiveDate}, #{item.expireDate}, sysdate()
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- Null means keep existing value (import empty freight/registration skips overwrite). -->
|
||||
<update id="updateDetailPrices">
|
||||
update prc_price_set_detail
|
||||
|
||||
@@ -125,6 +125,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
order by p.product_code asc
|
||||
</insert>
|
||||
|
||||
<select id="selectFromLibrary" resultMap="PrcPriceSetProductResult">
|
||||
select
|
||||
null as psp_id,
|
||||
null as price_set_id,
|
||||
null as psv_id,
|
||||
p.product_code,
|
||||
p.product_name,
|
||||
p.service_level,
|
||||
p.cargo_attr,
|
||||
p.dest_region,
|
||||
p.update_note,
|
||||
ifnull(p.tax_mode, 'TAX_INCLUDED') as tax_mode,
|
||||
p.product_id as source_product_id,
|
||||
p.source_sheet,
|
||||
null as create_time,
|
||||
null as update_time
|
||||
from product p
|
||||
where p.status = '1'
|
||||
and p.product_id = (
|
||||
select max(p2.product_id) from product p2
|
||||
where p2.product_code = p.product_code and p2.status = '1'
|
||||
)
|
||||
order by p.product_code asc
|
||||
</select>
|
||||
|
||||
<update id="bindDetailPspByPsvId">
|
||||
update prc_price_set_detail d
|
||||
inner join prc_price_set_product sp
|
||||
|
||||
@@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="effectiveTime" column="effective_time" />
|
||||
<result property="expireTime" column="expire_time" />
|
||||
<result property="status" column="status" />
|
||||
<result property="priceBuildMode" column="price_build_mode"/>
|
||||
<result property="createBy" column="created_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="updated_by" />
|
||||
@@ -20,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<sql id="selectPrcPriceSetVersionVo">
|
||||
select psv_id, price_set_id, version_no, version_seq, effective_time, expire_time, status,
|
||||
created_by, create_time, updated_by, update_time
|
||||
price_build_mode, created_by, create_time, updated_by, update_time
|
||||
from prc_price_set_version
|
||||
</sql>
|
||||
|
||||
@@ -57,6 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="effectiveTime != null">effective_time,</if>
|
||||
<if test="expireTime != null">expire_time,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="priceBuildMode != null and priceBuildMode != ''">price_build_mode,</if>
|
||||
<if test="createBy != null and createBy != ''">created_by,</if>
|
||||
create_time
|
||||
) values (
|
||||
@@ -66,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="effectiveTime != null">#{effectiveTime},</if>
|
||||
<if test="expireTime != null">#{expireTime},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="priceBuildMode != null and priceBuildMode != ''">#{priceBuildMode},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
@@ -79,6 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="effectiveTime != null">effective_time = #{effectiveTime},</if>
|
||||
expire_time = #{expireTime},
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="priceBuildMode != null and priceBuildMode != ''">price_build_mode = #{priceBuildMode},</if>
|
||||
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
|
||||
Reference in New Issue
Block a user