提交 0ce1a09f 作者: xiaowang

修复:商品编辑

上级 302f97c2
...@@ -377,17 +377,12 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -377,17 +377,12 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateMallProductSkuSpec(GoodsAddVO goodsAddVO) { public void updateMallProductSkuSpec(GoodsAddVO goodsAddVO) {
GoodsInfo goodsInfo = new GoodsInfo(goodsAddVO); GoodsInfo goodsInfo = new GoodsInfo(goodsAddVO);
// 1、普通的sku修改逻辑
List<GoodsProdSpecVO> specInfo =
goodsAddVO.getProductSpec().stream()
.filter(spec -> !spec.getFlag().equals(1))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(specInfo)) {
// 1.1先获取用户输入的商品绑定sku的id集合 // 1.1先获取用户输入的商品绑定sku的id集合
List<GoodsProdSpecVO> updateGoodsSpec = List<GoodsProdSpecVO> productSpec = goodsAddVO.getProductSpec();
specInfo.stream().filter(d -> d.getId() != null).collect(Collectors.toList()); // 获取不为空的产品规格
List<GoodsProdSpecVO> prod = productSpec.stream().filter(d -> d.getId() != null).collect(Collectors.toList());
List<Integer> inputMallSkuIds = List<Integer> inputMallSkuIds =
updateGoodsSpec.stream().map(GoodsProdSpecVO::getId).collect(Collectors.toList()); prod.stream().map(GoodsProdSpecVO::getId).collect(Collectors.toList());
// 1.2从数据库获取该商品对应绑定的skuId的集合 // 1.2从数据库获取该商品对应绑定的skuId的集合
List<MallProdInfoDO> mallProSkuInfoList = goodsInfoDao.getMallProSkuInfo(goodsAddVO.getId()); List<MallProdInfoDO> mallProSkuInfoList = goodsInfoDao.getMallProSkuInfo(goodsAddVO.getId());
List<Integer> dbMallSkuIds = List<Integer> dbMallSkuIds =
...@@ -402,6 +397,15 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -402,6 +397,15 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
goodsInfoDao.batchUpdateMallProSpec(delIds, goodsAddVO.getId()); goodsInfoDao.batchUpdateMallProSpec(delIds, goodsAddVO.getId());
goodsInfoDao.batchUpdateMallProductSku(delIds); goodsInfoDao.batchUpdateMallProductSku(delIds);
} }
// 1、普通的sku修改逻辑
List<GoodsProdSpecVO> specInfo =
goodsAddVO.getProductSpec().stream()
.filter(spec -> !spec.getFlag().equals(1))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(specInfo)) {
// 1.1先获取用户输入的商品绑定sku的id集合
List<GoodsProdSpecVO> updateGoodsSpec =
specInfo.stream().filter(d -> d.getId() != null).collect(Collectors.toList());
// 修改商品绑定的sku信息 // 修改商品绑定的sku信息
List<MallProdInfoDO> mallProdSkuInfoList = List<MallProdInfoDO> mallProdSkuInfoList =
updateGoodsSpec.stream() updateGoodsSpec.stream()
...@@ -547,6 +551,7 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -547,6 +551,7 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
goodsInfoDao.insertMallProdSkuInfoSpec(mallProdSkuInfoSpecDO); goodsInfoDao.insertMallProdSkuInfoSpec(mallProdSkuInfoSpecDO);
} }
} }
}
// 2.2 新增新的自定义规格信息 // 2.2 新增新的自定义规格信息
List<GoodsProdSpecVO> newZdySpec = List<GoodsProdSpecVO> newZdySpec =
zdySpecInfo.stream().filter(d -> d.getId() == null).collect(Collectors.toList()); zdySpecInfo.stream().filter(d -> d.getId() == null).collect(Collectors.toList());
...@@ -554,7 +559,6 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -554,7 +559,6 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
productSkuSpecOperation(goodsInfo, newZdySpec); productSkuSpecOperation(goodsInfo, newZdySpec);
} }
} }
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateOtherService(GoodsAddVO goodsAddVO) { public void updateOtherService(GoodsAddVO goodsAddVO) {
......
...@@ -207,23 +207,19 @@ ...@@ -207,23 +207,19 @@
mi.goods_info_id, mi.goods_info_id,
mi.product_id productId, mi.product_id productId,
mi.prod_spec_name prodSkuSpecName, mi.prod_spec_name prodSkuSpecName,
mi.categories_id categoriesId,
mi.choose_type chooseType, mi.choose_type chooseType,
mi.sku_unit_id skuUnitId, mi.sku_unit_id skuUnitId,
mi.is_must must, mi.is_must must,
mi.flag flag, mi.flag flag,
mi.create_time createTime, mi.create_time createTime,
c.name typeName,
su.id skuUnitId, su.id skuUnitId,
su.unit_name unitName, su.unit_name unitName,
ps.product_name productSkuName ps.product_name productSkuName
FROM mall_prod_info mi FROM mall_prod_info mi
INNER JOIN categories c ON c.id = mi.categories_id
INNER JOIN sku_unit su ON mi.sku_unit_id = su.id INNER JOIN sku_unit su ON mi.sku_unit_id = su.id
INNER JOIN product ps ON ps.id = mi.product_id INNER JOIN product ps ON ps.id = mi.product_id
WHERE mi.goods_info_id = #{id} WHERE mi.goods_info_id = #{id}
AND mi.is_deleted = 0 AND mi.is_deleted = 0
and flag = 0
</select> </select>
<select id="getMallIndustrySkuInfo" resultType="com.mmc.pms.entity.MallIndustrySkuInfoDO"> <select id="getMallIndustrySkuInfo" resultType="com.mmc.pms.entity.MallIndustrySkuInfoDO">
SELECT mi.id, SELECT mi.id,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论