应付邮编调整和订单应付计费的附加费调整
This commit is contained in:
@@ -34,6 +34,12 @@ public class PayPostcodeGroup extends BaseEntity
|
||||
/** 渠道名称,从表头识别,可在页面修改 */
|
||||
private String channelName;
|
||||
|
||||
/** 修改渠道名称前的原名称。分区维护按这个渠道收窄 */
|
||||
private String oldChannelName;
|
||||
|
||||
/** 为 true 时国家下的全部分区都查出来,不按渠道收窄 */
|
||||
private Boolean allChannels;
|
||||
|
||||
/** 目录里的服务类型,和报价产品对应 */
|
||||
private String serviceType;
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@ public class PayPostcodeLine implements Serializable
|
||||
|
||||
private String countryCode;
|
||||
|
||||
/** 查询条件:只看这个渠道下的邮编 */
|
||||
private String channelName;
|
||||
|
||||
private String regionName;
|
||||
|
||||
private String regionNameCn;
|
||||
|
||||
@@ -84,6 +84,9 @@ public class PaySurcharge
|
||||
/** 来自附加费配置的命中邮编。本表不保存 */
|
||||
private String postcodeText;
|
||||
|
||||
/** 来自附加费配置的适用国家。本表不保存 */
|
||||
private String countryCode;
|
||||
|
||||
/** 适用重量下限,空表示不限。首重从 0 开始 */
|
||||
private BigDecimal weightMin;
|
||||
|
||||
|
||||
@@ -50,6 +50,10 @@ public class PrcSurchargeBind
|
||||
|
||||
private String blockTitle;
|
||||
|
||||
private String countryCode;
|
||||
|
||||
private String feeType;
|
||||
|
||||
private String scNote;
|
||||
|
||||
private BigDecimal lengthCm;
|
||||
|
||||
@@ -168,6 +168,7 @@ public final class PayCostCalculator
|
||||
PayCostLine freightLine = line("BASIC_FREIGHT", "基础运费", 0L, freight, currency, freightRemark);
|
||||
result.getFees().add(freightLine);
|
||||
result.setCurrency(currency);
|
||||
addZoneFeeBands(result, product, band, weight, postcode, currency);
|
||||
addSurcharges(product, weight, length, width, height, postcode, zoneName, bizDate, orderStatus, freight, currency,
|
||||
band.getSectionName(), remoteHits, postcodeOn, zoneOn, countryCode, countryName, result);
|
||||
BigDecimal total = BigDecimal.ZERO;
|
||||
@@ -305,9 +306,18 @@ public final class PayCostCalculator
|
||||
continue;
|
||||
}
|
||||
String rule = fee.getCalcRule() == null || fee.getCalcRule().isBlank() ? PaySurchargeRules.MANUAL : fee.getCalcRule();
|
||||
boolean configFee = "附加费配置".equals(blank(fee.getSectionName()));
|
||||
if (PaySurchargeRules.EXTRA_KG.equals(rule) && configFee)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!countryAllows(fee, countryCode))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
List<Map<String, Object>> postcodeRules = prefixRules(product, PaySurchargeRules.POSTCODE);
|
||||
List<Map<String, Object>> zoneRules = prefixRules(product, PaySurchargeRules.ZONE);
|
||||
if (remoteHits != null && remoteFee(fee) && postcodeRules.isEmpty())
|
||||
if (!configFee && remoteHits != null && remoteFee(fee) && postcodeRules.isEmpty())
|
||||
{
|
||||
String name = blank(fee.getFeeName());
|
||||
boolean added = false;
|
||||
@@ -349,7 +359,7 @@ public final class PayCostCalculator
|
||||
}
|
||||
boolean configuredZone = PaySurchargeRules.ZONE.equals(rule) && !zoneRules.isEmpty();
|
||||
boolean postcodeDriven = PaySurchargeRules.POSTCODE.equals(rule) || !blank(fee.getPostcodeParam()).isEmpty();
|
||||
if (!configuredZone && !postcodeDriven && zoneName != null && !zoneName.isBlank() && fee.getZoneName() != null && !fee.getZoneName().isBlank()
|
||||
if (!configFee && !configuredZone && !postcodeDriven && zoneName != null && !zoneName.isBlank() && fee.getZoneName() != null && !fee.getZoneName().isBlank()
|
||||
&& !PayZoneMatcher.sameZone(fee.getZoneName(), zoneName))
|
||||
{
|
||||
continue;
|
||||
@@ -525,7 +535,7 @@ public final class PayCostCalculator
|
||||
}
|
||||
BigDecimal over = weight.subtract(threshold);
|
||||
BigDecimal amount = fee.getAmount().multiply(over).setScale(2, RoundingMode.HALF_UP);
|
||||
long scId = fee.getSurchargeId() == null ? 0L : fee.getSurchargeId();
|
||||
long scId = feeRef(fee);
|
||||
String remark = "超出 " + plain(over) + "kg × " + plain(fee.getAmount()) + " " + blank(fee.getPriceUnit());
|
||||
fees.add(line("SURCHARGE", blank(fee.getFeeName()), scId, amount, currency, remark));
|
||||
}
|
||||
@@ -550,6 +560,7 @@ public final class PayCostCalculator
|
||||
for (PaySurcharge fee : product.getSurcharges())
|
||||
{
|
||||
if (fee == null || !PaySurchargeRules.EXTRA_KG.equals(fee.getCalcRule()) || fee.getAmount() == null
|
||||
|| "附加费配置".equals(blank(fee.getSectionName()))
|
||||
|| !blank(fee.getPostcodeParam()).isEmpty())
|
||||
{
|
||||
continue;
|
||||
@@ -653,6 +664,27 @@ public final class PayCostCalculator
|
||||
return details;
|
||||
}
|
||||
|
||||
/** 附加费配置写了国家时,只对这个国家的订单收取。 */
|
||||
private static boolean countryAllows(PaySurcharge fee, String orderCountry)
|
||||
{
|
||||
String limited = blank(fee.getCountryCode());
|
||||
if (limited.isEmpty() || orderCountry == null || orderCountry.isBlank())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return limited.equalsIgnoreCase(orderCountry.trim());
|
||||
}
|
||||
|
||||
/** 绑定的附加费用配置编号,导入价卡用自己的行号。 */
|
||||
private static long feeRef(PaySurcharge fee)
|
||||
{
|
||||
if (fee.getScId() != null)
|
||||
{
|
||||
return fee.getScId();
|
||||
}
|
||||
return fee.getSurchargeId() == null ? 0L : fee.getSurchargeId();
|
||||
}
|
||||
|
||||
private static boolean remoteFee(PaySurcharge fee)
|
||||
{
|
||||
String name = blank(fee.getFeeName()).toLowerCase(Locale.ROOT);
|
||||
@@ -752,7 +784,7 @@ public final class PayCostCalculator
|
||||
return;
|
||||
}
|
||||
BigDecimal amount = fee.getAmount().multiply(weight).setScale(2, RoundingMode.HALF_UP);
|
||||
long scId = fee.getSurchargeId() == null ? 0L : fee.getSurchargeId();
|
||||
long scId = feeRef(fee);
|
||||
fees.add(line("SURCHARGE", blank(fee.getFeeName()), scId, amount, currency, remark + " × " + plain(weight) + "kg"));
|
||||
}
|
||||
|
||||
@@ -832,10 +864,10 @@ public final class PayCostCalculator
|
||||
{
|
||||
continue;
|
||||
}
|
||||
long scId = feeRef(fee);
|
||||
BigDecimal amount = fee.getAmount().multiply(steps);
|
||||
String remark = "三边之和 " + plain(sum) + "cm,超出 " + plain(excess) + "cm,每 " + plain(step) + "cm "
|
||||
+ plain(fee.getAmount()) + "," + plain(steps) + " 档";
|
||||
long scId = fee.getSurchargeId() == null ? 0L : fee.getSurchargeId();
|
||||
return line("SURCHARGE", blank(fee.getFeeName()), scId, amount, currency, remark);
|
||||
}
|
||||
return null;
|
||||
@@ -890,7 +922,7 @@ public final class PayCostCalculator
|
||||
return null;
|
||||
}
|
||||
}
|
||||
long scId = fee.getSurchargeId() == null ? 0L : fee.getSurchargeId();
|
||||
long scId = feeRef(fee);
|
||||
return line("SURCHARGE", blank(fee.getFeeName()), scId, amount, currency, remark);
|
||||
}
|
||||
|
||||
@@ -918,6 +950,75 @@ public final class PayCostCalculator
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 偏远附加费、额外线路运输费写在重量段里,不拿来当基础运费。 */
|
||||
private static boolean zoneFeeBand(PayWeightBand band)
|
||||
{
|
||||
String name = (blank(band.getChargeName()) + " " + blank(band.getSectionName())).toLowerCase(Locale.ROOT);
|
||||
return name.contains("偏远") || name.contains("额外") || name.contains("line-haul") || name.contains("linehaul") || name.contains("运输费");
|
||||
}
|
||||
|
||||
/** 和首重同一地区的线路费直接加;带邮编前缀的偏远费按邮编加。超出首重再加该费用自己的续重价。 */
|
||||
private static void addZoneFeeBands(PayOrderCostResult result, PayProduct product, PayWeightBand freight, BigDecimal weight,
|
||||
String postcode, String currency)
|
||||
{
|
||||
if (product.getWeightBands() == null || freight == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (PayWeightBand band : product.getWeightBands())
|
||||
{
|
||||
if (band == null || band.getPrice() == null || !zoneFeeBand(band) || !zoneFeeHits(band, freight, postcode))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
String name = blank(band.getChargeName()).isEmpty() ? blank(band.getSectionName()) : band.getChargeName();
|
||||
long bandId = band.getBandId() == null ? 0L : band.getBandId();
|
||||
result.getFees().add(line("SURCHARGE", name, bandId, band.getPrice(), currency,
|
||||
blank(band.getZoneName()).replace('\n', ' ') + " " + blank(band.getWeightLabel())));
|
||||
addZoneFeeExtra(result, product, band, weight, currency, name);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean zoneFeeHits(PayWeightBand band, PayWeightBand freight, String postcode)
|
||||
{
|
||||
String prefixes = PaySurchargeRules.remotePrefixes(band.getZoneName());
|
||||
if (!prefixes.isEmpty())
|
||||
{
|
||||
return PaySurchargeRules.matchesPostcode(prefixes, postcode);
|
||||
}
|
||||
return PayZoneMatcher.sameZone(band.getZoneName(), freight.getZoneName());
|
||||
}
|
||||
|
||||
private static void addZoneFeeExtra(PayOrderCostResult result, PayProduct product, PayWeightBand band, BigDecimal weight,
|
||||
String currency, String name)
|
||||
{
|
||||
if (weight == null || band.getWeightMax() == null || weight.compareTo(band.getWeightMax()) <= 0 || product.getSurcharges() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (PaySurcharge fee : product.getSurcharges())
|
||||
{
|
||||
if (fee == null || fee.getAmount() == null || !PaySurchargeRules.EXTRA_KG.equals(fee.getCalcRule()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!PayZoneMatcher.sameZone(fee.getZoneName(), band.getZoneName()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!sameSection(fee.getSectionName(), band.getSectionName()) && !sameSection(fee.getSectionName(), band.getChargeName()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
BigDecimal over = weight.subtract(band.getWeightMax());
|
||||
BigDecimal amount = fee.getAmount().multiply(over).setScale(2, RoundingMode.HALF_UP);
|
||||
long scId = feeRef(fee);
|
||||
result.getFees().add(line("SURCHARGE", name, scId, amount, currency,
|
||||
"超出 " + plain(over) + "kg × " + plain(fee.getAmount()) + " " + blank(fee.getPriceUnit())));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private static List<PayWeightBand> usableBands(List<PayWeightBand> bands)
|
||||
{
|
||||
List<PayWeightBand> usable = new ArrayList<>();
|
||||
@@ -927,7 +1028,7 @@ public final class PayCostCalculator
|
||||
}
|
||||
for (PayWeightBand band : bands)
|
||||
{
|
||||
if (band != null && band.getPrice() != null && band.getWeightMin() != null && band.getWeightMax() != null)
|
||||
if (band != null && band.getPrice() != null && band.getWeightMin() != null && band.getWeightMax() != null && !zoneFeeBand(band))
|
||||
{
|
||||
usable.add(band);
|
||||
}
|
||||
|
||||
@@ -65,10 +65,10 @@ public class PayOrderFeeCalculator
|
||||
PayProduct product = payProductService.selectPriceForDate(channel.getId(), priceDate);
|
||||
BigDecimal weight = chargeWeight(bill);
|
||||
Integer orderStatus = orderStatus(bill, ext);
|
||||
List<PayPostcodeGroup> linked = linkedGroups(product);
|
||||
List<PayPostcodeGroup> linked = linkedGroups(product, channel);
|
||||
String zoneName = resolveZone(channel, product, bill.getDestPostcode(), bill.getCountryCode(), bill.getCountryName(), linked);
|
||||
applyCurrentSurcharge(channel.getId(), product);
|
||||
List<PayRemoteBook.Hit> remoteHits = remoteHits(linked, bill.getDestPostcode(), bill.getCountryCode(), bill.getCountryName());
|
||||
List<PayRemoteBook.Hit> remoteHits = remoteHits(linked, bill.getDestPostcode(), bill.getCountryCode(), bill.getCountryName(), channel);
|
||||
PayOrderCostResult result = PayCostCalculator.calculate(product, weight, bill.getPkgLength(), bill.getPkgWidth(),
|
||||
bill.getPkgHeight(), bill.getDestPostcode(), zoneName, priceDate, orderStatus, remoteHits, true, true,
|
||||
bill.getCountryCode(), bill.getCountryName());
|
||||
@@ -180,7 +180,7 @@ public class PayOrderFeeCalculator
|
||||
}
|
||||
|
||||
/**
|
||||
* 运费仍按订单日期取版本。附加费只取该价卡产品已绑定且启用的附加费配置。
|
||||
* 运费按订单日期的重量段。附加费取已绑定的配置,超重续收只用价卡上按分区写的续重单价。
|
||||
*
|
||||
* @param channelId 渠道 ID
|
||||
* @param priced 订单日期已经命中的价卡,方法会改写它的附加费
|
||||
@@ -200,7 +200,8 @@ public class PayOrderFeeCalculator
|
||||
{
|
||||
// 今天没有生效版本时,改查订单日期命中的那一版有没有绑定
|
||||
}
|
||||
priced.setSurcharges(payProductService.boundSurcharges(source));
|
||||
priced.setSurcharges(PaySurchargeRules.surchargesForCalc(priced.getSurcharges(),
|
||||
payProductService.boundSurcharges(source)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,7 +210,7 @@ public class PayOrderFeeCalculator
|
||||
* @param product 当前价卡版本
|
||||
* @return 名称能对上的邮编组,没有时为空列表
|
||||
*/
|
||||
private List<PayPostcodeGroup> linkedGroups(PayProduct product)
|
||||
private List<PayPostcodeGroup> linkedGroups(PayProduct product, ServiceChannel channel)
|
||||
{
|
||||
List<String> names = new ArrayList<>();
|
||||
addName(names, product.getProductName());
|
||||
@@ -221,7 +222,7 @@ public class PayOrderFeeCalculator
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<PayPostcodeGroup> found = payPostcodeMapper.selectGroupsForProduct(names);
|
||||
return found == null ? new ArrayList<>() : found;
|
||||
return PayPostcodeBooks.ownChannel(found, channel.getChannelName(), channel.getChannelCode());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -253,7 +254,8 @@ public class PayOrderFeeCalculator
|
||||
* @param countryName 目的国名称
|
||||
* @return 命中的偏远分区;产品有名单但没命中时返回空列表
|
||||
*/
|
||||
private List<PayRemoteBook.Hit> remoteHits(List<PayPostcodeGroup> linked, String postcode, String countryCode, String countryName)
|
||||
private List<PayRemoteBook.Hit> remoteHits(List<PayPostcodeGroup> linked, String postcode, String countryCode, String countryName,
|
||||
ServiceChannel channel)
|
||||
{
|
||||
boolean productBook = false;
|
||||
for (PayPostcodeGroup group : linked)
|
||||
@@ -272,8 +274,10 @@ public class PayOrderFeeCalculator
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<PayPostcodeGroup> countryGroups = payPostcodeMapper.selectRemoteGroupsByCountry(countryCode, countryName);
|
||||
if (countryGroups == null || countryGroups.isEmpty())
|
||||
List<PayPostcodeGroup> countryGroups = PayPostcodeBooks.ownChannel(
|
||||
payPostcodeMapper.selectRemoteGroupsByCountry(countryCode, countryName),
|
||||
channel.getChannelName(), channel.getChannelCode());
|
||||
if (countryGroups.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -362,6 +366,7 @@ public class PayOrderFeeCalculator
|
||||
groups.add(group);
|
||||
}
|
||||
}
|
||||
groups = PayPostcodeBooks.ownChannel(groups, channel.getChannelName(), channel.getChannelCode());
|
||||
if (groups.isEmpty())
|
||||
{
|
||||
PayZoneMatcher.Decision mainland = PayZoneMatcher.resolve(zoneNames, new ArrayList<>(), postcode);
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.bms.price.pay;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import com.bms.price.domain.PayPostcodeGroup;
|
||||
|
||||
/** 同一国家下,只保留和订单渠道对得上的邮编配置。 */
|
||||
public final class PayPostcodeBooks
|
||||
{
|
||||
private PayPostcodeBooks()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道名称或编码对上的配置留下。没有写渠道的旧配置,只在没有任何对上的渠道时才使用。
|
||||
*
|
||||
* @param groups 已经按产品或国家查出的邮编组
|
||||
* @param channelName 订单渠道名称
|
||||
* @param channelCode 订单渠道编码
|
||||
* @return 这个渠道自己的邮编组
|
||||
*/
|
||||
public static List<PayPostcodeGroup> ownChannel(List<PayPostcodeGroup> groups, String channelName, String channelCode)
|
||||
{
|
||||
List<PayPostcodeGroup> found = groups == null ? new ArrayList<>() : groups;
|
||||
String name = norm(channelName);
|
||||
String code = norm(channelCode);
|
||||
if (found.isEmpty() || (name.isEmpty() && code.isEmpty()))
|
||||
{
|
||||
return found;
|
||||
}
|
||||
List<PayPostcodeGroup> matched = new ArrayList<>();
|
||||
List<PayPostcodeGroup> blank = new ArrayList<>();
|
||||
for (PayPostcodeGroup group : found)
|
||||
{
|
||||
if (group == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
String book = norm(group.getChannelName());
|
||||
if (book.isEmpty())
|
||||
{
|
||||
blank.add(group);
|
||||
continue;
|
||||
}
|
||||
if (hit(book, name) || hit(book, code))
|
||||
{
|
||||
matched.add(group);
|
||||
}
|
||||
}
|
||||
if (matched.isEmpty())
|
||||
{
|
||||
return blank;
|
||||
}
|
||||
return preferLonger(matched, name, code);
|
||||
}
|
||||
|
||||
/** 订单渠道同时含「evri」和「evri48」时,只留更长的那一个,避免短名称把另一个渠道的分区也带上。 */
|
||||
private static List<PayPostcodeGroup> preferLonger(List<PayPostcodeGroup> matched, String name, String code)
|
||||
{
|
||||
int best = 0;
|
||||
for (PayPostcodeGroup group : matched)
|
||||
{
|
||||
String book = norm(group.getChannelName());
|
||||
if (name.contains(book) || code.contains(book))
|
||||
{
|
||||
best = Math.max(best, book.length());
|
||||
}
|
||||
}
|
||||
if (best == 0)
|
||||
{
|
||||
return matched;
|
||||
}
|
||||
List<PayPostcodeGroup> specific = new ArrayList<>();
|
||||
for (PayPostcodeGroup group : matched)
|
||||
{
|
||||
String book = norm(group.getChannelName());
|
||||
if (book.length() == best && (name.contains(book) || code.contains(book)))
|
||||
{
|
||||
specific.add(group);
|
||||
}
|
||||
}
|
||||
return specific.isEmpty() ? matched : specific;
|
||||
}
|
||||
|
||||
private static boolean hit(String book, String channel)
|
||||
{
|
||||
if (book.isEmpty() || channel.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (book.equals(channel))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
int shorter = Math.min(book.length(), channel.length());
|
||||
return shorter >= 3 && (book.contains(channel) || channel.contains(book));
|
||||
}
|
||||
|
||||
private static String norm(String value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return value.toLowerCase(Locale.ROOT).replaceAll("[^a-z0-9\\u4e00-\\u9fa5]", "");
|
||||
}
|
||||
}
|
||||
@@ -578,6 +578,63 @@ public final class PaySurchargeRules
|
||||
return matchesWeight(fee == null ? null : fee.getCalcParam(), weight);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计费时使用的附加费。价卡绑定的附加费配置都参与判断,超重续收仍只用价卡上的每公斤续重。
|
||||
*
|
||||
* @param cardFees 订单日期那一版价卡上的费用行
|
||||
* @param bound 价卡已绑定且启用的附加费配置
|
||||
* @return 绑定配置里除超重续收以外的费用,再加上价卡续重
|
||||
*/
|
||||
public static List<PaySurcharge> surchargesForCalc(List<PaySurcharge> cardFees, List<PaySurcharge> bound)
|
||||
{
|
||||
List<PaySurcharge> fees = new ArrayList<>();
|
||||
if (bound != null)
|
||||
{
|
||||
for (PaySurcharge fee : bound)
|
||||
{
|
||||
if (fee != null && EXTRA_KG.equals(fee.getCalcRule()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
fees.add(fee);
|
||||
}
|
||||
}
|
||||
if (cardFees == null)
|
||||
{
|
||||
return fees;
|
||||
}
|
||||
for (PaySurcharge fee : cardFees)
|
||||
{
|
||||
if (freightContinuation(fee))
|
||||
{
|
||||
fees.add(fee);
|
||||
}
|
||||
}
|
||||
return fees;
|
||||
}
|
||||
|
||||
/** 价卡上的每公斤续重。带邮编的超重续收不拿来续运费。 */
|
||||
private static boolean freightContinuation(PaySurcharge fee)
|
||||
{
|
||||
if (fee == null || !EXTRA_KG.equals(fee.getCalcRule()) || fee.getAmount() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ("附加费配置".equals(fee.getSectionName()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (extraStartKg(fee) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (fee.getPostcodeParam() != null && !fee.getPostcodeParam().isBlank())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return fee.getPostcodeText() == null || fee.getPostcodeText().isBlank();
|
||||
}
|
||||
|
||||
/** 续重起始公斤。配置列优先,导入价卡仍从原条件文本读取。 */
|
||||
public static BigDecimal extraStartKg(PaySurcharge fee)
|
||||
{
|
||||
|
||||
@@ -1234,7 +1234,7 @@ public class PayWorkbookParser
|
||||
}
|
||||
|
||||
/**
|
||||
* 和派送费同一版式,但表头是偏远附加费、额外线路运输费这类费用。按地区和重量记附加费,不进重量段。
|
||||
* 和派送费同一版式,但表头是偏远附加费、额外线路运输费。首重记进重量段,每增加 1kg 记该费用的续重价。
|
||||
*/
|
||||
private int readFeeRateTable(ExcelGrid grid, int header, PayProduct product)
|
||||
{
|
||||
@@ -1322,6 +1322,18 @@ public class PayWorkbookParser
|
||||
priced = true;
|
||||
String feeName = shortCharge(parent[col]);
|
||||
String zone = zoneOf(sub[col], parent[col]).replace('\n', ' ').replaceAll("\\s+", " ").trim();
|
||||
if (zoneFeeName(feeName))
|
||||
{
|
||||
if (stepWeight(weight))
|
||||
{
|
||||
addExtraKg(product, feeName, zone, weight, price, firstLimit(product, feeName, zone));
|
||||
}
|
||||
else
|
||||
{
|
||||
addZoneFeeBand(product, feeName, zone, weight, price, parent[col]);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
String standard = price.stripTrailingZeros().toPlainString() + " " + feeUnit(parent[col], weight);
|
||||
String desc = country.isBlank() ? weight : country + ";" + weight;
|
||||
if (addSurcharge(product, feeName, feeName, zone, standard.trim(), desc, ""))
|
||||
@@ -1499,6 +1511,13 @@ public class PayWorkbookParser
|
||||
continue;
|
||||
}
|
||||
boolean feeHead = isPriceHead(parent[col]);
|
||||
if (stepWeight(weight))
|
||||
{
|
||||
String zone = feeHead ? zoneOf(sub[col], parent[col]) : (parent[col].isBlank() ? sub[col] : parent[col]);
|
||||
String sectionName = blankTo(section, "价格");
|
||||
addExtraKg(product, sectionName, zone, weight, price, firstLimit(product, sectionName, zone));
|
||||
continue;
|
||||
}
|
||||
PayWeightBand band = new PayWeightBand();
|
||||
band.setSectionName(blankTo(section, "价格"));
|
||||
band.setCountryName(country);
|
||||
@@ -2119,18 +2138,19 @@ public class PayWorkbookParser
|
||||
return row;
|
||||
}
|
||||
|
||||
/** Kg.ad. 按地区各记一条每公斤续重,不进入重量段。 */
|
||||
/** 每增加 1kg、Kg.ad. 记到该重量段的续重价,不再单独占一行重量段。 */
|
||||
private static void addExtraKg(PayProduct product, String section, String zone, String label, BigDecimal price, BigDecimal threshold)
|
||||
{
|
||||
BigDecimal from = threshold == null ? BigDecimal.ZERO : threshold;
|
||||
BigDecimal from = threshold == null ? BigDecimal.ONE : threshold;
|
||||
String currency = product.getCurrency() == null || product.getCurrency().isBlank() ? "EUR" : product.getCurrency().trim();
|
||||
PaySurcharge fee = new PaySurcharge();
|
||||
fee.setSectionName(section);
|
||||
fee.setFeeName("每公斤续重");
|
||||
fee.setZoneName(zone);
|
||||
fee.setChargeText(label + " " + price.stripTrailingZeros().toPlainString() + " EUR/KG");
|
||||
fee.setChargeText(label + " " + price.stripTrailingZeros().toPlainString() + " " + currency + "/KG");
|
||||
fee.setAmount(price);
|
||||
fee.setCurrency("EUR");
|
||||
fee.setPriceUnit("EUR/KG");
|
||||
fee.setCurrency(currency);
|
||||
fee.setPriceUnit(currency + "/KG");
|
||||
fee.setFeeDesc("超过" + from.stripTrailingZeros().toPlainString() + "kg后,按超出的重量每公斤加收");
|
||||
fee.setChargeTiming("产生时收取");
|
||||
fee.setCalcRule(PaySurchargeRules.EXTRA_KG);
|
||||
@@ -2139,6 +2159,82 @@ public class PayWorkbookParser
|
||||
product.getSurcharges().add(fee);
|
||||
}
|
||||
|
||||
/** 偏远附加费、额外线路运输费的首重,作为重量段里的费用项。 */
|
||||
private static void addZoneFeeBand(PayProduct product, String feeName, String zone, String weight, BigDecimal price, String head)
|
||||
{
|
||||
PayWeightBand band = new PayWeightBand();
|
||||
band.setSectionName(feeName);
|
||||
band.setZoneName(zone);
|
||||
band.setWeightLabel(weight);
|
||||
BigDecimal[] bounds = PayTexts.weightBounds(weight);
|
||||
band.setWeightMin(bounds[0]);
|
||||
band.setWeightMax(bounds[1]);
|
||||
band.setChargeName(feeName);
|
||||
band.setPrice(price);
|
||||
band.setPriceUnit(feeUnit(head, weight));
|
||||
band.setSortNo(product.getWeightBands().size() + 1);
|
||||
product.getWeightBands().add(band);
|
||||
}
|
||||
|
||||
/** 同一费用、同一地区里,续重从已读到的首重上限开始。 */
|
||||
private static BigDecimal firstLimit(PayProduct product, String section, String zone)
|
||||
{
|
||||
BigDecimal found = null;
|
||||
if (product.getWeightBands() != null)
|
||||
{
|
||||
for (PayWeightBand band : product.getWeightBands())
|
||||
{
|
||||
if (band == null || band.getWeightMax() == null || !sameSectionText(band.getSectionName(), section) || !sameZoneText(band.getZoneName(), zone))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
found = band.getWeightMax();
|
||||
}
|
||||
}
|
||||
return found == null ? BigDecimal.ONE : found;
|
||||
}
|
||||
|
||||
private static boolean stepWeight(String weight)
|
||||
{
|
||||
if (weight == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
String compact = weight.replace(" ", "").toLowerCase(Locale.ROOT);
|
||||
return compact.contains("每增加") || compact.contains("additionalkg") || compact.contains("kg.ad");
|
||||
}
|
||||
|
||||
/** 偏远、额外线路这类和首重同表的费用,要进重量段。超重、超尺寸仍走附加费。 */
|
||||
private static boolean zoneFeeName(String name)
|
||||
{
|
||||
if (name == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
String text = name.toLowerCase(Locale.ROOT);
|
||||
return text.contains("偏远") || text.contains("额外") || text.contains("line-haul") || text.contains("linehaul") || text.contains("运输费");
|
||||
}
|
||||
|
||||
private static boolean sameSectionText(String left, String right)
|
||||
{
|
||||
if (left == null || left.isBlank() || right == null || right.isBlank())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return left.trim().equals(right.trim());
|
||||
}
|
||||
|
||||
private static boolean sameZoneText(String left, String right)
|
||||
{
|
||||
boolean leftBlank = left == null || left.isBlank();
|
||||
boolean rightBlank = right == null || right.isBlank();
|
||||
if (leftBlank && rightBlank)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return PayZoneMatcher.sameZone(left, right);
|
||||
}
|
||||
|
||||
private static boolean isKgStepHeader(ExcelGrid grid, int row)
|
||||
{
|
||||
int names = 0;
|
||||
|
||||
@@ -10,7 +10,7 @@ public interface IPayPostcodeService
|
||||
{
|
||||
List<PayPostcodeGroup> selectGroupList(PayPostcodeGroup query);
|
||||
|
||||
/** 每个国家一行:邮编属性、服务类型、销售产品、渠道、分区数、邮编总数、导入时间 */
|
||||
/** 每个国家一行:渠道多个时用顿号分隔。分区在抽屉里按渠道分开 */
|
||||
List<PayPostcodeGroup> selectCountryList(PayPostcodeGroup query);
|
||||
|
||||
/** 一个国家下面的分区,同一分区名只出现一行 */
|
||||
|
||||
+15
-9
@@ -28,6 +28,7 @@ import com.bms.price.mapper.PrcOrderBillMapper;
|
||||
import com.bms.price.mapper.PrcPayBillFeeMapper;
|
||||
import com.bms.price.mapper.PrcPayBillMapper;
|
||||
import com.bms.price.pay.PayCostCalculator;
|
||||
import com.bms.price.pay.PayPostcodeBooks;
|
||||
import com.bms.price.pay.PayFeeMoney;
|
||||
import com.bms.price.pay.PaySettleSupport;
|
||||
import com.bms.price.pay.PayRemoteBook;
|
||||
@@ -133,10 +134,10 @@ public class PayOrderCostServiceImpl implements IPayOrderCostService
|
||||
PayProduct product = payProductService.selectPriceForDate(channel.getId(), bizDate);
|
||||
BigDecimal weight = firstPositive(bill.getChargeWeight(), bill.getWeight(), bill.getActualWeight(), bill.getReceiveWeight());
|
||||
Integer orderStatus = bill.getOrderStatus() != null ? bill.getOrderStatus() : (ext == null ? null : ext.getOrderStatus());
|
||||
List<PayPostcodeGroup> linked = linkedGroups(product);
|
||||
List<PayPostcodeGroup> linked = linkedGroups(product, channel);
|
||||
String zoneName = resolveZone(channel, product, bill.getDestPostcode(), bill.getCountryCode(), bill.getCountryName(), linked);
|
||||
applyCurrentSurcharge(channel.getId(), product);
|
||||
List<PayRemoteBook.Hit> remoteHits = remoteHits(linked, bill.getDestPostcode(), bill.getCountryCode(), bill.getCountryName());
|
||||
List<PayRemoteBook.Hit> remoteHits = remoteHits(linked, bill.getDestPostcode(), bill.getCountryCode(), bill.getCountryName(), channel);
|
||||
PayOrderCostResult result = PayCostCalculator.calculate(product, weight, bill.getPkgLength(), bill.getPkgWidth(),
|
||||
bill.getPkgHeight(), bill.getDestPostcode(), zoneName, bizDate, orderStatus, remoteHits, true, true,
|
||||
bill.getCountryCode(), bill.getCountryName());
|
||||
@@ -216,7 +217,7 @@ public class PayOrderCostServiceImpl implements IPayOrderCostService
|
||||
* @param product 当前价卡版本
|
||||
* @return 名称能对上的邮编组,没有时为空列表
|
||||
*/
|
||||
/** 运费仍按订单日期取版本。附加费只取该价卡产品已绑定且启用的附加费配置。 */
|
||||
/** 运费按订单日期的重量段。附加费取已绑定的配置,超重续收只用价卡上按分区写的续重单价。 */
|
||||
private void applyCurrentSurcharge(String channelId, PayProduct priced)
|
||||
{
|
||||
PayProduct source = priced;
|
||||
@@ -232,10 +233,11 @@ public class PayOrderCostServiceImpl implements IPayOrderCostService
|
||||
{
|
||||
// 今天没有生效版本时,改查订单日期命中的那一版有没有绑定
|
||||
}
|
||||
priced.setSurcharges(payProductService.boundSurcharges(source));
|
||||
priced.setSurcharges(PaySurchargeRules.surchargesForCalc(priced.getSurcharges(),
|
||||
payProductService.boundSurcharges(source)));
|
||||
}
|
||||
|
||||
private List<PayPostcodeGroup> linkedGroups(PayProduct product)
|
||||
private List<PayPostcodeGroup> linkedGroups(PayProduct product, ServiceChannel channel)
|
||||
{
|
||||
List<String> names = new ArrayList<>();
|
||||
addName(names, product.getProductName());
|
||||
@@ -247,7 +249,7 @@ public class PayOrderCostServiceImpl implements IPayOrderCostService
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<PayPostcodeGroup> found = payPostcodeMapper.selectGroupsForProduct(names);
|
||||
return found == null ? new ArrayList<>() : found;
|
||||
return PayPostcodeBooks.ownChannel(found, channel.getChannelName(), channel.getChannelCode());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -279,7 +281,8 @@ public class PayOrderCostServiceImpl implements IPayOrderCostService
|
||||
* @param countryName 目的国名称
|
||||
* @return 命中的偏远分区;产品有名单但没命中时返回空列表
|
||||
*/
|
||||
private List<PayRemoteBook.Hit> remoteHits(List<PayPostcodeGroup> linked, String postcode, String countryCode, String countryName)
|
||||
private List<PayRemoteBook.Hit> remoteHits(List<PayPostcodeGroup> linked, String postcode, String countryCode, String countryName,
|
||||
ServiceChannel channel)
|
||||
{
|
||||
boolean productBook = false;
|
||||
for (PayPostcodeGroup group : linked)
|
||||
@@ -298,8 +301,10 @@ public class PayOrderCostServiceImpl implements IPayOrderCostService
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<PayPostcodeGroup> countryGroups = payPostcodeMapper.selectRemoteGroupsByCountry(countryCode, countryName);
|
||||
if (countryGroups == null || countryGroups.isEmpty())
|
||||
List<PayPostcodeGroup> countryGroups = PayPostcodeBooks.ownChannel(
|
||||
payPostcodeMapper.selectRemoteGroupsByCountry(countryCode, countryName),
|
||||
channel.getChannelName(), channel.getChannelCode());
|
||||
if (countryGroups.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -380,6 +385,7 @@ public class PayOrderCostServiceImpl implements IPayOrderCostService
|
||||
groups.add(group);
|
||||
}
|
||||
}
|
||||
groups = PayPostcodeBooks.ownChannel(groups, channel.getChannelName(), channel.getChannelCode());
|
||||
if (groups.isEmpty())
|
||||
{
|
||||
PayZoneMatcher.Decision mainland = PayZoneMatcher.resolve(zoneNames, new ArrayList<>(), postcode);
|
||||
|
||||
+5
-2
@@ -46,6 +46,7 @@ public class PayPostcodeServiceImpl implements IPayPostcodeService
|
||||
public List<PayPostcodeGroup> selectZoneList(PayPostcodeGroup query)
|
||||
{
|
||||
requireCountry(query);
|
||||
query.setAllChannels(Boolean.TRUE);
|
||||
return payPostcodeMapper.selectZoneList(query);
|
||||
}
|
||||
|
||||
@@ -74,7 +75,7 @@ public class PayPostcodeServiceImpl implements IPayPostcodeService
|
||||
if ("REMOTE".equals(row.getCoverage()))
|
||||
{
|
||||
row.setSheetName("手工偏远");
|
||||
row.setChannelName("");
|
||||
row.setChannelName(firstText(zone.getChannelName(), sample == null ? "" : sample.getChannelName()));
|
||||
row.setProductName("");
|
||||
row.setQuoteSheet("");
|
||||
row.setFeeName("偏远");
|
||||
@@ -82,7 +83,7 @@ public class PayPostcodeServiceImpl implements IPayPostcodeService
|
||||
else
|
||||
{
|
||||
row.setSheetName(sample != null && !trimToEmpty(sample.getSheetName()).isEmpty() ? sample.getSheetName() : zoneName);
|
||||
row.setChannelName(sample == null ? "" : trimToEmpty(sample.getChannelName()));
|
||||
row.setChannelName(firstText(zone.getChannelName(), sample == null ? "" : sample.getChannelName()));
|
||||
row.setProductName(sample == null ? "" : trimToEmpty(sample.getProductName()));
|
||||
row.setQuoteSheet(sample == null ? "" : trimToEmpty(sample.getQuoteSheet()));
|
||||
row.setFeeName("");
|
||||
@@ -152,6 +153,7 @@ public class PayPostcodeServiceImpl implements IPayPostcodeService
|
||||
public int deleteCountry(PayPostcodeGroup country)
|
||||
{
|
||||
requireCountry(country);
|
||||
country.setAllChannels(Boolean.TRUE);
|
||||
List<Long> ids = payPostcodeMapper.selectGroupIdsByCountry(country);
|
||||
if (ids == null || ids.isEmpty())
|
||||
{
|
||||
@@ -427,6 +429,7 @@ public class PayPostcodeServiceImpl implements IPayPostcodeService
|
||||
PayPostcodeGroup country = new PayPostcodeGroup();
|
||||
country.setCountryCode(line.getCountryCode());
|
||||
country.setCountryName(line.getCountryName());
|
||||
country.setChannelName(line.getChannelName());
|
||||
requireCountry(country);
|
||||
return country;
|
||||
}
|
||||
|
||||
+17
-2
@@ -1045,13 +1045,27 @@ public class PayProductServiceImpl implements IPayProductService
|
||||
{
|
||||
return fees;
|
||||
}
|
||||
for (PrcSurchargeBind bind : surchargeBindMapper.selectByProduct(product.getProductId(), bindType(product)))
|
||||
String type = bindType(product);
|
||||
fees.addAll(enabledBinds(product.getProductId(), type, product.getCurrency()));
|
||||
Long originId = product.getOriginId();
|
||||
if (fees.isEmpty() && originId != null && !originId.equals(product.getProductId()))
|
||||
{
|
||||
fees.addAll(enabledBinds(originId, type, product.getCurrency()));
|
||||
}
|
||||
return fees;
|
||||
}
|
||||
|
||||
/** 这一版价卡上已启用的附加费配置。计费方式不限,订单计算时再按各自条件判断。 */
|
||||
private List<PaySurcharge> enabledBinds(Long productId, String type, String currency)
|
||||
{
|
||||
List<PaySurcharge> fees = new ArrayList<>();
|
||||
for (PrcSurchargeBind bind : surchargeBindMapper.selectByProduct(productId, type))
|
||||
{
|
||||
if (bind == null || bind.getSsCode() == null || !"on".equalsIgnoreCase(bind.getSsCode()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
fees.add(toBoundFee(bind, product.getCurrency()));
|
||||
fees.add(toBoundFee(bind, currency));
|
||||
}
|
||||
return fees;
|
||||
}
|
||||
@@ -1198,6 +1212,7 @@ public class PayProductServiceImpl implements IPayProductService
|
||||
fee.setOverWeightKg(bind.getOverWeightKg());
|
||||
fee.setExtraWeightKg(bind.getExtraWeightKg());
|
||||
fee.setPostcodeText(bind.getPostcodeText());
|
||||
fee.setCountryCode(bind.getCountryCode());
|
||||
PrcSurcharge config = new PrcSurcharge();
|
||||
config.setChargeType(bind.getChargeType());
|
||||
config.setLengthCm(bind.getLengthCm());
|
||||
|
||||
@@ -60,6 +60,31 @@
|
||||
and g.country_name = #{countryName}
|
||||
</otherwise>
|
||||
</choose>
|
||||
<include refid="channelMatch"/>
|
||||
</sql>
|
||||
|
||||
<sql id="lineChannelMatch">
|
||||
<choose>
|
||||
<when test="channelName != null and channelName != ''">
|
||||
and lower(trim(g.channel_name)) = lower(trim(#{channelName}))
|
||||
</when>
|
||||
<otherwise>
|
||||
and (g.channel_name is null or trim(g.channel_name) = '')
|
||||
</otherwise>
|
||||
</choose>
|
||||
</sql>
|
||||
|
||||
<sql id="channelMatch">
|
||||
<if test="allChannels == null or !allChannels">
|
||||
<choose>
|
||||
<when test="channelName != null and channelName != ''">
|
||||
and lower(trim(g.channel_name)) = lower(trim(#{channelName}))
|
||||
</when>
|
||||
<otherwise>
|
||||
and (g.channel_name is null or trim(g.channel_name) = '')
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<sql id="zoneExpr">
|
||||
@@ -79,19 +104,23 @@
|
||||
group_concat(distinct nullif(trim(g.service_type), '') order by g.service_type separator '、') as serviceType,
|
||||
group_concat(distinct nullif(trim(g.product_name), '') order by g.product_name separator '、') as productName,
|
||||
group_concat(distinct nullif(trim(g.channel_name), '') order by g.channel_name separator '、') as channelName,
|
||||
count(distinct
|
||||
case
|
||||
when l.line_id is not null then
|
||||
case
|
||||
when nullif(trim(l.zone_name), '') is not null then trim(l.zone_name)
|
||||
when nullif(trim(l.region_name), '') is not null then trim(l.region_name)
|
||||
when nullif(trim(g.block_title), '') is not null then trim(g.block_title)
|
||||
else '未分区'
|
||||
end
|
||||
when nullif(trim(g.block_title), '') is not null then trim(g.block_title)
|
||||
else null
|
||||
end
|
||||
) as zoneCount,
|
||||
count(distinct case
|
||||
when l.line_id is null and nullif(trim(g.block_title), '') is null then null
|
||||
else concat(
|
||||
case
|
||||
when l.line_id is not null then
|
||||
case
|
||||
when nullif(trim(l.zone_name), '') is not null then trim(l.zone_name)
|
||||
when nullif(trim(l.region_name), '') is not null then trim(l.region_name)
|
||||
when nullif(trim(g.block_title), '') is not null then trim(g.block_title)
|
||||
else '未分区'
|
||||
end
|
||||
else trim(g.block_title)
|
||||
end,
|
||||
'||',
|
||||
lower(ifnull(trim(g.channel_name), ''))
|
||||
)
|
||||
end) as zoneCount,
|
||||
count(l.line_id) as lineCount,
|
||||
max(g.create_time) as createTime
|
||||
from pay_postcode_group g
|
||||
@@ -125,9 +154,10 @@
|
||||
group_concat(distinct nullif(trim(t.coverage), '') order by t.coverage separator '、') as coverage,
|
||||
count(t.line_id) as lineCount,
|
||||
max(t.country_name) as countryName,
|
||||
max(t.country_code) as countryCode
|
||||
max(t.country_code) as countryCode,
|
||||
max(t.channel_name) as channelName
|
||||
from (
|
||||
select g.group_id, g.coverage, g.country_name, g.country_code, l.line_id,
|
||||
select g.group_id, g.coverage, g.country_name, g.country_code, g.channel_name, l.line_id,
|
||||
case
|
||||
when l.line_id is null then nullif(trim(g.block_title), '')
|
||||
else
|
||||
@@ -145,8 +175,12 @@
|
||||
</where>
|
||||
) t
|
||||
where t.zone_name is not null and t.zone_name <> ''
|
||||
group by t.zone_name
|
||||
order by t.zone_name asc
|
||||
group by t.zone_name,
|
||||
case
|
||||
when nullif(trim(t.channel_name), '') is not null then lower(trim(t.channel_name))
|
||||
else ''
|
||||
end
|
||||
order by t.zone_name asc, max(t.channel_name) asc
|
||||
</select>
|
||||
|
||||
<select id="selectSampleGroup" parameterType="com.bms.price.domain.PayPostcodeGroup" resultType="com.bms.price.domain.PayPostcodeGroup">
|
||||
@@ -196,10 +230,17 @@
|
||||
<update id="updateCountryProfile" parameterType="com.bms.price.domain.PayPostcodeGroup">
|
||||
update pay_postcode_group g
|
||||
set g.service_type = #{serviceType},
|
||||
g.product_name = #{productName},
|
||||
g.channel_name = #{channelName}
|
||||
g.product_name = #{productName}
|
||||
<where>
|
||||
<include refid="countryMatch"/>
|
||||
<choose>
|
||||
<when test="countryCode != null and countryCode != ''">
|
||||
and upper(trim(g.country_code)) = upper(trim(#{countryCode}))
|
||||
</when>
|
||||
<otherwise>
|
||||
and (g.country_code is null or trim(g.country_code) = '')
|
||||
and g.country_name = #{countryName}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
</update>
|
||||
|
||||
@@ -325,13 +366,16 @@
|
||||
</if>
|
||||
<if test="countryCode != null and countryCode != ''">
|
||||
and l.group_id in (
|
||||
select g.group_id from pay_postcode_group g where upper(trim(g.country_code)) = upper(trim(#{countryCode}))
|
||||
select g.group_id from pay_postcode_group g
|
||||
where upper(trim(g.country_code)) = upper(trim(#{countryCode}))
|
||||
<include refid="lineChannelMatch"/>
|
||||
)
|
||||
</if>
|
||||
<if test="(countryCode == null or countryCode == '') and countryName != null and countryName != ''">
|
||||
and l.group_id in (
|
||||
select g.group_id from pay_postcode_group g
|
||||
where (g.country_code is null or trim(g.country_code) = '') and g.country_name = #{countryName}
|
||||
<include refid="lineChannelMatch"/>
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
|
||||
@@ -8,7 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
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.block_title as blockTitle, c.sc_note as scNote, c.country_code as countryCode, c.fee_type as feeType,
|
||||
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>
|
||||
|
||||
Reference in New Issue
Block a user