Commit df2dcc00 by xiaoer.li@freemud.com

重新调整购物车svc卡计算逻辑

parent 74381499
...@@ -144,6 +144,6 @@ public class ShoppingCartGoodsResponseVo extends ShoppingCartGoodsBaseResponseV ...@@ -144,6 +144,6 @@ public class ShoppingCartGoodsResponseVo extends ShoppingCartGoodsBaseResponseV
/** /**
* svc卡支付金额 * svc卡支付金额
*/ */
private BigDecimal svcPayAmount; private Integer svcPayAmount;
} }
...@@ -1636,18 +1636,30 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -1636,18 +1636,30 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
if (response.getData() == null || response.getData().getData() == null || response.getData().getData().getCardSimpleInfos().size() > 1) { if (response.getData() == null || response.getData().getData() == null || response.getData().getData().getCardSimpleInfos().size() > 1) {
throw new ServiceException(ResponseResult.USER_SVC_CARD_ERROR); throw new ServiceException(ResponseResult.USER_SVC_CARD_ERROR);
} }
//混合支付无需校验svc卡余额,但是配送和包装费不计算在svc卡支付
Integer amount1 = response.getData().getData().getCardSimpleInfos().get(0).getAmount();
Integer vamount = response.getData().getData().getCardSimpleInfos().get(0).getVamount();
Integer svcTotalAmount = amount1+vamount;
//获取实际配送费 //获取实际配送费
Integer deliveryAmount = 0; Integer deliveryAmount = 0;
Integer svcPayAmount = 0;
if (StringUtils.isNotBlank(receiveId) && shoppingCartGoodsResponseVo.getDiscountDeliveryAmount() != null) { if (StringUtils.isNotBlank(receiveId) && shoppingCartGoodsResponseVo.getDiscountDeliveryAmount() != null) {
//Integer deliveryAmount = getDeliveryAmount(receiveId, partnerId, storeId); //Integer deliveryAmount = getDeliveryAmount(receiveId, partnerId, storeId);
deliveryAmount = shoppingCartGoodsResponseVo.getDiscountDeliveryAmount().intValue(); deliveryAmount = shoppingCartGoodsResponseVo.getDiscountDeliveryAmount().intValue();
orderAmount += deliveryAmount; orderAmount += deliveryAmount;
} }
//混合支付无需校验svc卡余额,但是配送和包装费不计算在svc卡支付 log.info("svcPrice:totalAmount:{},orderAmount:{},deliveryAmount:{}",shoppingCartGoodsResponseVo.getTotalAmount().intValue(),orderAmount,deliveryAmount);
Integer amount1 = response.getData().getData().getCardSimpleInfos().get(0).getAmount();
Integer vamount = response.getData().getData().getCardSimpleInfos().get(0).getVamount(); if (svcTotalAmount>0 && svcTotalAmount>orderAmount) {
svcPayAmount = orderAmount;
shoppingCartGoodsResponseVo.setTotalAmount(0L);
}
else if (svcTotalAmount>0 && svcTotalAmount<=orderAmount) {
svcPayAmount = svcTotalAmount;
shoppingCartGoodsResponseVo.setTotalAmount(orderAmount.longValue()-svcPayAmount.longValue());
}
/**
BigDecimal svcPayAmount = BigDecimal.ZERO; BigDecimal svcPayAmount = BigDecimal.ZERO;
//本金+赠送金额
if (orderAmount >= amount1 + vamount) { if (orderAmount >= amount1 + vamount) {
//throw new ServiceException(ResponseResult.USER_SVC_CARD_AMOUNT_DEFICIENCY); //throw new ServiceException(ResponseResult.USER_SVC_CARD_AMOUNT_DEFICIENCY);
svcPayAmount = new BigDecimal(amount1 + vamount).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP); svcPayAmount = new BigDecimal(amount1 + vamount).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
...@@ -1657,6 +1669,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -1657,6 +1669,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
svcPayAmount = new BigDecimal(orderAmount - deliveryAmount).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP); svcPayAmount = new BigDecimal(orderAmount - deliveryAmount).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);
shoppingCartGoodsResponseVo.setTotalAmount(deliveryAmount.longValue()); shoppingCartGoodsResponseVo.setTotalAmount(deliveryAmount.longValue());
} }
*/
shoppingCartGoodsResponseVo.setSvcPayAmount(svcPayAmount); shoppingCartGoodsResponseVo.setSvcPayAmount(svcPayAmount);
shoppingCartGoodsResponseVo.setSvcDiscountDesc("储值卡支付¥" + svcPayAmount); shoppingCartGoodsResponseVo.setSvcDiscountDesc("储值卡支付¥" + svcPayAmount);
//BigDecimal bigDecimal = new BigDecimal(orderAmount); //BigDecimal bigDecimal = new BigDecimal(orderAmount);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment