update:
1. publish
This commit is contained in:
@@ -115,7 +115,7 @@ public class MerchantInventoryServiceImpl extends BaseServiceImpl<MerchantInvent
|
|||||||
switch (currentType) {
|
switch (currentType) {
|
||||||
case PLATFORM -> {
|
case PLATFORM -> {
|
||||||
BigDecimal totalAmount = catalog.getCostPrice().multiply(BigDecimal.valueOf(num));
|
BigDecimal totalAmount = catalog.getCostPrice().multiply(BigDecimal.valueOf(num));
|
||||||
if (!cashCouponService.deductCashCoupon(new MarketCashCouponApiDTO(userId, totalAmount, MarketBusinessModule.MERCHANT_PURCHASING, null, "", String.format("采购商品[%s],ID[%d],数量[%d]", catalog.getProductName(), catalog.getId(), num)))) {
|
if (!cashCouponService.deductCashCoupon(new MarketCashCouponApiDTO(userId, totalAmount, MarketBusinessModule.MERCHANT_PURCHASING, null, "", String.format("采购商品 [%s],编号 [%d],数量 [%d]", catalog.getProductName(), catalog.getId(), num)))) {
|
||||||
throw new ServiceException("扣除现金券失败");
|
throw new ServiceException("扣除现金券失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -144,7 +144,7 @@ public class MerchantInventoryServiceImpl extends BaseServiceImpl<MerchantInvent
|
|||||||
if (baseMapper.increaseInventory(inventory.getId(), num, userId, inventory.getVersion()) < 1) {
|
if (baseMapper.increaseInventory(inventory.getId(), num, userId, inventory.getVersion()) < 1) {
|
||||||
throw new ServiceException("增加库存失败");
|
throw new ServiceException("增加库存失败");
|
||||||
}
|
}
|
||||||
if (!benefitPointService.deductBenefitPoint(new MarketBenefitPointApiDTO(userId, totalAmount, fee, MarketBusinessModule.MERCHANT_PUBLISH, null, "", String.format("增加库存[%s],ID[%d],数量[%d]", catalog.getProductName(), catalog.getId(), num)))) {
|
if (!benefitPointService.deductBenefitPoint(new MarketBenefitPointApiDTO(userId, totalAmount, fee, MarketBusinessModule.MERCHANT_PUBLISH, null, "", String.format("增加库存 [%s],编号 [%d],数量 [%d]", catalog.getProductName(), catalog.getId(), num)))) {
|
||||||
throw new ServiceException("扣除福利积分失败");
|
throw new ServiceException("扣除福利积分失败");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -181,14 +181,14 @@ public class MerchantInventoryServiceImpl extends BaseServiceImpl<MerchantInvent
|
|||||||
}
|
}
|
||||||
if (inventoryType == MerchantProductType.PLATFORM) {
|
if (inventoryType == MerchantProductType.PLATFORM) {
|
||||||
BigDecimal totalCashCouponAmount = catalog.getCostPrice().multiply(BigDecimal.valueOf(inventory.getStock()));
|
BigDecimal totalCashCouponAmount = catalog.getCostPrice().multiply(BigDecimal.valueOf(inventory.getStock()));
|
||||||
if (!cashCouponService.addCashCoupon(new MarketCashCouponApiDTO(userId, totalCashCouponAmount, MarketBusinessModule.MERCHANT_UNLIST, null, "", String.format("下架商品[%s],ID[%d],数量[%d]", catalog.getProductName(), catalog.getId(), inventory.getStock())))) {
|
if (!cashCouponService.addCashCoupon(new MarketCashCouponApiDTO(userId, totalCashCouponAmount, MarketBusinessModule.MERCHANT_UNLIST, null, "", String.format("下架商品 [%s],编号 [%d],数量 [%d]", catalog.getProductName(), catalog.getId(), inventory.getStock())))) {
|
||||||
throw new ServiceException("返还现金券失败");
|
throw new ServiceException("返还现金券失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BigDecimal totalBenefitPointAmount = inventory.getUnitGiftAmount().multiply(BigDecimal.valueOf(inventory.getStock()));
|
BigDecimal totalBenefitPointAmount = inventory.getUnitGiftAmount().multiply(BigDecimal.valueOf(inventory.getStock()));
|
||||||
BigDecimal fee = totalBenefitPointAmount.multiply(BigDecimal.valueOf(0.2));
|
BigDecimal fee = totalBenefitPointAmount.multiply(BigDecimal.valueOf(0.2));
|
||||||
totalBenefitPointAmount = totalBenefitPointAmount.add(fee);
|
totalBenefitPointAmount = totalBenefitPointAmount.add(fee);
|
||||||
if (!benefitPointService.addBenefitPoint(new MarketBenefitPointApiDTO(userId, totalBenefitPointAmount, fee, MarketBusinessModule.MERCHANT_UNLIST, null, "", String.format("下架商品[%s],ID[%d],数量[%d]", catalog.getProductName(), catalog.getId(), inventory.getStock())))) {
|
if (!benefitPointService.addBenefitPoint(new MarketBenefitPointApiDTO(userId, totalBenefitPointAmount, fee, MarketBusinessModule.MERCHANT_UNLIST, null, "", String.format("下架商品 [%s],编号 [%d],数量 [%d]", catalog.getProductName(), catalog.getId(), inventory.getStock())))) {
|
||||||
throw new ServiceException("返还福利积分失败");
|
throw new ServiceException("返还福利积分失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -227,7 +227,7 @@ public class MerchantInventoryServiceImpl extends BaseServiceImpl<MerchantInvent
|
|||||||
switch (currentType) {
|
switch (currentType) {
|
||||||
case PLATFORM -> {
|
case PLATFORM -> {
|
||||||
BigDecimal totalAmount = catalog.getCostPrice().multiply(BigDecimal.valueOf(num));
|
BigDecimal totalAmount = catalog.getCostPrice().multiply(BigDecimal.valueOf(num));
|
||||||
if (!cashCouponService.deductCashCoupon(new MarketCashCouponApiDTO(userId, totalAmount, MarketBusinessModule.MERCHANT_PURCHASING, null, "", String.format("采购商品[%s],ID[%d],数量[%d]", catalog.getProductName(), catalog.getId(), num)))) {
|
if (!cashCouponService.deductCashCoupon(new MarketCashCouponApiDTO(userId, totalAmount, MarketBusinessModule.MERCHANT_PURCHASING, null, "", String.format("采购商品 [%s],编号 [%d],数量 [%d]", catalog.getProductName(), catalog.getId(), num)))) {
|
||||||
throw new ServiceException("扣除现金券失败");
|
throw new ServiceException("扣除现金券失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -258,7 +258,7 @@ public class MerchantInventoryServiceImpl extends BaseServiceImpl<MerchantInvent
|
|||||||
BigDecimal benefitPointAmount = giftAmount.multiply(BigDecimal.valueOf(num));
|
BigDecimal benefitPointAmount = giftAmount.multiply(BigDecimal.valueOf(num));
|
||||||
BigDecimal fee = benefitPointAmount.multiply(BigDecimal.valueOf(0.2));
|
BigDecimal fee = benefitPointAmount.multiply(BigDecimal.valueOf(0.2));
|
||||||
BigDecimal totalAmount = benefitPointAmount.add(fee);
|
BigDecimal totalAmount = benefitPointAmount.add(fee);
|
||||||
if (!benefitPointService.deductBenefitPoint(new MarketBenefitPointApiDTO(userId, totalAmount, fee, MarketBusinessModule.MERCHANT_PUBLISH, null, "", String.format("上架商品[%s],ID[%d],数量[%d]", catalog.getProductName(), catalog.getId(), num)))) {
|
if (!benefitPointService.deductBenefitPoint(new MarketBenefitPointApiDTO(userId, totalAmount, fee, MarketBusinessModule.MERCHANT_PUBLISH, null, "", String.format("上架商品 [%s],编号 [%d],数量 [%d]", catalog.getProductName(), catalog.getId(), num)))) {
|
||||||
throw new ServiceException("扣除福利积分失败");
|
throw new ServiceException("扣除福利积分失败");
|
||||||
}
|
}
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
|
|||||||
Reference in New Issue
Block a user