fix:共富
This commit is contained in:
1 parent
26c3629f7d
commit
24e4121c11
1 file changed
+13
-5
+13
-5
@@ -426,12 +426,19 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
|
||||
List<MallProductDetailAppVo> spuList = remoteMallProductService.getSkusWithSpuBySkuIds(productIds).getData();
|
||||
for (HardCreateCarDto v : productList) {
|
||||
HardCarEntity item = HardCarEntity.builder().parentCarId(parentCarId).build();
|
||||
spuList.stream().filter(i -> ObjectUtil.equals(i.getId(), v.getProductId())).findFirst().ifPresent(spu -> {
|
||||
spu:
|
||||
for (MallProductDetailAppVo spu : spuList) {
|
||||
if (ObjectUtil.isEmpty(spu) || ObjectUtil.isEmpty(spu.getSkuList())) {
|
||||
continue spu;
|
||||
}
|
||||
MallProductSkuAppVo sku = spu.getSkuList().stream().filter(_item -> ObjectUtil.equals(_item.getId(), v.getProductId())).findFirst().orElse(null);
|
||||
if (ObjectUtil.isEmpty(sku)) {
|
||||
continue spu;
|
||||
}
|
||||
if (ObjectUtil.isEmpty(spu.getSkuList())) {
|
||||
throw new RuntimeException("共富商城商品无SKU信息商品名字:" + spu.getTitle() + "商品ID:" + spu.getId() + "请联系管理员");
|
||||
}
|
||||
MallProductSkuAppVo skuDetail = spu.getSkuList().get(0);
|
||||
Integer price = skuDetail.getPrice();
|
||||
Integer price = sku.getPrice();
|
||||
int totalPrice = 0;
|
||||
if (ObjectUtil.isNotEmpty(v.getProductCount()) && !ObjectUtil.equals(v.getProductCount(), 0)) {
|
||||
// 按数量
|
||||
@@ -440,7 +447,7 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
|
||||
// 按重量
|
||||
totalPrice = v.getProductWeight().multiply(BigDecimal.valueOf(price)).setScale(0, RoundingMode.CEILING).intValue();
|
||||
}
|
||||
item.setProductId(skuDetail.getId());
|
||||
item.setProductId(sku.getId());
|
||||
item.setProductName(spu.getTitle());
|
||||
item.setProductPrice(price);
|
||||
item.setProductPic(spu.getCoverImage());
|
||||
@@ -451,7 +458,8 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
|
||||
item.setProductCount(v.getProductCount());
|
||||
item.setProductWeight(v.getProductWeight());
|
||||
carObjectList.add(item);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
baseMapper.insert(carObjectList);
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user