Authored by chenchao

fetch shipfee from primary use db

@@ -222,7 +222,13 @@ public class ChargeService { @@ -222,7 +222,13 @@ public class ChargeService {
222 deliveryWayCost = 0D; 222 deliveryWayCost = 0D;
223 break; 223 break;
224 case OVERSEAS_HONGHONG: 224 case OVERSEAS_HONGHONG:
  225 + BigDecimal shipFee = chargeContext.getChargeParam().getShipFee();
  226 + if (shipFee==null || shipFee.compareTo(BigDecimal.ZERO) < 0){
  227 + //backup in memory
225 deliveryWayCost = deliveryWayCostSupport.getCostFromHk(); 228 deliveryWayCost = deliveryWayCostSupport.getCostFromHk();
  229 + }else{
  230 + deliveryWayCost = shipFee.doubleValue();
  231 + }
226 AmountCutPolicy shipFeeCutPolicy = chargeContext.getChargeParam().getShipFeeCutPolicy(); 232 AmountCutPolicy shipFeeCutPolicy = chargeContext.getChargeParam().getShipFeeCutPolicy();
227 SingleFeeDetail shipFeeDetail = calculateOverSeasOrderShipAmount(deliveryWayCost, shipFeeCutPolicy); 233 SingleFeeDetail shipFeeDetail = calculateOverSeasOrderShipAmount(deliveryWayCost, shipFeeCutPolicy);
228 deliveryWayCost = shipFeeDetail.getFinalAmount(); 234 deliveryWayCost = shipFeeDetail.getFinalAmount();
@@ -5,6 +5,7 @@ import lombok.Data; @@ -5,6 +5,7 @@ import lombok.Data;
5 import lombok.ToString; 5 import lombok.ToString;
6 import lombok.Builder; 6 import lombok.Builder;
7 7
  8 +import java.math.BigDecimal;
8 import java.util.List; 9 import java.util.List;
9 10
10 /** 11 /**
@@ -26,11 +27,17 @@ public class ChargeParam { @@ -26,11 +27,17 @@ public class ChargeParam {
26 public final static int SUBMIT = 50; 27 public final static int SUBMIT = 50;
27 private int uid; 28 private int uid;
28 private int deliveryWay; 29 private int deliveryWay;
  30 + /**
  31 + * 香港购运费 和税收费率 配置在一起
  32 + * 直接传值,避免多余的IO
  33 + */
  34 + private BigDecimal shipFee;
29 private List<String> couponCodes; 35 private List<String> couponCodes;
30 //算费阶段,目前优惠券的各种操作会用到 36 //算费阶段,目前优惠券的各种操作会用到
31 private int chargeStage; 37 private int chargeStage;
32 //接口版本 38 //接口版本
33 private int apiVersion; 39 private int apiVersion;
  40 +
34 /** 41 /**
35 * 税费减免策略 42 * 税费减免策略
36 */ 43 */
@@ -267,18 +267,19 @@ public class ShoppingServiceImpl implements IShoppingService { @@ -267,18 +267,19 @@ public class ShoppingServiceImpl implements IShoppingService {
267 SkupType skupType = SkupType.getSkupType(skupAttr); 267 SkupType skupType = SkupType.getSkupType(skupAttr);
268 FeeNRate feeNRate = getFeeNRate(skupType); 268 FeeNRate feeNRate = getFeeNRate(skupType);
269 BigDecimal tariffRate = null; 269 BigDecimal tariffRate = null;
  270 + BigDecimal shipFee = null;
270 if (feeNRate != null){ 271 if (feeNRate != null){
271 tariffRate = feeNRate.getTariffRate(); 272 tariffRate = feeNRate.getTariffRate();
  273 + shipFee = feeNRate.getShipFee();
272 } 274 }
273 275
274 Map<String,AmountCutPolicy> acpMap = buildTariffCutPolicy(skupAttr); 276 Map<String,AmountCutPolicy> acpMap = buildTariffCutPolicy(skupAttr);
275 277
276 -  
277 -  
278 ChargeParam chargeParam = ChargeParam.builder().uid(request.getUid()) 278 ChargeParam chargeParam = ChargeParam.builder().uid(request.getUid())
279 .chargeStage(chargeStage) 279 .chargeStage(chargeStage)
280 .apiVersion(request.getApiVersion()) 280 .apiVersion(request.getApiVersion())
281 .deliveryWay(buildDeliveryWay(skupType)) 281 .deliveryWay(buildDeliveryWay(skupType))
  282 + .shipFee(shipFee)
282 .couponCodes(request.getCouponCodes()) 283 .couponCodes(request.getCouponCodes())
283 .tariffCutPolicy(acpMap.get(BuyOrderFeeName.TARIFF_AMOUNT)) 284 .tariffCutPolicy(acpMap.get(BuyOrderFeeName.TARIFF_AMOUNT))
284 .shipFeeCutPolicy(acpMap.get(BuyOrderFeeName.SHIP_FEE)) 285 .shipFeeCutPolicy(acpMap.get(BuyOrderFeeName.SHIP_FEE))
@@ -127,6 +127,7 @@ public class ShoppingSupport { @@ -127,6 +127,7 @@ public class ShoppingSupport {
127 PromotionFormula tariffFormula = new PromotionFormula(); 127 PromotionFormula tariffFormula = new PromotionFormula();
128 tariffFormula.setPromotion(OrderConstant.TAX_DESC); 128 tariffFormula.setPromotion(OrderConstant.TAX_DESC);
129 if (tariffFee.getCutAmount()>0D){ 129 if (tariffFee.getCutAmount()>0D){
  130 + //数学含义:当应用题遇到问题时,打几折就是现价占原价的百分之几十,几几折就是现价是原价的百分之几十几
130 tariffFormula.setPromotionAside(OrderConstant.TAX_DESC_ASIDE); 131 tariffFormula.setPromotionAside(OrderConstant.TAX_DESC_ASIDE);
131 String tariffAmountDesc = OrderConstant.PLUS_SIGN + MathUtils.formatCurrencyStr(tariffAmount); 132 String tariffAmountDesc = OrderConstant.PLUS_SIGN + MathUtils.formatCurrencyStr(tariffAmount);
132 tariffFormula.setNormalAmount(tariffAmountDesc); 133 tariffFormula.setNormalAmount(tariffAmountDesc);