update:
1. fix
This commit is contained in:
@@ -128,12 +128,10 @@ public class MerchantInventoryServiceImpl extends BaseServiceImpl<MerchantInvent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MerchantInventoryEntity inventory = getOne(Wrappers.lambdaQuery(MerchantInventoryEntity.class).eq(MerchantInventoryEntity::getUserId, userId).eq(MerchantInventoryEntity::getType, currentType.getCode()).eq(MerchantInventoryEntity::getProductId, productId).eq(MerchantInventoryEntity::getIsDeleted, 0).orderByDesc(MerchantInventoryEntity::getId));
|
MerchantInventoryEntity inventory = getOne(Wrappers.lambdaQuery(MerchantInventoryEntity.class).eq(MerchantInventoryEntity::getUserId, userId)
|
||||||
|
.eq(MerchantInventoryEntity::getType, currentType.getCode()).eq(MerchantInventoryEntity::getProductId, productId).eq(MerchantInventoryEntity::getStatus, MerchantProductStatus.ON_SHELF.getCode()).eq(MerchantInventoryEntity::getIsDeleted, 0).orderByDesc(MerchantInventoryEntity::getId));
|
||||||
BigDecimal totalBenefitPointAmount = BigDecimal.ZERO;
|
BigDecimal totalBenefitPointAmount = BigDecimal.ZERO;
|
||||||
if (Objects.nonNull(inventory)) {
|
if (Objects.nonNull(inventory)) {
|
||||||
if (!Objects.equals(inventory.getStatus(), MerchantProductStatus.ON_SHELF.getCode())) {
|
|
||||||
throw new ServiceException("无法为已下架的商品添加库存");
|
|
||||||
}
|
|
||||||
BigDecimal multiply = inventory.getUnitGiftAmount().multiply(BigDecimal.valueOf(num));
|
BigDecimal multiply = inventory.getUnitGiftAmount().multiply(BigDecimal.valueOf(num));
|
||||||
totalBenefitPointAmount = totalBenefitPointAmount.add(multiply);
|
totalBenefitPointAmount = totalBenefitPointAmount.add(multiply);
|
||||||
if (baseMapper.increaseInventory(inventory.getId(), num, userId, inventory.getVersion()) < 1) {
|
if (baseMapper.increaseInventory(inventory.getId(), num, userId, inventory.getVersion()) < 1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user