1
|
package com.yohoufo.order.service.support;
|
1
|
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.yoho.core.config.ConfigReader;
|
4
|
import com.yohobuy.ufo.model.order.common.OrderAttributes;
|
5
|
import com.yohobuy.ufo.model.order.common.OrderAttributes;
|
5
|
import com.yohobuy.ufo.model.order.constants.DeliveryWayEnum;
|
6
|
import com.yohobuy.ufo.model.order.constants.DeliveryWayEnum;
|
6
|
import com.yohobuy.ufo.model.order.constants.OrderConstant;
|
7
|
import com.yohobuy.ufo.model.order.constants.OrderConstant;
|
|
@@ -15,6 +16,7 @@ import com.yohoufo.order.utils.MathUtils; |
|
@@ -15,6 +16,7 @@ import com.yohoufo.order.utils.MathUtils; |
15
|
import com.yohoufo.order.utils.OrderDetailDescHelper;
|
16
|
import com.yohoufo.order.utils.OrderDetailDescHelper;
|
16
|
import com.yohoufo.order.utils.SellerGoodsHelper;
|
17
|
import com.yohoufo.order.utils.SellerGoodsHelper;
|
17
|
import org.apache.commons.lang3.StringUtils;
|
18
|
import org.apache.commons.lang3.StringUtils;
|
|
|
19
|
+import org.springframework.beans.factory.annotation.Autowired;
|
18
|
import org.springframework.stereotype.Service;
|
20
|
import org.springframework.stereotype.Service;
|
19
|
|
21
|
|
20
|
import java.math.BigDecimal;
|
22
|
import java.math.BigDecimal;
|
|
@@ -24,6 +26,10 @@ import java.util.Objects; |
|
@@ -24,6 +26,10 @@ import java.util.Objects; |
24
|
@Service
|
26
|
@Service
|
25
|
public class ShoppingSupport {
|
27
|
public class ShoppingSupport {
|
26
|
|
28
|
|
|
|
29
|
+
|
|
|
30
|
+ @Autowired
|
|
|
31
|
+ private ConfigReader configReader;
|
|
|
32
|
+
|
27
|
/**
|
33
|
/**
|
28
|
* 支付方式
|
34
|
* 支付方式
|
29
|
* @return
|
35
|
* @return
|
|
@@ -273,10 +279,27 @@ public class ShoppingSupport { |
|
@@ -273,10 +279,27 @@ public class ShoppingSupport { |
273
|
|
279
|
|
274
|
public DepositResp getDepositResp(SkupType skupType){
|
280
|
public DepositResp getDepositResp(SkupType skupType){
|
275
|
DepositResp depositResp = null;
|
281
|
DepositResp depositResp = null;
|
276
|
- if(SellerGoodsHelper.canDeposit(skupType)){
|
282
|
+ //若订单类型支持寄存,且开关已打开,则页面展示寄存
|
|
|
283
|
+ if(SellerGoodsHelper.canDeposit(skupType) && isDepositSwitchOpen(skupType)){
|
277
|
SkupType target = SellerGoodsHelper.getTargetSkupType4DepositOrder(OrderAttributes.DEPOSITE.getCode(), skupType);
|
284
|
SkupType target = SellerGoodsHelper.getTargetSkupType4DepositOrder(OrderAttributes.DEPOSITE.getCode(), skupType);
|
278
|
depositResp = DepositResp.builder().desc(OrderDetailDescHelper.getPaymentDepositDesc(target)).depositable(OrderConstant.Y_STR).build();
|
285
|
depositResp = DepositResp.builder().desc(OrderDetailDescHelper.getPaymentDepositDesc(target)).depositable(OrderConstant.Y_STR).build();
|
279
|
}
|
286
|
}
|
280
|
return depositResp;
|
287
|
return depositResp;
|
281
|
}
|
288
|
}
|
|
|
289
|
+
|
|
|
290
|
+
|
|
|
291
|
+ private boolean isDepositSwitchOpen(SkupType skupType){
|
|
|
292
|
+ boolean depositSwitchStatus ;
|
|
|
293
|
+ switch (skupType){
|
|
|
294
|
+ case IN_STOCK://现货寄存
|
|
|
295
|
+ depositSwitchStatus = configReader.getBoolean("ufo.order.deposit.inStock.switch", false);break;
|
|
|
296
|
+ case QUICK_DELIVER://闪购寄存
|
|
|
297
|
+ depositSwitchStatus = configReader.getBoolean("ufo.order.deposit.quickDeliver.switch", false);break;
|
|
|
298
|
+ case FAST_DELIVERY://极速寄存
|
|
|
299
|
+ depositSwitchStatus = configReader.getBoolean("ufo.order.deposit.fastDeliver.switch", false);break;
|
|
|
300
|
+ default:
|
|
|
301
|
+ depositSwitchStatus = false;
|
|
|
302
|
+ }
|
|
|
303
|
+ return depositSwitchStatus;
|
|
|
304
|
+ }
|
282
|
} |
305
|
} |