Authored by kun

Merge remote-tracking branch 'origin/master'

... ... @@ -168,10 +168,10 @@ public class CollectionUtil {
* @param groupKey 多个分组方法
* @return 分组结果
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
/*@SuppressWarnings({ "unchecked", "rawtypes" })
public static <T, U> Map groupingByMulti(Collection<U> collection, Function<? super U, ?>... groupKey) {
return groupingByMulti(collection.stream(), groupKey);
}
}*/
/**
* 多个条件分组.
... ... @@ -180,14 +180,14 @@ public class CollectionUtil {
* @param groupKey 多个分组方法
* @return 分组结果
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
/*@SuppressWarnings({ "unchecked", "rawtypes" })
public static <T, U> Map groupingByMulti(Stream<U> stearm, Function<? super U, ?>... groupKey) {
Collector c = Collectors.groupingBy(groupKey[groupKey.length - 1]);
for (int i = groupKey.length - 2; i >= 0; i--) {
c = Collectors.groupingBy(groupKey[i], c);
}
return (Map) stearm.collect(c);
}
}*/
/**
* 多条件排序
... ...
... ... @@ -175,7 +175,7 @@
</update>
<select id="selectProductStorageCount" resultType="java.lang.Integer">
select count(*) from from product p where <include refid="skcPageCondition" />
select count(*) from product p where <include refid="skcPageCondition" />
</select>
<select id="selectProductStorageList" resultMap="BaseResultMap">
... ... @@ -185,6 +185,7 @@
</select>
<sql id="skcPageCondition">
1 = 1
<if test="product.id != null and product.id > 0">
and p.id = #{product.id}
</if>
... ...
... ... @@ -120,6 +120,7 @@
</select>
<sql id="skupPageCondition2" >
1 = 1
<if test="storagePrice.status != null and storagePrice.status > -1">
and status = #{storagePrice.status}
</if>
... ... @@ -141,7 +142,7 @@
select id, skup, product_id, goods_id, storage_id, depot_num, seller_uid, price, status,
update_time, create_time
from storage_price
where where product_id in
where product_id in
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
#{item}
</foreach> and status = 1
... ...
... ... @@ -253,8 +253,8 @@ public class ProductServiceImpl implements IProductService {
ProductEditResponceBo bo = new ProductEditResponceBo();
BeanUtils.copyProperties(product, bo);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
bo.setSaleTime(sdf.format((product.getSaleTime() == null || product.getSaleTime() == 0) ? ""
: sdf.format(product.getSaleTime() * 1000L)));
bo.setSaleTime((product.getSaleTime() == null || product.getSaleTime() == 0) ? ""
: sdf.format(product.getSaleTime() * 1000L));
bo.setGender(new Integer(product.getGender()));
bo.setMinPrice(product.getMinPrice().toString());
bo.setMaxPrice(product.getMaxPrice().toString());
... ... @@ -385,12 +385,13 @@ public static void main(String[] args) {
bo.getSkup(),
bo.getStart(),
bo.getRows());
List<Integer> productIdList = CollectionUtil.distinct(productList, Product::getId);
productList = productMapper.selectProductListByIds(productIdList);
productList.forEach(p -> {
ProductResponceBo b = new ProductResponceBo();
BeanUtils.copyProperties(p, b);
boList.add(b);
});
List<Integer> productIdList = CollectionUtil.distinct(productList, Product::getId);
List<Goods> goodsList = goodsMapper.selectByProductId(productIdList);
Map<Integer, Goods> goodsMap = CollectionUtil.extractMap(goodsList, Goods::getProductId);
List<Brand> brandList = brandMapper.selectBrandByIdList(CollectionUtil.distinct(productList, Product::getBrandId));
... ... @@ -463,7 +464,7 @@ public static void main(String[] args) {
bo.getStorageId(),
bo.getStart(),
bo.getRows());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
storagePrice.forEach(sp -> {
ProductResponceBo b = new ProductResponceBo();
b.setSkup(sp.getSkup());
... ... @@ -498,6 +499,9 @@ public static void main(String[] args) {
@Override
public ApiResponse<Void> changeProductStatus(ProductRequestBo bo) {
if (bo.getStatus() == null || (bo.getStatus() != 1 && bo.getStatus() != 0)) {
return new ApiResponse<>(400, "上下架状态错误");
}
Product product = productMapper.selectByPrimaryKey(bo.getId());
if (product == null) {
return new ApiResponse<>(400, "商品不存在");
... ...