Commit a88e8cd6 by 姜海波

businessType =》 menuType

parent c31005a7
...@@ -55,5 +55,5 @@ public class AddGoodsByWeixinCardRequestVo { ...@@ -55,5 +55,5 @@ public class AddGoodsByWeixinCardRequestVo {
/** /**
* 业务类型: 0 : 自提 1:外卖 2:微商城 * 业务类型: 0 : 自提 1:外卖 2:微商城
*/ */
private Integer businessType ; private Integer menuType ;
} }
...@@ -83,6 +83,6 @@ public class AddShoppingCartGoodsRequestVo { ...@@ -83,6 +83,6 @@ public class AddShoppingCartGoodsRequestVo {
/** /**
* 业务类型: 0 : 自提 1:外卖 2:微商城 * 业务类型: 0 : 自提 1:外卖 2:微商城
*/ */
private Integer businessType ; private Integer menuType ;
} }
...@@ -93,7 +93,7 @@ public class ShoppingCartInfoRequestVo { ...@@ -93,7 +93,7 @@ public class ShoppingCartInfoRequestVo {
/** /**
* 业务类型: 0 : 自提 1:外卖 2:微商城 * 业务类型: 0 : 自提 1:外卖 2:微商城
*/ */
private Integer businessType ; private Integer menuType ;
@Data @Data
public final static class SendGoods { public final static class SendGoods {
......
...@@ -61,6 +61,6 @@ public class UpdateShoppingCartGoodsQtyRequestVo { ...@@ -61,6 +61,6 @@ public class UpdateShoppingCartGoodsQtyRequestVo {
/** /**
* 业务类型: 0 : 自提 1:外卖 2:微商城 * 业务类型: 0 : 自提 1:外卖 2:微商城
*/ */
private Integer businessType ; private Integer menuType ;
} }
...@@ -98,7 +98,7 @@ public class AdditionalPromotionService implements IPromotionService { ...@@ -98,7 +98,7 @@ public class AdditionalPromotionService implements IPromotionService {
List<String> goodsIds = sendGoods.stream().map(ShoppingCartInfoRequestVo.SendGoods::getGoodsId).collect(Collectors.toList()); List<String> goodsIds = sendGoods.stream().map(ShoppingCartInfoRequestVo.SendGoods::getGoodsId).collect(Collectors.toList());
Map<String, ShoppingCartInfoRequestVo.SendGoods> goodQtyMap = sendGoods.stream().collect(Collectors.toMap(ShoppingCartInfoRequestVo.SendGoods::getGoodsId, Function.identity(), (k1, k2) -> k1)); Map<String, ShoppingCartInfoRequestVo.SendGoods> goodQtyMap = sendGoods.stream().collect(Collectors.toMap(ShoppingCartInfoRequestVo.SendGoods::getGoodsId, Function.identity(), (k1, k2) -> k1));
List<ProductBeanDTO> productBeanList = assortmentSdkService.getProductsInfoSdk(shoppingCartInfoRequestVo.getPartnerId() List<ProductBeanDTO> productBeanList = assortmentSdkService.getProductsInfoSdk(shoppingCartInfoRequestVo.getPartnerId()
, shoppingCartInfoRequestVo.getShopId(), goodsIds,shoppingCartInfoRequestVo.getBusinessType(), shoppingCartBaseService); , shoppingCartInfoRequestVo.getShopId(), goodsIds,shoppingCartInfoRequestVo.getMenuType(), shoppingCartBaseService);
if (CollectionUtils.isEmpty(productBeanList)) { if (CollectionUtils.isEmpty(productBeanList)) {
throw new ServiceException(ResponseResult.PREMIUM_EXCHANGE_ACTIVITY_NOT_EXIST); throw new ServiceException(ResponseResult.PREMIUM_EXCHANGE_ACTIVITY_NOT_EXIST);
} }
......
...@@ -163,13 +163,13 @@ public class AssortmentSdkService { ...@@ -163,13 +163,13 @@ public class AssortmentSdkService {
* @param goodsIds * @param goodsIds
* @return * @return
*/ */
public List<ProductBeanDTO> getProductsInfoSdk(String partnerId, String storeId, List<String> goodsIds,Integer businessType, ShoppingCartBaseService shoppingCartService) { public List<ProductBeanDTO> getProductsInfoSdk(String partnerId, String storeId, List<String> goodsIds,Integer menuType, ShoppingCartBaseService shoppingCartService) {
GetProductInfoRequest request = new GetProductInfoRequest(); GetProductInfoRequest request = new GetProductInfoRequest();
request.setGoodsIds(goodsIds); request.setGoodsIds(goodsIds);
request.setPartnerId(partnerId); request.setPartnerId(partnerId);
request.setStoreId(storeId); request.setStoreId(storeId);
request.setTrackingNo(LogThreadLocal.getTrackingNo()); request.setTrackingNo(LogThreadLocal.getTrackingNo());
request.setBusinessType(BusinessTypeEnum.getByType(businessType).getCode()); request.setBusinessType(BusinessTypeEnum.getByType(menuType).getCode());
BaseResponse<List<ProductBeanDTO>> baseResponse = BaseResponse<List<ProductBeanDTO>> baseResponse =
shoppingCartService.getProductsInfo(request); shoppingCartService.getProductsInfo(request);
if (baseResponse == null || !ResponseResult.SUCCESS.getCode().equals(baseResponse.getCode()) || CollectionUtils.isEmpty(baseResponse.getResult())) { if (baseResponse == null || !ResponseResult.SUCCESS.getCode().equals(baseResponse.getCode()) || CollectionUtils.isEmpty(baseResponse.getResult())) {
......
...@@ -55,7 +55,7 @@ public class BuyAndGiftsPromotionService implements IPromotionService { ...@@ -55,7 +55,7 @@ public class BuyAndGiftsPromotionService implements IPromotionService {
} }
List<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.SendActivity.SendGoods> sendGoodsList = new ArrayList<>(); List<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.SendActivity.SendGoods> sendGoodsList = new ArrayList<>();
sendActivities.forEach(sendActivity -> sendGoodsList.addAll(sendActivity.getSendGoods())); sendActivities.forEach(sendActivity -> sendGoodsList.addAll(sendActivity.getSendGoods()));
List<ProductBeanDTO> productBeanDTOS = buildActivityProduct(activityQueryDto, sendGoodsList,shoppingCartInfoRequestVo.getBusinessType()); List<ProductBeanDTO> productBeanDTOS = buildActivityProduct(activityQueryDto, sendGoodsList,shoppingCartInfoRequestVo.getMenuType());
if (CollectionUtils.isEmpty(productBeanDTOS)) { if (CollectionUtils.isEmpty(productBeanDTOS)) {
return; return;
} }
...@@ -149,11 +149,11 @@ public class BuyAndGiftsPromotionService implements IPromotionService { ...@@ -149,11 +149,11 @@ public class BuyAndGiftsPromotionService implements IPromotionService {
* @return * @return
*/ */
private List<ProductBeanDTO> buildActivityProduct(ActivityQueryDto activityQueryDto, List<ActivityCalculationDiscountResponseDto private List<ProductBeanDTO> buildActivityProduct(ActivityQueryDto activityQueryDto, List<ActivityCalculationDiscountResponseDto
.CalculationDiscountResult.SendActivity.SendGoods> sendGoodsList,Integer businessType) { .CalculationDiscountResult.SendActivity.SendGoods> sendGoodsList,Integer menuType) {
//获取 //获取
List<String> goodsIds = sendGoodsList.stream().map(ActivityCalculationDiscountResponseDto.CalculationDiscountResult.SendActivity.SendGoods::getGoodsId).collect(Collectors.toList()); List<String> goodsIds = sendGoodsList.stream().map(ActivityCalculationDiscountResponseDto.CalculationDiscountResult.SendActivity.SendGoods::getGoodsId).collect(Collectors.toList());
List<ProductBeanDTO> productBeanList = assortmentSdkService.getProductsInfoSdk(activityQueryDto.getPartnerId() List<ProductBeanDTO> productBeanList = assortmentSdkService.getProductsInfoSdk(activityQueryDto.getPartnerId()
, activityQueryDto.getStoreId(), goodsIds, businessType ,shoppingCartBaseService); , activityQueryDto.getStoreId(), goodsIds, menuType ,shoppingCartBaseService);
if (CollectionUtils.isEmpty(productBeanList)) { if (CollectionUtils.isEmpty(productBeanList)) {
throw new ServiceException(ResponseResult.SHOPPING_CART_GIFTS_PRODUCT_NOT_EXIST); throw new ServiceException(ResponseResult.SHOPPING_CART_GIFTS_PRODUCT_NOT_EXIST);
} }
......
...@@ -102,7 +102,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService { ...@@ -102,7 +102,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
} }
// 获取商品信息 // 获取商品信息
List<ProductBeanDTO> productBeanListSpuClass = List<ProductBeanDTO> productBeanListSpuClass =
assortmentSdkService.getProductsInfoSdk(partnerId, storeId, Collections.singletonList(spuId2),requestVo.getBusinessType(), mealCartBaseService); assortmentSdkService.getProductsInfoSdk(partnerId, storeId, Collections.singletonList(spuId2),requestVo.getMenuType(), mealCartBaseService);
if (productBeanListSpuClass == null) { if (productBeanListSpuClass == null) {
throw new ServiceException(ResponseResult.SHOPPING_CART_ADD_ERROR); throw new ServiceException(ResponseResult.SHOPPING_CART_ADD_ERROR);
} }
......
...@@ -174,7 +174,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -174,7 +174,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
} }
// 判断商品状态是否可以加入购物车 // 判断商品状态是否可以加入购物车
List<ProductBeanDTO> productInfos = assortmentSdkService.getProductsInfoSdk(request.getPartnerId(), request.getShopId(), Arrays.asList(getProductsVo.getSpuId()),request.getBusinessType(),this.shoppingCartBaseService); List<ProductBeanDTO> productInfos = assortmentSdkService.getProductsInfoSdk(request.getPartnerId(), request.getShopId(), Arrays.asList(getProductsVo.getSpuId()),request.getMenuType(),this.shoppingCartBaseService);
if (CollectionUtils.isNotEmpty(productInfos)) { if (CollectionUtils.isNotEmpty(productInfos)) {
ProductBeanDTO productBean = productInfos.get(0); ProductBeanDTO productBean = productInfos.get(0);
Integer status = productBean.getStatus(); Integer status = productBean.getStatus();
...@@ -225,7 +225,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -225,7 +225,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
} }
// 获取商品详细信息 // 获取商品详细信息
List<ProductBeanDTO> productBeanListSpuClass = assortmentSdkService.getProductsInfoSdk(partnerId, storeId List<ProductBeanDTO> productBeanListSpuClass = assortmentSdkService.getProductsInfoSdk(partnerId, storeId
, Collections.singletonList(spuId2),addShoppingCartGoodsRequestVo.getBusinessType(), this.shoppingCartBaseService); , Collections.singletonList(spuId2),addShoppingCartGoodsRequestVo.getMenuType(), this.shoppingCartBaseService);
//缓存中获取购物车商品信息 //缓存中获取购物车商品信息
// 注意,围餐和点餐redis数据结构不一样 // 注意,围餐和点餐redis数据结构不一样
...@@ -586,7 +586,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -586,7 +586,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
coupons.add(coupon); coupons.add(coupon);
} }
if (CollectionUtils.isNotEmpty(sendGoodsList)) { if (CollectionUtils.isNotEmpty(sendGoodsList)) {
processSendGoods(sendGoodsList, partnerId, storeId , shoppingCartInfoRequestVo.getBusinessType() , shoppingCartBaseService); processSendGoods(sendGoodsList, partnerId, storeId , shoppingCartInfoRequestVo.getMenuType() , shoppingCartBaseService);
} else { } else {
//组装加价购商品 //组装加价购商品
if (null != premiumExchangeActivity && CollectionUtils.isNotEmpty(premiumExchangeActivity.getProducts())) { if (null != premiumExchangeActivity && CollectionUtils.isNotEmpty(premiumExchangeActivity.getProducts())) {
...@@ -840,10 +840,10 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -840,10 +840,10 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
* @param storeId * @param storeId
*/ */
private void processSendGoods(List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList private void processSendGoods(List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList
, String partnerId, String storeId,Integer businessType, ShoppingCartBaseService shoppingCartService) { , String partnerId, String storeId,Integer menuType, ShoppingCartBaseService shoppingCartService) {
List<String> goodsIds = sendGoodsList.parallelStream().map(ShoppingCartInfoRequestVo.SendGoods::getGoodsId).collect(Collectors.toList()); List<String> goodsIds = sendGoodsList.parallelStream().map(ShoppingCartInfoRequestVo.SendGoods::getGoodsId).collect(Collectors.toList());
List<ProductBeanDTO> productBeanList = List<ProductBeanDTO> productBeanList =
assortmentSdkService.getProductsInfoSdk(partnerId, storeId, goodsIds, businessType, shoppingCartService); assortmentSdkService.getProductsInfoSdk(partnerId, storeId, goodsIds, menuType, shoppingCartService);
// 将productBeanList转换为Map,key为pid,即goodsId // 将productBeanList转换为Map,key为pid,即goodsId
Map<String, ProductBeanDTO> productBeanMap = productBeanList.parallelStream() Map<String, ProductBeanDTO> productBeanMap = productBeanList.parallelStream()
.collect(Collectors.toMap(ProductBeanDTO::getPid, Function.identity(), (k1, k2) -> k1)); .collect(Collectors.toMap(ProductBeanDTO::getPid, Function.identity(), (k1, k2) -> k1));
......
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