优化附加费计算规则,调整相关逻辑和注释
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 + ":价卡没有可计算的条件,暂不计费");
|
||||
|
||||
+14
@@ -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() + "个渠道";
|
||||
|
||||
@@ -16,7 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectByProductIdAndType" resultType="com.bms.price.domain.ChannelProductMap">
|
||||
select m.id,
|
||||
m.channel_id as channelId,
|
||||
m.channel_code as channelCode,
|
||||
coalesce(nullif(m.channel_code, ''), c.channel_code) as channelCode,
|
||||
m.product_id as productId,
|
||||
c.channel_name as channelName,
|
||||
m.pay_type as payType,
|
||||
@@ -28,13 +28,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
left join srv_service_channel c on c.id = m.channel_id
|
||||
where m.product_id = #{productId}
|
||||
and m.pay_type = #{payType}
|
||||
order by m.channel_code asc, m.channel_id asc
|
||||
order by coalesce(nullif(m.channel_code, ''), c.channel_code) asc, m.channel_id asc
|
||||
</select>
|
||||
|
||||
<select id="selectByProductIdsAndType" resultType="com.bms.price.domain.ChannelProductMap">
|
||||
select m.id,
|
||||
m.channel_id as channelId,
|
||||
m.channel_code as channelCode,
|
||||
coalesce(nullif(m.channel_code, ''), c.channel_code) as channelCode,
|
||||
m.product_id as productId,
|
||||
c.channel_name as channelName,
|
||||
m.pay_type as payType,
|
||||
@@ -49,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<foreach collection="productIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
order by m.product_id asc, m.channel_code asc, m.channel_id asc
|
||||
order by m.product_id asc, coalesce(nullif(m.channel_code, ''), c.channel_code) asc, m.channel_id asc
|
||||
</select>
|
||||
|
||||
<insert id="upsert">
|
||||
@@ -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()
|
||||
</insert>
|
||||
|
||||
Reference in New Issue
Block a user