编号:ZSSAC-163 描述:修改错误类

This commit is contained in:
pengren 2024-04-11 14:12:59 +08:00
parent 2623d56340
commit cfee6f1704
2 changed files with 4 additions and 81 deletions

View File

@ -1,77 +0,0 @@
package com.sf.common.exception;
import com.sf.common.enums.ErrorCodeTypeEnum;
/**
* @author : yswjme@163.com
* @Title : BusinessException.java
* @Package : com.zsmarter.ai.word.exception
* @Descript : 业务运行时异常
* @date : 2020-06-29 04:59:44
* @vsersion : V1.0
*/
public class BusinessException extends RuntimeException {
private static final long serialVersionUID = 4693786499059513760L;
private ErrorCodeTypeEnum errorCodeTypeEnum;
private final String errorDescription;
private String errorCode;
public BusinessException(String errorDescription) {
super(errorDescription);
this.errorDescription = errorDescription;
}
public BusinessException(String errorDescription, Throwable t) {
super(errorDescription, t);
this.errorDescription = errorDescription;
}
public BusinessException(String code, String errorDescription) {
super(errorDescription);
this.errorDescription = errorDescription;
this.errorCode = code;
}
public BusinessException(String code, String errorDescription, Throwable t) {
super(errorDescription, t);
this.errorDescription = errorDescription;
this.errorCode = code;
}
public BusinessException(ErrorCodeTypeEnum errorCodeTypeEnum, String code, String errorDescription) {
super(errorDescription);
this.errorDescription = errorDescription;
this.errorCode = code;
this.errorCodeTypeEnum = errorCodeTypeEnum;
}
public BusinessException(ErrorCodeTypeEnum errorCodeTypeEnum, String code, String errorDescription, Throwable t) {
super(errorDescription, t);
this.errorDescription = errorDescription;
this.errorCode = code;
this.errorCodeTypeEnum = errorCodeTypeEnum;
}
public String getErrorDescription() {
return this.errorDescription;
}
public String getErrorCode() {
return errorCode;
}
public String getErrorTitle() {
return "业务校验失败!";
}
public ErrorCodeTypeEnum getErrorCodeTypeEnum() {
return errorCodeTypeEnum;
}
}

View File

@ -2,7 +2,7 @@ package com.sf.order.service.impl;
import java.util.List; import java.util.List;
import com.sf.common.exception.BusinessException; import com.sf.common.exception.ServiceException;
import com.sf.common.utils.DateUtils; import com.sf.common.utils.DateUtils;
import com.sf.common.utils.SnowflakeIdWorker; import com.sf.common.utils.SnowflakeIdWorker;
import com.sf.order.domain.OrderInfo; import com.sf.order.domain.OrderInfo;
@ -97,16 +97,16 @@ public class OrderInfoServiceImpl implements IOrderInfoService
public void orderPay(Long orderId) { public void orderPay(Long orderId) {
OrderInfo updateOrder = this.selectOrderInfoById(orderId); OrderInfo updateOrder = this.selectOrderInfoById(orderId);
if (updateOrder == null) { if (updateOrder == null) {
throw new BusinessException("订单缺失!"); throw new ServiceException("订单缺失!");
} }
// if (!OrderInfoConstant.ORDER_WAITING_FOR_PAYMENT.equals(orderInfo.getOrderStatus())) { // if (!OrderInfoConstant.ORDER_WAITING_FOR_PAYMENT.equals(orderInfo.getOrderStatus())) {
// throw new BusinessException("订单状态异常!"); // throw new ServiceException("订单状态异常!");
// } // }
updateOrder.setOrderStatus(1L); updateOrder.setOrderStatus(1L);
updateOrder.setPayTime(DateUtils.getNowDate()); updateOrder.setPayTime(DateUtils.getNowDate());
// 修改订单状态 // 修改订单状态
if (1>this.updateOrderInfo(updateOrder)) { if (1>this.updateOrderInfo(updateOrder)) {
throw new BusinessException("支付异常,请联系管理员!"); throw new ServiceException("支付异常,请联系管理员!");
} }
} }