|
|
package com.yohoufo.order.service.impl;
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.yoho.core.rest.client.ServiceCaller;
|
|
|
import com.yoho.error.ServiceError;
|
|
|
import com.yoho.error.exception.ServiceException;
|
...
|
...
|
@@ -17,8 +18,7 @@ import com.yohoufo.order.model.AddressInfo; |
|
|
import com.yohoufo.order.model.dto.BuyerOrderSubmitResult;
|
|
|
import com.yohoufo.order.model.dto.OrderBuilder;
|
|
|
import com.yohoufo.order.model.request.ShoppingRequest;
|
|
|
import com.yohoufo.order.model.response.OrderSubmitResponse;
|
|
|
import com.yohoufo.order.model.response.PaymentResponse;
|
|
|
import com.yohoufo.order.model.response.*;
|
|
|
import com.yohoufo.order.service.ISubmitOrderService;
|
|
|
import com.yohoufo.order.service.IShoppingService;
|
|
|
import com.yohoufo.order.service.cache.CacheCleaner;
|
...
|
...
|
@@ -32,6 +32,8 @@ import org.slf4j.Logger; |
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
...
|
...
|
@@ -120,6 +122,69 @@ public class ShoppingServiceImpl implements IShoppingService { |
|
|
}
|
|
|
|
|
|
|
|
|
@Override
|
|
|
public ShoppingCouponListResp selectCoupon(ShoppingRequest request) {
|
|
|
//todo
|
|
|
ShoppingCoupon coupon1 = new ShoppingCoupon();
|
|
|
coupon1.setCouponValueStr("100");
|
|
|
coupon1.setCouponCode("a123456");
|
|
|
coupon1.setCouponName("test");
|
|
|
coupon1.setCouponValidity("2018.1.1-2019.1.1");
|
|
|
coupon1.setSelected("N");
|
|
|
coupon1.setIsSelectedSupport("Y");
|
|
|
coupon1.setUseRuleStr("满499可用");
|
|
|
|
|
|
ShoppingCoupon coupon2 = new ShoppingCoupon();
|
|
|
coupon2.setCouponValueStr("50");
|
|
|
coupon2.setCouponCode("b987654");
|
|
|
coupon2.setCouponName("全场通用");
|
|
|
coupon2.setCouponValidity("2018.1.1-2019.1.1");
|
|
|
coupon2.setSelected("N");
|
|
|
coupon2.setIsSelectedSupport("Y");
|
|
|
coupon2.setUseRuleStr("满200可用");
|
|
|
ShoppingCouponListResp resp = new ShoppingCouponListResp();
|
|
|
resp.setCoupons(Lists.newArrayList(coupon1, coupon2));
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public ComputeResponse compute(ShoppingRequest request) {
|
|
|
CouponUseResult result = new CouponUseResult();
|
|
|
result.setCouponCode("a123456");
|
|
|
result.setCouponAmountStr("¥50.00");
|
|
|
result.setCouponTitle("test");
|
|
|
result.setCouponCount(1);
|
|
|
|
|
|
|
|
|
PromotionFormula formula1 = new PromotionFormula();
|
|
|
formula1.setPromotion(OrderConstant.GOODS_PRICE);
|
|
|
formula1.setPromotionAmount(OrderConstant.MONEY_SIGN + "500");
|
|
|
|
|
|
PromotionFormula formula2 = new PromotionFormula();
|
|
|
formula2.setPromotion(OrderConstant.DELIVERY_DESC);
|
|
|
formula2.setPromotionAmount(OrderConstant.PLUS_SIGN + OrderConstant.MONEY_SIGN + delivery_way_sf_cost);
|
|
|
|
|
|
|
|
|
PromotionFormula formula3 = new PromotionFormula();
|
|
|
formula3.setPromotion(OrderConstant.GOODS_REAL_PRICE);
|
|
|
formula3.setPromotionAmount(OrderConstant.MONEY_SIGN + "425");
|
|
|
|
|
|
|
|
|
PromotionFormula formula4 = new PromotionFormula();
|
|
|
formula4.setPromotion("优惠券");
|
|
|
formula4.setPromotionAmount("-"+ OrderConstant.MONEY_SIGN +"100");
|
|
|
|
|
|
List<PromotionFormula> formulaList = Arrays.asList(formula1, formula2, formula4, formula3);
|
|
|
|
|
|
ComputeResponse response = new ComputeResponse();
|
|
|
|
|
|
response.setCouponUseResult(result);
|
|
|
response.setPromotionFormulaList(formulaList);
|
|
|
response.setAmount("425.00");
|
|
|
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 提交订单
|
|
|
* @param shoppingRequest
|
...
|
...
|
|