ApiNotPrintException 改为 CzgException
This commit is contained in:
@@ -1,18 +1,13 @@
|
||||
package com.czg.service.product.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.product.dto.storage.ShopStorageGoodDTO;
|
||||
import com.czg.product.entity.Product;
|
||||
import com.czg.product.entity.ShopProdUnit;
|
||||
import com.czg.product.entity.ShopStorage;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
import com.czg.product.service.ProductService;
|
||||
import com.czg.product.service.ShopProdUnitService;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.product.mapper.ShopStorageGoodMapper;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.product.entity.ShopStorageGood;
|
||||
@@ -39,7 +34,7 @@ public class ShopStorageGoodServiceImpl extends ServiceImpl<ShopStorageGoodMappe
|
||||
public Boolean edit(Long shopId, ShopStorageGoodDTO shopStorageGoodDTO) {
|
||||
ShopStorageGood storageGood = getOne(new QueryWrapper().eq(ShopStorageGood::getShopId, shopId).eq(ShopStorageGood::getId, shopStorageGoodDTO.getId()));
|
||||
if (storageGood == null) {
|
||||
throw new ApiNotPrintException("商品不存在");
|
||||
throw new CzgException("商品不存在");
|
||||
}
|
||||
|
||||
BeanUtil.copyProperties(shopStorageGoodDTO, storageGood);
|
||||
@@ -52,11 +47,11 @@ public class ShopStorageGoodServiceImpl extends ServiceImpl<ShopStorageGoodMappe
|
||||
ShopStorageGood shopStorageGood = BeanUtil.copyProperties(shopStorageGoodDTO, ShopStorageGood.class);
|
||||
if (shopStorageGoodDTO.getSource() == 1) {
|
||||
if (shopStorageGoodDTO.getProdId() == null) {
|
||||
throw new ApiNotPrintException("商品id不为空");
|
||||
throw new CzgException("商品id不为空");
|
||||
}
|
||||
Product product = productService.getOne(new QueryWrapper().eq(Product::getShopId, shopId).eq(Product::getId, shopStorageGoodDTO.getProdId()));
|
||||
if (product == null) {
|
||||
throw new ApiNotPrintException("商品不存在");
|
||||
throw new CzgException("商品不存在");
|
||||
}
|
||||
|
||||
shopStorageGood.setName(product.getName());
|
||||
|
||||
@@ -4,7 +4,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.account.service.ShopUserService;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.product.dto.storage.CountStorageDTO;
|
||||
import com.czg.product.dto.storage.ShopStorageAddDTO;
|
||||
import com.czg.product.dto.storage.ShopStorageEditDTO;
|
||||
@@ -72,12 +72,12 @@ public class ShopStorageServiceImpl extends ServiceImpl<ShopStorageMapper, ShopS
|
||||
public Boolean add(Long shopId, ShopStorageAddDTO shopStorageAddDTO) {
|
||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getUserId, shopStorageAddDTO.getUserId()).eq(ShopUser::getSourceShopId, shopId));
|
||||
if (shopUser == null) {
|
||||
throw new ApiNotPrintException("店铺用户不存在");
|
||||
throw new CzgException("店铺用户不存在");
|
||||
}
|
||||
|
||||
ShopStorageGood shopStorageGood = shopStorageGoodService.getOne(new QueryWrapper().eq(ShopStorageGood::getShopId, shopId).eq(ShopStorageGood::getId, shopStorageAddDTO.getShopStorageGoodId()));
|
||||
if (shopStorageGood == null) {
|
||||
throw new ApiNotPrintException("存酒商品不存在");
|
||||
throw new CzgException("存酒商品不存在");
|
||||
}
|
||||
|
||||
ShopStorage shopStorage = new ShopStorage().setName(shopStorageGood.getName())
|
||||
@@ -100,18 +100,18 @@ public class ShopStorageServiceImpl extends ServiceImpl<ShopStorageMapper, ShopS
|
||||
record.setContent("存入"+ shopStorage.getNum() + shopStorage.getUnit() + shopStorage.getName());
|
||||
return storageRecordService.save(record);
|
||||
}
|
||||
throw new ApiNotPrintException("保存失败");
|
||||
throw new CzgException("保存失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean edit(Long shopId, ShopStorageEditDTO shopStorageEditDTO) {
|
||||
ShopStorage shopStorage = getOne(new QueryWrapper().eq(ShopStorage::getShopId, shopId).eq(ShopStorage::getId, shopStorageEditDTO.getId()));
|
||||
if (shopStorage == null) {
|
||||
throw new ApiNotPrintException("存酒记录不存在");
|
||||
throw new CzgException("存酒记录不存在");
|
||||
}
|
||||
|
||||
if (shopStorageEditDTO.getNum() < 0 && shopStorage.getNum() + shopStorageEditDTO.getNum() < 0) {
|
||||
throw new ApiNotPrintException("可取酒数量不足");
|
||||
throw new CzgException("可取酒数量不足");
|
||||
}
|
||||
|
||||
shopStorage.setNum(shopStorage.getNum() + shopStorageEditDTO.getNum());
|
||||
@@ -136,7 +136,7 @@ public class ShopStorageServiceImpl extends ServiceImpl<ShopStorageMapper, ShopS
|
||||
public List<ShopStorageRecord> getRecord(Long shopId, Integer id) {
|
||||
ShopStorage shopStorage = getOne(new QueryWrapper().eq(ShopStorage::getShopId, shopId).eq(ShopStorage::getId, id));
|
||||
if (shopStorage == null) {
|
||||
throw new ApiNotPrintException("存酒记录不存在");
|
||||
throw new CzgException("存酒记录不存在");
|
||||
}
|
||||
return storageRecordService.list(new QueryWrapper().eq(ShopStorageRecord::getStorageId, id));
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.enums.DeleteEnum;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.product.dto.ShopVendorBillPayDTO;
|
||||
import com.czg.product.dto.ShopVendorDTO;
|
||||
@@ -151,11 +150,11 @@ public class ShopVendorServiceImpl extends ServiceImpl<ShopVendorMapper, ShopVen
|
||||
}
|
||||
|
||||
if (unPaidAmount.compareTo(BigDecimal.ZERO) == 0) {
|
||||
throw new ApiNotPrintException("此账单已付款");
|
||||
throw new CzgException("此账单已付款");
|
||||
}
|
||||
|
||||
if (unPaidAmount.compareTo(payDTO.getAmount()) != 0) {
|
||||
throw new ApiNotPrintException("批量付款应全部付款");
|
||||
throw new CzgException("批量付款应全部付款");
|
||||
}
|
||||
|
||||
consPayRecordService.saveBatch(records);
|
||||
@@ -163,15 +162,15 @@ public class ShopVendorServiceImpl extends ServiceImpl<ShopVendorMapper, ShopVen
|
||||
}else {
|
||||
ConsStockFlow stockFlow = consStockFlowMapper.selectOneByQuery(new QueryWrapper().eq(ConsStockFlow::getShopId, shopId).eq(ConsStockFlow::getId, payDTO.getFlowIdList().getFirst()));
|
||||
if (stockFlow == null) {
|
||||
throw new ApiNotPrintException("付款账单不存在");
|
||||
throw new CzgException("付款账单不存在");
|
||||
}
|
||||
|
||||
if (stockFlow.getAmountPayable().compareTo(stockFlow.getActualPaymentAmount()) <= 0) {
|
||||
throw new ApiNotPrintException("次账单已付款完成");
|
||||
throw new CzgException("次账单已付款完成");
|
||||
}
|
||||
|
||||
if (payDTO.getAmount().compareTo(stockFlow.getAmountPayable().subtract(stockFlow.getActualPaymentAmount())) > 0) {
|
||||
throw new ApiNotPrintException("付款金额不应超过待付款金额");
|
||||
throw new CzgException("付款金额不应超过待付款金额");
|
||||
}
|
||||
|
||||
ConsPayRecord consPayRecord = BeanUtil.copyProperties(payDTO, ConsPayRecord.class);
|
||||
|
||||
Reference in New Issue
Block a user