Authored by chenchao

fetch shipfee from primary use db

... ... @@ -222,7 +222,13 @@ public class ChargeService {
deliveryWayCost = 0D;
break;
case OVERSEAS_HONGHONG:
BigDecimal shipFee = chargeContext.getChargeParam().getShipFee();
if (shipFee==null || shipFee.compareTo(BigDecimal.ZERO) < 0){
//backup in memory
deliveryWayCost = deliveryWayCostSupport.getCostFromHk();
}else{
deliveryWayCost = shipFee.doubleValue();
}
AmountCutPolicy shipFeeCutPolicy = chargeContext.getChargeParam().getShipFeeCutPolicy();
SingleFeeDetail shipFeeDetail = calculateOverSeasOrderShipAmount(deliveryWayCost, shipFeeCutPolicy);
deliveryWayCost = shipFeeDetail.getFinalAmount();
... ...
... ... @@ -5,6 +5,7 @@ import lombok.Data;
import lombok.ToString;
import lombok.Builder;
import java.math.BigDecimal;
import java.util.List;
/**
... ... @@ -26,11 +27,17 @@ public class ChargeParam {
public final static int SUBMIT = 50;
private int uid;
private int deliveryWay;
/**
* 香港购运费 和税收费率 配置在一起
* 直接传值,避免多余的IO
*/
private BigDecimal shipFee;
private List<String> couponCodes;
//算费阶段,目前优惠券的各种操作会用到
private int chargeStage;
//接口版本
private int apiVersion;
/**
* 税费减免策略
*/
... ...
... ... @@ -267,18 +267,19 @@ public class ShoppingServiceImpl implements IShoppingService {
SkupType skupType = SkupType.getSkupType(skupAttr);
FeeNRate feeNRate = getFeeNRate(skupType);
BigDecimal tariffRate = null;
BigDecimal shipFee = null;
if (feeNRate != null){
tariffRate = feeNRate.getTariffRate();
shipFee = feeNRate.getShipFee();
}
Map<String,AmountCutPolicy> acpMap = buildTariffCutPolicy(skupAttr);
ChargeParam chargeParam = ChargeParam.builder().uid(request.getUid())
.chargeStage(chargeStage)
.apiVersion(request.getApiVersion())
.deliveryWay(buildDeliveryWay(skupType))
.shipFee(shipFee)
.couponCodes(request.getCouponCodes())
.tariffCutPolicy(acpMap.get(BuyOrderFeeName.TARIFF_AMOUNT))
.shipFeeCutPolicy(acpMap.get(BuyOrderFeeName.SHIP_FEE))
... ...
... ... @@ -127,6 +127,7 @@ public class ShoppingSupport {
PromotionFormula tariffFormula = new PromotionFormula();
tariffFormula.setPromotion(OrderConstant.TAX_DESC);
if (tariffFee.getCutAmount()>0D){
//数学含义:当应用题遇到问题时,打几折就是现价占原价的百分之几十,几几折就是现价是原价的百分之几十几
tariffFormula.setPromotionAside(OrderConstant.TAX_DESC_ASIDE);
String tariffAmountDesc = OrderConstant.PLUS_SIGN + MathUtils.formatCurrencyStr(tariffAmount);
tariffFormula.setNormalAmount(tariffAmountDesc);
... ...