feat:预约退款问题

This commit is contained in:
dzc committed 2025-09-22 09:51:46 +08:00
1 parent d41155b6a1
commit 3fd5d5355a
1 file changed
+38 -16
@@ -171,24 +171,46 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
}
yield canteenTotalPrice.get();
}
// 查询超市商品
case SUPERMARKET -> {
// 查询超市商品
AtomicInteger supermarketTotalPrice = new AtomicInteger();
List<SmErpUnitWithSpuVo> supList = supermarketUnitSkuService.getSupermarketUnits(productIds).getData();
for (HardCreateCarDto v : list) {
supList.stream().filter(i -> ObjectUtil.equals(i.getId(), v.getProductId())).findFirst().ifPresent(spu -> {
Integer price = getSupermarket(spu);
if (ObjectUtil.isNotEmpty(v.getProductCount()) && !ObjectUtil.equals(v.getProductCount(), 0)) {
// 按数量
int itemTotalPrice = v.getProductCount() * price;
supermarketTotalPrice.addAndGet(itemTotalPrice);
} else if (ObjectUtil.isNotEmpty(v.getProductWeight()) && v.getProductWeight().compareTo(BigDecimal.valueOf(0)) != 0) {
// 按重量
// 向上取整
int itemTotalPrice = v.getProductWeight().multiply(BigDecimal.valueOf(price)).setScale(0, RoundingMode.CEILING).intValue();
supermarketTotalPrice.addAndGet(itemTotalPrice);
}
});
// 线上
if (ObjectUtil.equals(HardOrderTypeEnum.RESERVE, orderType)) {
List<ShopSkuEntity> skuList = remoteShopSkuService.getSelectListAll(productIds).getData();
for (HardCreateCarDto v : list) {
skuList.stream().filter(i -> ObjectUtil.equals(i.getId(), v.getProductId())).findFirst().ifPresent(sku -> {
Integer price = getSupermarket(sku);
if (ObjectUtil.isNotEmpty(v.getProductCount()) && !ObjectUtil.equals(v.getProductCount(), 0)) {
// 按数量
int itemTotalPrice = v.getProductCount() * price;
supermarketTotalPrice.addAndGet(itemTotalPrice);
} else if (ObjectUtil.isNotEmpty(v.getProductWeight()) && v.getProductWeight().compareTo(BigDecimal.valueOf(0)) != 0) {
// 按重量
// 向上取整
int itemTotalPrice = v.getProductWeight().multiply(BigDecimal.valueOf(price)).setScale(0, RoundingMode.CEILING).intValue();
supermarketTotalPrice.addAndGet(itemTotalPrice);
}
});
}
}
// 线下
else {
List<SmErpUnitWithSpuVo> supList = supermarketUnitSkuService.getSupermarketUnits(productIds).getData();
for (HardCreateCarDto v : list) {
supList.stream().filter(i -> ObjectUtil.equals(i.getId(), v.getProductId())).findFirst().ifPresent(spu -> {
Integer price = getSupermarket(spu);
if (ObjectUtil.isNotEmpty(v.getProductCount()) && !ObjectUtil.equals(v.getProductCount(), 0)) {
// 按数量
int itemTotalPrice = v.getProductCount() * price;
supermarketTotalPrice.addAndGet(itemTotalPrice);
} else if (ObjectUtil.isNotEmpty(v.getProductWeight()) && v.getProductWeight().compareTo(BigDecimal.valueOf(0)) != 0) {
// 按重量
// 向上取整
int itemTotalPrice = v.getProductWeight().multiply(BigDecimal.valueOf(price)).setScale(0, RoundingMode.CEILING).intValue();
supermarketTotalPrice.addAndGet(itemTotalPrice);
}
});
}
}
yield supermarketTotalPrice.get();
}