ApiNotPrintException 改为 CzgException

This commit is contained in:
2025-11-13 17:15:11 +08:00
parent d05a52f98e
commit 134a7aae85
45 changed files with 199 additions and 385 deletions

View File

@@ -20,7 +20,6 @@ import com.czg.entity.notify.CzgPayNotifyDTO;
import com.czg.entity.notify.CzgRefundNotifyDTO;
import com.czg.enums.ShopTableStatusEnum;
import com.czg.enums.ShopUserFlowBizEnum;
import com.czg.exception.ApiNotPrintException;
import com.czg.exception.CzgException;
import com.czg.exception.OrderCancelException;
import com.czg.exception.OrderValidateException;
@@ -1558,7 +1557,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
public Boolean printOrder(Long shopId, OrderInfoPrintDTO orderInfoPrintDTO) {
OrderInfo orderInfo = getOne(new QueryWrapper().eq(OrderInfo::getShopId, shopId).eq(OrderInfo::getId, orderInfoPrintDTO.getId()));
if (orderInfo == null) {
throw new ApiNotPrintException("订单信息不存在");
throw new CzgException("订单信息不存在");
}
switch (orderInfoPrintDTO.getType()) {
@@ -1580,23 +1579,23 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
public Boolean removeOrderDetail(Long shopId, Long orderId, Long detailId) {
OrderInfo orderInfo = getOne(new QueryWrapper().eq(OrderInfo::getId, orderId).eq(OrderInfo::getShopId, shopId));
if (orderInfo == null) {
throw new ApiNotPrintException("订单不存在");
throw new CzgException("订单不存在");
}
if (!OrderStatusEnums.UNPAID.getCode().equals(orderInfo.getStatus())) {
throw new ApiNotPrintException("订单不处于待支付状态");
throw new CzgException("订单不处于待支付状态");
}
OrderDetail orderDetail = orderDetailService.getOne(new QueryWrapper().eq(OrderDetail::getId, detailId).eq(OrderDetail::getOrderId, orderId));
if (orderDetail == null || !orderDetail.getStatus().equals(OrderStatusEnums.UNPAID.getCode())) {
throw new ApiNotPrintException("不处于待支付或订单详情不存在");
throw new CzgException("不处于待支付或订单详情不存在");
}
int i = mapper.decrMoney(orderInfo.getId(), orderDetail.getPayAmount().add(orderDetail.getPackAmount()));
if (i > 0) {
return orderDetailService.removeById(orderDetail.getId());
}
throw new ApiNotPrintException("操作失败");
throw new CzgException("操作失败");
}
@Override