超市优化

This commit is contained in:
zengtao01
2024-11-15 10:55:02 +08:00
parent f663fbf6b6
commit 23d10238a1
2 changed files with 5 additions and 1 deletions

View File

@ -116,6 +116,7 @@ public interface ErrorCodeConstants {
ErrorCode AMOUNT_NOT_ENOUGH = new ErrorCode(1_007_904_008, "金额不足");
ErrorCode CODE_NOT_TIME = new ErrorCode(1_007_904_008, "二维码过期");
ErrorCode STATUS_ERROR = new ErrorCode(1_007_904_007, "订单已完成或已退款");
ErrorCode STATUS_ERROR_CANCEL = new ErrorCode(1_007_904_007, "订单已取消");
ErrorCode ORDER_FAIL = new ErrorCode(1_007_904_008, "下单失败");
ErrorCode ORDER_CANCEL_FAIL = new ErrorCode(1_007_904_008, "订单取消失败");

View File

@ -464,7 +464,7 @@ public class StoreOrderServiceImpl implements StoreOrderService {
public AddReqVO cancel(Integer orderId) {
StoreOrderDO storeOrderDO;
synchronized (getStoreOrderLock("cancel")) {
storeOrderDO = storeOrderMapper.selectById(orderId);
storeOrderDO = storeOrderMapper.selectById(orderId);
if(ObjectUtil.isEmpty(storeOrderDO)){
throw exception(STORE_ORDER_NOT_EXISTS);
}
@ -472,6 +472,9 @@ public class StoreOrderServiceImpl implements StoreOrderService {
|| storeOrderDO.getStatus().equals(StoreOrderStatusEnum.REFUND.getCode())){
throw exception(STATUS_ERROR);
}
if(storeOrderDO.getStatus().equals(StoreOrderStatusEnum.CANCEL.getCode())){
throw exception(STATUS_ERROR_CANCEL);
}
}
//修改状态