日历对接

This commit is contained in:
zhangchenbiao
2023-06-14 10:44:55 +08:00
parent 00c535d950
commit 2ed2296a82
11 changed files with 423 additions and 21 deletions

View File

@@ -0,0 +1,92 @@
package com.cool.store.exception;
import com.cool.store.enums.ErrorCodeEnum;
import lombok.Data;
import java.text.MessageFormat;
/**
* @Description 业务异常类返回
* @author Aaron
* @date 2019/12/20
*/
@Data
public class ApiException extends Exception{
private static final long serialVersionUID = -5068776742356414959L;
/**
* 返回码
*/
private Integer errorCode;
/**
* 返回信息
*/
private String errorMessage;
private Object data;
/**
* 构造函数
* @param errorCode
* @param errorMessage
*/
@Deprecated
public ApiException(Integer errorCode, String errorMessage) {
super(errorMessage);
this.errorCode = errorCode;
this.errorMessage = errorMessage;
}
/**
* 构造函数
* @param errorCode
* @param errorMessage
*/
@Deprecated
public ApiException(Integer errorCode, String errorMessage, Object data) {
super(errorMessage);
this.errorCode = errorCode;
this.errorMessage = errorMessage;
this.data = data;
}
/**
* 构造函数
* @param errorMessage
*/
public ApiException(String errorMessage) {
super(errorMessage);
this.errorMessage = errorMessage;
}
/**
* 构造函数
* @param errorCode
* @param errorMessage
* @param cause
*/
@Deprecated
public ApiException(Integer errorCode, String errorMessage, Throwable cause) {
super(errorMessage, cause);
this.errorCode = errorCode;
this.errorMessage = errorMessage;
}
public ApiException(ErrorCodeEnum responseEnum) {
super(responseEnum.getMessage());
this.errorCode = responseEnum.getCode();
this.errorMessage = responseEnum.getMessage();
}
public ApiException(ErrorCodeEnum responseEnum, Object... objects) {
super(responseEnum.getMessage());
String message = MessageFormat.format(responseEnum.getMessage(), objects);
this.errorCode = responseEnum.getCode();
this.errorMessage = message;
}
}