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