OCT 1. 更新所有文档注释
This commit is contained in:
parent
ba79c32441
commit
98b8215329
|
@ -1,8 +1,8 @@
|
|||
#!/bin/bash
|
||||
# crontab里加上进程自动拉起任务,做个简单的监控
|
||||
# */1 * * * * source /etc/profile;sh /apprun/${YOUR_APP_NAME}/bin/processor_check.sh
|
||||
# processor_check.sh脚本内容如下
|
||||
|
||||
#!/bin/bash
|
||||
APP_NAME=dispose_platform.jar
|
||||
WORK_PATH=$(cd `dirname $0`; pwd)
|
||||
|
||||
|
|
|
@ -5,11 +5,19 @@ import org.springframework.boot.SpringApplication;
|
|||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
* The type Game database service application.
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@MapperScan(basePackages = {"com.cmhi.gds.mapper"})
|
||||
@EnableScheduling
|
||||
public class GameDatabaseServiceApplication {
|
||||
|
||||
/**
|
||||
* The entry point of application.
|
||||
*
|
||||
* @param args the input arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(GameDatabaseServiceApplication.class, args);
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@ package com.cmhi.gds.common;
|
|||
|
||||
/**
|
||||
* The interface Base enum.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
public interface BaseEnum {
|
||||
/**
|
||||
|
|
|
@ -14,16 +14,9 @@ import java.util.List;
|
|||
* The type Common enum handler.
|
||||
*
|
||||
* @param <E> the type parameter
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
public final class CommonEnumHandler<E extends BaseEnum> extends BaseTypeHandler<E> {
|
||||
/**
|
||||
* The Enum type.
|
||||
*/
|
||||
private final Class<E> enumType;
|
||||
/**
|
||||
* The Enums.
|
||||
*/
|
||||
private final List<E> enums;
|
||||
|
||||
/**
|
||||
|
@ -60,28 +53,11 @@ public final class CommonEnumHandler<E extends BaseEnum> extends BaseTypeHandler
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets non null parameter.
|
||||
*
|
||||
* @param preparedStatement the prepared statement
|
||||
* @param i the
|
||||
* @param e the e
|
||||
* @param jdbcType the jdbc type
|
||||
* @throws SQLException the sql exception
|
||||
*/
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement preparedStatement, int i, E e, JdbcType jdbcType) throws SQLException {
|
||||
preparedStatement.setInt(i, e.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets nullable result.
|
||||
*
|
||||
* @param resultSet the result set
|
||||
* @param s the s
|
||||
* @return the nullable result
|
||||
* @throws SQLException the sql exception
|
||||
*/
|
||||
@Override
|
||||
public E getNullableResult(ResultSet resultSet, String s) throws SQLException {
|
||||
if (resultSet.getObject(s) == null) {
|
||||
|
@ -92,14 +68,6 @@ public final class CommonEnumHandler<E extends BaseEnum> extends BaseTypeHandler
|
|||
return locateEnumStatus(val);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets nullable result.
|
||||
*
|
||||
* @param resultSet the result set
|
||||
* @param index the index
|
||||
* @return the nullable result
|
||||
* @throws SQLException the sql exception
|
||||
*/
|
||||
@Override
|
||||
public E getNullableResult(ResultSet resultSet, int index) throws SQLException {
|
||||
if (resultSet.getObject(index) == null) {
|
||||
|
@ -110,14 +78,6 @@ public final class CommonEnumHandler<E extends BaseEnum> extends BaseTypeHandler
|
|||
return locateEnumStatus(val);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets nullable result.
|
||||
*
|
||||
* @param callableStatement the callable statement
|
||||
* @param index the index
|
||||
* @return the nullable result
|
||||
* @throws SQLException the sql exception
|
||||
*/
|
||||
@Override
|
||||
public E getNullableResult(CallableStatement callableStatement, int index) throws SQLException {
|
||||
if (callableStatement.getObject(index) == null) {
|
||||
|
@ -128,12 +88,6 @@ public final class CommonEnumHandler<E extends BaseEnum> extends BaseTypeHandler
|
|||
return locateEnumStatus(val);
|
||||
}
|
||||
|
||||
/**
|
||||
* Locate enum status e.
|
||||
*
|
||||
* @param index the index
|
||||
* @return the e
|
||||
*/
|
||||
private E locateEnumStatus(int index) {
|
||||
for (E e : enums) {
|
||||
if (e.getValue() == index) {
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
package com.cmhi.gds.common;
|
||||
|
||||
/**
|
||||
* The type Const value.
|
||||
*/
|
||||
public class ConstValue {
|
||||
/**
|
||||
* The constant STRING_HTTP_AUTH_HEAD.
|
||||
*/
|
||||
public static final String STRING_HTTP_AUTH_HEAD = "Bearer ";
|
||||
|
||||
/**
|
||||
* The constant IP_ADDR_REG.
|
||||
*/
|
||||
public static final String IP_ADDR_REG = "^((25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}" +
|
||||
"(25[0-5]|2[0-4]\\d|[01]?\\d\\d?)$|^" +
|
||||
"([\\da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(25[0-5]|2[0-4]\\d|[01]?\\d\\d?)$|^::" +
|
||||
|
@ -19,6 +25,10 @@ public class ConstValue {
|
|||
"4}){1,5}|:)$|^([\\da-fA-F]{1,4}:){2}((:[\\da-fA-F]{1,4}){1,4}|:)$|^([\\da-fA-F]{1,4}:){3}((:[\\da-fA-F]{1," +
|
||||
"4}){1,3}|:)$|^([\\da-fA-F]{1,4}:){4}((:[\\da-fA-F]{1,4}){1,2}|:)$|^([\\da-fA-F]{1,4}:){5}:([\\da-fA-F]{1,4})" +
|
||||
"?$|^([\\da-fA-F]{1,4}:){6}:$";
|
||||
|
||||
/**
|
||||
* The type Protocol.
|
||||
*/
|
||||
public static class Protocol {
|
||||
/**
|
||||
* The constant VERSION.
|
||||
|
|
|
@ -4,243 +4,229 @@ import javax.servlet.http.HttpServletResponse;
|
|||
|
||||
/**
|
||||
* The enum Error code.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
public enum ErrorCode implements BaseEnum {
|
||||
/**
|
||||
* The Err ok.
|
||||
* Err ok error code.
|
||||
*/
|
||||
ERR_OK(0, "成功"),
|
||||
/**
|
||||
* The Err password.
|
||||
* Err password error code.
|
||||
*/
|
||||
ERR_PASSWORD(1, "密码错误"),
|
||||
/**
|
||||
* The Err usernotfound.
|
||||
* Err usernotfound error code.
|
||||
*/
|
||||
ERR_USERNOTFOUND(2, "用户不存在"),
|
||||
/**
|
||||
* The Err passwordmore.
|
||||
* Err passwordmore error code.
|
||||
*/
|
||||
ERR_PASSWORDMORE(3, "连续密码错误达上限,再次输入错误将锁定用户"),
|
||||
/**
|
||||
* The Err userlock.
|
||||
* Err userlock error code.
|
||||
*/
|
||||
ERR_USERLOCK(4, "密码错误达上限,用户被锁定"),
|
||||
/**
|
||||
* The Err account.
|
||||
* Err account error code.
|
||||
*/
|
||||
ERR_ACCOUNT(5, "用户账户异常"),
|
||||
/**
|
||||
* The Err userexist.
|
||||
* Err userexist error code.
|
||||
*/
|
||||
ERR_USEREXIST(6, "该用户已经存在"),
|
||||
/**
|
||||
* The Err passwordsimple.
|
||||
* Err passwordsimple error code.
|
||||
*/
|
||||
ERR_PASSWORDSIMPLE(7, "用户密码强度不符合要求"),
|
||||
/**
|
||||
* The Err inputformat.
|
||||
* Err inputformat error code.
|
||||
*/
|
||||
ERR_INPUTFORMAT(8, "输入信息格式有误"),
|
||||
/**
|
||||
* The Err inputmiss.
|
||||
* Err inputmiss error code.
|
||||
*/
|
||||
ERR_INPUTMISS(9, "缺少必要输入信息"),
|
||||
/**
|
||||
* The Err permission.
|
||||
* Err permission error code.
|
||||
*/
|
||||
ERR_PERMISSION(10, "操作员权限不足"),
|
||||
/**
|
||||
* The Err reqtimeout.
|
||||
* Err reqtimeout error code.
|
||||
*/
|
||||
ERR_REQTIMEOUT(11, "请求超时"),
|
||||
/**
|
||||
* The Err params.
|
||||
* Err params error code.
|
||||
*/
|
||||
ERR_PARAMS(12, "参数错误"),
|
||||
/**
|
||||
* The Err systemexception.
|
||||
* Err systemexception error code.
|
||||
*/
|
||||
ERR_SYSTEMEXCEPTION(13, "系统异常"),
|
||||
/**
|
||||
* The Err unknowncmd.
|
||||
* Err unknowncmd error code.
|
||||
*/
|
||||
ERR_UNKNOWNCMD(14, "未知命令"),
|
||||
/**
|
||||
* The Err logout.
|
||||
* Err logout error code.
|
||||
*/
|
||||
ERR_LOGOUT(15, "用户未登录"),
|
||||
/**
|
||||
* The Err tokentimeout.
|
||||
* Err tokentimeout error code.
|
||||
*/
|
||||
ERR_TOKENTIMEOUT(16, "Token超时"),
|
||||
/**
|
||||
* The Err tokennotfound.
|
||||
* Err tokennotfound error code.
|
||||
*/
|
||||
ERR_TOKENNOTFOUND(17, "非法Token"),
|
||||
/**
|
||||
* The Err missauthhead.
|
||||
* Err missauthhead error code.
|
||||
*/
|
||||
ERR_MISSAUTHHEAD(18, "Http 请求缺少认证头部"),
|
||||
/**
|
||||
* The Err nosuchdevice.
|
||||
* Err nosuchdevice error code.
|
||||
*/
|
||||
ERR_NOSUCHDEVICE(19, "没有这个设备"),
|
||||
/**
|
||||
* The Err deviceexists.
|
||||
* Err deviceexists error code.
|
||||
*/
|
||||
ERR_DEVICEEXISTS(20, "设备已经存在"),
|
||||
/**
|
||||
* The Err paramexception.
|
||||
* Err paramexception error code.
|
||||
*/
|
||||
ERR_PARAMEXCEPTION(21, "参数异常"),
|
||||
/**
|
||||
* The Err devicelocked.
|
||||
* Err devicelocked error code.
|
||||
*/
|
||||
ERR_DEVICELOCKED(22, "设备已锁定"),
|
||||
/**
|
||||
* The Err version.
|
||||
* Err version error code.
|
||||
*/
|
||||
ERR_VERSION(23, "协议版本不兼容,请升级系统"),
|
||||
/**
|
||||
* The Err nosuchtype.
|
||||
* Err nosuchtype error code.
|
||||
*/
|
||||
ERR_NOSUCHTYPE(24, "没有这个类型的设备"),
|
||||
/**
|
||||
* The Err removemore.
|
||||
* Err removemore error code.
|
||||
*/
|
||||
ERR_REMOVEMORE(25, "禁止同时删除多个设备"),
|
||||
/**
|
||||
* The Err taskrunning.
|
||||
* Err taskrunning error code.
|
||||
*/
|
||||
ERR_TASKRUNNING(26, "同类任务正在运行"),
|
||||
/**
|
||||
* The Err unsupport.
|
||||
* Err unsupport error code.
|
||||
*/
|
||||
ERR_UNSUPPORT(27, "不支持的操作"),
|
||||
/**
|
||||
* The Err interrupt.
|
||||
* Err interrupt error code.
|
||||
*/
|
||||
ERR_INTERRUPT(28, "操作中断"),
|
||||
/**
|
||||
* The Err calldevice.
|
||||
* Err calldevice error code.
|
||||
*/
|
||||
ERR_CALLDEVICE(29, "调用设备失败"),
|
||||
/**
|
||||
* The Err nosuchtask.
|
||||
* Err nosuchtask error code.
|
||||
*/
|
||||
ERR_NOSUCHTASK(30, "没有该任务"),
|
||||
/**
|
||||
* The Err tasknotrunning.
|
||||
* Err tasknotrunning error code.
|
||||
*/
|
||||
ERR_TASKNOTRUNNING(31, "该任务没有运行"),
|
||||
/**
|
||||
* The Err requesttimeout.
|
||||
* Err requesttimeout error code.
|
||||
*/
|
||||
ERR_REQUESTTIMEOUT(32, "请求超时"),
|
||||
/**
|
||||
* The Err unabledisposeip.
|
||||
* Err unabledisposeip error code.
|
||||
*/
|
||||
ERR_UNABLEDISPOSEIP(33, "无法处置该IP"),
|
||||
/**
|
||||
* The Err database.
|
||||
* Err database error code.
|
||||
*/
|
||||
ERR_DATABASE(34, "操作数据库失败"),
|
||||
/**
|
||||
* The Err untrusthost.
|
||||
* Err untrusthost error code.
|
||||
*/
|
||||
ERR_UNTRUSTHOST(35, "未经授权的客户端"),
|
||||
/**
|
||||
* The Err untrusttoken.
|
||||
* Err untrusttoken error code.
|
||||
*/
|
||||
ERR_UNTRUSTTOKEN(36, "未经授权的Token"),
|
||||
/**
|
||||
* The Err unknowninterface.
|
||||
* Err unknowninterface error code.
|
||||
*/
|
||||
ERR_UNKNOWNINTERFACE(37, "未提供该接口"),
|
||||
/**
|
||||
* The Err decrypt base 64.
|
||||
* Err decrypt base 64 error code.
|
||||
*/
|
||||
ERR_DECRYPT_BASE64(100, "BASE64解密失败"),
|
||||
/**
|
||||
* The Err encrypt base 64.
|
||||
* Err encrypt base 64 error code.
|
||||
*/
|
||||
ERR_ENCRYPT_BASE64(101, "BASE64加密失败"),
|
||||
/**
|
||||
* The Err decrypt aes 128.
|
||||
* Err decrypt aes 128 error code.
|
||||
*/
|
||||
ERR_DECRYPT_AES128(102, "AES128解密失败"),
|
||||
/**
|
||||
* The Err encrypt aes 128.
|
||||
* Err encrypt aes 128 error code.
|
||||
*/
|
||||
ERR_ENCRYPT_AES128(103, "AES128加密失败"),
|
||||
/**
|
||||
* The Err decrypt 3 des.
|
||||
* Err decrypt 3 des error code.
|
||||
*/
|
||||
ERR_DECRYPT_3DES(104, "3DES解密失败"),
|
||||
/**
|
||||
* The Err encrypt 3 des.
|
||||
* Err encrypt 3 des error code.
|
||||
*/
|
||||
ERR_ENCRYPT_3DES(105, "3DES加密失败"),
|
||||
/**
|
||||
* The Err decrypt unknown.
|
||||
* Err decrypt unknown error code.
|
||||
*/
|
||||
ERR_DECRYPT_UNKNOWN(106, "不支持的解密算法"),
|
||||
/**
|
||||
* The Err encrypt unknown.
|
||||
* Err encrypt unknown error code.
|
||||
*/
|
||||
ERR_ENCRYPT_UNKNOWN(107, "不支持的加密算法"),
|
||||
/**
|
||||
* The Err json encode.
|
||||
* Err json encode error code.
|
||||
*/
|
||||
ERR_JSON_ENCODE(108, "Json 序列号错误"),
|
||||
/**
|
||||
* The Err json decode.
|
||||
* Err json decode error code.
|
||||
*/
|
||||
ERR_JSON_DECODE(109, "Json 反序列化错误"),
|
||||
/**
|
||||
* The Err encrypt aes 256.
|
||||
* Err encrypt aes 256 error code.
|
||||
*/
|
||||
ERR_ENCRYPT_AES256(110, "AES256加密失败"),
|
||||
/**
|
||||
* The Err decrypt aes 256.
|
||||
* Err decrypt aes 256 error code.
|
||||
*/
|
||||
ERR_DECRYPT_AES256(111, "AES256解密失败"),
|
||||
/**
|
||||
* The Err nodevice areacode.
|
||||
* Err nosuch game error code.
|
||||
*/
|
||||
ERR_NOSUCH_GAME(112, "该游戏不存在"),
|
||||
/**
|
||||
* The Err specifiedip exists.
|
||||
* Err specifiedip exists error code.
|
||||
*/
|
||||
ERR_SPECIFIEDIP_EXISTS(113, "指定的IP已经存在"),
|
||||
/**
|
||||
* The Err specifiedip notexists.
|
||||
* Err specifiedip notexists error code.
|
||||
*/
|
||||
ERR_SPECIFIEDIP_NOTEXISTS(114, "指定的IP地址不存在"),
|
||||
/**
|
||||
* The Err server processreq.
|
||||
* Err server processreq error code.
|
||||
*/
|
||||
ERR_SERVER_PROCESSREQ(115, "服务器处理请求错误"),
|
||||
;
|
||||
|
||||
/**
|
||||
* The Errno.
|
||||
*/
|
||||
private final int errno;
|
||||
/**
|
||||
* The Err msg.
|
||||
*/
|
||||
private final String errMsg;
|
||||
|
||||
/**
|
||||
* Instantiates a new Error code.
|
||||
*
|
||||
* @param err the err
|
||||
* @param msg the msg
|
||||
*/
|
||||
ErrorCode(int err, String msg) {
|
||||
this.errno = err;
|
||||
this.errMsg = msg;
|
||||
|
@ -298,21 +284,11 @@ public enum ErrorCode implements BaseEnum {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets value.
|
||||
*
|
||||
* @return the value
|
||||
*/
|
||||
@Override
|
||||
public Integer getValue() {
|
||||
return this.errno;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets description.
|
||||
*
|
||||
* @return the description
|
||||
*/
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return this.errMsg;
|
||||
|
|
|
@ -1,11 +1,20 @@
|
|||
package com.cmhi.gds.common;
|
||||
|
||||
/**
|
||||
* The type Global configure.
|
||||
*/
|
||||
public class GlobalConfigure {
|
||||
private GlobalConfigure() {
|
||||
throw new AssertionError("Instantiating utility class.");
|
||||
}
|
||||
|
||||
/**
|
||||
* The constant CHECK_PROTO_REQUEST_TIMEOUT.
|
||||
*/
|
||||
public static volatile boolean CHECK_PROTO_REQUEST_TIMEOUT = false;
|
||||
|
||||
/**
|
||||
* The constant REQUEST_TIMEOUT_MS.
|
||||
*/
|
||||
public static volatile long REQUEST_TIMEOUT_MS = 5 * 1000;
|
||||
}
|
||||
|
|
|
@ -2,24 +2,22 @@ package com.cmhi.gds.common;
|
|||
|
||||
/**
|
||||
* The enum Proto crypto type.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
public enum ProtoCryptoType {
|
||||
/**
|
||||
* The Crypto none.
|
||||
* Crypto none proto crypto type.
|
||||
*/
|
||||
CRYPTO_NONE(0, "不加密"),
|
||||
/**
|
||||
* The Crypto base 64.
|
||||
* Crypto base 64 proto crypto type.
|
||||
*/
|
||||
CRYPTO_BASE64(1, "Base64编码"),
|
||||
/**
|
||||
* The Crypto aes 128.
|
||||
* Crypto aes 128 proto crypto type.
|
||||
*/
|
||||
CRYPTO_AES128(2, "AES128加密"),
|
||||
/**
|
||||
* The Crypto des.
|
||||
* Crypto des proto crypto type.
|
||||
*/
|
||||
CRYPTO_DES(3, "DES对称加密"),
|
||||
/**
|
||||
|
@ -28,21 +26,9 @@ public enum ProtoCryptoType {
|
|||
CRYPTO_AES256(4, "AES256加密"),
|
||||
;
|
||||
|
||||
/**
|
||||
* The Code.
|
||||
*/
|
||||
private final int code;
|
||||
/**
|
||||
* The Readme.
|
||||
*/
|
||||
private final String readme;
|
||||
|
||||
/**
|
||||
* Instantiates a new Proto crypto type.
|
||||
*
|
||||
* @param code the code
|
||||
* @param readme the readme
|
||||
*/
|
||||
ProtoCryptoType(int code, String readme) {
|
||||
this.code = code;
|
||||
this.readme = readme;
|
||||
|
|
|
@ -2,14 +2,9 @@ package com.cmhi.gds.common;
|
|||
|
||||
/**
|
||||
* The type Security config value.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
public class SecurityConfigValue {
|
||||
|
||||
/**
|
||||
* Instantiates a new Security config value.
|
||||
*/
|
||||
private SecurityConfigValue() {
|
||||
throw new AssertionError("Instantiating utility class.");
|
||||
}
|
||||
|
|
|
@ -1,59 +1,35 @@
|
|||
package com.cmhi.gds.common;
|
||||
|
||||
/**
|
||||
* The enum Dispose device type.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
* The enum Transport protocol type.
|
||||
*/
|
||||
public enum TransportProtocolType implements BaseEnum {
|
||||
/**
|
||||
* The Dptech umc.
|
||||
* Tcp protocol transport protocol type.
|
||||
*/
|
||||
TCP_PROTOCOL(0, "TCP"),
|
||||
/**
|
||||
* The Haohan platform.
|
||||
* Udp protocol transport protocol type.
|
||||
*/
|
||||
UDP_PROTOCOL(1, "UDP"),
|
||||
/**
|
||||
* The Pengxin platform.
|
||||
* Unknown protocol transport protocol type.
|
||||
*/
|
||||
UNKNOWN_PROTOCOL(2, "UNKNOWN");
|
||||
|
||||
/**
|
||||
* The Code.
|
||||
*/
|
||||
private final int code;
|
||||
/**
|
||||
* The Readme.
|
||||
*/
|
||||
private final String readme;
|
||||
|
||||
/**
|
||||
* Instantiates a new Dispose device type.
|
||||
*
|
||||
* @param code the code
|
||||
* @param readme the readme
|
||||
*/
|
||||
TransportProtocolType(int code, String readme) {
|
||||
this.code = code;
|
||||
this.readme = readme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets value.
|
||||
*
|
||||
* @return the value
|
||||
*/
|
||||
@Override
|
||||
public Integer getValue() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets description.
|
||||
*
|
||||
* @return the description
|
||||
*/
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return this.readme;
|
||||
|
|
|
@ -15,8 +15,6 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* The type Error controller.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
@Controller
|
||||
public class ErrorController extends BasicErrorController {
|
||||
|
@ -29,12 +27,6 @@ public class ErrorController extends BasicErrorController {
|
|||
super(new DefaultErrorAttributes(), serverProperties.getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* Error response entity.
|
||||
*
|
||||
* @param request the request
|
||||
* @return the response entity
|
||||
*/
|
||||
@Override
|
||||
public ResponseEntity<Map<String, Object>> error(HttpServletRequest request) {
|
||||
HttpStatus status = getStatus(request);
|
||||
|
|
|
@ -37,6 +37,9 @@ import java.util.Map;
|
|||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* The type Game database info controller.
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "/gameinfo")
|
||||
@Slf4j
|
||||
|
@ -49,6 +52,11 @@ public class GameDatabaseInfoController {
|
|||
@Resource
|
||||
private GameDatabaseServiceService gameDatabaseServiceService;
|
||||
|
||||
/**
|
||||
* Gets game list summary.
|
||||
*
|
||||
* @return the game list summary
|
||||
*/
|
||||
@GetMapping("gamelistsummary")
|
||||
@ResponseBody
|
||||
public ProtocolRespDTO<GetGamesSummaryRsp> getGameListSummary() {
|
||||
|
@ -84,12 +92,23 @@ public class GameDatabaseInfoController {
|
|||
return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets game list summary 2.
|
||||
*
|
||||
* @return the game list summary 2
|
||||
*/
|
||||
@PostMapping("gamelistsummary2")
|
||||
@ResponseBody
|
||||
public ProtocolRespDTO<GetGamesSummaryRsp> getGameListSummary2(@RequestBody ProtocolReqDTO<Object> mr) {
|
||||
public ProtocolRespDTO<GetGamesSummaryRsp> getGameListSummary2() {
|
||||
return getGameListSummary();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets game info details.
|
||||
*
|
||||
* @param mr the mr
|
||||
* @return the game info details
|
||||
*/
|
||||
@PostMapping("gamelistDetails")
|
||||
@ResponseBody
|
||||
public ProtocolRespDTO<GetGamesInfoRsp> getGameInfoDetails(@Validated(ValidGroups.AddGameServiceValid.class)
|
||||
|
@ -150,6 +169,12 @@ public class GameDatabaseInfoController {
|
|||
return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Report game service data protocol resp dto.
|
||||
*
|
||||
* @param mr the mr
|
||||
* @return the protocol resp dto
|
||||
*/
|
||||
@PostMapping("/gamedata")
|
||||
@ResponseBody
|
||||
public ProtocolRespDTO<GameServerRsp> reportGameServiceData(
|
||||
|
|
|
@ -6,19 +6,14 @@ import lombok.Setter;
|
|||
|
||||
/**
|
||||
* The type Controller not support exception.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class ControllerNotSupportException extends RuntimeException {
|
||||
/**
|
||||
* The Err.
|
||||
*/
|
||||
private ErrorCode err;
|
||||
|
||||
/**
|
||||
* Instantiates a new Security protocol exception.
|
||||
* Instantiates a new Controller not support exception.
|
||||
*
|
||||
* @param err the err
|
||||
*/
|
||||
|
|
|
@ -6,20 +6,12 @@ import lombok.Setter;
|
|||
|
||||
/**
|
||||
* The type Controller request timeout exception.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class ControllerRequestTimeoutException extends RuntimeException {
|
||||
/**
|
||||
* The Err.
|
||||
*/
|
||||
private ErrorCode err;
|
||||
|
||||
/**
|
||||
* The Message.
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,8 +20,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
|
||||
/**
|
||||
* The type Global exception handler.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
@ControllerAdvice
|
||||
@Slf4j
|
||||
|
|
|
@ -5,22 +5,17 @@ import lombok.Getter;
|
|||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* The type Security exception.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
* The type Security protocol exception.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class SecurityProtocolException extends RuntimeException {
|
||||
/**
|
||||
* The Err.
|
||||
*/
|
||||
private ErrorCode err;
|
||||
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* Instantiates a new Security exception.
|
||||
* Instantiates a new Security protocol exception.
|
||||
*
|
||||
* @param err the err
|
||||
*/
|
||||
|
@ -30,6 +25,12 @@ public class SecurityProtocolException extends RuntimeException {
|
|||
this.description = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new Security protocol exception.
|
||||
*
|
||||
* @param err the err
|
||||
* @param readme the readme
|
||||
*/
|
||||
public SecurityProtocolException(ErrorCode err, String readme) {
|
||||
super();
|
||||
this.err = err;
|
||||
|
|
|
@ -16,13 +16,8 @@ import java.nio.charset.Charset;
|
|||
|
||||
/**
|
||||
* The type Request body cache wrapper.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
public class RequestBodyCacheWrapper extends HttpServletRequestWrapper {
|
||||
/**
|
||||
* The Body.
|
||||
*/
|
||||
private final byte[] body;
|
||||
|
||||
/**
|
||||
|
@ -62,21 +57,11 @@ public class RequestBodyCacheWrapper extends HttpServletRequestWrapper {
|
|||
return Helper.inputStream2String(inputStream);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets reader.
|
||||
*
|
||||
* @return the reader
|
||||
*/
|
||||
@Override
|
||||
public BufferedReader getReader() {
|
||||
return new BufferedReader(new InputStreamReader(getInputStream()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets input stream.
|
||||
*
|
||||
* @return the input stream
|
||||
*/
|
||||
@Override
|
||||
public ServletInputStream getInputStream() {
|
||||
|
||||
|
|
|
@ -13,37 +13,17 @@ import java.io.IOException;
|
|||
|
||||
/**
|
||||
* The type Request body filter.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
|
||||
@WebFilter(filterName = "RequestBodyFilter", urlPatterns = "/*")
|
||||
public class RequestBodyFilter implements Filter {
|
||||
/**
|
||||
* Init.
|
||||
*
|
||||
* @param filterConfig the filter config
|
||||
*/
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy.
|
||||
*/
|
||||
@Override
|
||||
public void destroy() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Do filter.
|
||||
*
|
||||
* @param request the request
|
||||
* @param response the response
|
||||
* @param filterChain the filter chain
|
||||
* @throws IOException the io exception
|
||||
* @throws ServletException the servlet exception
|
||||
*/
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
|
||||
ServletRequest requestWrapper = new RequestBodyCacheWrapper((HttpServletRequest) request);
|
||||
|
|
|
@ -16,27 +16,14 @@ import java.lang.reflect.Type;
|
|||
|
||||
/**
|
||||
* The type Request protocol security.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
@Slf4j
|
||||
@RestControllerAdvice
|
||||
public class RequestProtocolSecurity implements RequestBodyAdvice {
|
||||
|
||||
/**
|
||||
* The Protocol security service.
|
||||
*/
|
||||
@Resource
|
||||
private ProtocolSecurityService protocolSecurityService;
|
||||
|
||||
/**
|
||||
* Supports boolean.
|
||||
*
|
||||
* @param methodParameter the method parameter
|
||||
* @param type the type
|
||||
* @param aClass the a class
|
||||
* @return the boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean supports(@NotNull MethodParameter methodParameter,
|
||||
@NotNull Type type,
|
||||
|
@ -45,15 +32,6 @@ public class RequestProtocolSecurity implements RequestBodyAdvice {
|
|||
|| methodParameter.hasMethodAnnotation(Decryption.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Before body read http input message.
|
||||
*
|
||||
* @param httpInputMessage the http input message
|
||||
* @param methodParameter the method parameter
|
||||
* @param type the type
|
||||
* @param aClass the a class
|
||||
* @return the http input message
|
||||
*/
|
||||
@Override
|
||||
@NotNull
|
||||
public HttpInputMessage beforeBodyRead(@NotNull HttpInputMessage httpInputMessage,
|
||||
|
@ -63,16 +41,6 @@ public class RequestProtocolSecurity implements RequestBodyAdvice {
|
|||
return protocolSecurityService.decryptProtocol(httpInputMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle empty body object.
|
||||
*
|
||||
* @param o the o
|
||||
* @param httpInputMessage the http input message
|
||||
* @param methodParameter the method parameter
|
||||
* @param type the type
|
||||
* @param aClass the a class
|
||||
* @return the object
|
||||
*/
|
||||
@Override
|
||||
public Object handleEmptyBody(Object o,
|
||||
@NotNull HttpInputMessage httpInputMessage,
|
||||
|
@ -82,16 +50,6 @@ public class RequestProtocolSecurity implements RequestBodyAdvice {
|
|||
return o;
|
||||
}
|
||||
|
||||
/**
|
||||
* After body read object.
|
||||
*
|
||||
* @param o the o
|
||||
* @param httpInputMessage the http input message
|
||||
* @param methodParameter the method parameter
|
||||
* @param type the type
|
||||
* @param aClass the a class
|
||||
* @return the object
|
||||
*/
|
||||
@Override
|
||||
@NotNull
|
||||
public Object afterBodyRead(@NotNull Object o,
|
||||
|
|
|
@ -19,26 +19,14 @@ import javax.annotation.Resource;
|
|||
|
||||
/**
|
||||
* The type Response protocol security.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
@Slf4j
|
||||
@RestControllerAdvice
|
||||
public class ResponseProtocolSecurity implements ResponseBodyAdvice<Object> {
|
||||
|
||||
/**
|
||||
* The Protocol security service.
|
||||
*/
|
||||
@Resource
|
||||
private ProtocolSecurityService protocolSecurityService;
|
||||
|
||||
/**
|
||||
* Supports boolean.
|
||||
*
|
||||
* @param methodParameter the method parameter
|
||||
* @param aClass the a class
|
||||
* @return the boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean supports(@NotNull MethodParameter methodParameter,
|
||||
@NotNull Class<? extends HttpMessageConverter<?>> aClass) {
|
||||
|
@ -47,17 +35,6 @@ public class ResponseProtocolSecurity implements ResponseBodyAdvice<Object> {
|
|||
|| methodParameter.hasMethodAnnotation(Encryption.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Before body write object.
|
||||
*
|
||||
* @param o the o
|
||||
* @param methodParameter the method parameter
|
||||
* @param mediaType the media type
|
||||
* @param aClass the a class
|
||||
* @param serverHttpRequest the server http request
|
||||
* @param serverHttpResponse the server http response
|
||||
* @return the object
|
||||
*/
|
||||
@Override
|
||||
@NotNull
|
||||
public Object beforeBodyWrite(Object o,
|
||||
|
|
|
@ -6,12 +6,38 @@ import com.cmhi.gds.pojo.vo.GameTableSummary;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The interface Game database service manager.
|
||||
*/
|
||||
public interface GameDatabaseServiceManager {
|
||||
/**
|
||||
* Gets game table summary.
|
||||
*
|
||||
* @return the game table summary
|
||||
*/
|
||||
List<GameTableSummary> getGameTableSummary();
|
||||
|
||||
/**
|
||||
* Gets game table details.
|
||||
*
|
||||
* @param gameId the game id
|
||||
* @return the game table details
|
||||
*/
|
||||
List<GameTableItemsDetail> getGameTableDetails(List<Long> gameId);
|
||||
|
||||
/**
|
||||
* Gets game server info by game info id.
|
||||
*
|
||||
* @param gameInfoId the game info id
|
||||
* @return the game server info by game info id
|
||||
*/
|
||||
List<GameServer> getGameServerInfoByGameInfoId(List<Long> gameInfoId);
|
||||
|
||||
/**
|
||||
* Add game server info int.
|
||||
*
|
||||
* @param gsList the gs list
|
||||
* @return the int
|
||||
*/
|
||||
int addGameServerInfo(List<GameServer> gsList);
|
||||
}
|
||||
|
|
|
@ -13,6 +13,9 @@ import org.springframework.stereotype.Component;
|
|||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The type Game database service manager.
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class GameDatabaseServiceManagerImpl implements GameDatabaseServiceManager {
|
||||
|
|
|
@ -4,6 +4,14 @@ import com.cmhi.gds.pojo.entry.GameInfo;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The interface Game info mapper.
|
||||
*/
|
||||
public interface GameInfoMapper {
|
||||
/**
|
||||
* Select all list.
|
||||
*
|
||||
* @return the list
|
||||
*/
|
||||
List<GameInfo> selectAll();
|
||||
}
|
||||
|
|
|
@ -5,10 +5,30 @@ import org.apache.ibatis.annotations.Param;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The interface Game server mapper.
|
||||
*/
|
||||
public interface GameServerMapper {
|
||||
/**
|
||||
* Select all list.
|
||||
*
|
||||
* @return the list
|
||||
*/
|
||||
List<GameServer> selectAll();
|
||||
|
||||
/**
|
||||
* Select all by game info id list.
|
||||
*
|
||||
* @param idList the id list
|
||||
* @return the list
|
||||
*/
|
||||
List<GameServer> selectAllByGameInfoId(@Param("idList") List<Long> idList);
|
||||
|
||||
/**
|
||||
* Add game server info list int.
|
||||
*
|
||||
* @param gameSvrInfo the game svr info
|
||||
* @return the int
|
||||
*/
|
||||
int addGameServerInfoList(@Param("gameSvrInfo") List<GameServer> gameSvrInfo);
|
||||
}
|
||||
|
|
|
@ -7,10 +7,29 @@ import org.apache.ibatis.annotations.Param;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The interface Game table mapper.
|
||||
*/
|
||||
public interface GameTableMapper {
|
||||
/**
|
||||
* Select all list.
|
||||
*
|
||||
* @return the list
|
||||
*/
|
||||
List<GameTable> selectAll();
|
||||
|
||||
/**
|
||||
* Select all game summary list.
|
||||
*
|
||||
* @return the list
|
||||
*/
|
||||
List<GameTableSummary> selectAllGameSummary();
|
||||
|
||||
/**
|
||||
* Select all game detail by id list.
|
||||
*
|
||||
* @param idList the id list
|
||||
* @return the list
|
||||
*/
|
||||
List<GameTableItemsDetail> selectAllGameDetailById(@Param("idList") List<Long> idList);
|
||||
}
|
||||
|
|
|
@ -18,15 +18,10 @@ import java.time.format.DateTimeFormatter;
|
|||
|
||||
/**
|
||||
* The type Helper.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
@Slf4j
|
||||
public class Helper {
|
||||
|
||||
/**
|
||||
* Instantiates a new Helper.
|
||||
*/
|
||||
private Helper() {
|
||||
throw new AssertionError("Instantiating utility class.");
|
||||
}
|
||||
|
@ -109,6 +104,12 @@ public class Helper {
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ip address is hostname boolean.
|
||||
*
|
||||
* @param hostStr the host str
|
||||
* @return the boolean
|
||||
*/
|
||||
public static Boolean ipAddressIsHostname(String hostStr) {
|
||||
HostName host = new HostName(hostStr);
|
||||
try {
|
||||
|
@ -119,6 +120,12 @@ public class Helper {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ip address is ipv 6 boolean.
|
||||
*
|
||||
* @param ipAddr the ip addr
|
||||
* @return the boolean
|
||||
*/
|
||||
public static boolean ipAddressIsIpv6(String ipAddr) {
|
||||
IPAddress loopback = new IPAddressString(ipAddr).getAddress();
|
||||
|
||||
|
@ -129,6 +136,13 @@ public class Helper {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is ip address equal boolean.
|
||||
*
|
||||
* @param ip1 the ip 1
|
||||
* @param ip2 the ip 2
|
||||
* @return the boolean
|
||||
*/
|
||||
public static boolean isIpAddressEqual(String ip1, String ip2) {
|
||||
if (ipAddressIsHostname(ip1) == null || ipAddressIsHostname(ip1) == null) {
|
||||
return false;
|
||||
|
@ -152,6 +166,12 @@ public class Helper {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ip address to big integer big integer.
|
||||
*
|
||||
* @param ipAddr the ip addr
|
||||
* @return the big integer
|
||||
*/
|
||||
public static BigInteger ipAddressToBigInteger(String ipAddr) {
|
||||
IPAddress loopback = new IPAddressString(ipAddr).getAddress();
|
||||
|
||||
|
|
|
@ -9,8 +9,6 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
/**
|
||||
* The type Base id resp.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
|
@ -19,17 +17,8 @@ import lombok.NoArgsConstructor;
|
|||
@JsonPropertyOrder({"id", "devId", "taskId", "status", "message"})
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class BaseIdResp extends BaseRespStatus {
|
||||
/**
|
||||
* The Id.
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* The Dev id.
|
||||
*/
|
||||
private String devId;
|
||||
|
||||
/**
|
||||
* The Task id.
|
||||
*/
|
||||
private String taskId;
|
||||
}
|
||||
|
|
|
@ -14,40 +14,27 @@ import javax.validation.constraints.NotNull;
|
|||
* The type Base protocol dto.
|
||||
*
|
||||
* @param <T> the type parameter
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@JsonPropertyOrder({"ver", "cryptoType", "timeStamp", "msgContent"})
|
||||
public class BaseProtocolDTO<T> {
|
||||
/**
|
||||
* 当前协议版本号
|
||||
*/
|
||||
@NotNull(message = "ver 字段不能为空", groups = ValidGroups.ProtocolCommonValid.class)
|
||||
@Range(min = 1, max = 9999, message = "ver 字段最小值为 1", groups = ValidGroups.ProtocolCommonValid.class)
|
||||
private Integer ver;
|
||||
|
||||
/**
|
||||
* msgContent字段内容编码格式
|
||||
*/
|
||||
@NotNull(message = "cryptoType 字段不能为空", groups = ValidGroups.ProtocolCommonValid.class)
|
||||
@Range(min = 0, max = 4,
|
||||
message = "cryptoType 字段取值为 [0, 4]"
|
||||
, groups = ValidGroups.ProtocolCommonValid.class)
|
||||
private Integer cryptoType;
|
||||
|
||||
/**
|
||||
* 当前UTC时间戳(ms)
|
||||
*/
|
||||
@NotNull(message = "timeStamp 字段不能为空", groups = ValidGroups.ProtocolCommonValid.class)
|
||||
@DecimalMin(value = "1595494343000",
|
||||
message = "timeStamp 字段值不能为过去时间"
|
||||
, groups = ValidGroups.ProtocolCommonValid.class)
|
||||
private Long timeStamp;
|
||||
|
||||
/**
|
||||
* 协议详细内容
|
||||
*/
|
||||
@Valid
|
||||
private T msgContent;
|
||||
}
|
||||
|
|
|
@ -5,21 +5,13 @@ import lombok.Data;
|
|||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* The type Response status.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
* The type Base resp status.
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class BaseRespStatus {
|
||||
|
||||
/**
|
||||
* 0:成功;其它:失败原因.
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 登录消息: status状态码对应的提示信息
|
||||
*/
|
||||
private String[] message;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import java.util.Objects;
|
|||
* The type Protocol req dto.
|
||||
*
|
||||
* @param <T> the type parameter
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
|
|
|
@ -16,7 +16,6 @@ import lombok.extern.slf4j.Slf4j;
|
|||
* The type Protocol resp dto.
|
||||
*
|
||||
* @param <T> the type parameter
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
@Slf4j
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
@ -25,25 +24,10 @@ import lombok.extern.slf4j.Slf4j;
|
|||
@AllArgsConstructor
|
||||
@JsonPropertyOrder({"ver", "cryptoType", "timeStamp", "code", "msgContent"})
|
||||
public class ProtocolRespDTO<T> extends BaseProtocolDTO<T> {
|
||||
/**
|
||||
* The constant OBJECT_MAPPER.
|
||||
*/
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
/**
|
||||
* The Code.
|
||||
*/
|
||||
private Integer code;
|
||||
|
||||
/**
|
||||
* Result protocol resp dto.
|
||||
*
|
||||
* @param <T> the type parameter
|
||||
* @param err the err
|
||||
* @param httpCode the http code
|
||||
* @param respMsg the resp msg
|
||||
* @return the protocol resp dto
|
||||
*/
|
||||
private static <T> ProtocolRespDTO<T> result(ErrorCode err, Integer httpCode, T respMsg) {
|
||||
ProtocolRespDTO<T> resp = new ProtocolRespDTO<>();
|
||||
|
||||
|
|
|
@ -11,6 +11,9 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The type Game info content.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Builder
|
||||
|
@ -19,6 +22,9 @@ import java.util.List;
|
|||
@JsonPropertyOrder({"gameId", "name", "company", "gamesInfo", "status", "message"})
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class GameInfoContent extends BaseRespStatus {
|
||||
/**
|
||||
* The Games info.
|
||||
*/
|
||||
List<GameInfoDetail> gamesInfo;
|
||||
private Long gameId;
|
||||
private String name;
|
||||
|
|
|
@ -7,6 +7,9 @@ import lombok.Builder;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* The type Game info detail.
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
|
|
|
@ -8,12 +8,18 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The type Game list summary.
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonPropertyOrder({"gameId", "gamesFilename"})
|
||||
public class GameListSummary {
|
||||
/**
|
||||
* The Games filename.
|
||||
*/
|
||||
List<String> gamesFilename;
|
||||
private Long gameId;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,9 @@ import javax.validation.constraints.NotNull;
|
|||
import javax.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The type Game server content.
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
|
|
|
@ -15,6 +15,9 @@ import lombok.NoArgsConstructor;
|
|||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* The type Game server detail.
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
|
|
|
@ -9,6 +9,9 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* The type Game server ret.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Builder
|
||||
|
|
|
@ -11,6 +11,9 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The type Game server rsp.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Builder
|
||||
|
@ -19,5 +22,8 @@ import java.util.List;
|
|||
@JsonPropertyOrder({"items", "status", "message"})
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class GameServerRsp extends BaseRespStatus {
|
||||
/**
|
||||
* The Items.
|
||||
*/
|
||||
List<GameServerRet> items;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,9 @@ import javax.validation.constraints.NotNull;
|
|||
import javax.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The type Get game info detail req.
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
|
|
|
@ -11,6 +11,9 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The type Get games info rsp.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Builder
|
||||
|
@ -19,5 +22,8 @@ import java.util.List;
|
|||
@JsonPropertyOrder({"items", "status", "message"})
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class GetGamesInfoRsp extends BaseRespStatus {
|
||||
/**
|
||||
* The Items.
|
||||
*/
|
||||
List<GameInfoContent> items;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,9 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The type Get games summary rsp.
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Builder
|
||||
|
@ -19,5 +22,8 @@ import java.util.List;
|
|||
@JsonPropertyOrder({"items", "status", "message"})
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class GetGamesSummaryRsp extends BaseRespStatus {
|
||||
/**
|
||||
* The Items.
|
||||
*/
|
||||
List<GameListSummary> items;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,9 @@ import javax.validation.constraints.NotNull;
|
|||
import javax.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The type Report game server req.
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
|
|
|
@ -14,6 +14,9 @@ import javax.persistence.Id;
|
|||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* The type Game info.
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
|
@ -23,14 +26,8 @@ import java.io.Serializable;
|
|||
@Table(name = "game_info")
|
||||
@NameStyle(Style.normal)
|
||||
public class GameInfo implements Serializable {
|
||||
/**
|
||||
* The constant serialVersionUID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* The Id.
|
||||
*/
|
||||
@Id
|
||||
@KeySql(useGeneratedKeys = true)
|
||||
private Long id;
|
||||
|
|
|
@ -15,6 +15,9 @@ import javax.persistence.Id;
|
|||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* The type Game server.
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
|
@ -24,15 +27,9 @@ import java.io.Serializable;
|
|||
@Table(name = "game_server")
|
||||
@NameStyle(Style.normal)
|
||||
public class GameServer implements Serializable {
|
||||
/**
|
||||
* The constant serialVersionUID.
|
||||
*/
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* The Id.
|
||||
*/
|
||||
@Id
|
||||
@KeySql(useGeneratedKeys = true)
|
||||
private Long id;
|
||||
|
|
|
@ -14,6 +14,9 @@ import javax.persistence.Id;
|
|||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* The type Game table.
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
|
@ -23,14 +26,8 @@ import java.io.Serializable;
|
|||
@Table(name = "game_tables")
|
||||
@NameStyle(Style.normal)
|
||||
public class GameTable implements Serializable {
|
||||
/**
|
||||
* The constant serialVersionUID.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* The Id.
|
||||
*/
|
||||
@Id
|
||||
@KeySql(useGeneratedKeys = true)
|
||||
private Long id;
|
||||
|
|
|
@ -6,6 +6,9 @@ import lombok.Builder;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* The type Game detail.
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
|
|
|
@ -5,6 +5,9 @@ import lombok.Builder;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* The type Game summary.
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
|
|
|
@ -8,12 +8,18 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The type Game table items detail.
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class GameTableItemsDetail {
|
||||
/**
|
||||
* The Game details.
|
||||
*/
|
||||
List<GameDetail> gameDetails;
|
||||
|
||||
private Long gameId;
|
||||
|
|
|
@ -8,6 +8,9 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The type Game table items summary.
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
|
|
|
@ -8,6 +8,9 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The type Game table summary.
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
|
|
|
@ -7,8 +7,6 @@ import java.lang.annotation.Target;
|
|||
|
||||
/**
|
||||
* The interface Decryption.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
|
|
@ -7,8 +7,6 @@ import java.lang.annotation.Target;
|
|||
|
||||
/**
|
||||
* The interface Encryption.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
|
|
@ -17,27 +17,16 @@ import java.security.SecureRandom;
|
|||
|
||||
/**
|
||||
* The type Crypto helper.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
@Slf4j
|
||||
public class CryptoHelper {
|
||||
|
||||
/**
|
||||
* Instantiates a new Crypto helper.
|
||||
*/
|
||||
private CryptoHelper() {
|
||||
throw new AssertionError("Instantiating utility class.");
|
||||
}
|
||||
|
||||
/**
|
||||
* The constant AES_ALGORITHM_STR.
|
||||
*/
|
||||
private static final String AES_ALGORITHM_STR = "AES/ECB/PKCS5Padding";
|
||||
|
||||
/**
|
||||
* The constant DES_ALGORITHM_STR.
|
||||
*/
|
||||
private static final String DES_ALGORITHM_STR = "DES/ECB/PKCS5Padding";
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,14 +14,9 @@ import org.apache.commons.lang.StringUtils;
|
|||
|
||||
/**
|
||||
* The type Encryption property resolver.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
@Slf4j
|
||||
public class EncryptionPropertyResolver implements EncryptablePropertyResolver {
|
||||
/**
|
||||
* The Password.
|
||||
*/
|
||||
private final String password;
|
||||
|
||||
/**
|
||||
|
@ -33,12 +28,6 @@ public class EncryptionPropertyResolver implements EncryptablePropertyResolver {
|
|||
this.password = key + "cmcc@10086!";
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve property value string.
|
||||
*
|
||||
* @param value the value
|
||||
* @return the string
|
||||
*/
|
||||
@Override
|
||||
public String resolvePropertyValue(String value) {
|
||||
final String encPrefix = "ENC@";
|
||||
|
@ -57,12 +46,6 @@ public class EncryptionPropertyResolver implements EncryptablePropertyResolver {
|
|||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve value string.
|
||||
*
|
||||
* @param value the value
|
||||
* @return the string
|
||||
*/
|
||||
private String resolveValue(String value) throws IllegalBlockSizeException, InvalidKeyException,
|
||||
BadPaddingException, NoSuchAlgorithmException, NoSuchPaddingException {
|
||||
//自定义密文解密
|
||||
|
|
|
@ -13,20 +13,12 @@ import java.nio.charset.StandardCharsets;
|
|||
|
||||
/**
|
||||
* The type Decrypt request protocol.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
@Slf4j
|
||||
public class DecryptRequestProtocol implements HttpInputMessage {
|
||||
|
||||
/**
|
||||
* The Input message.
|
||||
*/
|
||||
private final HttpInputMessage inputMessage;
|
||||
|
||||
/**
|
||||
* The Msg content.
|
||||
*/
|
||||
private final String msgContent;
|
||||
|
||||
/**
|
||||
|
@ -41,11 +33,6 @@ public class DecryptRequestProtocol implements HttpInputMessage {
|
|||
this.msgContent = msgContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets body.
|
||||
*
|
||||
* @return the body
|
||||
*/
|
||||
@Override
|
||||
@NotNull
|
||||
public InputStream getBody() throws IOException {
|
||||
|
@ -53,11 +40,6 @@ public class DecryptRequestProtocol implements HttpInputMessage {
|
|||
return IOUtils.toInputStream(msgContent, StandardCharsets.UTF_8.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets headers.
|
||||
*
|
||||
* @return the headers
|
||||
*/
|
||||
@Override
|
||||
@NotNull
|
||||
public HttpHeaders getHeaders() {
|
||||
|
|
|
@ -8,11 +8,31 @@ import com.cmhi.gds.pojo.vo.GameTableItemsSummary;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The interface Game database service service.
|
||||
*/
|
||||
public interface GameDatabaseServiceService {
|
||||
|
||||
/**
|
||||
* Gets game table summary items.
|
||||
*
|
||||
* @return the game table summary items
|
||||
*/
|
||||
List<GameTableItemsSummary> getGameTableSummaryItems();
|
||||
|
||||
/**
|
||||
* Gets game table items.
|
||||
*
|
||||
* @param gameIds the game ids
|
||||
* @return the game table items
|
||||
*/
|
||||
List<GameTableItemsDetail> getGameTableItems(List<Long> gameIds);
|
||||
|
||||
/**
|
||||
* Add game server info map.
|
||||
*
|
||||
* @param gameServerContents the game server contents
|
||||
* @return the map
|
||||
*/
|
||||
Map<Long, ErrorCode> addGameServerInfo(List<GameServerContent> gameServerContents);
|
||||
}
|
||||
|
|
|
@ -9,8 +9,6 @@ import java.io.IOException;
|
|||
|
||||
/**
|
||||
* The interface Protocol security service.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
public interface ProtocolSecurityService {
|
||||
/**
|
||||
|
|
|
@ -24,6 +24,9 @@ import java.util.Map;
|
|||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* The type Game database service service.
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class GameDatabaseServiceServiceImpl implements GameDatabaseServiceService {
|
||||
|
|
|
@ -29,25 +29,13 @@ import java.nio.charset.StandardCharsets;
|
|||
|
||||
/**
|
||||
* The type Protocol security service.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ProtocolSecurityServiceImpl implements ProtocolSecurityService {
|
||||
/**
|
||||
* The Object mapper.
|
||||
*/
|
||||
@Resource
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
/**
|
||||
* Decrypt protocol string.
|
||||
*
|
||||
* @param ciphertext the ciphertext
|
||||
* @return the string
|
||||
* @throws JsonProcessingException the json processing exception
|
||||
*/
|
||||
@Override
|
||||
public String decryptProtocol(String ciphertext) throws JsonProcessingException {
|
||||
JsonNode objRoot = objectMapper.readTree(ciphertext);
|
||||
|
@ -125,13 +113,6 @@ public class ProtocolSecurityServiceImpl implements ProtocolSecurityService {
|
|||
return ciphertext.replace("\"" + proReq.getMsgContent() + "\"", decodeMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrypt protocol decrypt request protocol.
|
||||
*
|
||||
* @param httpInputMessage the http input message
|
||||
* @return the decrypt request protocol
|
||||
* @throws IOException the io exception
|
||||
*/
|
||||
@Override
|
||||
public DecryptRequestProtocol decryptProtocol(HttpInputMessage httpInputMessage) throws IOException {
|
||||
// 提取协议中的JSON字符串
|
||||
|
@ -140,13 +121,6 @@ public class ProtocolSecurityServiceImpl implements ProtocolSecurityService {
|
|||
return new DecryptRequestProtocol(httpInputMessage, decryptProtocol(reqMessage));
|
||||
}
|
||||
|
||||
/**
|
||||
* Encrypt protocol string string.
|
||||
*
|
||||
* @param plainText the plain text
|
||||
* @param cryptoType the crypto type
|
||||
* @return the string
|
||||
*/
|
||||
@Override
|
||||
public String encryptProtocolString(String plainText, int cryptoType) {
|
||||
String cipherText;
|
||||
|
@ -188,13 +162,6 @@ public class ProtocolSecurityServiceImpl implements ProtocolSecurityService {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Encrypt protocol protocol resp dto.
|
||||
*
|
||||
* @param orgProtocol the org protocol
|
||||
* @param cryptoType the crypto type
|
||||
* @return the protocol resp dto
|
||||
*/
|
||||
@Override
|
||||
public ProtocolRespDTO<String> encryptProtocol(Object orgProtocol, int cryptoType) {
|
||||
ProtocolRespDTO<String> cryptoObject = new ProtocolRespDTO<>();
|
||||
|
|
|
@ -2,110 +2,82 @@ package com.cmhi.gds.validation.group;
|
|||
|
||||
/**
|
||||
* The interface Valid groups.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
public interface ValidGroups {
|
||||
/**
|
||||
* The interface Protocol common valid.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
interface ProtocolCommonValid {
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface Login req valid.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
interface LoginReqValid extends LogoutReqValid {
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface Logout req valid.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
interface LogoutReqValid extends ProtocolCommonValid {
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface Upgrade device valid.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
* The interface Add game service valid.
|
||||
*/
|
||||
interface AddGameServiceValid extends ProtocolCommonValid {
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface Add device valid.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
interface AddDeviceValid extends AddGameServiceValid {
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface Id array valid.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
interface IdArrayValid extends ProtocolCommonValid {
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface Explicit id array valid.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
interface ExplicitIdArrayValid extends IdArrayValid {
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface Task start req common valid.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
interface TaskStartReqCommonValid extends ProtocolCommonValid {
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface Task start req valid.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
interface TaskStartReqValid extends TaskStartReqCommonValid {
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface Task start mul req valid.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
interface TaskStartMulReqValid extends TaskStartReqCommonValid {
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface Task stop req valid.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
interface TaskStopReqValid extends ProtocolCommonValid {
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface Get dev ver req valid.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
interface GetDevVerReqValid extends ProtocolCommonValid {
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface Add device valid.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
* The interface Add user info valid.
|
||||
*/
|
||||
interface AddUserInfoValid extends ProtocolCommonValid {
|
||||
}
|
||||
|
|
|
@ -12,9 +12,7 @@ import java.lang.annotation.RetentionPolicy;
|
|||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* The interface Valid custom base enum.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
* The interface Valid base enum.
|
||||
*/
|
||||
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
|
|
@ -12,8 +12,6 @@ import java.lang.annotation.Target;
|
|||
|
||||
/**
|
||||
* The interface Valid ip addr.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
|
|
@ -12,8 +12,6 @@ import java.lang.annotation.Target;
|
|||
|
||||
/**
|
||||
* The interface Valid ip port.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
|
|
@ -14,41 +14,21 @@ import java.util.List;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* The type Valid custom base enum.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
* The type Valid base enum.
|
||||
*/
|
||||
@Slf4j
|
||||
public class ValidBaseEnumImpl implements ConstraintValidator<ValidBaseEnum, Integer> {
|
||||
|
||||
/**
|
||||
* The Enum class.
|
||||
*/
|
||||
private Class<? extends BaseEnum> enumClass;
|
||||
|
||||
/**
|
||||
* The Message.
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* Initialize.
|
||||
*
|
||||
* @param constraintAnnotation the constraint annotation
|
||||
*/
|
||||
@Override
|
||||
public void initialize(ValidBaseEnum constraintAnnotation) {
|
||||
this.enumClass = constraintAnnotation.enumClass();
|
||||
this.message = constraintAnnotation.message();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is valid boolean.
|
||||
*
|
||||
* @param integer the integer
|
||||
* @param ctx the constraint validator context
|
||||
* @return the boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean isValid(Integer integer, ConstraintValidatorContext ctx) {
|
||||
|
||||
|
|
|
@ -11,27 +11,13 @@ import java.util.regex.Pattern;
|
|||
|
||||
/**
|
||||
* The type Valid ip addr.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
public class ValidIpAddrImpl implements ConstraintValidator<ValidIpAddr, String> {
|
||||
|
||||
/**
|
||||
* Initialize.
|
||||
*
|
||||
* @param constraintAnnotation the constraint annotation
|
||||
*/
|
||||
@Override
|
||||
public void initialize(ValidIpAddr constraintAnnotation) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Is valid boolean.
|
||||
*
|
||||
* @param s the s
|
||||
* @param constraintValidatorContext the constraint validator context
|
||||
* @return the boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {
|
||||
|
||||
|
|
|
@ -9,27 +9,13 @@ import javax.validation.ConstraintValidatorContext;
|
|||
|
||||
/**
|
||||
* The type Valid ip port.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
public class ValidIpPortImpl implements ConstraintValidator<ValidIpPort, String> {
|
||||
/**
|
||||
* Initialize.
|
||||
*
|
||||
* @param constraintAnnotation the constraint annotation
|
||||
*/
|
||||
@Override
|
||||
public void initialize(ValidIpPort constraintAnnotation) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Is valid boolean.
|
||||
*
|
||||
* @param s the s
|
||||
* @param constraintValidatorContext the constraint validator context
|
||||
* @return the boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {
|
||||
final int minSocketPort = 1;
|
||||
|
|
Loading…
Reference in New Issue