...
|
...
|
@@ -73,14 +73,17 @@ public class ProductServiceImpl implements IProductService { |
|
|
List<GoodsImages> goodsImagesList = getGoodsImagesFromBo(bo);
|
|
|
Integer productId;
|
|
|
Integer goodsId;
|
|
|
int now = (int) (System.currentTimeMillis() / 1000);
|
|
|
// 新增
|
|
|
if (bo.getId() == null || bo.getId() < 1) {
|
|
|
product.setShelveTime(0);
|
|
|
product.setEditTime(0);
|
|
|
product.setStorage(0);
|
|
|
if (productMapper.insert(product) == 0) {
|
|
|
return new ApiResponse<Void>(500, "创建商品失败");
|
|
|
}
|
|
|
productId = product.getId();
|
|
|
goods.setProductId(productId);
|
|
|
goodsMapper.insert(goods);
|
|
|
if (goodsMapper.insert(goods) == 0) {
|
|
|
return new ApiResponse<Void>(500, "创建商品颜色失败");
|
|
|
}
|
...
|
...
|
@@ -98,6 +101,8 @@ public class ProductServiceImpl implements IProductService { |
|
|
for (Storage s : storageList) {
|
|
|
s.setProductId(productId);
|
|
|
s.setGoodsId(goodsId);
|
|
|
s.setCreateTime(now);
|
|
|
s.setUpdateTime(0);
|
|
|
storageMapper.insert(s);
|
|
|
}
|
|
|
if (bo.getEditImage() != null && bo.getEditImage() == 1) {
|
...
|
...
|
@@ -142,6 +147,7 @@ public class ProductServiceImpl implements IProductService { |
|
|
private Goods getGoodsFromBo(ProductRequestBo bo) {
|
|
|
Goods g = new Goods();
|
|
|
BeanUtils.copyProperties(bo, g);
|
|
|
g.setId(bo.getGoodsId());
|
|
|
g.setIsDefault("Y");
|
|
|
if (CollectionUtils.isNotEmpty(bo.getImageUrlList())) {
|
|
|
g.setColorImage(bo.getImageUrlList().get(0));
|
...
|
...
|
@@ -247,7 +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() * 1000L));
|
|
|
bo.setSaleTime(sdf.format((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());
|
...
|
...
|
@@ -413,10 +420,10 @@ public static void main(String[] args) { |
|
|
}
|
|
|
List<Storage> aStorageList = storageMap.get(goods.getId());
|
|
|
int countStock = 0;
|
|
|
if(CollectionUtils.isNotEmpty(aStorageList)) {
|
|
|
for(Storage s : aStorageList) {
|
|
|
countStock += s.getStorageNum();
|
|
|
}
|
|
|
respBo.setStorage(countStock);
|
|
|
List<ProductResponceBo> skuList = new ArrayList<>();
|
|
|
respBo.setSkuList(skuList);
|
|
|
//respBo
|
...
|
...
|
@@ -433,6 +440,8 @@ public static void main(String[] args) { |
|
|
skuList.add(skuBo);
|
|
|
}
|
|
|
}
|
|
|
respBo.setStorage(countStock);
|
|
|
}
|
|
|
}
|
|
|
PageResponseBO<ProductResponceBo> pageBo = new PageResponseBO<>(count, boList, bo.getPage(), bo.getRows());
|
|
|
return new ApiResponse<>(pageBo);
|
...
|
...
|
@@ -461,7 +470,8 @@ public static void main(String[] args) { |
|
|
b.setSellerUid(sp.getSellerUid());
|
|
|
b.setCurrentPrice(sp.getPrice().toString());
|
|
|
b.setStatus(sp.getStatus());
|
|
|
b.setSkupCreateTime(sdf.format(sp.getCreateTime() * 1000L));
|
|
|
b.setSkupCreateTime((sp.getCreateTime() == null || sp.getCreateTime() == 0) ? ""
|
|
|
: sdf.format(sp.getCreateTime() * 1000L));
|
|
|
boList.add(b);
|
|
|
});
|
|
|
}
|
...
|
...
|
|