Commit f29e89e4 by chongfu.liang

SDK

parent 5e9cb1ea
...@@ -108,6 +108,24 @@ public class BaseListCartGoodsVO { ...@@ -108,6 +108,24 @@ public class BaseListCartGoodsVO {
*/ */
private String couponCode; private String couponCode;
/**
* 现总价
*/
private Long totalAmount;
/**
* 减免后配送费
*/
private Long discountDeliveryAmount;
/**
* svc卡支付金额
*/
private String svcPayAmount;
/**
* svc卡支付描述
*/
private String svcDiscountDesc;
} }
...@@ -42,10 +42,7 @@ public class PlatformListCartGoodsVO extends BaseListCartGoodsVO { ...@@ -42,10 +42,7 @@ public class PlatformListCartGoodsVO extends BaseListCartGoodsVO {
* 原总价 * 原总价
*/ */
private Long originalTotalAmount; private Long originalTotalAmount;
/**
* 现总价
*/
private Long totalAmount;
/** /**
* 总折扣价 * 总折扣价
*/ */
...@@ -65,10 +62,6 @@ public class PlatformListCartGoodsVO extends BaseListCartGoodsVO { ...@@ -65,10 +62,6 @@ public class PlatformListCartGoodsVO extends BaseListCartGoodsVO {
* 满减折扣 * 满减折扣
*/ */
private Long fullDiscount; private Long fullDiscount;
/**
* svc卡支付描述
*/
private String svcDiscountDesc;
/** /**
* 可用优惠券列表 * 可用优惠券列表
...@@ -99,10 +92,6 @@ public class PlatformListCartGoodsVO extends BaseListCartGoodsVO { ...@@ -99,10 +92,6 @@ public class PlatformListCartGoodsVO extends BaseListCartGoodsVO {
*/ */
private Long deliveryAmount; private Long deliveryAmount;
/**
* 减免后配送费
*/
private Long discountDeliveryAmount;
/** /**
* 满多少额度 减免 * 满多少额度 减免
...@@ -143,10 +132,6 @@ public class PlatformListCartGoodsVO extends BaseListCartGoodsVO { ...@@ -143,10 +132,6 @@ public class PlatformListCartGoodsVO extends BaseListCartGoodsVO {
* 麦咖啡-咖啡月卡价格 * 麦咖啡-咖啡月卡价格
*/ */
private Long payCardFee; private Long payCardFee;
/**
* svc卡支付金额
*/
private String svcPayAmount;
/** /**
* 购物车版本号 * 购物车版本号
......
...@@ -22,6 +22,7 @@ import cn.freemud.constant.CustomerScoreConstant; ...@@ -22,6 +22,7 @@ import cn.freemud.constant.CustomerScoreConstant;
import cn.freemud.constant.ResponseCodeConstant; import cn.freemud.constant.ResponseCodeConstant;
import cn.freemud.constant.ShoppingCartConstant; import cn.freemud.constant.ShoppingCartConstant;
import cn.freemud.demo.controller.ShoppingCartDemoController; import cn.freemud.demo.controller.ShoppingCartDemoController;
import cn.freemud.demo.entities.dto.goods.add.list.BaseListCartGoodsVO;
import cn.freemud.entities.dto.*; import cn.freemud.entities.dto.*;
import cn.freemud.entities.dto.activity.ActivityQueryDto; import cn.freemud.entities.dto.activity.ActivityQueryDto;
import cn.freemud.entities.dto.activity.ActivityQueryResponseDto; import cn.freemud.entities.dto.activity.ActivityQueryResponseDto;
...@@ -714,30 +715,35 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -714,30 +715,35 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
return ResponseUtil.error(ResponseResult.PARAMETER_MISSING); return ResponseUtil.error(ResponseResult.PARAMETER_MISSING);
} }
BaseResponse<ShoppingCartGoodsResponseVo> goodsList = null; String partnerId = shoppingCartInfoRequestVo.getPartnerId();
String storeId = shoppingCartInfoRequestVo.getShopId();
if (SDKCommonBaseContextWare.getBean(ShoppingCartNewServiceImpl.class).newShoppingCartGray(shoppingCartInfoRequestVo.getPartnerId(), shoppingCartInfoRequestVo.getShopId())){ if (SDKCommonBaseContextWare.getBean(ShoppingCartNewServiceImpl.class).newShoppingCartGray(shoppingCartInfoRequestVo.getPartnerId(), shoppingCartInfoRequestVo.getShopId())){
Map requestMap = mapperFacade.map(shoppingCartInfoRequestVo, Map.class); Map requestMap = mapperFacade.map(shoppingCartInfoRequestVo, Map.class);
BaseResponse<BaseListCartGoodsVO> goodsList = null;
goodsList = shoppingCartDemoController.listCartGoods(requestMap); goodsList = shoppingCartDemoController.listCartGoods(requestMap);
} else {
goodsList = getGoodsList(shoppingCartInfoRequestVo);
}
if (goodsList == null || !ResponseResult.SUCCESS.getCode().equals(goodsList.getCode())) { if (goodsList == null || !ResponseResult.SUCCESS.getCode().equals(goodsList.getCode())) {
return goodsList; return goodsList;
} }
BaseListCartGoodsVO result = goodsList.getResult();
//SVC卡支付
SVCCardPay(shoppingCartInfoRequestVo.getCardCode(), shoppingCartInfoRequestVo.getReceiveId(), partnerId, storeId, result);
return ResponseUtil.success(goodsList.getResult());
String partnerId = shoppingCartInfoRequestVo.getPartnerId(); } else {
String storeId = shoppingCartInfoRequestVo.getShopId(); BaseResponse<ShoppingCartGoodsResponseVo> goodsList = null;
goodsList = getGoodsList(shoppingCartInfoRequestVo);
if (goodsList == null || !ResponseResult.SUCCESS.getCode().equals(goodsList.getCode())) {
return goodsList;
}
ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo = goodsList.getResult(); ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo = goodsList.getResult();
// 校验入参券是否可用
if (!checkAvailableCoupon(shoppingCartGoodsResponseVo, shoppingCartInfoRequestVo.getCouponCode())){
return ResponseUtil.error(ResponseResult.SHOPPING_CART_COUPON_NOT_USE);
};
//SVC卡支付 //SVC卡支付
SVCCardPay(shoppingCartInfoRequestVo.getCardCode(), shoppingCartInfoRequestVo.getReceiveId(), partnerId, storeId, shoppingCartGoodsResponseVo); SVCCardPay(shoppingCartInfoRequestVo.getCardCode(), shoppingCartInfoRequestVo.getReceiveId(), partnerId, storeId, shoppingCartGoodsResponseVo);
return ResponseUtil.success(shoppingCartGoodsResponseVo); return ResponseUtil.success(goodsList.getResult());
}
} }
/** /**
...@@ -1912,6 +1918,74 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -1912,6 +1918,74 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
* 校验订单商品金额与外卖配送费 * 校验订单商品金额与外卖配送费
*/ */
private void SVCCardPay(String cardCode, String receiveId, String partnerId, String storeId, private void SVCCardPay(String cardCode, String receiveId, String partnerId, String storeId,
BaseListCartGoodsVO shoppingCartGoodsResponseVo) {
if (StringUtils.isBlank(cardCode)) {
return;
}
Integer orderAmount = shoppingCartGoodsResponseVo.getTotalAmount().intValue();
String trackingNo = LogThreadLocal.getTrackingNo();
SVCCardAmountRequest request = new SVCCardAmountRequest();
request.setPartnerId(partnerId);
request.setCardCodes(Arrays.asList(cardCode));
//查询svc卡金额
com.freemud.application.sdk.api.base.BaseResponse<SVCCardAmountResponse> response = paymentNewService.querySVCCardAmount(request, trackingNo);
if (response == null) {
throw new ServiceException(ResponseResult.SYSTEM_BUSINESS_ERROR);
}
if (response.getData() == null || response.getData().getData() == null || response.getData().getData().getCardSimpleInfos().size() > 1) {
throw new ServiceException(ResponseResult.USER_SVC_CARD_ERROR);
}
boolean check = this.checkSvcComPay(partnerId, storeId);
if (check) {
//混合支付无需校验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 svcPayAmount = 0;
if (StringUtils.isNotBlank(receiveId) && shoppingCartGoodsResponseVo.getDiscountDeliveryAmount() != null) {
//Integer deliveryAmount = getDeliveryAmount(receiveId, partnerId, storeId);
deliveryAmount = shoppingCartGoodsResponseVo.getDiscountDeliveryAmount().intValue();
orderAmount += deliveryAmount;
}
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 bigDecimal = new BigDecimal(svcPayAmount);
String amountStr = bigDecimal.divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP).toString();
shoppingCartGoodsResponseVo.setSvcPayAmount(amountStr);
shoppingCartGoodsResponseVo.setSvcDiscountDesc("储值卡支付¥" + amountStr);
}
else {
//获取实际配送费
if (StringUtils.isNotBlank(receiveId) && shoppingCartGoodsResponseVo.getDiscountDeliveryAmount() != null) {
Integer deliveryAmount = shoppingCartGoodsResponseVo.getDiscountDeliveryAmount().intValue();
orderAmount += deliveryAmount;
}
Integer amount1 = response.getData().getData().getCardSimpleInfos().get(0).getAmount();
Integer vamount = response.getData().getData().getCardSimpleInfos().get(0).getVamount();
if (orderAmount > amount1 + vamount) {
throw new ServiceException(ResponseResult.USER_SVC_CARD_AMOUNT_DEFICIENCY);
}
BigDecimal bigDecimal = new BigDecimal(orderAmount);
String amountStr = bigDecimal.divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP).toString();
shoppingCartGoodsResponseVo.setTotalAmount(0L);
shoppingCartGoodsResponseVo.setSvcDiscountDesc("储值卡支付¥" + amountStr);
}
}
/**
* 储值卡支付余额校验
* 校验订单商品金额与外卖配送费
*/
private void SVCCardPay(String cardCode, String receiveId, String partnerId, String storeId,
ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo) { ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo) {
if (StringUtils.isBlank(cardCode)) { if (StringUtils.isBlank(cardCode)) {
return; return;
...@@ -1974,6 +2048,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -1974,6 +2048,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
} }
} }
/** /**
* 储值卡支付查询配送费 * 储值卡支付查询配送费
* *
......
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