Merge branch 'dev' into prod
This commit is contained in:
@@ -12,6 +12,7 @@ import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||
import org.springframework.validation.ObjectError;
|
||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
@@ -125,6 +126,15 @@ public class CzgControllerAdvice {
|
||||
// return CzgResult.failure(CzgRespCode.PARAM_ERROR.getCode(), ex.getMessage());
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* get/post 等方法不支持异常
|
||||
*/
|
||||
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
||||
public CzgResult<Object> handleHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException ex) {
|
||||
return CzgResult.failure(CzgRespCode.UN_PERMISSION.getCode(), ex.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理Hutool的校验工具类抛出异常
|
||||
*/
|
||||
|
||||
@@ -31,7 +31,7 @@ public class OrderDetailServiceImpl extends ServiceImpl<OrderDetailMapper, Order
|
||||
|
||||
@Override
|
||||
public void updateOrderDetailStatus(Long orderId,String status) {
|
||||
OrderDetail orderDetail = getById(orderId);
|
||||
OrderDetail orderDetail = new OrderDetail();
|
||||
orderDetail.setStatus(status);
|
||||
update(orderDetail, QueryWrapper.create()
|
||||
.eq(OrderDetail::getOrderId,orderId)
|
||||
|
||||
@@ -1599,10 +1599,12 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||
public Boolean cancelledOrder(Long shopId, Long orderId) throws OrderCancelException {
|
||||
OrderInfo orderInfo = getById(orderId);
|
||||
if (orderInfo == null) {
|
||||
throw new OrderCancelException("订单不存在");
|
||||
// throw new OrderCancelException("订单不存在");
|
||||
return true;
|
||||
}
|
||||
if (!OrderStatusEnums.UNPAID.getCode().equals(orderInfo.getStatus())) {
|
||||
throw new OrderCancelException("订单不可取消");
|
||||
// throw new OrderCancelException("订单不可取消");
|
||||
return true;
|
||||
}
|
||||
updateChain()
|
||||
.set(OrderInfo::getStatus, OrderStatusEnums.CANCELLED.getCode())
|
||||
@@ -1636,10 +1638,12 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||
public Boolean cancelledPlaceOrder(Long shopId, Long orderId, Integer placeNum) {
|
||||
OrderInfo orderInfo = getById(orderId);
|
||||
if (orderInfo == null) {
|
||||
throw new OrderCancelException("订单不存在");
|
||||
// throw new OrderCancelException("订单不存在");
|
||||
return true;
|
||||
}
|
||||
if (!OrderStatusEnums.UNPAID.getCode().equals(orderInfo.getStatus())) {
|
||||
throw new OrderCancelException("订单不可取消");
|
||||
// throw new OrderCancelException("订单不可取消");
|
||||
return true;
|
||||
}
|
||||
if (orderInfo.getPlaceNum().equals(1)) {
|
||||
updateChain()
|
||||
|
||||
Reference in New Issue
Block a user