feat:口库存放在钱包支付后面

This commit is contained in:
dzc committed 2025-03-19 15:31:15 +08:00
1 parent 13d9bee30c
commit e7660adc02
2 files changed
+13 -5

No files matched your search

@@ -253,7 +253,7 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
item.setProductPic(spu.getPicUrl());
item.setTotalPrice((long) totalPrice);
item.setProductCount(v.getProductCount());
item.setProductWeight(new BigDecimal(0));
item.setProductWeight(v.getProductWeight());
carObjectList.add(item);
});
}
@@ -265,10 +265,10 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
.build();
if (isPay) orderObj.setWalletId(wallet.getId());
baseMapper.insert(orderObj);
// 钱包扣款
if (isPay) getSelf().fastReduceBalance(orderObj);
// 扣减库存
getSelf().fastenerInventory(orderObj, YesNoEnum.YES);
// 钱包扣款
if (isPay) getSelf().fastReduceBalance(orderObj);
return orderObj.getId();
}
@@ -475,8 +475,16 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
List<SupermarketSpuUpdateStockReqDTO.Item> list = carList.stream().map(v -> {
SupermarketSpuUpdateStockReqDTO.Item item = new SupermarketSpuUpdateStockReqDTO.Item();
item.setId(v.getProductId());
double weight = BigDecimal.valueOf(v.getProductCount()).multiply(BigDecimal.valueOf(base)).setScale(2, RoundingMode.HALF_UP).doubleValue();
item.setIncrCount(weight);
// 按数量
if (ObjectUtil.isNotEmpty(v.getProductCount()) && !ObjectUtil.equals(v.getProductCount(), 0)) {
double count = BigDecimal.valueOf(v.getProductCount()).multiply(BigDecimal.valueOf(base)).setScale(2, RoundingMode.HALF_UP).doubleValue();
item.setIncrCount(count);
}
// 按重量
if (ObjectUtil.isNotEmpty(v.getProductWeight()) && !ObjectUtil.equals(v.getProductWeight(), 0)) {
double weight = v.getProductWeight().multiply(BigDecimal.valueOf(base)).setScale(2, RoundingMode.HALF_UP).doubleValue();
item.setIncrCount(weight);
}
return item;
}).toList();
dto.setItems(list);