Merge branch 'dev-promotion' of http://git.yoho.cn/ufo/yohoufo-fore into dev-promotion
Showing
13 changed files
with
293 additions
and
31 deletions
@@ -63,14 +63,6 @@ | @@ -63,14 +63,6 @@ | ||
63 | <include refid="CouponsLogsQueryUsable"/> | 63 | <include refid="CouponsLogsQueryUsable"/> |
64 | </select> | 64 | </select> |
65 | 65 | ||
66 | - | ||
67 | - <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > | ||
68 | - select | ||
69 | - <include refid="Base_Column_List" /> | ||
70 | - from user_coupon | ||
71 | - where id = #{id,jdbcType=INTEGER} | ||
72 | - </select> | ||
73 | - | ||
74 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > | 66 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > |
75 | delete from user_coupon | 67 | delete from user_coupon |
76 | where id = #{id,jdbcType=INTEGER} | 68 | where id = #{id,jdbcType=INTEGER} |
1 | package com.yohoufo.order.controller; | 1 | package com.yohoufo.order.controller; |
2 | 2 | ||
3 | - | ||
4 | import com.google.common.collect.Lists; | 3 | import com.google.common.collect.Lists; |
5 | import com.yohoufo.common.ApiResponse; | 4 | import com.yohoufo.common.ApiResponse; |
6 | -import com.yohoufo.common.cache.Cachable; | ||
7 | import com.yohoufo.order.model.request.ShoppingRequest; | 5 | import com.yohoufo.order.model.request.ShoppingRequest; |
8 | -import com.yohoufo.order.model.response.OrderSubmitResponse; | ||
9 | -import com.yohoufo.order.model.response.OrderSummaryResp; | ||
10 | -import com.yohoufo.order.model.response.PaymentResponse; | 6 | +import com.yohoufo.order.model.response.*; |
11 | import com.yohoufo.order.service.IBuyerOrderService; | 7 | import com.yohoufo.order.service.IBuyerOrderService; |
12 | import com.yohoufo.order.service.IShoppingService; | 8 | import com.yohoufo.order.service.IShoppingService; |
13 | import com.yohoufo.order.service.impl.SellerOrderService; | 9 | import com.yohoufo.order.service.impl.SellerOrderService; |
10 | +import com.yohoufo.order.utils.CouponCodeUtils; | ||
14 | import org.apache.commons.lang3.StringUtils; | 11 | import org.apache.commons.lang3.StringUtils; |
15 | import org.slf4j.Logger; | 12 | import org.slf4j.Logger; |
16 | import org.slf4j.LoggerFactory; | 13 | import org.slf4j.LoggerFactory; |
@@ -48,6 +45,38 @@ public class ShoppingController { | @@ -48,6 +45,38 @@ public class ShoppingController { | ||
48 | return new ApiResponse.ApiResponseBuilder().code(200).data(paymentResponse).message("结算成功").build(); | 45 | return new ApiResponse.ApiResponseBuilder().code(200).data(paymentResponse).message("结算成功").build(); |
49 | } | 46 | } |
50 | 47 | ||
48 | + /** | ||
49 | + * 券列表 | ||
50 | + * | ||
51 | + * @return | ||
52 | + */ | ||
53 | + @RequestMapping(params = "method=ufo.order.selectCoupon") | ||
54 | + public ApiResponse selectCoupon(@RequestParam(name = "uid") int uid, | ||
55 | + @RequestParam(name = "skup") int skup, | ||
56 | + @RequestParam(name = "coupon_code",required = false) String couponCode) { | ||
57 | + | ||
58 | + ShoppingRequest req = ShoppingRequest.builder().uid(uid).skup(skup).couponCodes(CouponCodeUtils.asList(couponCode)).build(); | ||
59 | + logger.info("in ufo.order.selectCoupon, req {}", req); | ||
60 | + ShoppingCouponListResp resp = buyerOrderService.selectCoupon(req); | ||
61 | + return new ApiResponse.ApiResponseBuilder().code(200).data(resp).message("ok").build(); | ||
62 | + } | ||
63 | + | ||
64 | + /** | ||
65 | + * 用券结算 | ||
66 | + * | ||
67 | + * @return | ||
68 | + */ | ||
69 | + @RequestMapping(params = "method=ufo.order.compute") | ||
70 | + public ApiResponse compute(@RequestParam(name = "uid") int uid, | ||
71 | + @RequestParam(name = "skup") int skup, | ||
72 | + @RequestParam(name = "coupon_code",required = false) String couponCode) { | ||
73 | + | ||
74 | + ShoppingRequest req = ShoppingRequest.builder().uid(uid).skup(skup).couponCodes(CouponCodeUtils.asList(couponCode)).build(); | ||
75 | + logger.info("in ufo.order.compute, req {}", req); | ||
76 | + ComputeResponse resp = buyerOrderService.compute(req); | ||
77 | + return new ApiResponse.ApiResponseBuilder().code(200).data(resp).message("ok").build(); | ||
78 | + } | ||
79 | + | ||
51 | 80 | ||
52 | /** | 81 | /** |
53 | * 提交订单成功 | 82 | * 提交订单成功 |
@@ -56,13 +85,14 @@ public class ShoppingController { | @@ -56,13 +85,14 @@ public class ShoppingController { | ||
56 | @RequestMapping(params = "method=ufo.order.submit") | 85 | @RequestMapping(params = "method=ufo.order.submit") |
57 | public ApiResponse submit(@RequestParam(name = "uid") int uid, | 86 | public ApiResponse submit(@RequestParam(name = "uid") int uid, |
58 | @RequestParam(name = "skup") int skup, | 87 | @RequestParam(name = "skup") int skup, |
88 | + @RequestParam(name = "coupon_code",required = false) String couponCode, | ||
59 | @RequestParam(name = "channelNo", required = false) String channelNo, | 89 | @RequestParam(name = "channelNo", required = false) String channelNo, |
60 | @RequestParam(name = "addressId") String addressId, | 90 | @RequestParam(name = "addressId") String addressId, |
61 | @RequestParam(name = "client_type", required = false) String clientType){ | 91 | @RequestParam(name = "client_type", required = false) String clientType){ |
62 | if(StringUtils.isBlank(channelNo)){ | 92 | if(StringUtils.isBlank(channelNo)){ |
63 | channelNo = "2919"; | 93 | channelNo = "2919"; |
64 | } | 94 | } |
65 | - ShoppingRequest request = ShoppingRequest.builder().uid(uid).skup(skup).channelNo(channelNo).clientType(clientType).addressId(addressId).build(); | 95 | + ShoppingRequest request = ShoppingRequest.builder().uid(uid).skup(skup).couponCodes(CouponCodeUtils.asList(couponCode)).channelNo(channelNo).clientType(clientType).addressId(addressId).build(); |
66 | logger.info("in ufo.order.submit, req {}", request); | 96 | logger.info("in ufo.order.submit, req {}", request); |
67 | OrderSubmitResponse paymentResponse = buyerOrderService.submit(request); | 97 | OrderSubmitResponse paymentResponse = buyerOrderService.submit(request); |
68 | return new ApiResponse.ApiResponseBuilder().code(200).data(paymentResponse).message("提交订单SUCCESS").build(); | 98 | return new ApiResponse.ApiResponseBuilder().code(200).data(paymentResponse).message("提交订单SUCCESS").build(); |
@@ -5,6 +5,8 @@ import lombok.Data; | @@ -5,6 +5,8 @@ import lombok.Data; | ||
5 | import lombok.NoArgsConstructor; | 5 | import lombok.NoArgsConstructor; |
6 | import lombok.experimental.Builder; | 6 | import lombok.experimental.Builder; |
7 | 7 | ||
8 | +import java.util.List; | ||
9 | + | ||
8 | @Data | 10 | @Data |
9 | @Builder | 11 | @Builder |
10 | @AllArgsConstructor | 12 | @AllArgsConstructor |
@@ -16,6 +18,11 @@ public class ShoppingRequest { | @@ -16,6 +18,11 @@ public class ShoppingRequest { | ||
16 | private int uid; | 18 | private int uid; |
17 | 19 | ||
18 | /** | 20 | /** |
21 | + * 券code | ||
22 | + */ | ||
23 | + private List<String> couponCodes; | ||
24 | + | ||
25 | + /** | ||
19 | * 加密过的地址Id | 26 | * 加密过的地址Id |
20 | */ | 27 | */ |
21 | private String addressId; | 28 | private String addressId; |
@@ -31,5 +38,4 @@ public class ShoppingRequest { | @@ -31,5 +38,4 @@ public class ShoppingRequest { | ||
31 | private String channelNo; | 38 | private String channelNo; |
32 | 39 | ||
33 | 40 | ||
34 | - | ||
35 | } | 41 | } |
1 | +package com.yohoufo.order.model.response; | ||
2 | + | ||
3 | +import lombok.Data; | ||
4 | +import lombok.ToString; | ||
5 | + | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +/** | ||
9 | + * Created by jiexiang.wu on 2018/11/19. | ||
10 | + */ | ||
11 | +@Data | ||
12 | +@ToString | ||
13 | +public class ComputeResponse { | ||
14 | + | ||
15 | + /** | ||
16 | + * 券使用结果 | ||
17 | + */ | ||
18 | + CouponUseResult couponUseResult; | ||
19 | + | ||
20 | + /** | ||
21 | + * 费用列表 | ||
22 | + */ | ||
23 | + List<PromotionFormula> promotionFormulaList; | ||
24 | + | ||
25 | + | ||
26 | + /** | ||
27 | + * 待支付金额 | ||
28 | + */ | ||
29 | + String amount; | ||
30 | +} |
1 | +package com.yohoufo.order.model.response; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.annotation.JSONField; | ||
4 | +import lombok.Data; | ||
5 | +import lombok.ToString; | ||
6 | + | ||
7 | +/** | ||
8 | + * Created by jiexiang.wu on 2018/11/19. | ||
9 | + */ | ||
10 | +@Data | ||
11 | +@ToString | ||
12 | +public class CouponUseResult { | ||
13 | + @JSONField(name = "coupon_code") | ||
14 | + private String couponCode; | ||
15 | + @JSONField(name = "coupon_title") | ||
16 | + private String couponTitle; | ||
17 | + | ||
18 | + //coupon_amount的字符串表示 | ||
19 | + @JSONField(name = "coupon_amount_str") | ||
20 | + private String couponAmountStr; | ||
21 | + | ||
22 | + //券的个数 | ||
23 | + @JSONField(name = "coupon_count") | ||
24 | + private int couponCount; | ||
25 | +} |
@@ -59,14 +59,4 @@ public class PaymentResponse { | @@ -59,14 +59,4 @@ public class PaymentResponse { | ||
59 | 59 | ||
60 | private String deliveryWayCost; | 60 | private String deliveryWayCost; |
61 | } | 61 | } |
62 | - | ||
63 | - | ||
64 | - | ||
65 | - @Data | ||
66 | - @ToString | ||
67 | - public static class PromotionFormula{ | ||
68 | - | ||
69 | - private String promotion; | ||
70 | - private String promotionAmount; | ||
71 | - } | ||
72 | } | 62 | } |
1 | +package com.yohoufo.order.model.response; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.annotation.JSONField; | ||
4 | +import lombok.AllArgsConstructor; | ||
5 | +import lombok.Data; | ||
6 | +import lombok.NoArgsConstructor; | ||
7 | +import lombok.experimental.Builder; | ||
8 | + | ||
9 | +/** | ||
10 | + * Created by jiexiang.wu on 2018/11/19. | ||
11 | + */ | ||
12 | +@Data | ||
13 | +@Builder | ||
14 | +@AllArgsConstructor | ||
15 | +@NoArgsConstructor | ||
16 | +public class ShoppingCoupon { | ||
17 | + //优惠券code | ||
18 | + @JSONField(name = "coupon_code") | ||
19 | + private String couponCode; | ||
20 | + //名称 | ||
21 | + @JSONField(name = "coupon_name") | ||
22 | + private String couponName; | ||
23 | + /** | ||
24 | + * 优惠券 有效期 2013.11.01-2017.01.31 | ||
25 | + */ | ||
26 | + @JSONField(name = "coupon_validity") | ||
27 | + private String couponValidity; | ||
28 | + | ||
29 | + @JSONField(name = "coupon_value_str") | ||
30 | + private String couponValueStr; | ||
31 | + | ||
32 | + /** | ||
33 | + * 使用规则描述 如:满200可用 | ||
34 | + */ | ||
35 | + @JSONField(name = "use_rule_str") | ||
36 | + private String useRuleStr; | ||
37 | + | ||
38 | + //是否选中 Y选中 | ||
39 | + private String selected; | ||
40 | + | ||
41 | + //是否支持可选 | ||
42 | + @JSONField(name = "is_selected_support") | ||
43 | + private String isSelectedSupport; | ||
44 | +} |
1 | +package com.yohoufo.order.model.response; | ||
2 | + | ||
3 | +import lombok.AllArgsConstructor; | ||
4 | +import lombok.Data; | ||
5 | +import lombok.NoArgsConstructor; | ||
6 | +import lombok.experimental.Builder; | ||
7 | + | ||
8 | +import java.util.List; | ||
9 | + | ||
10 | +/** | ||
11 | + * Created by jiexiang.wu on 2018/11/19. | ||
12 | + */ | ||
13 | +@Data | ||
14 | +@Builder | ||
15 | +@AllArgsConstructor | ||
16 | +@NoArgsConstructor | ||
17 | +public class ShoppingCouponListResp { | ||
18 | + private List<ShoppingCoupon> coupons; | ||
19 | + | ||
20 | +} |
@@ -2,8 +2,10 @@ package com.yohoufo.order.service; | @@ -2,8 +2,10 @@ package com.yohoufo.order.service; | ||
2 | 2 | ||
3 | 3 | ||
4 | import com.yohoufo.order.model.request.ShoppingRequest; | 4 | import com.yohoufo.order.model.request.ShoppingRequest; |
5 | +import com.yohoufo.order.model.response.ComputeResponse; | ||
5 | import com.yohoufo.order.model.response.OrderSubmitResponse; | 6 | import com.yohoufo.order.model.response.OrderSubmitResponse; |
6 | import com.yohoufo.order.model.response.PaymentResponse; | 7 | import com.yohoufo.order.model.response.PaymentResponse; |
8 | +import com.yohoufo.order.model.response.ShoppingCouponListResp; | ||
7 | 9 | ||
8 | public interface IShoppingService { | 10 | public interface IShoppingService { |
9 | 11 | ||
@@ -16,6 +18,23 @@ public interface IShoppingService { | @@ -16,6 +18,23 @@ public interface IShoppingService { | ||
16 | 18 | ||
17 | 19 | ||
18 | /** | 20 | /** |
21 | + * 券列表,选择券 | ||
22 | + * | ||
23 | + * @param request | ||
24 | + * @return | ||
25 | + */ | ||
26 | + ShoppingCouponListResp selectCoupon(ShoppingRequest request); | ||
27 | + | ||
28 | + | ||
29 | + /** | ||
30 | + * 重新结算 | ||
31 | + * @param request | ||
32 | + * @return | ||
33 | + */ | ||
34 | + ComputeResponse compute(ShoppingRequest request); | ||
35 | + | ||
36 | + | ||
37 | + /** | ||
19 | * 提交订单 | 38 | * 提交订单 |
20 | * @param shoppingRequest | 39 | * @param shoppingRequest |
21 | * @return | 40 | * @return |
1 | package com.yohoufo.order.service.impl; | 1 | package com.yohoufo.order.service.impl; |
2 | 2 | ||
3 | +import com.google.common.collect.Lists; | ||
3 | import com.yoho.core.rest.client.ServiceCaller; | 4 | import com.yoho.core.rest.client.ServiceCaller; |
4 | import com.yoho.error.ServiceError; | 5 | import com.yoho.error.ServiceError; |
5 | import com.yoho.error.exception.ServiceException; | 6 | import com.yoho.error.exception.ServiceException; |
@@ -17,8 +18,7 @@ import com.yohoufo.order.model.AddressInfo; | @@ -17,8 +18,7 @@ import com.yohoufo.order.model.AddressInfo; | ||
17 | import com.yohoufo.order.model.dto.BuyerOrderSubmitResult; | 18 | import com.yohoufo.order.model.dto.BuyerOrderSubmitResult; |
18 | import com.yohoufo.order.model.dto.OrderBuilder; | 19 | import com.yohoufo.order.model.dto.OrderBuilder; |
19 | import com.yohoufo.order.model.request.ShoppingRequest; | 20 | import com.yohoufo.order.model.request.ShoppingRequest; |
20 | -import com.yohoufo.order.model.response.OrderSubmitResponse; | ||
21 | -import com.yohoufo.order.model.response.PaymentResponse; | 21 | +import com.yohoufo.order.model.response.*; |
22 | import com.yohoufo.order.service.ISubmitOrderService; | 22 | import com.yohoufo.order.service.ISubmitOrderService; |
23 | import com.yohoufo.order.service.IShoppingService; | 23 | import com.yohoufo.order.service.IShoppingService; |
24 | import com.yohoufo.order.service.cache.CacheCleaner; | 24 | import com.yohoufo.order.service.cache.CacheCleaner; |
@@ -32,6 +32,8 @@ import org.slf4j.Logger; | @@ -32,6 +32,8 @@ import org.slf4j.Logger; | ||
32 | import org.slf4j.LoggerFactory; | 32 | import org.slf4j.LoggerFactory; |
33 | import org.springframework.beans.factory.annotation.Autowired; | 33 | import org.springframework.beans.factory.annotation.Autowired; |
34 | import java.math.BigDecimal; | 34 | import java.math.BigDecimal; |
35 | +import java.util.Arrays; | ||
36 | +import java.util.List; | ||
35 | 37 | ||
36 | import org.springframework.beans.factory.annotation.Value; | 38 | import org.springframework.beans.factory.annotation.Value; |
37 | import org.springframework.stereotype.Service; | 39 | import org.springframework.stereotype.Service; |
@@ -120,6 +122,69 @@ public class ShoppingServiceImpl implements IShoppingService { | @@ -120,6 +122,69 @@ public class ShoppingServiceImpl implements IShoppingService { | ||
120 | } | 122 | } |
121 | 123 | ||
122 | 124 | ||
125 | + @Override | ||
126 | + public ShoppingCouponListResp selectCoupon(ShoppingRequest request) { | ||
127 | + //todo | ||
128 | + ShoppingCoupon coupon1 = new ShoppingCoupon(); | ||
129 | + coupon1.setCouponValueStr("100"); | ||
130 | + coupon1.setCouponCode("a123456"); | ||
131 | + coupon1.setCouponName("test"); | ||
132 | + coupon1.setCouponValidity("2018.1.1-2019.1.1"); | ||
133 | + coupon1.setSelected("N"); | ||
134 | + coupon1.setIsSelectedSupport("Y"); | ||
135 | + coupon1.setUseRuleStr("满499可用"); | ||
136 | + | ||
137 | + ShoppingCoupon coupon2 = new ShoppingCoupon(); | ||
138 | + coupon2.setCouponValueStr("50"); | ||
139 | + coupon2.setCouponCode("b987654"); | ||
140 | + coupon2.setCouponName("全场通用"); | ||
141 | + coupon2.setCouponValidity("2018.1.1-2019.1.1"); | ||
142 | + coupon2.setSelected("N"); | ||
143 | + coupon2.setIsSelectedSupport("Y"); | ||
144 | + coupon2.setUseRuleStr("满200可用"); | ||
145 | + ShoppingCouponListResp resp = new ShoppingCouponListResp(); | ||
146 | + resp.setCoupons(Lists.newArrayList(coupon1, coupon2)); | ||
147 | + return resp; | ||
148 | + } | ||
149 | + | ||
150 | + @Override | ||
151 | + public ComputeResponse compute(ShoppingRequest request) { | ||
152 | + CouponUseResult result = new CouponUseResult(); | ||
153 | + result.setCouponCode("a123456"); | ||
154 | + result.setCouponAmountStr("¥50.00"); | ||
155 | + result.setCouponTitle("test"); | ||
156 | + result.setCouponCount(1); | ||
157 | + | ||
158 | + | ||
159 | + PromotionFormula formula1 = new PromotionFormula(); | ||
160 | + formula1.setPromotion(OrderConstant.GOODS_PRICE); | ||
161 | + formula1.setPromotionAmount(OrderConstant.MONEY_SIGN + "500"); | ||
162 | + | ||
163 | + PromotionFormula formula2 = new PromotionFormula(); | ||
164 | + formula2.setPromotion(OrderConstant.DELIVERY_DESC); | ||
165 | + formula2.setPromotionAmount(OrderConstant.PLUS_SIGN + OrderConstant.MONEY_SIGN + delivery_way_sf_cost); | ||
166 | + | ||
167 | + | ||
168 | + PromotionFormula formula3 = new PromotionFormula(); | ||
169 | + formula3.setPromotion(OrderConstant.GOODS_REAL_PRICE); | ||
170 | + formula3.setPromotionAmount(OrderConstant.MONEY_SIGN + "425"); | ||
171 | + | ||
172 | + | ||
173 | + PromotionFormula formula4 = new PromotionFormula(); | ||
174 | + formula4.setPromotion("优惠券"); | ||
175 | + formula4.setPromotionAmount("-"+ OrderConstant.MONEY_SIGN +"100"); | ||
176 | + | ||
177 | + List<PromotionFormula> formulaList = Arrays.asList(formula1, formula2, formula4, formula3); | ||
178 | + | ||
179 | + ComputeResponse response = new ComputeResponse(); | ||
180 | + | ||
181 | + response.setCouponUseResult(result); | ||
182 | + response.setPromotionFormulaList(formulaList); | ||
183 | + response.setAmount("425.00"); | ||
184 | + | ||
185 | + return response; | ||
186 | + } | ||
187 | + | ||
123 | /** | 188 | /** |
124 | * 提交订单 | 189 | * 提交订单 |
125 | * @param shoppingRequest | 190 | * @param shoppingRequest |
@@ -6,6 +6,7 @@ import com.yohoufo.dal.order.model.SellerOrderGoods; | @@ -6,6 +6,7 @@ import com.yohoufo.dal.order.model.SellerOrderGoods; | ||
6 | import com.yohobuy.ufo.model.order.constants.OrderConstant; | 6 | import com.yohobuy.ufo.model.order.constants.OrderConstant; |
7 | import com.yohoufo.order.model.response.GoodsInfo; | 7 | import com.yohoufo.order.model.response.GoodsInfo; |
8 | import com.yohoufo.order.model.response.PaymentResponse; | 8 | import com.yohoufo.order.model.response.PaymentResponse; |
9 | +import com.yohoufo.order.model.response.PromotionFormula; | ||
9 | import org.springframework.beans.factory.annotation.Value; | 10 | import org.springframework.beans.factory.annotation.Value; |
10 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
11 | 12 | ||
@@ -69,17 +70,17 @@ public class ShoppingSupport { | @@ -69,17 +70,17 @@ public class ShoppingSupport { | ||
69 | * @param skup | 70 | * @param skup |
70 | * @return | 71 | * @return |
71 | */ | 72 | */ |
72 | - public List<PaymentResponse.PromotionFormula> getPromotionFormula(SellerOrderGoods skup) { | ||
73 | - PaymentResponse.PromotionFormula formula1 = new PaymentResponse.PromotionFormula(); | 73 | + public List<PromotionFormula> getPromotionFormula(SellerOrderGoods skup) { |
74 | + PromotionFormula formula1 = new PromotionFormula(); | ||
74 | formula1.setPromotion(OrderConstant.GOODS_PRICE); | 75 | formula1.setPromotion(OrderConstant.GOODS_PRICE); |
75 | formula1.setPromotionAmount(OrderConstant.MONEY_SIGN + skup.getGoodsPrice()); | 76 | formula1.setPromotionAmount(OrderConstant.MONEY_SIGN + skup.getGoodsPrice()); |
76 | 77 | ||
77 | - PaymentResponse.PromotionFormula formula2 = new PaymentResponse.PromotionFormula(); | 78 | + PromotionFormula formula2 = new PromotionFormula(); |
78 | formula2.setPromotion(OrderConstant.DELIVERY_DESC); | 79 | formula2.setPromotion(OrderConstant.DELIVERY_DESC); |
79 | formula2.setPromotionAmount(OrderConstant.PLUS_SIGN + OrderConstant.MONEY_SIGN + delivery_way_sf_cost); | 80 | formula2.setPromotionAmount(OrderConstant.PLUS_SIGN + OrderConstant.MONEY_SIGN + delivery_way_sf_cost); |
80 | 81 | ||
81 | 82 | ||
82 | - PaymentResponse.PromotionFormula formula3 = new PaymentResponse.PromotionFormula(); | 83 | + PromotionFormula formula3 = new PromotionFormula(); |
83 | formula3.setPromotion(OrderConstant.GOODS_REAL_PRICE); | 84 | formula3.setPromotion(OrderConstant.GOODS_REAL_PRICE); |
84 | BigDecimal amount = BigDecimalHelper.halfUp(skup.getGoodsPrice().add(new BigDecimal(delivery_way_sf_cost))); | 85 | BigDecimal amount = BigDecimalHelper.halfUp(skup.getGoodsPrice().add(new BigDecimal(delivery_way_sf_cost))); |
85 | formula3.setPromotionAmount(OrderConstant.MONEY_SIGN + amount); | 86 | formula3.setPromotionAmount(OrderConstant.MONEY_SIGN + amount); |
1 | +package com.yohoufo.order.utils; | ||
2 | + | ||
3 | +import com.google.common.collect.Lists; | ||
4 | +import org.apache.commons.lang3.StringUtils; | ||
5 | + | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +/** | ||
9 | + * Created by jiexiang.wu on 2018/11/19. | ||
10 | + */ | ||
11 | +public class CouponCodeUtils { | ||
12 | + | ||
13 | + public final static String SPLIT_TOKEN = ","; | ||
14 | + | ||
15 | + public static List<String> asList(String couponCode) { | ||
16 | + if (StringUtils.isEmpty(couponCode)) { | ||
17 | + return Lists.newArrayList(); | ||
18 | + } | ||
19 | + | ||
20 | + return Lists.newArrayList(couponCode.split(SPLIT_TOKEN)); | ||
21 | + } | ||
22 | + | ||
23 | + public static String asString(List<String> list) { | ||
24 | + return StringUtils.join(list, SPLIT_TOKEN); | ||
25 | + } | ||
26 | +} |
-
Please register or login to post a comment