Authored by chenchao

support quick deliver 4 buyer order

@@ -33,7 +33,6 @@ import com.yohoufo.order.service.impl.PaymentServiceImpl; @@ -33,7 +33,6 @@ import com.yohoufo.order.service.impl.PaymentServiceImpl;
33 import com.yohoufo.order.service.impl.SellerService; 33 import com.yohoufo.order.service.impl.SellerService;
34 import com.yohoufo.order.service.impl.SellerWrapper; 34 import com.yohoufo.order.service.impl.SellerWrapper;
35 import com.yohoufo.order.service.impl.TradeBillsService; 35 import com.yohoufo.order.service.impl.TradeBillsService;
36 -import org.apache.commons.collections.CollectionUtils;  
37 import org.apache.commons.lang3.StringUtils; 36 import org.apache.commons.lang3.StringUtils;
38 import org.slf4j.Logger; 37 import org.slf4j.Logger;
39 import org.slf4j.LoggerFactory; 38 import org.slf4j.LoggerFactory;
@@ -44,7 +43,6 @@ import java.math.BigDecimal; @@ -44,7 +43,6 @@ import java.math.BigDecimal;
44 import java.text.SimpleDateFormat; 43 import java.text.SimpleDateFormat;
45 import java.util.*; 44 import java.util.*;
46 import java.util.function.Supplier; 45 import java.util.function.Supplier;
47 -import java.util.stream.Collectors;  
48 46
49 @Service 47 @Service
50 public class MerchantOrderPaymentService extends AbstractOrderPaymentService { 48 public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
  1 +package com.yohoufo.order.service.impl;
  2 +
  3 +import com.yohobuy.ufo.model.order.bo.OrderInfo;
  4 +import com.yohoufo.order.model.request.PaymentRequest;
  5 +import com.yohoufo.order.model.response.PrepayResponse;
  6 +import com.yohoufo.order.service.AbstractOrderPaymentService;
  7 +import org.springframework.stereotype.Service;
  8 +
  9 +@Service
  10 +public class DeposiOrderPaymentService extends AbstractOrderPaymentService {
  11 + @Override
  12 + public boolean isTimeoutCancelStatus(OrderInfo orderInfo) {
  13 + return false;
  14 + }
  15 +
  16 + @Override
  17 + public OrderInfo getOrderInfo(long orderCode, int uid) {
  18 + return null;
  19 + }
  20 +
  21 + @Override
  22 + public OrderInfo getOrderInfo(long orderCode) {
  23 + return null;
  24 + }
  25 +
  26 + @Override
  27 + public void checkOrderStatus(OrderInfo orderInfo) {
  28 +
  29 + }
  30 +
  31 + @Override
  32 + public void updatePayment(OrderInfo orderInfo, int payment) {
  33 +
  34 + }
  35 +
  36 + @Override
  37 + public PrepayResponse getAppPayRequest(PaymentRequest request) {
  38 + return null;
  39 + }
  40 +
  41 + @Override
  42 + public void saveAppPayRequest(OrderInfo orderInfo, PrepayResponse response) {
  43 +
  44 + }
  45 +
  46 + @Override
  47 + public boolean isOrderWaitingPay(OrderInfo orderInfo) {
  48 + return false;
  49 + }
  50 +
  51 + @Override
  52 + public boolean isOrderPaid(OrderInfo orderInfo) {
  53 + return false;
  54 + }
  55 +
  56 + @Override
  57 + public boolean canRefund(OrderInfo orderInfo) {
  58 + return false;
  59 + }
  60 +
  61 + @Override
  62 + public int updateOrderStatusPaid(OrderInfo orderInfo) {
  63 + return 0;
  64 + }
  65 +
  66 + @Override
  67 + public void processAfterPay(OrderInfo orderInfo) {
  68 +
  69 + }
  70 +}
@@ -60,6 +60,7 @@ import org.springframework.stereotype.Service; @@ -60,6 +60,7 @@ import org.springframework.stereotype.Service;
60 60
61 import java.math.BigDecimal; 61 import java.math.BigDecimal;
62 import java.util.*; 62 import java.util.*;
  63 +import java.util.function.Function;
63 import java.util.stream.Collectors; 64 import java.util.stream.Collectors;
64 65
65 @Primary 66 @Primary
@@ -256,24 +257,34 @@ public class ShoppingServiceImpl implements IShoppingService { @@ -256,24 +257,34 @@ public class ShoppingServiceImpl implements IShoppingService {
256 return tcpMap; 257 return tcpMap;
257 } 258 }
258 259
  260 +
259 private ChargeContext buildChargeContext(ShoppingRequest request, 261 private ChargeContext buildChargeContext(ShoppingRequest request,
260 SellerOrderGoods skupInfo, 262 SellerOrderGoods skupInfo,
261 ActivityPrice activityPrice, 263 ActivityPrice activityPrice,
262 int chargeStage) { 264 int chargeStage) {
263 Integer skupAttr = skupInfo.getAttributes(); 265 Integer skupAttr = skupInfo.getAttributes();
264 SkupType skupType = SkupType.getSkupType(skupAttr); 266 SkupType skupType = SkupType.getSkupType(skupAttr);
265 - FeeNRate feeNRate = getFeeNRate(skupType); 267 + Function<SkupType,FeeNRate> feeNRateFunc = this::getFeeNRate;
  268 + boolean depositChoose = OrderConstant.Y_STR.equalsIgnoreCase(request.getDepositRequirement());
  269 + boolean depositRequirement = SellerGoodsHelper.canDeposit(skupType)
  270 + && depositChoose;
266 BigDecimal tariffRate = null; 271 BigDecimal tariffRate = null;
267 BigDecimal shipFee = null; 272 BigDecimal shipFee = null;
268 - if (feeNRate != null){ 273 + BigDecimal storageManagementFee = null;
  274 + if (SkupType.HK_IN_STOCK.equals(skupType)){
  275 + FeeNRate feeNRate = feeNRateFunc.apply(skupType);
269 tariffRate = feeNRate.getTariffRate(); 276 tariffRate = feeNRate.getTariffRate();
270 shipFee = feeNRate.getShipFee(); 277 shipFee = feeNRate.getShipFee();
271 } 278 }
272 - boolean depositRequirement = SellerGoodsHelper.canDeposit(skupType)  
273 - && OrderConstant.Y_STR.equalsIgnoreCase(request.getDepositRequirement());  
274 - BigDecimal storageManagementFee = null; 279 + //急速商品 非寄存
  280 + if (!depositChoose && SkupType.QUICK_DELIVER.equals(skupType)){
  281 + FeeNRate feeNRate = feeNRateFunc.apply(skupType);
  282 + storageManagementFee = feeNRate.getStorageManagementFee();
  283 + }
  284 +
  285 + //现货 or 闪购 商品,且选择了寄存
275 if (depositRequirement){ 286 if (depositRequirement){
276 - FeeNRate depositFee = getFeeNRate(SkupType.DEPOSIT); 287 + FeeNRate depositFee = feeNRateFunc.apply(SkupType.DEPOSIT);
277 storageManagementFee = depositFee.getStorageManagementFee(); 288 storageManagementFee = depositFee.getStorageManagementFee();
278 } 289 }
279 290
@@ -385,11 +396,16 @@ public class ShoppingServiceImpl implements IShoppingService { @@ -385,11 +396,16 @@ public class ShoppingServiceImpl implements IShoppingService {
385 switch (skupType){ 396 switch (skupType){
386 case HK_IN_STOCK: 397 case HK_IN_STOCK:
387 feeNRate = new FeeNRate(); 398 feeNRate = new FeeNRate();
388 - feeNRate.setShipFee(new BigDecimal(55)); 399 + feeNRate.setShipFee(new BigDecimal(30));
389 feeNRate.setShipFee(new BigDecimal(0.091)); 400 feeNRate.setShipFee(new BigDecimal(0.091));
390 break; 401 break;
391 case DEPOSIT: 402 case DEPOSIT:
392 feeNRate = new FeeNRate(); 403 feeNRate = new FeeNRate();
  404 + feeNRate.setStorageManagementFee(new BigDecimal(10));
  405 + break;
  406 + case QUICK_DELIVER:
  407 + feeNRate = new FeeNRate();
  408 + feeNRate.setStorageManagementFee(new BigDecimal(15));
393 break; 409 break;
394 410
395 } 411 }
@@ -2,12 +2,12 @@ package com.yohoufo.order.service.support; @@ -2,12 +2,12 @@ package com.yohoufo.order.service.support;
2 2
3 import com.google.common.collect.Lists; 3 import com.google.common.collect.Lists;
4 import com.yohobuy.ufo.model.order.constants.DeliveryWayEnum; 4 import com.yohobuy.ufo.model.order.constants.DeliveryWayEnum;
  5 +import com.yohobuy.ufo.model.order.constants.OrderConstant;
5 import com.yohobuy.ufo.model.order.constants.OrderDetailDesc; 6 import com.yohobuy.ufo.model.order.constants.OrderDetailDesc;
6 import com.yohobuy.ufo.model.order.constants.SkupType; 7 import com.yohobuy.ufo.model.order.constants.SkupType;
7 import com.yohobuy.ufo.model.promotion.constant.CouponTypeEnum; 8 import com.yohobuy.ufo.model.promotion.constant.CouponTypeEnum;
8 import com.yohoufo.common.helper.ImageUrlAssist; 9 import com.yohoufo.common.helper.ImageUrlAssist;
9 import com.yohoufo.dal.order.model.SellerOrderGoods; 10 import com.yohoufo.dal.order.model.SellerOrderGoods;
10 -import com.yohobuy.ufo.model.order.constants.OrderConstant;  
11 import com.yohoufo.order.charge.model.*; 11 import com.yohoufo.order.charge.model.*;
12 import com.yohoufo.order.constants.CouponConstants; 12 import com.yohoufo.order.constants.CouponConstants;
13 import com.yohoufo.order.model.response.*; 13 import com.yohoufo.order.model.response.*;
@@ -259,8 +259,7 @@ public class ShoppingSupport { @@ -259,8 +259,7 @@ public class ShoppingSupport {
259 public DepositResp getDepositResp(SkupType skupType){ 259 public DepositResp getDepositResp(SkupType skupType){
260 DepositResp depositResp = null; 260 DepositResp depositResp = null;
261 if(SellerGoodsHelper.canDeposit(skupType)){ 261 if(SellerGoodsHelper.canDeposit(skupType)){
262 - depositResp = new DepositResp();  
263 - depositResp.setDepositable(OrderConstant.Y_STR); 262 + depositResp = DepositResp.builder().depositable(OrderConstant.Y_STR).build();
264 } 263 }
265 return depositResp; 264 return depositResp;
266 } 265 }