Authored by Lixiaodi

闪购

@@ -8,5 +8,6 @@ public class StorageDepositCount { @@ -8,5 +8,6 @@ public class StorageDepositCount {
8 private Integer productId; 8 private Integer productId;
9 private Integer storageIdCount; 9 private Integer storageIdCount;
10 private Integer storageCount; 10 private Integer storageCount;
  11 + private Integer skup;
11 private Integer unShelfStorageCount; 12 private Integer unShelfStorageCount;
12 } 13 }
@@ -25,6 +25,7 @@ @@ -25,6 +25,7 @@
25 <resultMap id="CountResultMap" type="com.yohoufo.dal.order.model.StorageDepositCount" > 25 <resultMap id="CountResultMap" type="com.yohoufo.dal.order.model.StorageDepositCount" >
26 <result column="product_id" property="productId" jdbcType="INTEGER" /> 26 <result column="product_id" property="productId" jdbcType="INTEGER" />
27 <result column="storage_id_count" property="storageIdCount" jdbcType="INTEGER" /> 27 <result column="storage_id_count" property="storageIdCount" jdbcType="INTEGER" />
  28 + <result column="skup" property="skup" jdbcType="BIGINT" />
28 <result column="storage_count" property="storageCount" jdbcType="INTEGER" /> 29 <result column="storage_count" property="storageCount" jdbcType="INTEGER" />
29 <result column="un_shelf_storage_count" property="unShelfStorageCount" jdbcType="INTEGER" /> 30 <result column="un_shelf_storage_count" property="unShelfStorageCount" jdbcType="INTEGER" />
30 </resultMap> 31 </resultMap>
@@ -263,7 +264,7 @@ @@ -263,7 +264,7 @@
263 </select> 264 </select>
264 265
265 <select id="queryUserDepositProduct" resultMap="CountResultMap"> 266 <select id="queryUserDepositProduct" resultMap="CountResultMap">
266 - select product_id , count(distinct storage_id) as storage_id_count,count(*) as storage_count,sum( if( order_status = 0, 1, 0)) as un_shelf_storage_count from storage_deposit 267 + select product_id , count(distinct storage_id) as storage_id_count,count(*) as storage_count,sum( if( order_status = 0, 1, 0)) as un_shelf_storage_count,max(skup) as skup from storage_deposit
267 where owner_uid = #{uid} and status=1 and del_status=0 limit #{start}, #{count} 268 where owner_uid = #{uid} and status=1 and del_status=0 limit #{start}, #{count}
268 and product_id in 269 and product_id in
269 <foreach item="item" index="index" collection="productIdList" open="(" separator="," close=")"> 270 <foreach item="item" index="index" collection="productIdList" open="(" separator="," close=")">
@@ -49,32 +49,20 @@ public class DepositServiceImpl implements DepositService { @@ -49,32 +49,20 @@ public class DepositServiceImpl implements DepositService {
49 } 49 }
50 List<Integer> productIdList = storageDepositMapper.queryUserDepositProductId(uid, (page - 1) * limit, limit); 50 List<Integer> productIdList = storageDepositMapper.queryUserDepositProductId(uid, (page - 1) * limit, limit);
51 List<StorageDepositCount> countInfoList = storageDepositMapper.queryUserDepositProduct(uid, productIdList); 51 List<StorageDepositCount> countInfoList = storageDepositMapper.queryUserDepositProduct(uid, productIdList);
52 - /*// 商品名称  
53 - List<Product> productList = productMapper.selectByIds(productIdList);  
54 - // 颜色  
55 - List<Goods> goodsList = goodsMapper.selectByProductIds(productIdList);  
56 - // 图片  
57 - List<GoodsImages> goodsImagesList = goodsImagesMapper.selectByGoodsIdList(goodsList.stream().map(Goods::getId).collect(Collectors.toList())); 52 + List<Integer> skupList = countInfoList.stream().map(StorageDepositCount::getSkup).collect(Collectors.toList());
  53 + List<SellerOrderGoods> goodsList = sellerOrderGoodsMapper.selectBySkups(skupList);
58 Map<Integer, StorageDepositCount> countInfoMap = countInfoList.stream().map(Function.identity()).collect(Collectors.toMap(StorageDepositCount::getProductId, Function.identity())); 54 Map<Integer, StorageDepositCount> countInfoMap = countInfoList.stream().map(Function.identity()).collect(Collectors.toMap(StorageDepositCount::getProductId, Function.identity()));
59 - Map<Integer, Product> productMap = productList.stream().map(Function.identity()).collect(Collectors.toMap(Product::getId, Function.identity()));  
60 - Map<Integer, Goods> goodsMap = goodsList.stream().map(Function.identity()).collect(Collectors.toMap(Goods::getProductId, Function.identity()));  
61 - Map<Integer, GoodsImages> goodsImagesMap = goodsImagesList.stream().map(Function.identity()).collect(Collectors.toMap(GoodsImages::getProductId, Function.identity())); 55 + Map<Integer, SellerOrderGoods> goodsMap = goodsList.stream().map(Function.identity()).collect(Collectors.toMap(SellerOrderGoods::getProductId, Function.identity()));
62 56
63 List<DepositProductBo> result = new ArrayList<>(); 57 List<DepositProductBo> result = new ArrayList<>();
64 for (Integer productId : productIdList) { 58 for (Integer productId : productIdList) {
65 DepositProductBo bo = new DepositProductBo(); 59 DepositProductBo bo = new DepositProductBo();
66 bo.setProductId(productId); 60 bo.setProductId(productId);
67 - Product p = productMap.get(productId);  
68 - if (p != null) {  
69 - bo.setProductName(p.getProductName());  
70 - }  
71 - Goods g = goodsMap.get(productId);  
72 - if (g != null) {  
73 - bo.setColorName(StringUtils.isBlank(g.getGoodsName()) ? g.getColorName() : g.getGoodsName());  
74 - }  
75 - GoodsImages gi = goodsImagesMap.get(productId);  
76 - if (gi != null) {  
77 - bo.setPic(ImageUrlAssist.getAllProductPicUrl(gi.getImageUrl(), "goodsimg", "center", "d2hpdGU=")); 61 + SellerOrderGoods goods = goodsMap.get(productId);
  62 + if (goods != null) {
  63 + bo.setProductName(goods.getProductName());
  64 + bo.setColorName(goods.getColorName());
  65 + bo.setPic(goods.getImageUrl());
78 } 66 }
79 StorageDepositCount countInfo = countInfoMap.get(productId); 67 StorageDepositCount countInfo = countInfoMap.get(productId);
80 if (countInfo != null) { 68 if (countInfo != null) {
@@ -83,7 +71,7 @@ public class DepositServiceImpl implements DepositService { @@ -83,7 +71,7 @@ public class DepositServiceImpl implements DepositService {
83 bo.setShelfStatus(countInfo.getStorageIdCount() == 0 ? "全部已上架" : ("有" + countInfo.getStorageIdCount() + "件未上架")); 71 bo.setShelfStatus(countInfo.getStorageIdCount() == 0 ? "全部已上架" : ("有" + countInfo.getStorageIdCount() + "件未上架"));
84 } 72 }
85 result.add(bo); 73 result.add(bo);
86 - }*/ 74 + }
87 return null; 75 return null;
88 } 76 }
89 77