Authored by kun

Merge remote-tracking branch 'origin/master'

@@ -160,7 +160,7 @@ public class CollectionUtil { @@ -160,7 +160,7 @@ public class CollectionUtil {
160 }); 160 });
161 return r; 161 return r;
162 } 162 }
163 - 163 +
164 /** 164 /**
165 * 多个条件分组. 165 * 多个条件分组.
166 * 166 *
@@ -168,10 +168,10 @@ public class CollectionUtil { @@ -168,10 +168,10 @@ public class CollectionUtil {
168 * @param groupKey 多个分组方法 168 * @param groupKey 多个分组方法
169 * @return 分组结果 169 * @return 分组结果
170 */ 170 */
171 - @SuppressWarnings({ "unchecked", "rawtypes" }) 171 + /*@SuppressWarnings({ "unchecked", "rawtypes" })
172 public static <T, U> Map groupingByMulti(Collection<U> collection, Function<? super U, ?>... groupKey) { 172 public static <T, U> Map groupingByMulti(Collection<U> collection, Function<? super U, ?>... groupKey) {
173 return groupingByMulti(collection.stream(), groupKey); 173 return groupingByMulti(collection.stream(), groupKey);
174 - } 174 + }*/
175 175
176 /** 176 /**
177 * 多个条件分组. 177 * 多个条件分组.
@@ -180,14 +180,14 @@ public class CollectionUtil { @@ -180,14 +180,14 @@ public class CollectionUtil {
180 * @param groupKey 多个分组方法 180 * @param groupKey 多个分组方法
181 * @return 分组结果 181 * @return 分组结果
182 */ 182 */
183 - @SuppressWarnings({ "unchecked", "rawtypes" }) 183 + /*@SuppressWarnings({ "unchecked", "rawtypes" })
184 public static <T, U> Map groupingByMulti(Stream<U> stearm, Function<? super U, ?>... groupKey) { 184 public static <T, U> Map groupingByMulti(Stream<U> stearm, Function<? super U, ?>... groupKey) {
185 Collector c = Collectors.groupingBy(groupKey[groupKey.length - 1]); 185 Collector c = Collectors.groupingBy(groupKey[groupKey.length - 1]);
186 for (int i = groupKey.length - 2; i >= 0; i--) { 186 for (int i = groupKey.length - 2; i >= 0; i--) {
187 c = Collectors.groupingBy(groupKey[i], c); 187 c = Collectors.groupingBy(groupKey[i], c);
188 } 188 }
189 return (Map) stearm.collect(c); 189 return (Map) stearm.collect(c);
190 - } 190 + }*/
191 191
192 /** 192 /**
193 * 多条件排序 193 * 多条件排序
@@ -175,7 +175,7 @@ @@ -175,7 +175,7 @@
175 </update> 175 </update>
176 176
177 <select id="selectProductStorageCount" resultType="java.lang.Integer"> 177 <select id="selectProductStorageCount" resultType="java.lang.Integer">
178 - select count(*) from from product p where <include refid="skcPageCondition" /> 178 + select count(*) from product p where <include refid="skcPageCondition" />
179 </select> 179 </select>
180 180
181 <select id="selectProductStorageList" resultMap="BaseResultMap"> 181 <select id="selectProductStorageList" resultMap="BaseResultMap">
@@ -185,6 +185,7 @@ @@ -185,6 +185,7 @@
185 </select> 185 </select>
186 186
187 <sql id="skcPageCondition"> 187 <sql id="skcPageCondition">
  188 + 1 = 1
188 <if test="product.id != null and product.id > 0"> 189 <if test="product.id != null and product.id > 0">
189 and p.id = #{product.id} 190 and p.id = #{product.id}
190 </if> 191 </if>
@@ -120,6 +120,7 @@ @@ -120,6 +120,7 @@
120 </select> 120 </select>
121 121
122 <sql id="skupPageCondition2" > 122 <sql id="skupPageCondition2" >
  123 + 1 = 1
123 <if test="storagePrice.status != null and storagePrice.status > -1"> 124 <if test="storagePrice.status != null and storagePrice.status > -1">
124 and status = #{storagePrice.status} 125 and status = #{storagePrice.status}
125 </if> 126 </if>
@@ -141,7 +142,7 @@ @@ -141,7 +142,7 @@
141 select id, skup, product_id, goods_id, storage_id, depot_num, seller_uid, price, status, 142 select id, skup, product_id, goods_id, storage_id, depot_num, seller_uid, price, status,
142 update_time, create_time 143 update_time, create_time
143 from storage_price 144 from storage_price
144 - where where product_id in 145 + where product_id in
145 <foreach item="item" index="index" collection="list" open="(" separator="," close=")"> 146 <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
146 #{item} 147 #{item}
147 </foreach> and status = 1 148 </foreach> and status = 1
@@ -253,8 +253,8 @@ public class ProductServiceImpl implements IProductService { @@ -253,8 +253,8 @@ public class ProductServiceImpl implements IProductService {
253 ProductEditResponceBo bo = new ProductEditResponceBo(); 253 ProductEditResponceBo bo = new ProductEditResponceBo();
254 BeanUtils.copyProperties(product, bo); 254 BeanUtils.copyProperties(product, bo);
255 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 255 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
256 - bo.setSaleTime(sdf.format((product.getSaleTime() == null || product.getSaleTime() == 0) ? ""  
257 - : sdf.format(product.getSaleTime() * 1000L))); 256 + bo.setSaleTime((product.getSaleTime() == null || product.getSaleTime() == 0) ? ""
  257 + : sdf.format(product.getSaleTime() * 1000L));
258 bo.setGender(new Integer(product.getGender())); 258 bo.setGender(new Integer(product.getGender()));
259 bo.setMinPrice(product.getMinPrice().toString()); 259 bo.setMinPrice(product.getMinPrice().toString());
260 bo.setMaxPrice(product.getMaxPrice().toString()); 260 bo.setMaxPrice(product.getMaxPrice().toString());
@@ -385,12 +385,13 @@ public static void main(String[] args) { @@ -385,12 +385,13 @@ public static void main(String[] args) {
385 bo.getSkup(), 385 bo.getSkup(),
386 bo.getStart(), 386 bo.getStart(),
387 bo.getRows()); 387 bo.getRows());
  388 + List<Integer> productIdList = CollectionUtil.distinct(productList, Product::getId);
  389 + productList = productMapper.selectProductListByIds(productIdList);
388 productList.forEach(p -> { 390 productList.forEach(p -> {
389 ProductResponceBo b = new ProductResponceBo(); 391 ProductResponceBo b = new ProductResponceBo();
390 BeanUtils.copyProperties(p, b); 392 BeanUtils.copyProperties(p, b);
391 boList.add(b); 393 boList.add(b);
392 }); 394 });
393 - List<Integer> productIdList = CollectionUtil.distinct(productList, Product::getId);  
394 List<Goods> goodsList = goodsMapper.selectByProductId(productIdList); 395 List<Goods> goodsList = goodsMapper.selectByProductId(productIdList);
395 Map<Integer, Goods> goodsMap = CollectionUtil.extractMap(goodsList, Goods::getProductId); 396 Map<Integer, Goods> goodsMap = CollectionUtil.extractMap(goodsList, Goods::getProductId);
396 List<Brand> brandList = brandMapper.selectBrandByIdList(CollectionUtil.distinct(productList, Product::getBrandId)); 397 List<Brand> brandList = brandMapper.selectBrandByIdList(CollectionUtil.distinct(productList, Product::getBrandId));
@@ -463,7 +464,7 @@ public static void main(String[] args) { @@ -463,7 +464,7 @@ public static void main(String[] args) {
463 bo.getStorageId(), 464 bo.getStorageId(),
464 bo.getStart(), 465 bo.getStart(),
465 bo.getRows()); 466 bo.getRows());
466 - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 467 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
467 storagePrice.forEach(sp -> { 468 storagePrice.forEach(sp -> {
468 ProductResponceBo b = new ProductResponceBo(); 469 ProductResponceBo b = new ProductResponceBo();
469 b.setSkup(sp.getSkup()); 470 b.setSkup(sp.getSkup());
@@ -498,6 +499,9 @@ public static void main(String[] args) { @@ -498,6 +499,9 @@ public static void main(String[] args) {
498 499
499 @Override 500 @Override
500 public ApiResponse<Void> changeProductStatus(ProductRequestBo bo) { 501 public ApiResponse<Void> changeProductStatus(ProductRequestBo bo) {
  502 + if (bo.getStatus() == null || (bo.getStatus() != 1 && bo.getStatus() != 0)) {
  503 + return new ApiResponse<>(400, "上下架状态错误");
  504 + }
501 Product product = productMapper.selectByPrimaryKey(bo.getId()); 505 Product product = productMapper.selectByPrimaryKey(bo.getId());
502 if (product == null) { 506 if (product == null) {
503 return new ApiResponse<>(400, "商品不存在"); 507 return new ApiResponse<>(400, "商品不存在");