diff --git a/app/build.gradle b/app/build.gradle index 92785f6e6613400ec198699d077a352deeb461bc..e0b7d4b95428ff2234efb515e4564c2d24ee49df 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -64,7 +64,7 @@ springBoot { artifact = 'app' version = '1.2.3' group = 'hxy.cupb.springboot' - name = '简印用户服务端' + name = '捕风的逍遥侯gradle多module项目构建实例' } } } \ No newline at end of file diff --git a/app/src/test/resources/rest-api.http b/app/src/test/resources/rest-api.http index e48e42d27e92c6789354aa01473dc4d7ab1882f8..117a624d8a74a41a497f5d2dc281a355d11404c8 100755 --- a/app/src/test/resources/rest-api.http +++ b/app/src/test/resources/rest-api.http @@ -1,4 +1,4 @@ -GET http://localhost:8080/user/list?PageSize=1 +GET http://localhost:8080/user/list?pageSize=10&pageNum=1 Accept: application/json ### diff --git a/common/src/main/java/hxy/cupb/springboot/common/exception/GlobalExceptionHandler.java b/common/src/main/java/hxy/cupb/springboot/common/exception/GlobalExceptionHandler.java index dbcee74ecf23d1b6107fb840aa74de3e00e78d24..42acea03fc8a7914b27f972ee0fc8a72c1dbd60b 100755 --- a/common/src/main/java/hxy/cupb/springboot/common/exception/GlobalExceptionHandler.java +++ b/common/src/main/java/hxy/cupb/springboot/common/exception/GlobalExceptionHandler.java @@ -6,7 +6,6 @@ import org.slf4j.LoggerFactory; import org.springframework.dao.DuplicateKeyException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.MethodArgumentNotValidException; -import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestControllerAdvice; @@ -30,14 +29,6 @@ public class GlobalExceptionHandler { private static int PARAM_FAIL_CODE = 1002; private static int VALIDATION_CODE = 1003; - /** - * 处理自定义异常 - */ -// @ExceptionHandler(BizException.class) -// public BaseResponseVO handleRRException(BizException e) { -// logger.error(e.getMessage(), e); -// return new BaseResponseVO(e.getCode(), e.getMessage()); -// } /** * 方法参数校验 diff --git a/common/src/main/java/hxy/cupb/springboot/common/filter/CustomWebFilter.java b/common/src/main/java/hxy/cupb/springboot/common/filter/CustomWebFilter.java old mode 100755 new mode 100644 diff --git a/entity/src/main/java/hxy/cupb/springboot/entity/vo/BaseResponseVO.java b/entity/src/main/java/hxy/cupb/springboot/entity/vo/BaseResponseVO.java index 74caae78e4a237f46ba69f57dc9274ebda971335..edcf6581af701d319326d36ee81b082f51539156 100755 --- a/entity/src/main/java/hxy/cupb/springboot/entity/vo/BaseResponseVO.java +++ b/entity/src/main/java/hxy/cupb/springboot/entity/vo/BaseResponseVO.java @@ -2,6 +2,8 @@ package hxy.cupb.springboot.entity.vo; import lombok.Data; +import java.io.Serializable; + /** * @author eric * @program springboot-gradle-basic @@ -9,7 +11,12 @@ import lombok.Data; * @date 2020/2/17 */ @Data -public class BaseResponseVO { +public class BaseResponseVO implements Serializable { + private static final long serialVersionUID = 6610930573200798624L; + /** + * 时间戳 + */ + private long timestamp = System.currentTimeMillis(); private String msg; private Integer code; @@ -55,4 +62,75 @@ public class BaseResponseVO { public static BaseResponseVO success(String msg, T data) { return new BaseResponseVO(200, msg, data); } + + + +// public static BaseResponseVO success(T data) { +// return new BaseResponseVO(StatusCodeEnum.SUCCESS.getCode(), "success", data); +// } +// +// public static BaseResponseVO success(String message, T data) { +// return new BaseResponseVO(SUCCESS.getCode(), message, data); +// } +// +// public static BaseResponseVO error() { +// return new BaseResponseVO(FAIL.getCode(), FAIL.getDescription(), null); +// } +// +// public static BaseResponseVO error(String message) { +// return new BaseResponseVO(FAIL.getCode(), message, null); +// } +// +// public static BaseResponseVO error(T data) { +// return new BaseResponseVO(FAIL.getCode(), FAIL.getDescription(), data); +// } +// +// public static BaseResponseVO error(String message, T data) { +// return new BaseResponseVO(FAIL.getCode(), message, data); +// } +// +// public static BaseResponseVO notFound(String message, T data) { +// return new BaseResponseVO(DATA_NOT_FOUND.getCode(), message, data); +// } +// +// public static BaseResponseVO notFound(T data) { +// return new BaseResponseVO(DATA_NOT_FOUND.getCode(), DATA_NOT_FOUND.getDescription(), data); +// } +// +// public static BaseResponseVO deleteWarn(T data) { +// return new BaseResponseVO(DELETE_WARN.getCode(), DELETE_WARN.getDescription(), data); +// } +// +// /** +// * 请求错误 +// * +// * @param data +// * @param +// * @return +// */ +// public static BaseResponseVO badRequest(T data) { +// return new BaseResponseVO(PARAM_BASE_CHECK_FAIL.getCode(), PARAM_BASE_CHECK_FAIL.getDescription(), data); +// } +// +// +// public static BaseResponseVO badrequest() { +// return new BaseResponseVO(PARAM_BASE_CHECK_FAIL.getCode(), "no identifier arguments", null); +// } +// +// public static BaseResponseVO badrequest(String message) { +// return new BaseResponseVO(PARAM_BASE_CHECK_FAIL.getCode(), message, null); +// } +// +// public static BaseResponseVO badrequest(T data) { +// return new BaseResponseVO(PARAM_BASE_CHECK_FAIL.getCode(), "no identifier arguments", data); +// } +// +// public static BaseResponseVO badrequest(String message, T data) { +// return new BaseResponseVO(PARAM_BASE_CHECK_FAIL.getCode(), message, data); +// } +// +// public static BaseResponseVO noLogin(String message) { +// return new BaseResponseVO(UNAUTHORIZED.getCode(), message, null); +// } + }