新增按国家去重区块标题接口,优化计费列表请求方式
This commit is contained in:
@@ -16,8 +16,10 @@ public class PrcSurcharge extends BaseEntity
|
||||
private String scName;
|
||||
/** 字典 bms_fee_type */
|
||||
private String feeType;
|
||||
/** FIXED / WEIGHT / RATE */
|
||||
/** 计费方式:ALWAYS/每票都收、POSTCODE/命中邮编、ZONE/命中分区、EXTRA_KG/超重续收、WEIGHT/超重、SIZE/超尺寸、RETURN/退件、MANUAL/暂不计费 */
|
||||
private String chargeType;
|
||||
/** 渠道产品(字典 payment_product_type.dict_value) */
|
||||
private String dictValue;
|
||||
private BigDecimal chargeValue;
|
||||
private String currency;
|
||||
/** 字典 bms_round_mode:UP / DOWN / HALF_UP */
|
||||
@@ -29,6 +31,8 @@ public class PrcSurcharge extends BaseEntity
|
||||
public static final String IS_DEL_YES = "1";
|
||||
private String isDel;
|
||||
private String countryCode;
|
||||
/** 分区/区块(对应 pay_postcode_group.block_title) */
|
||||
private String blockTitle;
|
||||
private String scNote;
|
||||
private Long tmsId;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,10 @@ public interface PayPostcodeMapper
|
||||
{
|
||||
List<PayPostcodeGroup> selectGroupList(PayPostcodeGroup query);
|
||||
|
||||
/** 按国家去重区块标题 */
|
||||
List<String> selectBlockTitlesByCountry(@Param("countryCode") String countryCode,
|
||||
@Param("countryName") String countryName);
|
||||
|
||||
PayPostcodeGroup selectGroupById(Long groupId);
|
||||
|
||||
int updateGroup(PayPostcodeGroup group);
|
||||
|
||||
@@ -10,6 +10,9 @@ public interface IPayPostcodeService
|
||||
{
|
||||
List<PayPostcodeGroup> selectGroupList(PayPostcodeGroup query);
|
||||
|
||||
/** 附加费分区下拉:按国家去重区块标题 */
|
||||
List<String> selectBlockTitlesByCountry(String countryCode, String countryName);
|
||||
|
||||
PayPostcodeGroup selectGroupById(Long groupId);
|
||||
|
||||
int updateGroup(PayPostcodeGroup group);
|
||||
|
||||
+6
@@ -34,6 +34,12 @@ public class PayPostcodeServiceImpl implements IPayPostcodeService
|
||||
return payPostcodeMapper.selectGroupList(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> selectBlockTitlesByCountry(String countryCode, String countryName)
|
||||
{
|
||||
return payPostcodeMapper.selectBlockTitlesByCountry(countryCode, countryName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PayPostcodeGroup selectGroupById(Long groupId)
|
||||
{
|
||||
|
||||
+5
-13
@@ -1716,21 +1716,13 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
RoundingMode rm = resolveFeeRoundingMode(surcharge.getRoundMode());
|
||||
String chargeType = surcharge.getChargeType() == null ? "FIXED" : surcharge.getChargeType().toUpperCase();
|
||||
BigDecimal amount;
|
||||
if ("WEIGHT".equals(chargeType))
|
||||
String chargeType = surcharge.getChargeType() == null ? "MANUAL" : surcharge.getChargeType().toUpperCase();
|
||||
// MANUAL=暂不计费;其他计费方式暂按固定金额 charge_value
|
||||
if ("MANUAL".equals(chargeType))
|
||||
{
|
||||
amount = surcharge.getChargeValue().multiply(nz(weight));
|
||||
return BigDecimal.ZERO.setScale(4, rm);
|
||||
}
|
||||
else if ("RATE".equals(chargeType))
|
||||
{
|
||||
amount = nz(freightAmount).multiply(surcharge.getChargeValue());
|
||||
}
|
||||
else
|
||||
{
|
||||
amount = surcharge.getChargeValue();
|
||||
}
|
||||
return amount.setScale(4, rm);
|
||||
return surcharge.getChargeValue().setScale(4, rm);
|
||||
}
|
||||
|
||||
private RoundingMode resolveFeeRoundingMode(String roundMode)
|
||||
|
||||
+8
@@ -79,11 +79,13 @@ public class PrcSurchargeServiceImpl implements IPrcSurchargeService
|
||||
fresh.setScName(surcharge.getScName());
|
||||
fresh.setFeeType(StringUtils.isNotEmpty(surcharge.getFeeType()) ? surcharge.getFeeType() : old.getFeeType());
|
||||
fresh.setChargeType(surcharge.getChargeType());
|
||||
fresh.setDictValue(surcharge.getDictValue());
|
||||
fresh.setChargeValue(surcharge.getChargeValue());
|
||||
fresh.setCurrency(surcharge.getCurrency());
|
||||
fresh.setRoundMode(surcharge.getRoundMode());
|
||||
fresh.setSsCode(old.getSsCode());
|
||||
fresh.setCountryCode(surcharge.getCountryCode());
|
||||
fresh.setBlockTitle(surcharge.getBlockTitle());
|
||||
fresh.setScNote(surcharge.getScNote());
|
||||
applyInsertDefaults(fresh);
|
||||
fresh.setCreateBy(operator);
|
||||
@@ -99,10 +101,12 @@ public class PrcSurchargeServiceImpl implements IPrcSurchargeService
|
||||
return eq(old.getScName(), updated.getScName())
|
||||
&& eq(old.getFeeType(), updated.getFeeType())
|
||||
&& eq(old.getChargeType(), updated.getChargeType())
|
||||
&& eq(old.getDictValue(), updated.getDictValue())
|
||||
&& eqDecimal(old.getChargeValue(), updated.getChargeValue())
|
||||
&& eq(old.getCurrency(), updated.getCurrency())
|
||||
&& eq(old.getRoundMode(), updated.getRoundMode())
|
||||
&& eq(old.getCountryCode(), updated.getCountryCode())
|
||||
&& eq(old.getBlockTitle(), updated.getBlockTitle())
|
||||
&& eq(old.getScNote(), updated.getScNote());
|
||||
}
|
||||
|
||||
@@ -161,6 +165,10 @@ public class PrcSurchargeServiceImpl implements IPrcSurchargeService
|
||||
{
|
||||
surcharge.setRoundMode("HALF_UP");
|
||||
}
|
||||
if (StringUtils.isEmpty(surcharge.getChargeType()))
|
||||
{
|
||||
surcharge.setChargeType("MANUAL");
|
||||
}
|
||||
}
|
||||
|
||||
private void validate(PrcSurcharge surcharge)
|
||||
|
||||
+5
-13
@@ -1841,21 +1841,13 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
RoundingMode rm = resolveRoundingMode(rel.getRoundMode());
|
||||
String chargeType = rel.getChargeType() == null ? "FIXED" : rel.getChargeType().toUpperCase();
|
||||
BigDecimal amount;
|
||||
if ("WEIGHT".equals(chargeType))
|
||||
String chargeType = rel.getChargeType() == null ? "MANUAL" : rel.getChargeType().toUpperCase();
|
||||
// MANUAL=暂不计费;其他计费方式暂按固定金额 charge_value
|
||||
if ("MANUAL".equals(chargeType))
|
||||
{
|
||||
amount = rel.getChargeValue().multiply(nvl(weight));
|
||||
return BigDecimal.ZERO.setScale(2, rm);
|
||||
}
|
||||
else if ("RATE".equals(chargeType))
|
||||
{
|
||||
amount = nvl(freightAmount).multiply(rel.getChargeValue());
|
||||
}
|
||||
else
|
||||
{
|
||||
amount = rel.getChargeValue();
|
||||
}
|
||||
return amount.setScale(2, rm);
|
||||
return rel.getChargeValue().setScale(2, rm);
|
||||
}
|
||||
|
||||
private void persistQuote(String quoteKey, TmsPriceQuoteRequest request, BigDecimal weight,
|
||||
|
||||
@@ -30,6 +30,26 @@
|
||||
order by group_id desc
|
||||
</select>
|
||||
|
||||
<select id="selectBlockTitlesByCountry" resultType="string">
|
||||
select distinct block_title
|
||||
from pay_postcode_group
|
||||
where block_title is not null
|
||||
and block_title <> ''
|
||||
<if test="countryCode != null and countryCode != ''">
|
||||
and (
|
||||
upper(ifnull(country_code, '')) = upper(#{countryCode})
|
||||
or upper(ifnull(catalog_country, '')) = upper(#{countryCode})
|
||||
)
|
||||
</if>
|
||||
<if test="countryName != null and countryName != ''">
|
||||
and (
|
||||
country_name like concat('%', #{countryName}, '%')
|
||||
or catalog_country like concat('%', #{countryName}, '%')
|
||||
)
|
||||
</if>
|
||||
order by block_title asc
|
||||
</select>
|
||||
|
||||
<select id="selectLineList" parameterType="com.bms.price.domain.PayPostcodeLine" resultType="com.bms.price.domain.PayPostcodeLine">
|
||||
select line_id as lineId, group_id as groupId, country_name as countryName, country_code as countryCode,
|
||||
region_name as regionName, region_name_cn as regionNameCn, city_name as cityName, region_code as regionCode,
|
||||
|
||||
@@ -9,12 +9,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="scName" column="sc_name" />
|
||||
<result property="feeType" column="fee_type" />
|
||||
<result property="chargeType" column="charge_type" />
|
||||
<result property="dictValue" column="dict_value" />
|
||||
<result property="chargeValue" column="charge_value" />
|
||||
<result property="currency" column="currency" />
|
||||
<result property="roundMode" column="round_mode" />
|
||||
<result property="ssCode" column="ss_code" />
|
||||
<result property="isDel" column="is_del" />
|
||||
<result property="countryCode" column="country_code" />
|
||||
<result property="blockTitle" column="block_title" />
|
||||
<result property="scNote" column="sc_note" />
|
||||
<result property="tmsId" column="tms_id" />
|
||||
<result property="createBy" column="created_by" />
|
||||
@@ -24,8 +26,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcSurchargeVo">
|
||||
select sc_id, sc_name, fee_type, charge_type, charge_value, currency, round_mode, ss_code, is_del,
|
||||
country_code, sc_note, tms_id, created_by, create_time, updated_by, update_time
|
||||
select sc_id, sc_name, fee_type, charge_type, dict_value, charge_value, 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>
|
||||
|
||||
@@ -55,6 +57,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="chargeType != null and chargeType != ''">
|
||||
AND charge_type = #{chargeType}
|
||||
</if>
|
||||
<if test="dictValue != null and dictValue != ''">
|
||||
AND dict_value = #{dictValue}
|
||||
</if>
|
||||
<if test="blockTitle != null and blockTitle != ''">
|
||||
AND block_title like concat('%', #{blockTitle}, '%')
|
||||
</if>
|
||||
<if test="roundMode != null and roundMode != ''">
|
||||
AND round_mode = #{roundMode}
|
||||
</if>
|
||||
@@ -82,12 +90,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="scName != null and scName != ''">sc_name,</if>
|
||||
<if test="feeType != null and feeType != ''">fee_type,</if>
|
||||
<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="currency != null and currency != ''">currency,</if>
|
||||
<if test="roundMode != null and roundMode != ''">round_mode,</if>
|
||||
<if test="ssCode != null and ssCode != ''">ss_code,</if>
|
||||
is_del,
|
||||
<if test="countryCode != null">country_code,</if>
|
||||
<if test="blockTitle != null">block_title,</if>
|
||||
<if test="scNote != null">sc_note,</if>
|
||||
<if test="tmsId != null">tms_id,</if>
|
||||
<if test="createBy != null and createBy != ''">created_by,</if>
|
||||
@@ -96,12 +106,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="scName != null and scName != ''">#{scName},</if>
|
||||
<if test="feeType != null and feeType != ''">#{feeType},</if>
|
||||
<if test="chargeType != null and chargeType != ''">#{chargeType},</if>
|
||||
<if test="dictValue != null">#{dictValue},</if>
|
||||
<if test="chargeValue != null">#{chargeValue},</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>
|
||||
ifnull(#{isDel}, '0'),
|
||||
<if test="countryCode != null">#{countryCode},</if>
|
||||
<if test="blockTitle != null">#{blockTitle},</if>
|
||||
<if test="scNote != null">#{scNote},</if>
|
||||
<if test="tmsId != null">#{tmsId},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
|
||||
Reference in New Issue
Block a user