support before version 6.9.3
Showing
4 changed files
with
46 additions
and
11 deletions
@@ -40,10 +40,12 @@ public class ShoppingController { | @@ -40,10 +40,12 @@ public class ShoppingController { | ||
40 | */ | 40 | */ |
41 | @RequestMapping(params = "method=ufo.order.payment") | 41 | @RequestMapping(params = "method=ufo.order.payment") |
42 | public ApiResponse payment(@RequestParam(name = "uid") int uid, | 42 | public ApiResponse payment(@RequestParam(name = "uid") int uid, |
43 | - @RequestParam(name = "skup") int skup){ | 43 | + @RequestParam(name = "skup") int skup, |
44 | + @RequestParam(value = "app_version", required = false)String appVersion){ | ||
44 | //AUTO 自动匹配 | 45 | //AUTO 自动匹配 |
45 | ShoppingRequest req = ShoppingRequest.builder().uid(uid).skup(skup) | 46 | ShoppingRequest req = ShoppingRequest.builder().uid(uid).skup(skup) |
46 | - .couponCodes(CouponConstants.AUTO_RECOMMENDED_COUPON_CODES).build(); | 47 | + .couponCodes(CouponConstants.AUTO_RECOMMENDED_COUPON_CODES) |
48 | + .appVersion(appVersion).build(); | ||
47 | logger.info("in ufo.order.payment, req {}", req); | 49 | logger.info("in ufo.order.payment, req {}", req); |
48 | PaymentResponse paymentResponse = buyerOrderService.payment(req); | 50 | PaymentResponse paymentResponse = buyerOrderService.payment(req); |
49 | return new ApiResponse.ApiResponseBuilder().code(200).data(paymentResponse).message("结算成功").build(); | 51 | return new ApiResponse.ApiResponseBuilder().code(200).data(paymentResponse).message("结算成功").build(); |
@@ -59,7 +61,10 @@ public class ShoppingController { | @@ -59,7 +61,10 @@ public class ShoppingController { | ||
59 | @RequestParam(name = "skup") int skup, | 61 | @RequestParam(name = "skup") int skup, |
60 | @RequestParam(name = "coupon_code",required = false) String couponCode) { | 62 | @RequestParam(name = "coupon_code",required = false) String couponCode) { |
61 | 63 | ||
62 | - ShoppingRequest req = ShoppingRequest.builder().uid(uid).skup(skup).couponCodes(CouponCodeUtils.asList(couponCode)).build(); | 64 | + ShoppingRequest req = ShoppingRequest.builder() |
65 | + .uid(uid).skup(skup) | ||
66 | + .couponCodes(CouponCodeUtils.asList(couponCode)) | ||
67 | + .build(); | ||
63 | logger.info("in ufo.order.selectCoupon, req {}", req); | 68 | logger.info("in ufo.order.selectCoupon, req {}", req); |
64 | ShoppingCouponListResp resp = buyerOrderService.selectCoupon(req); | 69 | ShoppingCouponListResp resp = buyerOrderService.selectCoupon(req); |
65 | return new ApiResponse.ApiResponseBuilder().code(200).data(resp).message("ok").build(); | 70 | return new ApiResponse.ApiResponseBuilder().code(200).data(resp).message("ok").build(); |
@@ -74,12 +79,14 @@ public class ShoppingController { | @@ -74,12 +79,14 @@ public class ShoppingController { | ||
74 | public ApiResponse compute(@RequestParam(name = "uid") int uid, | 79 | public ApiResponse compute(@RequestParam(name = "uid") int uid, |
75 | @RequestParam(name = "skup") int skup, | 80 | @RequestParam(name = "skup") int skup, |
76 | @RequestParam(name = "coupon_code",required = false) String couponCode, | 81 | @RequestParam(name = "coupon_code",required = false) String couponCode, |
77 | - @RequestParam(name = "addressId", required = false) String addressId) { | 82 | + @RequestParam(name = "addressId", required = false) String addressId, |
83 | + @RequestParam(value = "app_version", required = false)String appVersion) { | ||
78 | 84 | ||
79 | ShoppingRequest req = ShoppingRequest.builder().uid(uid) | 85 | ShoppingRequest req = ShoppingRequest.builder().uid(uid) |
80 | .skup(skup) | 86 | .skup(skup) |
81 | .couponCodes(CouponCodeUtils.asList(couponCode)) | 87 | .couponCodes(CouponCodeUtils.asList(couponCode)) |
82 | .addressId(addressId) | 88 | .addressId(addressId) |
89 | + .appVersion(appVersion) | ||
83 | .build(); | 90 | .build(); |
84 | logger.info("in ufo.order.compute, req {}", req); | 91 | logger.info("in ufo.order.compute, req {}", req); |
85 | ComputeResponse resp = buyerOrderService.compute(req); | 92 | ComputeResponse resp = buyerOrderService.compute(req); |
@@ -134,9 +134,9 @@ public class ShoppingServiceImpl implements IShoppingService { | @@ -134,9 +134,9 @@ public class ShoppingServiceImpl implements IShoppingService { | ||
134 | 134 | ||
135 | PaymentResponse response = new PaymentResponse(); | 135 | PaymentResponse response = new PaymentResponse(); |
136 | response.setPaymentWay(shoppingSupport.getPaymentWay()); | 136 | response.setPaymentWay(shoppingSupport.getPaymentWay()); |
137 | - response.setDeliveryWay(shoppingSupport.getDeliverWay(chargeResult)); | 137 | + response.setDeliveryWay(shoppingSupport.getDeliverWay(chargeResult, request.getAppVersion())); |
138 | response.setGood(shoppingSupport.getGoodsInfo(skupGood)); | 138 | response.setGood(shoppingSupport.getGoodsInfo(skupGood)); |
139 | - response.setPromotionFormulaList(shoppingSupport.getPromotionFormula(chargeResult)); | 139 | + response.setPromotionFormulaList(shoppingSupport.getPromotionFormula(chargeResult, request.getAppVersion(), false)); |
140 | response.setAmount(MathUtils.formatStr(chargeResult.getFinalAmount())); | 140 | response.setAmount(MathUtils.formatStr(chargeResult.getFinalAmount())); |
141 | 141 | ||
142 | BigDecimal ompensate = sellerFeeService.computeBuyerCompensate(skup); | 142 | BigDecimal ompensate = sellerFeeService.computeBuyerCompensate(skup); |
@@ -248,7 +248,7 @@ public class ShoppingServiceImpl implements IShoppingService { | @@ -248,7 +248,7 @@ public class ShoppingServiceImpl implements IShoppingService { | ||
248 | 248 | ||
249 | ComputeResponse response = new ComputeResponse(); | 249 | ComputeResponse response = new ComputeResponse(); |
250 | response.setCouponInfo(couponSupport.getCouponInfo(chargeResult)); | 250 | response.setCouponInfo(couponSupport.getCouponInfo(chargeResult)); |
251 | - response.setPromotionFormulaList(shoppingSupport.getPromotionFormula(chargeResult)); | 251 | + response.setPromotionFormulaList(shoppingSupport.getPromotionFormula(chargeResult, request.getAppVersion(), true)); |
252 | response.setAmount(MathUtils.formatStr(chargeResult.getFinalAmount())); | 252 | response.setAmount(MathUtils.formatStr(chargeResult.getFinalAmount())); |
253 | 253 | ||
254 | return response; | 254 | return response; |
@@ -15,6 +15,7 @@ import com.yohoufo.order.model.response.PromotionFormula; | @@ -15,6 +15,7 @@ import com.yohoufo.order.model.response.PromotionFormula; | ||
15 | import com.yohoufo.order.model.response.RecommendedCouponInfo; | 15 | import com.yohoufo.order.model.response.RecommendedCouponInfo; |
16 | import com.yohoufo.order.utils.MathUtils; | 16 | import com.yohoufo.order.utils.MathUtils; |
17 | import com.yohoufo.order.utils.SellerGoodsHelper; | 17 | import com.yohoufo.order.utils.SellerGoodsHelper; |
18 | +import org.apache.commons.lang3.StringUtils; | ||
18 | import org.springframework.stereotype.Service; | 19 | import org.springframework.stereotype.Service; |
19 | 20 | ||
20 | import java.math.BigDecimal; | 21 | import java.math.BigDecimal; |
@@ -40,16 +41,32 @@ public class ShoppingSupport { | @@ -40,16 +41,32 @@ public class ShoppingSupport { | ||
40 | * 配送方式 | 41 | * 配送方式 |
41 | * @return | 42 | * @return |
42 | */ | 43 | */ |
43 | - public PaymentResponse.DeliveryWay getDeliverWay(final ChargeResult chargeResult) { | 44 | + public PaymentResponse.DeliveryWay getDeliverWay(final ChargeResult chargeResult, String appVersion) { |
44 | // 快递方式 | 45 | // 快递方式 |
45 | PaymentResponse.DeliveryWay deliveryWay = new PaymentResponse.DeliveryWay(); | 46 | PaymentResponse.DeliveryWay deliveryWay = new PaymentResponse.DeliveryWay(); |
46 | deliveryWay.setDeliveryWayId(chargeResult.getDeliveryWay()); | 47 | deliveryWay.setDeliveryWayId(chargeResult.getDeliveryWay()); |
47 | - deliveryWay.setDeliveryWayCost(OrderConstant.MONEY_SIGN + chargeResult.getShippingAmount()); | 48 | + |
49 | + deliveryWay.setDeliveryWayCost(buildDeliveryWayCost(appVersion, chargeResult.getShippingAmount())); | ||
48 | deliveryWay.setDeliveryWayName(getDeliveryWayStr(chargeResult.getDeliveryWay())); | 50 | deliveryWay.setDeliveryWayName(getDeliveryWayStr(chargeResult.getDeliveryWay())); |
49 | return deliveryWay; | 51 | return deliveryWay; |
50 | } | 52 | } |
51 | 53 | ||
52 | 54 | ||
55 | + String buildDeliveryWayCost(String appVersion, double shippingAmount){ | ||
56 | + if (isLowerVersion(appVersion, "6.9.3")){ | ||
57 | + return "以实际提交订单金额为准"; | ||
58 | + }else{ | ||
59 | + String currencyAmount = MathUtils.formatCurrencyStr( shippingAmount ); | ||
60 | + | ||
61 | + return currencyAmount; | ||
62 | + } | ||
63 | + } | ||
64 | + | ||
65 | + boolean isLowerVersion(String appVersion, String comparedVersion){ | ||
66 | + return StringUtils.isNotBlank(appVersion) && appVersion.compareTo(comparedVersion) < 0; | ||
67 | + } | ||
68 | + | ||
69 | + | ||
53 | private String getDeliveryWayStr(int deliveryWay) { | 70 | private String getDeliveryWayStr(int deliveryWay) { |
54 | return deliveryWay == OrderConstant.DELIVERY_WAY_STORE ? OrderConstant.DELIVERY_WAY_STORE_NAME : OrderConstant.DELIVERY_WAY_SF_NAME; | 71 | return deliveryWay == OrderConstant.DELIVERY_WAY_STORE ? OrderConstant.DELIVERY_WAY_STORE_NAME : OrderConstant.DELIVERY_WAY_SF_NAME; |
55 | } | 72 | } |
@@ -83,7 +100,7 @@ public class ShoppingSupport { | @@ -83,7 +100,7 @@ public class ShoppingSupport { | ||
83 | * @param chargeResult | 100 | * @param chargeResult |
84 | * @return | 101 | * @return |
85 | */ | 102 | */ |
86 | - public List<PromotionFormula> getPromotionFormula(ChargeResult chargeResult) { | 103 | + public List<PromotionFormula> getPromotionFormula(ChargeResult chargeResult, String appVersion, boolean showCalDetail) { |
87 | 104 | ||
88 | List<PromotionFormula> formulas = Lists.newArrayList(); | 105 | List<PromotionFormula> formulas = Lists.newArrayList(); |
89 | 106 | ||
@@ -97,7 +114,13 @@ public class ShoppingSupport { | @@ -97,7 +114,13 @@ public class ShoppingSupport { | ||
97 | //运费 | 114 | //运费 |
98 | PromotionFormula expressFormula = new PromotionFormula(); | 115 | PromotionFormula expressFormula = new PromotionFormula(); |
99 | expressFormula.setPromotion(OrderConstant.DELIVERY_DESC); | 116 | expressFormula.setPromotion(OrderConstant.DELIVERY_DESC); |
100 | - expressFormula.setPromotionAmount(OrderConstant.PLUS_SIGN + MathUtils.formatCurrencyStr(chargeResult.getShippingAmount())); | 117 | + String shipFee = null; |
118 | + if (showCalDetail){ | ||
119 | + shipFee = OrderConstant.PLUS_SIGN + MathUtils.formatCurrencyStr(chargeResult.getShippingAmount()); | ||
120 | + }else{ | ||
121 | + shipFee = buildDeliveryWayCost(appVersion, chargeResult.getShippingAmount()); | ||
122 | + } | ||
123 | + expressFormula.setPromotionAmount(shipFee); | ||
101 | 124 | ||
102 | formulas.add(expressFormula); | 125 | formulas.add(expressFormula); |
103 | 126 |
-
Please register or login to post a comment