Authored by mali

根据sku列表 查询商品的信息

1 package com.yohoufo.product.controller; 1 package com.yohoufo.product.controller;
2 2
3 import com.alibaba.fastjson.JSONObject; 3 import com.alibaba.fastjson.JSONObject;
  4 +import com.google.common.collect.Lists;
4 import com.yoho.core.config.ConfigReader; 5 import com.yoho.core.config.ConfigReader;
5 import com.yoho.error.exception.ServiceException; 6 import com.yoho.error.exception.ServiceException;
6 import com.yoho.tools.docs.ApiOperation; 7 import com.yoho.tools.docs.ApiOperation;
@@ -881,4 +882,14 @@ public class ProductController { @@ -881,4 +882,14 @@ public class ProductController {
881 LOG.info("in method=ufo.product.info.data productId = {}", productId); 882 LOG.info("in method=ufo.product.info.data productId = {}", productId);
882 return productService.queryProductInfo(productId); 883 return productService.queryProductInfo(productId);
883 } 884 }
  885 +
  886 + @ApiOperation(name = "ufo.product.storageList.data", desc = "sku信息")
  887 + @RequestMapping(params = "method=ufo.product.storageList.data")
  888 + public List<StorageDataResp> queryStorageListInfo(@RequestParam(value = "storageIdList") List<Integer> storageIdList) {
  889 + LOG.info("in method=ufo.product.storageList.data storageIdList Is {}", storageIdList);
  890 + if (CollectionUtils.isEmpty(storageIdList)) {
  891 + return Lists.newArrayList();
  892 + }
  893 + return productService.queryStorageListInfo(storageIdList);
  894 + }
884 } 895 }
@@ -123,4 +123,6 @@ public interface ProductService { @@ -123,4 +123,6 @@ public interface ProductService {
123 * @return 123 * @return
124 */ 124 */
125 ProductInfo queryProductInfo(Integer productId); 125 ProductInfo queryProductInfo(Integer productId);
  126 +
  127 + List<StorageDataResp> queryStorageListInfo(List<Integer> storageIdList);
126 } 128 }
@@ -1926,4 +1926,47 @@ public class ProductServiceImpl implements ProductService { @@ -1926,4 +1926,47 @@ public class ProductServiceImpl implements ProductService {
1926 1926
1927 return resp; 1927 return resp;
1928 } 1928 }
  1929 +
  1930 + public List<StorageDataResp> queryStorageListInfo(List<Integer> storageIdList) {
  1931 + List<StorageDataResp> respList = new ArrayList<>();
  1932 + List<Storage> storageList = storageMapper.selectByIds(storageIdList);
  1933 + if (CollectionUtils.isEmpty(storageList)) {
  1934 + return null;
  1935 + }
  1936 +
  1937 + /*List<Integer> sizeIdList = storageList.stream().map(Storage::getSizeId).collect(Collectors.toList());
  1938 + List<Size> sizes = sizeMapper.selectByIds(sizeIdList);
  1939 +
  1940 + List<Integer> goodsIdList = storageList.stream().map(Storage::getGoodsId).collect(Collectors.toList());
  1941 + List<Goods> goodsList = goodsMapper.selectByIds(goodsIdList);
  1942 +
  1943 + List<Integer> productIdList = storageList.stream().map(Storage::getProductId).collect(Collectors.toList());
  1944 + List<Product> products = productMapper.selectByIds(productIdList);
  1945 +
  1946 + StorageDataResp resp = new StorageDataResp();
  1947 + storageList.forEach(item -> {
  1948 +
  1949 + GoodsSize goodsSize = new GoodsSize();
  1950 + goodsSize.setSizeId(storage.getSizeId());
  1951 + if (size != null) {
  1952 + goodsSize.setSizeName(size.getSizeName());
  1953 + }
  1954 + resp.setSize(goodsSize);
  1955 +
  1956 +
  1957 +
  1958 + resp.setColorId(goods.getColorId().toString());
  1959 + resp.setColorName(StringUtils.isEmpty(goods.getGoodsName()) ? goods.getColorName() : goods.getGoodsName());
  1960 + resp.setImageUrl(goods.getColorImage());
  1961 +
  1962 +
  1963 + if (product != null) {
  1964 + resp.setProductId(product.getId());
  1965 + resp.setProductName(product.getProductName());
  1966 + resp.setStatus(product.getShelveStatus());
  1967 + }
  1968 + });*/
  1969 +
  1970 + return respList;
  1971 + }
1929 } 1972 }