diff --git a/bms-back/bms-system/src/main/java/com/bms/price/label/LblSurchargeRules.java b/bms-back/bms-system/src/main/java/com/bms/price/label/LblSurchargeRules.java index 8b7fb7fc..9f64b3b5 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/label/LblSurchargeRules.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/label/LblSurchargeRules.java @@ -78,7 +78,7 @@ public final class LblSurchargeRules } if (name.contains("签名") || name.contains("重复") || name.contains("未预报") || name.contains("重新贴")) { - fee.setCalcRule(MANUAL); + fee.setCalcRule("ITEM"); return; } String postcodes = postcodeParam(desc); @@ -104,10 +104,10 @@ public final class LblSurchargeRules } if (blob.contains("固定收取") || "固定收取".equals(fee.getChargeTiming())) { - fee.setCalcRule(ALWAYS); + fee.setCalcRule("ITEM"); return; } - fee.setCalcRule(MANUAL); + fee.setCalcRule("ITEM"); } public static boolean matchesPostcode(String param, String postcode) diff --git a/bms-back/bms-system/src/main/java/com/bms/price/label/LblWorkbookParser.java b/bms-back/bms-system/src/main/java/com/bms/price/label/LblWorkbookParser.java index 5a710562..92567cf1 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/label/LblWorkbookParser.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/label/LblWorkbookParser.java @@ -3443,7 +3443,7 @@ public class LblWorkbookParser product.getSurcharges().add(fee); } - /** 附加费币种为空时取价卡币种,价卡也没有则默认 EUR。 */ + /** 附加费补齐币种;计费条件默认按票(ITEM),单位不默认。 */ private static void fillSurchargeCurrency(LblProduct product, String cardCurrency) { if (product == null || product.getSurcharges() == null || product.getSurcharges().isEmpty()) @@ -3461,6 +3461,23 @@ public class LblWorkbookParser { fee.setCurrency(fallback); } + ensureSurchargeDefaults(fee); + } + } + + private static void ensureSurchargeDefaults(LblSurcharge fee) + { + String name = fee.getFeeName() == null ? "" : fee.getFeeName(); + boolean quoteNote = name.contains("报价说明"); + if (quoteNote) + { + return; + } + String rule = fee.getCalcRule() == null ? "" : fee.getCalcRule().trim(); + if (rule.isEmpty() || LblSurchargeRules.MANUAL.equalsIgnoreCase(rule) + || LblSurchargeRules.ALWAYS.equalsIgnoreCase(rule)) + { + fee.setCalcRule("ITEM"); } } @@ -4819,7 +4836,7 @@ public class LblWorkbookParser return currency.isEmpty() ? "每票" : currency + "/票"; } - /** 附加费的货币单位跟重量段一样,价格数字单独放 amount,这里只放 EUR/ITEM、RMB/KG、%。 */ + /** 附加费的货币单位跟重量段一样,价格数字单独放 amount,这里只放 EUR/ITEM、RMB/KG、%;无单位不默认。 */ private static String surchargeUnit(LblTexts.Money money, String standard) { if (money == null || money.amount == null) diff --git a/bms-back/bms-system/src/main/java/com/bms/price/pay/LabelArCostCalculator.java b/bms-back/bms-system/src/main/java/com/bms/price/pay/LabelArCostCalculator.java index 5d17b918..442de90c 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/pay/LabelArCostCalculator.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/pay/LabelArCostCalculator.java @@ -406,7 +406,7 @@ public final class LabelArCostCalculator addExtraKg(result.getFees(), fee, weight, currency); } } - else if (PaySurchargeRules.ALWAYS.equals(rule)) + else if (PaySurchargeRules.ALWAYS.equals(rule) || "ITEM".equals(rule)) { PayCostLine matched = matchedFee(fee, freight, currency, blank(fee.getChargeText())); if (matched != null) @@ -414,6 +414,10 @@ public final class LabelArCostCalculator result.getFees().add(matched); } } + else if ("PER_KG".equals(rule)) + { + addPerKg(result.getFees(), fee, weight, currency, blank(fee.getChargeText())); + } else if (!name.isEmpty() && !name.contains("报价说明")) { result.getSkipped().add(name + ":价卡没有可计算的条件,暂不计费"); diff --git a/bms-back/bms-system/src/main/java/com/bms/price/service/impl/LblProductServiceImpl.java b/bms-back/bms-system/src/main/java/com/bms/price/service/impl/LblProductServiceImpl.java index 4679073a..ff115f61 100644 --- a/bms-back/bms-system/src/main/java/com/bms/price/service/impl/LblProductServiceImpl.java +++ b/bms-back/bms-system/src/main/java/com/bms/price/service/impl/LblProductServiceImpl.java @@ -23,6 +23,8 @@ import com.bms.common.utils.DateUtils; import com.bms.common.utils.SecurityUtils; import com.bms.common.utils.file.OssStorage; import com.bms.common.utils.uuid.IdUtils; +import com.bms.masterdata.domain.ServiceChannel; +import com.bms.masterdata.mapper.ServiceChannelMapper; import com.bms.price.domain.ChannelProductMap; import com.bms.price.domain.LabelPackageVersion; import com.bms.price.domain.LblPreview; @@ -82,6 +84,9 @@ public class LblProductServiceImpl implements ILblProductService @Autowired private ChannelProductMapMapper channelProductMapMapper; + @Autowired + private ServiceChannelMapper serviceChannelMapper; + @Autowired private ISysDictTypeService dictTypeService; @@ -546,12 +551,21 @@ public class LblProductServiceImpl implements ILblProductService } } } + String operator = SecurityUtils.getUsername(); for (String channelId : wanted) { + ServiceChannel channel = serviceChannelMapper.selectServiceChannelById(channelId); + if (channel == null || isBlank(channel.getChannelCode())) + { + throw new ServiceException("渠道不存在或渠道编码为空: " + channelId); + } ChannelProductMap row = new ChannelProductMap(); row.setChannelId(channelId); + row.setChannelCode(channel.getChannelCode()); row.setProductId(productId); row.setPayType(type); + row.setCreateBy(operator); + row.setUpdateBy(operator); channelProductMapMapper.upsert(row); } return "已绑定" + wanted.size() + "个渠道"; diff --git a/bms-back/bms-system/src/main/resources/mapper/price/ChannelProductMapMapper.xml b/bms-back/bms-system/src/main/resources/mapper/price/ChannelProductMapMapper.xml index 39a3c05f..3aba5ea2 100644 --- a/bms-back/bms-system/src/main/resources/mapper/price/ChannelProductMapMapper.xml +++ b/bms-back/bms-system/src/main/resources/mapper/price/ChannelProductMapMapper.xml @@ -16,7 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -61,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" on duplicate key update channel_code = values(channel_code), product_id = values(product_id), + create_by = ifnull(create_by, values(create_by)), update_by = values(update_by), update_time = sysdate() diff --git a/bms-front/src/views/price/label/components/LabelConfigDetail.vue b/bms-front/src/views/price/label/components/LabelConfigDetail.vue index 394bc74a..84226cd9 100644 --- a/bms-front/src/views/price/label/components/LabelConfigDetail.vue +++ b/bms-front/src/views/price/label/components/LabelConfigDetail.vue @@ -79,7 +79,7 @@
- + 添加附加费 {{ row.feeName || '-' }} - - - - - - - + - - - + @@ -593,8 +596,8 @@ const columns = [ { label: '客户', prop: 'customerName', minWidth: 140, showOverflowTooltip: true }, { label: '客户代码', prop: 'customerCode', width: 120 }, { label: '产品', prop: 'product', minWidth: 160, slot: 'product' }, + { label: '渠道', prop: 'channel', minWidth: 160, slot: 'channel' }, { label: '国家', prop: 'country', minWidth: 130, slot: 'country' }, - { label: '件数', prop: 'pieces', align: 'center', width: 70 }, { label: '计费重', prop: 'weight', align: 'center', width: 90, slot: 'weight' }, { label: '体积重', prop: 'volumeWeight', align: 'center', width: 90, slot: 'volumeWeight' }, { label: '实重', prop: 'receiveWeight', align: 'center', width: 90, slot: 'receiveWeight' },