Commit b5426e33 by chongfu.liang

fix

parent efd89853
...@@ -337,7 +337,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -337,7 +337,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
this.addProductGoods(addShoppingCartGoodsRequestVo, cartGoods, spuId2, userId, shoppingCartGoodsResponseVo, this.addProductGoods(addShoppingCartGoodsRequestVo, cartGoods, spuId2, userId, shoppingCartGoodsResponseVo,
spuId, allCartGoodsList, productBeanListSpuClass, couponProductDto); spuId, allCartGoodsList, productBeanListSpuClass, couponProductDto);
} }
Long deliveryAmount = calculateDeliveryAmount(receiveId, partnerId, storeId, userLoginInfoDto.getWxAppid(), shoppingCartGoodsResponseVo); Long deliveryAmount = calculateDeliveryAmount(receiveId, partnerId, storeId, userLoginInfoDto.getWxAppid(), shoppingCartGoodsResponseVo,addShoppingCartGoodsRequestVo.getOrderType());
ActivityQueryDto activityQueryDto = activityAdapter.getActivityQueryDto(partnerId, storeId, userId, appId, addShoppingCartGoodsRequestVo.getOrderType()); ActivityQueryDto activityQueryDto = activityAdapter.getActivityQueryDto(partnerId, storeId, userId, appId, addShoppingCartGoodsRequestVo.getOrderType());
if (grayPush(partnerId,storeId,"2")) { if (grayPush(partnerId,storeId,"2")) {
...@@ -462,7 +462,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -462,7 +462,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// 重新存储最新购物车 // 重新存储最新购物车
assortmentSdkService.setShoppingCart(partnerId, storeId, userId, cartGoodsList, updateShoppingCartGoodsQtyRequestVo.getSessionId(), "", shoppingCartBaseService); assortmentSdkService.setShoppingCart(partnerId, storeId, userId, cartGoodsList, updateShoppingCartGoodsQtyRequestVo.getSessionId(), "", shoppingCartBaseService);
Long deliveryAmount = calculateDeliveryAmount(receiveId, partnerId, storeId, userLoginInfoDto.getWxAppid(), shoppingCartGoodsResponseVo); Long deliveryAmount = calculateDeliveryAmount(receiveId, partnerId, storeId, userLoginInfoDto.getWxAppid(), shoppingCartGoodsResponseVo,updateShoppingCartGoodsQtyRequestVo.getOrderType());
ActivityQueryDto activityQueryDto = activityAdapter.getActivityQueryDto(partnerId, storeId, userId, appId, updateShoppingCartGoodsQtyRequestVo.getOrderType()); ActivityQueryDto activityQueryDto = activityAdapter.getActivityQueryDto(partnerId, storeId, userId, appId, updateShoppingCartGoodsQtyRequestVo.getOrderType());
if (grayPush(partnerId,storeId,"2")) { if (grayPush(partnerId,storeId,"2")) {
...@@ -598,7 +598,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -598,7 +598,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
assortmentSdkService.setShoppingCart(partnerId, storeId, userId, cartGoodsList, assortmentCustomerInfoVo.getSessionId(), "", this.shoppingCartBaseService); assortmentSdkService.setShoppingCart(partnerId, storeId, userId, cartGoodsList, assortmentCustomerInfoVo.getSessionId(), "", this.shoppingCartBaseService);
} }
Long deliveryAmount = calculateDeliveryAmount(receiveId, partnerId, storeId, userLoginInfoDto.getWxAppid(), shoppingCartGoodsResponseVo); Long deliveryAmount = calculateDeliveryAmount(receiveId, partnerId, storeId, userLoginInfoDto.getWxAppid(), shoppingCartGoodsResponseVo,shoppingCartInfoRequestVo.getOrderType());
ActivityQueryDto activityQueryDto = activityAdapter.getActivityQueryDto(partnerId, storeId, userId, appId, shoppingCartInfoRequestVo.getOrderType()); ActivityQueryDto activityQueryDto = activityAdapter.getActivityQueryDto(partnerId, storeId, userId, appId, shoppingCartInfoRequestVo.getOrderType());
CouponPromotionVO couponPromotionVO = couponAdapter.getCouponPromotionVO(shoppingCartInfoRequestVo, userLoginInfoDto); CouponPromotionVO couponPromotionVO = couponAdapter.getCouponPromotionVO(shoppingCartInfoRequestVo, userLoginInfoDto);
...@@ -840,7 +840,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -840,7 +840,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
ActivityQueryDto activityQueryDto = activityAdapter.getActivityQueryDto(partnerId, storeId, userId, appId, shoppingCartInfoRequestVo.getOrderType()); ActivityQueryDto activityQueryDto = activityAdapter.getActivityQueryDto(partnerId, storeId, userId, appId, shoppingCartInfoRequestVo.getOrderType());
CouponPromotionVO couponPromotionVO = couponAdapter.getCouponPromotionVO(shoppingCartInfoRequestVo, userLoginInfoDto); CouponPromotionVO couponPromotionVO = couponAdapter.getCouponPromotionVO(shoppingCartInfoRequestVo, userLoginInfoDto);
Long deliveryAmount = calculateDeliveryAmount(receiveId, partnerId, storeId, userLoginInfoDto.getWxAppid(), shoppingCartGoodsResponseVo); Long deliveryAmount = calculateDeliveryAmount(receiveId, partnerId, storeId, userLoginInfoDto.getWxAppid(), shoppingCartGoodsResponseVo,shoppingCartInfoRequestVo.getOrderType());
if (grayPush(partnerId,storeId,"2")) { if (grayPush(partnerId,storeId,"2")) {
List<CalculationSharingDiscountRequestDto.CalculationDiscountCoupon> coupons = new ArrayList<>(); List<CalculationSharingDiscountRequestDto.CalculationDiscountCoupon> coupons = new ArrayList<>();
// 当couponCode不为空时,需参与价格计算 // 当couponCode不为空时,需参与价格计算
...@@ -1987,33 +1987,19 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -1987,33 +1987,19 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
return amount; return amount;
} }
private Long getNewDeliveryAmount(String receiveId, String partnerId, String storeId, ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo) { private Long getNewDeliveryAmount(String receiveId, String partnerId, String storeId, ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo,Integer orderType) {
String trackingNo = LogThreadLocal.getTrackingNo(); //String trackingNo = LogThreadLocal.getTrackingNo();
Long amount = 0L; Long amount = 0L;
if (StringUtils.isBlank(receiveId)) { // 如果订单的收获地址为空,且订单是外卖单,返回运费
// 主要是为了兼容coco不传收获地址,需要获取固定运费的情况
if (StringUtils.isBlank(receiveId) && !Objects.equals(orderType, CreateOrderType.TAKE_OUT.getCode())) {
return amount; return amount;
} }
QueryReceiveAddressRequest queryReceive = new QueryReceiveAddressRequest(receiveId, partnerId);
//查询会员后货地址经纬度
com.freemud.application.sdk.api.base.BaseResponse<QueryReceiveAddressResponse> queryReceiveAddressResponse = memberCenterService.queryReceiveAddressById(queryReceive, trackingNo);
if (!ResponseResult.SUCCESS.getCode().equals(queryReceiveAddressResponse.getCode()) || queryReceiveAddressResponse.getData() == null) {
throw new ServiceException(ResponseResult.USER_GETRECEIVEADDRESS_ERROR);
}
QueryDeliveryRequest queryDeliveryRequest = new QueryDeliveryRequest(); DeliveryService deliveryService = deliveryFactory.getCalculateDeliveryAmount(orderType,receiveId);
queryDeliveryRequest.setPartnerId(partnerId); amount = deliveryService.calculateDeliveryAmount(receiveId,partnerId,storeId,shoppingCartGoodsResponseVo);
queryDeliveryRequest.setStoreCode(storeId);
queryDeliveryRequest.setUserLatitude(queryReceiveAddressResponse.getData().getLatitude()); return amount;
queryDeliveryRequest.setUserLongitude(queryReceiveAddressResponse.getData().getLongitude());
com.freemud.application.sdk.api.base.BaseResponse<QueryDeliverDetailResponse> queryDeliverDetailResponse = storeCenterService.queryDeliverDetail(queryDeliveryRequest, trackingNo);
if (queryDeliverDetailResponse == null || !ResponseResult.SUCCESS.getCode().equals(queryDeliverDetailResponse.getCode()) || queryDeliverDetailResponse.getData() == null) {
throw new ServiceException(ResponseResult.STORE_ITEM_NOT_DELIVERY);
}
if(queryDeliverDetailResponse.getData().getDeliveryAmount() == null) {
throw new ServiceException(ResponseResult.STORE_DELIVERY_AMOUNT_ERROR);
}
shoppingCartGoodsResponseVo.setDeliveryFeeZeroReason(queryDeliverDetailResponse.getData().getDeliveryFeeZeroReason() != null ? queryDeliverDetailResponse.getData().getDeliveryFeeZeroReason() : 0);
return queryDeliverDetailResponse.getData().getDeliveryAmount();
} }
/** /**
...@@ -2060,7 +2046,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -2060,7 +2046,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
return calculationDiscountResult; return calculationDiscountResult;
} }
private Long calculateDeliveryAmount(String receiveId, String partnerId, String storeId, String wxappid, ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo) { public Long calculateDeliveryAmount(String receiveId, String partnerId, String storeId, String wxappid, ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo, Integer orderType) {
Long deliveryAmount = 0L; Long deliveryAmount = 0L;
if (StringUtils.isBlank(receiveId)) { if (StringUtils.isBlank(receiveId)) {
return deliveryAmount; return deliveryAmount;
...@@ -2070,7 +2056,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -2070,7 +2056,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
deliveryAmount = Long.parseLong(getDeliveryAmount(receiveId, partnerId, storeId).toString()); deliveryAmount = Long.parseLong(getDeliveryAmount(receiveId, partnerId, storeId).toString());
shoppingCartGoodsResponseVo.setDeliveryFeeZeroReason(0); shoppingCartGoodsResponseVo.setDeliveryFeeZeroReason(0);
} else { } else {
deliveryAmount = getNewDeliveryAmount(receiveId, partnerId, storeId, shoppingCartGoodsResponseVo); deliveryAmount = getNewDeliveryAmount(receiveId, partnerId, storeId, shoppingCartGoodsResponseVo, orderType);
} }
return deliveryAmount; return deliveryAmount;
......
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