OCT 1. 修正代码规范问题
This commit is contained in:
parent
517a9a70dc
commit
3a65ae27ad
5
pom.xml
5
pom.xml
|
@ -132,6 +132,11 @@
|
||||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
<version>3.0.2</version>
|
<version>3.0.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.yaml</groupId>
|
||||||
|
<artifactId>snakeyaml</artifactId>
|
||||||
|
<version>2.1</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -334,31 +334,16 @@ public enum ErrorCode implements BaseEnum {
|
||||||
* @return the http code
|
* @return the http code
|
||||||
*/
|
*/
|
||||||
public int getHttpCode() {
|
public int getHttpCode() {
|
||||||
switch (this) {
|
return switch (this) {
|
||||||
case ERR_OK:
|
case ERR_OK -> HttpServletResponse.SC_OK;
|
||||||
return HttpServletResponse.SC_OK;
|
case ERR_SYSTEMEXCEPTION, ERR_PARAMEXCEPTION -> HttpServletResponse.SC_EXPECTATION_FAILED;
|
||||||
case ERR_SYSTEMEXCEPTION:
|
case ERR_TOKENTIMEOUT, ERR_REQTIMEOUT -> HttpServletResponse.SC_REQUEST_TIMEOUT;
|
||||||
case ERR_PARAMEXCEPTION:
|
case ERR_UNTRUSTTOKEN, ERR_UNTRUSTHOST, ERR_LOGOUT -> HttpServletResponse.SC_UNAUTHORIZED;
|
||||||
return HttpServletResponse.SC_EXPECTATION_FAILED;
|
case ERR_MISSAUTHHEAD, ERR_PARAMS, ERR_INPUTFORMAT, ERR_INPUTMISS -> HttpServletResponse.SC_BAD_REQUEST;
|
||||||
case ERR_TOKENTIMEOUT:
|
case ERR_UNSUPPORT -> HttpServletResponse.SC_METHOD_NOT_ALLOWED;
|
||||||
case ERR_REQTIMEOUT:
|
case ERR_UNKNOWNINTERFACE -> HttpServletResponse.SC_NOT_FOUND;
|
||||||
return HttpServletResponse.SC_REQUEST_TIMEOUT;
|
default -> HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
|
||||||
case ERR_UNTRUSTTOKEN:
|
};
|
||||||
case ERR_UNTRUSTHOST:
|
|
||||||
case ERR_LOGOUT:
|
|
||||||
return HttpServletResponse.SC_UNAUTHORIZED;
|
|
||||||
case ERR_MISSAUTHHEAD:
|
|
||||||
case ERR_PARAMS:
|
|
||||||
case ERR_INPUTFORMAT:
|
|
||||||
case ERR_INPUTMISS:
|
|
||||||
return HttpServletResponse.SC_BAD_REQUEST;
|
|
||||||
case ERR_UNSUPPORT:
|
|
||||||
return HttpServletResponse.SC_METHOD_NOT_ALLOWED;
|
|
||||||
case ERR_UNKNOWNINTERFACE:
|
|
||||||
return HttpServletResponse.SC_NOT_FOUND;
|
|
||||||
default:
|
|
||||||
return HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -66,9 +66,10 @@ public class GlobalExceptionHandler {
|
||||||
}
|
}
|
||||||
sb.append("]");
|
sb.append("]");
|
||||||
|
|
||||||
log.error("Interface [{}] request <{}> from {}, token = <{}>\n" +
|
log.error("""
|
||||||
"+++ Request: {}\n" +
|
Interface [{}] request <{}> from {}, token = <{}>
|
||||||
"--- Verify params failed: {}",
|
+++ Request: {}
|
||||||
|
--- Verify params failed: {}""",
|
||||||
reqType, reqPath, reqIp, reqToken, Helper.inputStream2String(req.getInputStream()), sb);
|
reqType, reqPath, reqIp, reqToken, Helper.inputStream2String(req.getInputStream()), sb);
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
|
@ -112,9 +113,10 @@ public class GlobalExceptionHandler {
|
||||||
if (reqToken != null && !reqToken.isEmpty()) {
|
if (reqToken != null && !reqToken.isEmpty()) {
|
||||||
reqToken = reqToken.replace(ConstValue.STRING_HTTP_AUTH_HEAD, "");
|
reqToken = reqToken.replace(ConstValue.STRING_HTTP_AUTH_HEAD, "");
|
||||||
}
|
}
|
||||||
log.error("Interface [{}] request <{}> from {}, token = <{}>\n" +
|
log.error("""
|
||||||
"+++ Request: {}\n" +
|
Interface [{}] request <{}> from {}, token = <{}>
|
||||||
"--- Verify params failed: {}",
|
+++ Request: {}
|
||||||
|
--- Verify params failed: {}""",
|
||||||
reqType, reqPath, reqIp, reqToken, Helper.inputStream2String(req.getInputStream()),
|
reqType, reqPath, reqIp, reqToken, Helper.inputStream2String(req.getInputStream()),
|
||||||
ex.getMessage() == null ? ex.getDescription() : ex.getMessage());
|
ex.getMessage() == null ? ex.getDescription() : ex.getMessage());
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
|
@ -161,9 +163,10 @@ public class GlobalExceptionHandler {
|
||||||
if (reqToken != null && !reqToken.isEmpty()) {
|
if (reqToken != null && !reqToken.isEmpty()) {
|
||||||
reqToken = reqToken.replace(ConstValue.STRING_HTTP_AUTH_HEAD, "");
|
reqToken = reqToken.replace(ConstValue.STRING_HTTP_AUTH_HEAD, "");
|
||||||
}
|
}
|
||||||
log.error("Interface [{}] request <{}> from {}, token = <{}>\n" +
|
log.error("""
|
||||||
"+++ Request: {}\n" +
|
Interface [{}] request <{}> from {}, token = <{}>
|
||||||
"--- Verify params failed: {}",
|
+++ Request: {}
|
||||||
|
--- Verify params failed: {}""",
|
||||||
reqType, reqPath, reqIp, reqToken, Helper.inputStream2String(req.getInputStream()),
|
reqType, reqPath, reqIp, reqToken, Helper.inputStream2String(req.getInputStream()),
|
||||||
ex.getMessage());
|
ex.getMessage());
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
|
@ -202,7 +205,7 @@ public class GlobalExceptionHandler {
|
||||||
errMeg.add(ErrorCode.ERR_PARAMEXCEPTION.getMsg());
|
errMeg.add(ErrorCode.ERR_PARAMEXCEPTION.getMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ex.getMessage() != null && ex.getMessage().length() > 0) {
|
if (ex.getMessage() != null && !ex.getMessage().isEmpty()) {
|
||||||
errMeg.add(ex.getMessage());
|
errMeg.add(ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.cmhi.gds.manager;
|
package com.cmhi.gds.manager;
|
||||||
|
|
||||||
import com.cmhi.gds.pojo.entry.GameInfo;
|
|
||||||
import com.cmhi.gds.pojo.entry.GameTable;
|
|
||||||
import com.cmhi.gds.pojo.entry.GameTableSummary;
|
import com.cmhi.gds.pojo.entry.GameTableSummary;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.cmhi.gds.pojo.dto.protocol.info;
|
package com.cmhi.gds.pojo.dto.protocol.info;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
|
|
Loading…
Reference in New Issue