Commit 9fb9285d by haibo.jiang

Merge remote-tracking branch 'remotes/origin/feature/1.9.9-购物车接口增加渠道-海波'

parents 2e7b1ae7 6067bcb5
......@@ -27,4 +27,6 @@ public class GetProductInfoRequest {
String trackingNo;
String businessType;
}
......@@ -106,7 +106,7 @@ public interface ShoppingCartBaseService {
getProductInfoDto.setShopId(getProductInfoRequest.getStoreId());
getProductInfoDto.setProductInfoType(2);
getProductInfoDto.setProductIds(goodsIds);
getProductInfoDto.setChannel(OrderChannelType.SAAS.getCode());
getProductInfoDto.setChannel(getProductInfoRequest.getBusinessType());
ProductService productService = SDKCommonBaseContextWare.getBean(ProductService.class);
com.freemud.application.sdk.api.base.BaseResponse<ProductInfosDTO> productInfosDTOBaseResponse = productService.listProductInfoByIdList(getProductInfoDto, LogThreadLocal.getTrackingNo());
if (!Objects.equals(ResponseResultEnum.SUCCESS.getCode(), productInfosDTOBaseResponse.getCode()) || productInfosDTOBaseResponse.getData() == null) {
......
......@@ -48,5 +48,12 @@ public class AddGoodsByWeixinCardRequestVo {
@NotNull(message = "couponType不能为空")
private Integer couponType;
private String skuId;
/**
* 业务类型: 0 : 自提 1:外卖 2:微商城
*/
private Integer businessType ;
}
......@@ -75,7 +75,14 @@ public class AddShoppingCartGoodsRequestVo {
private String appType;
private String tableNumber;
private Integer qty;
/**
* 业务类型: 0 : 自提 1:外卖 2:微商城
*/
private Integer businessType ;
}
......@@ -90,6 +90,11 @@ public class ShoppingCartInfoRequestVo {
*/
private BuyMemberCard buyMemberCard;
/**
* 业务类型: 0 : 自提 1:外卖 2:微商城
*/
private Integer businessType ;
@Data
public final static class SendGoods {
/**
......
......@@ -58,4 +58,9 @@ public class UpdateShoppingCartGoodsQtyRequestVo {
*/
private Integer carVer;
/**
* 业务类型: 0 : 自提 1:外卖 2:微商城
*/
private Integer businessType ;
}
package cn.freemud.enums;
import java.util.Arrays;
public enum BusinessTypeEnum {
SAAS_PICKUP(0,"自提","saas"),
SAAS_DELIVERY(1,"外卖","saas_delivery"),
SAAS_MALL(2,"商城","saas_mall"),
SAAS_WC(3,"围餐","wc");
private Integer type;
private String name;
private String code;
BusinessTypeEnum(Integer type, String name, String code) {
this.type = type;
this.name = name;
this.code = code;
}
public static BusinessTypeEnum getByType(Integer type) {
return Arrays.stream(BusinessTypeEnum.values())
.filter(e -> e.type.equals(type))
.findFirst().get();
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
......@@ -97,7 +97,8 @@ public class AdditionalPromotionService implements IPromotionService {
List<ShoppingCartInfoRequestVo.SendGoods> sendGoods = shoppingCartInfoRequestVo.getSendGoods();
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));
List<ProductBeanDTO> productBeanList = assortmentSdkService.getProductsInfoSdk(shoppingCartInfoRequestVo.getPartnerId(), shoppingCartInfoRequestVo.getShopId(), goodsIds, shoppingCartBaseService);
List<ProductBeanDTO> productBeanList = assortmentSdkService.getProductsInfoSdk(shoppingCartInfoRequestVo.getPartnerId()
, shoppingCartInfoRequestVo.getShopId(), goodsIds,shoppingCartInfoRequestVo.getBusinessType(), shoppingCartBaseService);
if (CollectionUtils.isEmpty(productBeanList)) {
throw new ServiceException(ResponseResult.PREMIUM_EXCHANGE_ACTIVITY_NOT_EXIST);
}
......
......@@ -4,6 +4,7 @@ import ch.qos.logback.classic.Level;
import cn.freemud.base.entity.BaseResponse;
import cn.freemud.entities.vo.CartGoods;
import cn.freemud.entities.vo.ShoppingCartGoodsBaseResponseVo;
import cn.freemud.enums.BusinessTypeEnum;
import cn.freemud.enums.ResponseResult;
import cn.freemud.interceptor.ServiceException;
import cn.freemud.utils.LogUtil;
......@@ -162,12 +163,13 @@ public class AssortmentSdkService {
* @param goodsIds
* @return
*/
public List<ProductBeanDTO> getProductsInfoSdk(String partnerId, String storeId, List<String> goodsIds, ShoppingCartBaseService shoppingCartService) {
public List<ProductBeanDTO> getProductsInfoSdk(String partnerId, String storeId, List<String> goodsIds,Integer businessType, ShoppingCartBaseService shoppingCartService) {
GetProductInfoRequest request = new GetProductInfoRequest();
request.setGoodsIds(goodsIds);
request.setPartnerId(partnerId);
request.setStoreId(storeId);
request.setTrackingNo(LogThreadLocal.getTrackingNo());
request.setBusinessType(BusinessTypeEnum.getByType(businessType).getCode());
BaseResponse<List<ProductBeanDTO>> baseResponse =
shoppingCartService.getProductsInfo(request);
if (baseResponse == null || !ResponseResult.SUCCESS.getCode().equals(baseResponse.getCode()) || CollectionUtils.isEmpty(baseResponse.getResult())) {
......
......@@ -42,7 +42,10 @@ public class BuyAndGiftsPromotionService implements IPromotionService {
private ShoppingCartBaseServiceImpl shoppingCartBaseService;
@Override
public void updateShoppingCartGoodsDiscount(CouponPromotionVO couponPromotionVO, ActivityQueryDto activityQueryDto, ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult, List<CartGoods> cartGoodsList, ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo, UserLoginInfoDto userLoginInfoDto, ShoppingCartInfoRequestVo shoppingCartInfoRequestVo) {
public void updateShoppingCartGoodsDiscount(CouponPromotionVO couponPromotionVO, ActivityQueryDto activityQueryDto,
ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult,
List<CartGoods> cartGoodsList, ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo,
UserLoginInfoDto userLoginInfoDto, ShoppingCartInfoRequestVo shoppingCartInfoRequestVo) {
if (calculationDiscountResult == null || CollectionUtils.isEmpty(calculationDiscountResult.getSendGoods())) {
return;
}
......@@ -52,7 +55,7 @@ public class BuyAndGiftsPromotionService implements IPromotionService {
}
List<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.SendActivity.SendGoods> sendGoodsList = new ArrayList<>();
sendActivities.forEach(sendActivity -> sendGoodsList.addAll(sendActivity.getSendGoods()));
List<ProductBeanDTO> productBeanDTOS = buildActivityProduct(activityQueryDto, sendGoodsList);
List<ProductBeanDTO> productBeanDTOS = buildActivityProduct(activityQueryDto, sendGoodsList,shoppingCartInfoRequestVo.getBusinessType());
if (CollectionUtils.isEmpty(productBeanDTOS)) {
return;
}
......@@ -145,10 +148,12 @@ public class BuyAndGiftsPromotionService implements IPromotionService {
* @param sendGoodsList
* @return
*/
private List<ProductBeanDTO> buildActivityProduct(ActivityQueryDto activityQueryDto, List<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.SendActivity.SendGoods> sendGoodsList) {
private List<ProductBeanDTO> buildActivityProduct(ActivityQueryDto activityQueryDto, List<ActivityCalculationDiscountResponseDto
.CalculationDiscountResult.SendActivity.SendGoods> sendGoodsList,Integer businessType) {
//获取
List<String> goodsIds = sendGoodsList.stream().map(ActivityCalculationDiscountResponseDto.CalculationDiscountResult.SendActivity.SendGoods::getGoodsId).collect(Collectors.toList());
List<ProductBeanDTO> productBeanList = assortmentSdkService.getProductsInfoSdk(activityQueryDto.getPartnerId(), activityQueryDto.getStoreId(), goodsIds, shoppingCartBaseService);
List<ProductBeanDTO> productBeanList = assortmentSdkService.getProductsInfoSdk(activityQueryDto.getPartnerId()
, activityQueryDto.getStoreId(), goodsIds, businessType ,shoppingCartBaseService);
if (CollectionUtils.isEmpty(productBeanList)) {
throw new ServiceException(ResponseResult.SHOPPING_CART_GIFTS_PRODUCT_NOT_EXIST);
}
......
......@@ -102,7 +102,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
}
// 获取商品信息
List<ProductBeanDTO> productBeanListSpuClass =
assortmentSdkService.getProductsInfoSdk(partnerId, storeId, Collections.singletonList(spuId2), mealCartBaseService);
assortmentSdkService.getProductsInfoSdk(partnerId, storeId, Collections.singletonList(spuId2),requestVo.getBusinessType(), mealCartBaseService);
if (productBeanListSpuClass == null) {
throw new ServiceException(ResponseResult.SHOPPING_CART_ADD_ERROR);
}
......
......@@ -174,7 +174,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
// 判断商品状态是否可以加入购物车
List<ProductBeanDTO> productInfos = assortmentSdkService.getProductsInfoSdk(request.getPartnerId(), request.getShopId(), Arrays.asList(getProductsVo.getSpuId()), this.shoppingCartBaseService);
List<ProductBeanDTO> productInfos = assortmentSdkService.getProductsInfoSdk(request.getPartnerId(), request.getShopId(), Arrays.asList(getProductsVo.getSpuId()),request.getBusinessType(),this.shoppingCartBaseService);
if (CollectionUtils.isNotEmpty(productInfos)) {
ProductBeanDTO productBean = productInfos.get(0);
Integer status = productBean.getStatus();
......@@ -224,7 +224,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
spuId2 = validCoupon(partnerId, storeId, spuId, productIds);
}
// 获取商品详细信息
List<ProductBeanDTO> productBeanListSpuClass = assortmentSdkService.getProductsInfoSdk(partnerId, storeId, Collections.singletonList(spuId2), this.shoppingCartBaseService);
List<ProductBeanDTO> productBeanListSpuClass = assortmentSdkService.getProductsInfoSdk(partnerId, storeId
, Collections.singletonList(spuId2),addShoppingCartGoodsRequestVo.getBusinessType(), this.shoppingCartBaseService);
//缓存中获取购物车商品信息
// 注意,围餐和点餐redis数据结构不一样
......@@ -585,7 +586,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
coupons.add(coupon);
}
if (CollectionUtils.isNotEmpty(sendGoodsList)) {
processSendGoods(sendGoodsList, partnerId, storeId, shoppingCartBaseService);
processSendGoods(sendGoodsList, partnerId, storeId , shoppingCartInfoRequestVo.getBusinessType() , shoppingCartBaseService);
} else {
//组装加价购商品
if (null != premiumExchangeActivity && CollectionUtils.isNotEmpty(premiumExchangeActivity.getProducts())) {
......@@ -838,10 +839,11 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
* @param partnerId
* @param storeId
*/
private void processSendGoods(List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList, String partnerId, String storeId, ShoppingCartBaseService shoppingCartService) {
private void processSendGoods(List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList
, String partnerId, String storeId,Integer businessType, ShoppingCartBaseService shoppingCartService) {
List<String> goodsIds = sendGoodsList.parallelStream().map(ShoppingCartInfoRequestVo.SendGoods::getGoodsId).collect(Collectors.toList());
List<ProductBeanDTO> productBeanList =
assortmentSdkService.getProductsInfoSdk(partnerId, storeId, goodsIds, shoppingCartService);
assortmentSdkService.getProductsInfoSdk(partnerId, storeId, goodsIds, businessType, shoppingCartService);
// 将productBeanList转换为Map,key为pid,即goodsId
Map<String, ProductBeanDTO> productBeanMap = productBeanList.parallelStream()
.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