Authored by chenchao

fix ship show info

@@ -88,6 +88,47 @@ public class ShoppingSupport { @@ -88,6 +88,47 @@ public class ShoppingSupport {
88 } 88 }
89 89
90 /** 90 /**
  91 + * build express formula
  92 + * @param chargeResult
  93 + * @return
  94 + */
  95 + private PromotionFormula buildExpressFormula(ChargeResult chargeResult){
  96 + PromotionFormula expressFormula = new PromotionFormula();
  97 +
  98 + String shipFee = null;
  99 + double finalShipFee;
  100 + //香港直邮订单 运费数据存在shipFeeDetail
  101 + boolean showShipFee = false;
  102 + SingleFeeDetail shipFeeDetail;
  103 + if (Objects.nonNull(shipFeeDetail = chargeResult.getShipFeeDetail())){
  104 + if (shipFeeDetail.getCutAmount()>0D){
  105 + String normalShipFee = OrderConstant.PLUS_SIGN + MathUtils.formatCurrencyStr(shipFeeDetail.getAmount());
  106 + expressFormula.setNormalAmount(normalShipFee);
  107 + }
  108 + finalShipFee = shipFeeDetail.getFinalAmount();
  109 + if (finalShipFee == 0D){
  110 + expressFormula.setPromotionAside(OrderConstant.DELIVERY_DESC_ASIDE);
  111 + }
  112 + //0元也得展示
  113 + shipFee = OrderConstant.PLUS_SIGN + MathUtils.formatCurrencyStr(finalShipFee);
  114 + showShipFee = true;
  115 + }else{
  116 + //非香港直邮订单 直接从chargeResult取值
  117 + finalShipFee = chargeResult.getShippingAmount();
  118 + //0元 不展示
  119 + if (finalShipFee > 0D){
  120 + shipFee = OrderConstant.PLUS_SIGN + MathUtils.formatCurrencyStr(finalShipFee);
  121 + showShipFee = true;
  122 + }
  123 + }
  124 +
  125 + if (showShipFee){
  126 + expressFormula.setPromotion(OrderConstant.DELIVERY_DESC);
  127 + expressFormula.setPromotionAmount(shipFee);
  128 + }
  129 + return expressFormula;
  130 + }
  131 + /**
91 * 付款信息 132 * 付款信息
92 * @param chargeResult 133 * @param chargeResult
93 * @return 134 * @return
@@ -122,33 +163,9 @@ public class ShoppingSupport { @@ -122,33 +163,9 @@ public class ShoppingSupport {
122 } 163 }
123 164
124 //运费 165 //运费
125 - PromotionFormula expressFormula = new PromotionFormula();  
126 - expressFormula.setPromotion(OrderConstant.DELIVERY_DESC);  
127 - String shipFee = null;  
128 - double finalShipFee;  
129 - //香港直邮订单 运费数据存在shipFeeDetail  
130 - SingleFeeDetail shipFeeDetail;  
131 - if (Objects.nonNull(shipFeeDetail = chargeResult.getShipFeeDetail())){  
132 - if (shipFeeDetail.getCutAmount()>0D){  
133 - String normalShipFee = OrderConstant.PLUS_SIGN + MathUtils.formatCurrencyStr(shipFeeDetail.getAmount());  
134 - expressFormula.setNormalAmount(normalShipFee);  
135 - }  
136 - finalShipFee = shipFeeDetail.getFinalAmount();  
137 - if (finalShipFee == 0D){  
138 - expressFormula.setPromotionAside(OrderConstant.DELIVERY_DESC_ASIDE);  
139 - }  
140 - //0元也得展示  
141 - shipFee = OrderConstant.PLUS_SIGN + MathUtils.formatCurrencyStr(finalShipFee);  
142 - }else{  
143 - //非香港直邮订单 直接从chargeResult取值  
144 - finalShipFee = chargeResult.getShippingAmount();  
145 - //0元 不展示  
146 - if (finalShipFee > 0D){  
147 - shipFee = OrderConstant.PLUS_SIGN + MathUtils.formatCurrencyStr(finalShipFee);  
148 - }  
149 - }  
150 - expressFormula.setPromotionAmount(shipFee); 166 + PromotionFormula expressFormula = buildExpressFormula(chargeResult);
151 formulas.add(expressFormula); 167 formulas.add(expressFormula);
  168 +
152 //税费 169 //税费
153 SingleFeeDetail tariffFee; 170 SingleFeeDetail tariffFee;
154 if ((tariffFee = chargeResult.getTariffFee()) != null){ 171 if ((tariffFee = chargeResult.getTariffFee()) != null){