Commit 8e2eda09 by 姜海波

menuType修改

parent cd5b7f6a
...@@ -50,14 +50,14 @@ public class StoreItemAdapter { ...@@ -50,14 +50,14 @@ public class StoreItemAdapter {
return getProductDto; return getProductDto;
} }
public GetProductInfoDto convert2ProductInfoDto(String partnerId, String shopId, Integer productInfoType, List<String> productIds) { public GetProductInfoDto convert2ProductInfoDto(String partnerId, String shopId, Integer productInfoType, List<String> productIds, String menuType) {
GetProductInfoDto getProductInfoDto = new GetProductInfoDto(); GetProductInfoDto getProductInfoDto = new GetProductInfoDto();
getProductInfoDto.setPartnerId(partnerId); getProductInfoDto.setPartnerId(partnerId);
getProductInfoDto.setShopId(shopId); getProductInfoDto.setShopId(shopId);
getProductInfoDto.setProductInfoType(productInfoType); getProductInfoDto.setProductInfoType(productInfoType);
getProductInfoDto.setProductIds(productIds); getProductInfoDto.setProductIds(productIds);
// 商品服务增加channel // 商品服务增加channel
getProductInfoDto.setChannel(OrderSourceType.SAAS.getCode()); getProductInfoDto.setChannel(menuType);
return getProductInfoDto; return getProductInfoDto;
} }
......
...@@ -14,4 +14,5 @@ public class CheckSpqInfoRequestDto { ...@@ -14,4 +14,5 @@ public class CheckSpqInfoRequestDto {
* 券code * 券code
*/ */
private String couponCode; private String couponCode;
private String menuType;
} }
...@@ -28,6 +28,6 @@ public interface ItemService { ...@@ -28,6 +28,6 @@ public interface ItemService {
* @param storeId * @param storeId
* @return key = skuid * @return key = skuid
*/ */
Map<String, GetProductsVo> getProducts(List<String> pids, String partnerId, String storeId); Map<String, GetProductsVo> getProducts(List<String> pids, String partnerId, String storeId ,String menuType);
} }
...@@ -27,5 +27,5 @@ public interface ProductService { ...@@ -27,5 +27,5 @@ public interface ProductService {
* @param cartGoodsList * @param cartGoodsList
* @return * @return
*/ */
boolean hasRequiredProducts(String partnerId, String storeId, List<CartGoods> cartGoodsList); boolean hasRequiredProducts(String partnerId, String storeId, List<CartGoods> cartGoodsList,String menuType);
} }
...@@ -95,7 +95,7 @@ public interface ShoppingCartNewService { ...@@ -95,7 +95,7 @@ public interface ShoppingCartNewService {
Integer orderType, Integer orderType,
List<CartGoods> cartGoodsList, List<CartGoods> cartGoodsList,
List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons, List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons,
List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList); List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList,String menuType);
List<CartGoods> updateCartGoodsLegal(CartGoods cartGoods, String userId, ShoppingCartGoodsBaseResponseVo shoppingCartGoodsResponseVo, AddShoppingCartGoodsRequestVo addShoppingCartGoodsRequestVo, List<CartGoods> oldAllCartGoodsList); List<CartGoods> updateCartGoodsLegal(CartGoods cartGoods, String userId, ShoppingCartGoodsBaseResponseVo shoppingCartGoodsResponseVo, AddShoppingCartGoodsRequestVo addShoppingCartGoodsRequestVo, List<CartGoods> oldAllCartGoodsList);
...@@ -109,9 +109,9 @@ public interface ShoppingCartNewService { ...@@ -109,9 +109,9 @@ public interface ShoppingCartNewService {
* @param productIds * @param productIds
* @return * @return
*/ */
default String validCoupon(String partnerId, String storeId, String spuId, List<Long> productIds) { default String validCoupon(String partnerId, String storeId, String spuId, List<Long> productIds,String menuType) {
String spuId2; String spuId2;
CheckSpqInfoRequestDto checkSpqInfoRequestDto = new CheckSpqInfoRequestDto(partnerId, storeId, spuId.substring(CommonsConstant.COUPON_PREFIX.length())); CheckSpqInfoRequestDto checkSpqInfoRequestDto = new CheckSpqInfoRequestDto(partnerId, storeId, spuId.substring(CommonsConstant.COUPON_PREFIX.length()),menuType);
CouponService couponService = SDKCommonBaseContextWare.getBean(CouponService.class); CouponService couponService = SDKCommonBaseContextWare.getBean(CouponService.class);
CheckSpqInfoResponseDto checkSpqInfoResponseDto = couponService.checkSpqInfo(checkSpqInfoRequestDto); CheckSpqInfoResponseDto checkSpqInfoResponseDto = couponService.checkSpqInfo(checkSpqInfoRequestDto);
if (checkSpqInfoResponseDto == null) { if (checkSpqInfoResponseDto == null) {
......
...@@ -15,6 +15,7 @@ import cn.freemud.interceptor.ServiceException; ...@@ -15,6 +15,7 @@ import cn.freemud.interceptor.ServiceException;
import cn.freemud.service.IPromotionService; import cn.freemud.service.IPromotionService;
import cn.freemud.service.ItemService; import cn.freemud.service.ItemService;
import com.freemud.application.sdk.api.productcenter.domain.ProductBeanDTO; import com.freemud.application.sdk.api.productcenter.domain.ProductBeanDTO;
import com.freemud.sdk.api.assortment.shoppingcart.enums.BusinessTypeEnum;
import com.freemud.sdk.api.assortment.shoppingcart.service.impl.ShoppingCartBaseServiceImpl; import com.freemud.sdk.api.assortment.shoppingcart.service.impl.ShoppingCartBaseServiceImpl;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.ObjectUtils;
...@@ -206,7 +207,7 @@ public class AdditionalPromotionService implements IPromotionService { ...@@ -206,7 +207,7 @@ public class AdditionalPromotionService implements IPromotionService {
Map<String, ActivityCalculationDiscountResponseDto.CalculationDiscountResult.SendActivity.SendGoods> sendGoodsMap = sendActivity1.getSendGoods().stream().collect(Collectors.toMap(ActivityCalculationDiscountResponseDto.CalculationDiscountResult.SendActivity.SendGoods::getGoodsId, Function.identity(), (k1, k2) -> k1)); Map<String, ActivityCalculationDiscountResponseDto.CalculationDiscountResult.SendActivity.SendGoods> sendGoodsMap = sendActivity1.getSendGoods().stream().collect(Collectors.toMap(ActivityCalculationDiscountResponseDto.CalculationDiscountResult.SendActivity.SendGoods::getGoodsId, Function.identity(), (k1, k2) -> k1));
//添加商品行 //添加商品行
List<String> productIds = premiumExchangeActivity.getProducts().parallelStream().map(p -> StringUtils.isEmpty(p.getSkuId()) ? p.getSpuId() : p.getSkuId()).collect(Collectors.toList()); List<String> productIds = premiumExchangeActivity.getProducts().parallelStream().map(p -> StringUtils.isEmpty(p.getSkuId()) ? p.getSpuId() : p.getSkuId()).collect(Collectors.toList());
Map<String, GetProductsVo> getProductsVoMap = itemService.getProducts(productIds, shoppingCartInfoRequestVo.getPartnerId(), shoppingCartInfoRequestVo.getShopId()); Map<String, GetProductsVo> getProductsVoMap = itemService.getProducts(productIds, shoppingCartInfoRequestVo.getPartnerId(), shoppingCartInfoRequestVo.getShopId(), BusinessTypeEnum.getByType(shoppingCartInfoRequestVo.getMenuType()).getCode());
// 获取计算返回的价格 // 获取计算返回的价格
Long originalTotalAmount = shoppingCartGoodsResponseVo.getOriginalTotalAmount(); Long originalTotalAmount = shoppingCartGoodsResponseVo.getOriginalTotalAmount();
Long totalAmount = shoppingCartGoodsResponseVo.getTotalAmount(); Long totalAmount = shoppingCartGoodsResponseVo.getTotalAmount();
......
...@@ -588,7 +588,7 @@ public class CouponServiceImpl implements CouponService { ...@@ -588,7 +588,7 @@ public class CouponServiceImpl implements CouponService {
String skuId = couponDetailResponseDto.getDetails().get(0).getActiveProduct().get(0).getProductIdPartner(); String skuId = couponDetailResponseDto.getDetails().get(0).getActiveProduct().get(0).getProductIdPartner();
skuIds.add(String.valueOf(skuId)); skuIds.add(String.valueOf(skuId));
//TODO 通过skuid查询spuid //TODO 通过skuid查询spuid
Map<String, GetProductsVo> productsVoMap = itemService.getProducts(skuIds, partnerId, storeId); Map<String, GetProductsVo> productsVoMap = itemService.getProducts(skuIds, partnerId, storeId , requestDto.getMenuType());
GetProductsVo productsVo = productsVoMap.get(skuId); GetProductsVo productsVo = productsVoMap.get(skuId);
if (null == productsVo || !Objects.equals(productsVo.getStatus(), StoreItemStatus.PUT_ON_SALE.getCode())) { if (null == productsVo || !Objects.equals(productsVo.getStatus(), StoreItemStatus.PUT_ON_SALE.getCode())) {
return null; return null;
......
...@@ -63,7 +63,7 @@ public class ItemServiceImpl implements ItemService { ...@@ -63,7 +63,7 @@ public class ItemServiceImpl implements ItemService {
public BaseResponse<Map<String, ProductBean>> getProducts(String partnerId, String shopId, List<String> productIds, boolean reflash) { public BaseResponse<Map<String, ProductBean>> getProducts(String partnerId, String shopId, List<String> productIds, boolean reflash ,String menuType) {
Map<String, ProductBean> newProductBeanMap = Maps.newTreeMap(); Map<String, ProductBean> newProductBeanMap = Maps.newTreeMap();
if (CollectionUtils.isEmpty(productIds)) { if (CollectionUtils.isEmpty(productIds)) {
return ResponseUtil.success(newProductBeanMap); return ResponseUtil.success(newProductBeanMap);
...@@ -75,7 +75,7 @@ public class ItemServiceImpl implements ItemService { ...@@ -75,7 +75,7 @@ public class ItemServiceImpl implements ItemService {
return ResponseUtil.success(productBeanMap); return ResponseUtil.success(productBeanMap);
} }
GetProductValidateDto getProductValidateDto = storeItemAdapter.convert2ProductValidateDto(partnerId, shopId, productIds); GetProductValidateDto getProductValidateDto = storeItemAdapter.convert2ProductValidateDto(partnerId, shopId, productIds);
GetProductInfoDto getProductInfoDto = storeItemAdapter.convert2ProductInfoDto(partnerId, shopId, ProductInfoType.ALL.getCode(), productIds); GetProductInfoDto getProductInfoDto = storeItemAdapter.convert2ProductInfoDto(partnerId, shopId, ProductInfoType.ALL.getCode(), productIds,menuType);
ProductInfosDto productInfosDto = storeItemClient.listProductInfos(getProductInfoDto); ProductInfosDto productInfosDto = storeItemClient.listProductInfos(getProductInfoDto);
if (!RESPONSE_SUCCESS_CODE.equals(productInfosDto.getErrcode()) || CollectionUtils.isEmpty(productInfosDto.getData().getProducts())) { if (!RESPONSE_SUCCESS_CODE.equals(productInfosDto.getErrcode()) || CollectionUtils.isEmpty(productInfosDto.getData().getProducts())) {
log.error("getShoppingCartInfo checkProductValidate is error , getProductValidateDto:{} , productCheckVaildDto:{}", log.error("getShoppingCartInfo checkProductValidate is error , getProductValidateDto:{} , productCheckVaildDto:{}",
...@@ -141,14 +141,14 @@ public class ItemServiceImpl implements ItemService { ...@@ -141,14 +141,14 @@ public class ItemServiceImpl implements ItemService {
} }
@Override @Override
public Map<String, GetProductsVo> getProducts(List<String> pids, String partnerId, String storeId) { public Map<String, GetProductsVo> getProducts(List<String> pids, String partnerId, String storeId, String menuType) {
Map<String, GetProductsVo> resultMap = new HashMap<>(); Map<String, GetProductsVo> resultMap = new HashMap<>();
if (CollectionUtils.isEmpty(pids)) { if (CollectionUtils.isEmpty(pids)) {
return resultMap; return resultMap;
} }
List<String> skuIds = Lists.newArrayList(); List<String> skuIds = Lists.newArrayList();
//查询商品详情 //查询商品详情
GetProductInfoDto getProductInfoDto = storeItemAdapter.convert2ProductInfoDto(partnerId, storeId, ProductInfoType.ALL.getCode(), pids); GetProductInfoDto getProductInfoDto = storeItemAdapter.convert2ProductInfoDto(partnerId, storeId, ProductInfoType.ALL.getCode(), pids,menuType);
ProductInfosDto productInfosDto = storeItemClient.listProductInfos(getProductInfoDto); ProductInfosDto productInfosDto = storeItemClient.listProductInfos(getProductInfoDto);
if (ResponseCodeConstant.RESPONSE_SUCCESS.equals(productInfosDto.getErrcode()) if (ResponseCodeConstant.RESPONSE_SUCCESS.equals(productInfosDto.getErrcode())
&& productInfosDto.getData() != null && productInfosDto.getData() != null
......
...@@ -33,8 +33,8 @@ public class ProductServiceImpl implements ProductService { ...@@ -33,8 +33,8 @@ public class ProductServiceImpl implements ProductService {
private ProductClient productClient; private ProductClient productClient;
@Override @Override
public boolean hasRequiredProducts(String partnerId, String storeId, List<CartGoods> cartGoodsList) { public boolean hasRequiredProducts(String partnerId, String storeId, List<CartGoods> cartGoodsList,String menuType) {
RequiredProductRequest request = RequiredProductRequest.builder().channel("saas").partnerId(partnerId).shopId(storeId).build(); RequiredProductRequest request = RequiredProductRequest.builder().channel(menuType).partnerId(partnerId).shopId(storeId).build();
ProductBaseResponse<List<String>> requiredProductList = productClient.getRequiredProductList(request); ProductBaseResponse<List<String>> requiredProductList = productClient.getRequiredProductList(request);
if (null != requiredProductList && ResponseCodeConstant.RESPONSE_SUCCESS.equals(requiredProductList.getErrcode()) && if (null != requiredProductList && ResponseCodeConstant.RESPONSE_SUCCESS.equals(requiredProductList.getErrcode()) &&
!CollectionUtils.isEmpty(requiredProductList.getData())) { !CollectionUtils.isEmpty(requiredProductList.getData())) {
......
...@@ -99,7 +99,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService { ...@@ -99,7 +99,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
productIds.add(Long.parseLong(goodsId)); productIds.add(Long.parseLong(goodsId));
} else { } else {
//校验券是否有效 //校验券是否有效
spuId2 = validCoupon(partnerId, storeId, spuId, productIds); spuId2 = validCoupon(partnerId, storeId, spuId, productIds,BusinessTypeEnum.getByType(requestVo.getMenuType()).getCode());
} }
// 获取商品信息 // 获取商品信息
List<ProductBeanDTO> productBeanListSpuClass = List<ProductBeanDTO> productBeanListSpuClass =
...@@ -491,7 +491,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService { ...@@ -491,7 +491,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
@Override @Override
public ActivityCalculationDiscountResponseDto.CalculationDiscountResult public ActivityCalculationDiscountResponseDto.CalculationDiscountResult
getActivityCalculationDiscountResponse(String partnerId, String storeId, String userId, String appId, Integer orderType, getActivityCalculationDiscountResponse(String partnerId, String storeId, String userId, String appId, Integer orderType,
List<CartGoods> cartGoodsList, List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons, List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList) { List<CartGoods> cartGoodsList, List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons, List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList,String menuType) {
return null; return null;
} }
......
...@@ -53,7 +53,7 @@ public class ItemServiceTest { ...@@ -53,7 +53,7 @@ public class ItemServiceTest {
@Test @Test
public void getProducts() { public void getProducts() {
Map<String, GetProductsVo> maps = itemService.getProducts(Arrays.asList("1", "2"), "1864", "1011"); Map<String, GetProductsVo> maps = itemService.getProducts(Arrays.asList("1", "2"), "1864", "1011","saas");
assertFalse(maps == null || maps.isEmpty()); assertFalse(maps == null || maps.isEmpty());
} }
} }
...@@ -71,7 +71,7 @@ public class StoreItemServiceTest { ...@@ -71,7 +71,7 @@ public class StoreItemServiceTest {
"125115354620910102", "125115354620910102",
"125117293812275722", "125117293812275722",
"125117293812275726", "125117293812275726",
"125117293812275730"), "1864", "1001"); "125117293812275730"), "1864", "1001","saas");
System.out.println(getProductsVoMap); System.out.println(getProductsVoMap);
} }
......
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