Commit 0ad9d806 by zhiheng.zhang

Merge branch 'feature/2020-1104-混合支付' into develop

# Conflicts:
#	shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/ShoppingCartGoodsResponseVo.java
parents d4f0eb84 df2dcc00
...@@ -2544,7 +2544,7 @@ public class OrderServiceImpl implements Orderservice { ...@@ -2544,7 +2544,7 @@ public class OrderServiceImpl implements Orderservice {
} }
//svc 卡支付失败 //svc 卡支付失败
if (StringUtils.isNotBlank(cardCode)) { if (StringUtils.isNotBlank(cardCode)) {
return ResponseUtil.error(ResponseResultEnum.PAY_BACKEND_CONFIG_ERROR.getCode(), ResponseResultEnum.PAY_BACKEND_CONFIG_ERROR.getMessage(), null); return ResponseUtil.error(ResponseResultEnum.PAY_BACKEND_CONFIG_ERROR.getCode(), StringUtils.isNotBlank(msg) ? msg : ResponseResultEnum.PAY_BACKEND_CONFIG_ERROR.getMessage(), null);
} }
return ResponseUtil.error(ResponseResultEnum.PAY_UNIFIED_ORDER_ERROR.getCode(), ResponseResultEnum.PAY_UNIFIED_ORDER_ERROR.getMessage(), null); return ResponseUtil.error(ResponseResultEnum.PAY_UNIFIED_ORDER_ERROR.getCode(), ResponseResultEnum.PAY_UNIFIED_ORDER_ERROR.getMessage(), null);
} }
......
...@@ -132,11 +132,6 @@ public class ShoppingCartGoodsResponseVo extends ShoppingCartGoodsBaseResponseV ...@@ -132,11 +132,6 @@ public class ShoppingCartGoodsResponseVo extends ShoppingCartGoodsBaseResponseV
private String couponCode; private String couponCode;
/** /**
* svc卡支付金额
*/
private BigDecimal svcPayAmount;
/**
* 运费券 * 运费券
*/ */
private String freightCouponCode; private String freightCouponCode;
...@@ -145,12 +140,14 @@ public class ShoppingCartGoodsResponseVo extends ShoppingCartGoodsBaseResponseV ...@@ -145,12 +140,14 @@ public class ShoppingCartGoodsResponseVo extends ShoppingCartGoodsBaseResponseV
* 麦咖啡-咖啡月卡价格 * 麦咖啡-咖啡月卡价格
*/ */
private Long payCardFee; private Long payCardFee;
private Integer version;
/** /**
* 购物车版本号 * 购物车版本号
*/ */
private Integer carVer; private Integer carVer;
/**
* 支付金额
*/
private Integer svcPayAmount;
} }
...@@ -1643,18 +1643,30 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -1643,18 +1643,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);
...@@ -1664,6 +1676,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -1664,6 +1676,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