diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/rest/ServiceException.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/rest/ServiceException.java index d0b3c614..a474466f 100644 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/rest/ServiceException.java +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/rest/ServiceException.java @@ -21,6 +21,7 @@ */ package fun.asgc.neutrino.proxy.server.base.rest; +import fun.asgc.neutrino.proxy.server.base.rest.constant.ExceptionConstant; import lombok.Getter; /** diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/rest/constant/EnableStatusEnum.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/rest/constant/EnableStatusEnum.java new file mode 100644 index 00000000..e20fef02 --- /dev/null +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/rest/constant/EnableStatusEnum.java @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2022 aoshiguchen + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package fun.asgc.neutrino.proxy.server.base.rest.constant; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 启用状态枚举 + * @author: aoshiguchen + * @date: 2022/8/5 + */ +@Getter +@AllArgsConstructor +public enum EnableStatusEnum { + ENABLE(1, "启用"), + DISABLE(2, "禁用"); + + private Integer status; + private String desc; +} diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/rest/ExceptionConstant.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/rest/constant/ExceptionConstant.java similarity index 96% rename from neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/rest/ExceptionConstant.java rename to neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/rest/constant/ExceptionConstant.java index 546fdcdf..c716414b 100644 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/rest/ExceptionConstant.java +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/rest/constant/ExceptionConstant.java @@ -19,7 +19,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package fun.asgc.neutrino.proxy.server.base.rest; +package fun.asgc.neutrino.proxy.server.base.rest.constant; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/rest/interceptor/BaseAuthInterceptor.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/rest/interceptor/BaseAuthInterceptor.java index 6cb56aed..410c7fa4 100644 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/rest/interceptor/BaseAuthInterceptor.java +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/rest/interceptor/BaseAuthInterceptor.java @@ -28,6 +28,7 @@ import fun.asgc.neutrino.core.web.context.HttpRequestWrapper; import fun.asgc.neutrino.core.web.context.HttpResponseWrapper; import fun.asgc.neutrino.core.web.interceptor.HandlerInterceptor; import fun.asgc.neutrino.proxy.server.base.rest.*; +import fun.asgc.neutrino.proxy.server.base.rest.constant.ExceptionConstant; import fun.asgc.neutrino.proxy.server.dal.entity.UserDO; import fun.asgc.neutrino.proxy.server.service.UserService; import fun.asgc.neutrino.proxy.server.util.HttpUtil; diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/rest/interceptor/GlobalExceptionHandler.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/rest/interceptor/GlobalExceptionHandler.java index 1af408c1..349db089 100644 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/rest/interceptor/GlobalExceptionHandler.java +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/base/rest/interceptor/GlobalExceptionHandler.java @@ -24,7 +24,7 @@ package fun.asgc.neutrino.proxy.server.base.rest.interceptor; import fun.asgc.neutrino.core.web.context.HttpRequestWrapper; import fun.asgc.neutrino.core.web.context.HttpResponseWrapper; import fun.asgc.neutrino.core.web.interceptor.RestControllerExceptionHandler; -import fun.asgc.neutrino.proxy.server.base.rest.ExceptionConstant; +import fun.asgc.neutrino.proxy.server.base.rest.constant.ExceptionConstant; import fun.asgc.neutrino.proxy.server.base.rest.ResponseBody; import fun.asgc.neutrino.proxy.server.base.rest.ServiceException; import org.apache.commons.lang3.exception.ExceptionUtils; diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/UserService.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/UserService.java index ea6976a5..08d2bde2 100644 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/UserService.java +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/UserService.java @@ -24,7 +24,7 @@ package fun.asgc.neutrino.proxy.server.service; import fun.asgc.neutrino.core.annotation.Autowired; import fun.asgc.neutrino.core.annotation.Component; import fun.asgc.neutrino.core.util.DateUtil; -import fun.asgc.neutrino.proxy.server.base.rest.ExceptionConstant; +import fun.asgc.neutrino.proxy.server.base.rest.constant.ExceptionConstant; import fun.asgc.neutrino.proxy.server.base.rest.ServiceException; import fun.asgc.neutrino.proxy.server.base.rest.SystemContextHolder; import fun.asgc.neutrino.proxy.server.controller.req.LoginReq; diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/util/ParamCheckUtil.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/util/ParamCheckUtil.java index 4391e7e6..05b8e7b6 100644 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/util/ParamCheckUtil.java +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/util/ParamCheckUtil.java @@ -22,7 +22,7 @@ package fun.asgc.neutrino.proxy.server.util; import fun.asgc.neutrino.core.util.StringUtil; -import fun.asgc.neutrino.proxy.server.base.rest.ExceptionConstant; +import fun.asgc.neutrino.proxy.server.base.rest.constant.ExceptionConstant; import fun.asgc.neutrino.proxy.server.base.rest.ServiceException; /** diff --git a/neutrino-proxy-server/src/main/resources/sql/init-structure.sql b/neutrino-proxy-server/src/main/resources/sql/init-structure.sql index f6266061..d4b3a8b0 100644 --- a/neutrino-proxy-server/src/main/resources/sql/init-structure.sql +++ b/neutrino-proxy-server/src/main/resources/sql/init-structure.sql @@ -4,6 +4,7 @@ CREATE TABLE IF NOT EXISTS `user` ( `name` varchar(50) NOT NULL, `login_name` varchar(50) NOT NULL, `login_password` varchar(255) NOT NULL, + `enable` INTEGER(2) NOT NULL, `create_time` INTEGER(20) NOT NULL, `update_time` INTEGER(20) NOT NULL ); @@ -15,6 +16,7 @@ CREATE TABLE IF NOT EXISTS `license` ( `key` varchar(100) NOT NULL, `user_id` INTEGER NOT NULL, `is_online` INTEGER(2) NOT NULL, + `enable` INTEGER(2) NOT NULL, `create_time` INTEGER(20) NOT NULL, `update_time` INTEGER(20) NOT NULL ); @@ -46,6 +48,8 @@ CREATE TABLE IF NOT EXISTS `user_login_record` ( `ip` varchar(50) NOT NULL, `token` varchar(50) NOT NULL, `type` INTEGER(2) NOT NULL, + `enable` INTEGER(2) NOT NULL, + `update_time` INTEGER(20) NOT NULL, `create_time` INTEGER(20) NOT NULL ); @@ -57,7 +61,7 @@ CREATE TABLE IF NOT EXISTS `port_mapping` ( `client_ip` varchar(20) NOT NULL, `client_port` INTEGER NOT NULL, `is_online` INTEGER(2) NOT NULL, - `enable` INTEGER NOT NULL, + `enable` INTEGER(2) NOT NULL, `create_time` INTEGER(20) NOT NULL, `update_time` INTEGER(20) NOT NULL ); diff --git a/neutrino-proxy-server/src/main/resources/sql/user.data.sql b/neutrino-proxy-server/src/main/resources/sql/user.data.sql index f2094e02..81c853f2 100644 --- a/neutrino-proxy-server/src/main/resources/sql/user.data.sql +++ b/neutrino-proxy-server/src/main/resources/sql/user.data.sql @@ -1,3 +1,3 @@ #用户表 -insert into `user`(`id`, `name`,`login_name`,`login_password`,`create_time`, `update_time`) values -(1, '管理员', 'admin', 'e10adc3949ba59abbe56e057f20f883e', datetime('now', 'localtime'), datetime('now', 'localtime')); +insert into `user`(`id`, `name`,`login_name`,`login_password`,`enable`,`create_time`, `update_time`) values +(1, '管理员', 'admin', 'e10adc3949ba59abbe56e057f20f883e', 1, datetime('now', 'localtime'), datetime('now', 'localtime'));