🎨 Improving structure / format of the code. 格式化代码

This commit is contained in:
pig666 committed 2020-10-24 16:31:21 +08:00
1 parent b15dbe08ec
commit b43599167e
22 files changed
+814 -588

No files matched your search

@@ -63,7 +63,7 @@ public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {
*/
@Override
public void configure(WebSecurity web) {
web.ignoring().antMatchers("/favicon.ico","/css/**","/error");
web.ignoring().antMatchers("/favicon.ico", "/css/**", "/error");
}
@Bean
@@ -10,8 +10,7 @@ public interface KeyStrResolver {
/**
* 字符串加工
*
* @param in 输入字符串
* @param in 输入字符串
* @param split 分割符
* @return 输出字符串
*/
@@ -19,8 +18,8 @@ public interface KeyStrResolver {
/**
* 字符串获取
*
* @return 模块返回字符串
*/
String key();
}
@@ -13,8 +13,7 @@ public class TenantKeyStrResolver implements KeyStrResolver {
/**
* 传入字符串增加 租户编号:in
*
* @param in 输入字符串
* @param in 输入字符串
* @param split 分割符
* @return
*/
@@ -25,7 +24,6 @@ public class TenantKeyStrResolver implements KeyStrResolver {
/**
* 返回当前租户ID
*
* @return
*/
@Override
@@ -51,7 +51,7 @@ public class LogAutoConfiguration {
@Bean
public SysLogAspect sysLogAspect(ApplicationEventPublisher publisher, KeyStrResolver resolver) {
return new SysLogAspect(publisher,resolver);
return new SysLogAspect(publisher, resolver);
}
}
@@ -46,7 +46,6 @@ public class SysLogAspect {
private final KeyStrResolver tenantKeyStrResolver;
@SneakyThrows
@Around("@annotation(sysLog)")
public Object around(ProceedingJoinPoint point, SysLog sysLog) {
@@ -103,15 +103,9 @@ public class PermitAllUrlResolver implements InitializingBean {
/**
* 过滤 Inner 设置
*
* <p>
* 0. 暴露安全检查
* </p>
* <p>
* 1. 路径转换: 如果为restful(/xx/{xx}) --> /xx/* ant 表达式
* </p>
* <p>
* 2. 构建表达式:允许暴露的接口|允许暴露的方法类型,允许暴露的方法类型 URL|GET,POST,DELETE,PUT
* 0. 暴露安全检查 1. 路径转换: 如果为restful(/xx/{xx}) --> /xx/* ant 表达式 2.
* 构建表达式:允许暴露的接口|允许暴露的方法类型,允许暴露的方法类型 URL|GET,POST,DELETE,PUT
* </p>
* @param url mapping路径
* @param info 请求犯法
@@ -95,4 +95,5 @@ public class GlobalBizExceptionHandler {
public R noHandlerFoundException() {
return R.failed();
}
}
@@ -1,7 +1,6 @@
package com.pig4cloud.pigx.admin.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@@ -84,7 +83,6 @@ public class SysLogDTO {
*/
private String serviceId;
/**
* 创建时间区间 [开始时间,结束时间]
*/
@@ -51,8 +51,7 @@ public class SysLogController {
/**
* 简单分页查询
*
* @param page 分页对象
* @param page 分页对象
* @param sysLog 系统日志
* @return
*/
@@ -63,7 +62,6 @@ public class SysLogController {
/**
* 删除日志
*
* @param id ID
* @return success/false
*/
@@ -75,19 +73,17 @@ public class SysLogController {
/**
* 插入日志
*
* @param sysLog 日志实体
* @return success/false
*/
@Inner
@PostMapping("/save")
public R save(@Valid @RequestBody SysLogDTO sysLog) {
return R.ok(sysLogService.saveLog(sysLog));
return R.ok(sysLogService.saveLog(sysLog));
}
/**
* 批量插入前端异常日志
*
* @param preLogVoList 日志实体
* @return success/false
*/
@@ -39,7 +39,6 @@ public interface SysLogService extends IService<SysLog> {
/**
* 批量插入前端错误日志
*
* @param preLogVoList 日志信息
* @return true/false
*/
@@ -47,7 +46,6 @@ public interface SysLogService extends IService<SysLog> {
/**
* 分页查询日志
*
* @param page
* @param sysLog
* @return
@@ -56,9 +54,9 @@ public interface SysLogService extends IService<SysLog> {
/**
* 插入日志
*
* @param sysLog 日志对象
* @return true/false
*/
Boolean saveLog(SysLogDTO sysLog);
}
@@ -54,7 +54,6 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
/**
* 批量插入前端错误日志
*
* @param preLogVoList 日志信息
* @return true/false
*/
@@ -92,7 +91,6 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
/**
* 插入日志
*
* @param sysLog 日志对象
* @return true/false
*/
@@ -27,7 +27,6 @@ public class DruidMonitorConfigurer {
return registrationBean;
}
@Data
@Component
@ConfigurationProperties(prefix = "monitor")
@@ -37,5 +36,7 @@ public class DruidMonitorConfigurer {
* 需要监控的服务
*/
private List<String> applications;
}
}
@@ -7,4 +7,5 @@ package com.pig4cloud.pigx.monitor.controller;
* druid 监控控制器
*/
public class DruidController {
}
@@ -9,12 +9,12 @@ import lombok.Data;
@Data
public class ServiceNode {
private String id;
private String id;
private Integer port;
private Integer port;
private String address;
private String address;
private String serviceName;
private String serviceName;
}
@@ -15,36 +15,49 @@ import java.util.List;
@Data
public class ConnectionResult {
@JSONField(name = "ResultCode")
private int ResultCode;
@JSONField(name = "Content")
private List<ContentBean> Content;
@JSONField(name = "ResultCode")
private int ResultCode;
@NoArgsConstructor
@Data
public static class ContentBean {
@JSONField(name = "Content")
private List<ContentBean> Content;
@NoArgsConstructor
@Data
public static class ContentBean {
@JSONField(name = "id")
private int id;
@JSONField(name = "connectionId")
private int connectionId;
@JSONField(name = "useCount")
private int useCount;
@JSONField(name = "lastActiveTime")
private String lastActiveTime;
@JSONField(name = "connectTime")
private String connectTime;
@JSONField(name = "holdability")
private int holdability;
@JSONField(name = "transactionIsolation")
private int transactionIsolation;
@JSONField(name = "autoCommit")
private boolean autoCommit;
@JSONField(name = "readoOnly")
private boolean readoOnly;
@JSONField(name = "keepAliveCheckCount")
private int keepAliveCheckCount;
@JSONField(name = "pscache")
private List<?> pscache;
}
@JSONField(name = "id")
private int id;
@JSONField(name = "connectionId")
private int connectionId;
@JSONField(name = "useCount")
private int useCount;
@JSONField(name = "lastActiveTime")
private String lastActiveTime;
@JSONField(name = "connectTime")
private String connectTime;
@JSONField(name = "holdability")
private int holdability;
@JSONField(name = "transactionIsolation")
private int transactionIsolation;
@JSONField(name = "autoCommit")
private boolean autoCommit;
@JSONField(name = "readoOnly")
private boolean readoOnly;
@JSONField(name = "keepAliveCheckCount")
private int keepAliveCheckCount;
@JSONField(name = "pscache")
private List<?> pscache;
}
}
@@ -14,152 +14,222 @@ import java.util.List;
@NoArgsConstructor
public class DataSourceResult {
@JSONField(name = "ResultCode")
private int ResultCode;
@JSONField(name = "Content")
private List<ContentBean> Content;
@JSONField(name = "ResultCode")
private int ResultCode;
@NoArgsConstructor
@Data
public static class ContentBean {
@JSONField(name = "Content")
private List<ContentBean> Content;
private String serviceId;
@NoArgsConstructor
@Data
public static class ContentBean {
private String serviceId;
@JSONField(name = "Identity")
private int Identity;
@JSONField(name = "Name")
private String Name;
@JSONField(name = "DbType")
private String DbType;
@JSONField(name = "DriverClassName")
private String DriverClassName;
@JSONField(name = "URL")
private String URL;
@JSONField(name = "UserName")
private String UserName;
@JSONField(name = "WaitThreadCount")
private int WaitThreadCount;
@JSONField(name = "NotEmptyWaitCount")
private int NotEmptyWaitCount;
@JSONField(name = "NotEmptyWaitMillis")
private int NotEmptyWaitMillis;
@JSONField(name = "PoolingCount")
private int PoolingCount;
@JSONField(name = "PoolingPeak")
private int PoolingPeak;
@JSONField(name = "PoolingPeakTime")
private String PoolingPeakTime;
@JSONField(name = "ActiveCount")
private int ActiveCount;
@JSONField(name = "ActivePeak")
private int ActivePeak;
@JSONField(name = "ActivePeakTime")
private String ActivePeakTime;
@JSONField(name = "InitialSize")
private int InitialSize;
@JSONField(name = "MinIdle")
private int MinIdle;
@JSONField(name = "MaxActive")
private int MaxActive;
@JSONField(name = "QueryTimeout")
private int QueryTimeout;
@JSONField(name = "TransactionQueryTimeout")
private int TransactionQueryTimeout;
@JSONField(name = "LoginTimeout")
private int LoginTimeout;
@JSONField(name = "ValidConnectionCheckerClassName")
private String ValidConnectionCheckerClassName;
@JSONField(name = "ExceptionSorterClassName")
private String ExceptionSorterClassName;
@JSONField(name = "TestOnBorrow")
private boolean TestOnBorrow;
@JSONField(name = "TestOnReturn")
private boolean TestOnReturn;
@JSONField(name = "TestWhileIdle")
private boolean TestWhileIdle;
@JSONField(name = "DefaultAutoCommit")
private boolean DefaultAutoCommit;
@JSONField(name = "DefaultReadOnly")
private Object DefaultReadOnly;
@JSONField(name = "DefaultTransactionIsolation")
private Object DefaultTransactionIsolation;
@JSONField(name = "LogicConnectCount")
private int LogicConnectCount;
@JSONField(name = "LogicCloseCount")
private int LogicCloseCount;
@JSONField(name = "LogicConnectErrorCount")
private int LogicConnectErrorCount;
@JSONField(name = "PhysicalConnectCount")
private int PhysicalConnectCount;
@JSONField(name = "PhysicalCloseCount")
private int PhysicalCloseCount;
@JSONField(name = "PhysicalConnectErrorCount")
private int PhysicalConnectErrorCount;
@JSONField(name = "ExecuteCount")
private int ExecuteCount;
@JSONField(name = "ExecuteUpdateCount")
private int ExecuteUpdateCount;
@JSONField(name = "ExecuteQueryCount")
private int ExecuteQueryCount;
@JSONField(name = "ExecuteBatchCount")
private int ExecuteBatchCount;
@JSONField(name = "ErrorCount")
private int ErrorCount;
@JSONField(name = "CommitCount")
private int CommitCount;
@JSONField(name = "RollbackCount")
private int RollbackCount;
@JSONField(name = "PSCacheAccessCount")
private int PSCacheAccessCount;
@JSONField(name = "PSCacheHitCount")
private int PSCacheHitCount;
@JSONField(name = "PSCacheMissCount")
private int PSCacheMissCount;
@JSONField(name = "StartTransactionCount")
private int StartTransactionCount;
@JSONField(name = "RemoveAbandoned")
private boolean RemoveAbandoned;
@JSONField(name = "ClobOpenCount")
private int ClobOpenCount;
@JSONField(name = "BlobOpenCount")
private int BlobOpenCount;
@JSONField(name = "KeepAliveCheckCount")
private int KeepAliveCheckCount;
@JSONField(name = "KeepAlive")
private boolean KeepAlive;
@JSONField(name = "FailFast")
private boolean FailFast;
@JSONField(name = "MaxWait")
private int MaxWait;
@JSONField(name = "MaxWaitThreadCount")
private int MaxWaitThreadCount;
@JSONField(name = "PoolPreparedStatements")
private boolean PoolPreparedStatements;
@JSONField(name = "MaxPoolPreparedStatementPerConnectionSize")
private int MaxPoolPreparedStatementPerConnectionSize;
@JSONField(name = "MinEvictableIdleTimeMillis")
private int MinEvictableIdleTimeMillis;
@JSONField(name = "MaxEvictableIdleTimeMillis")
private int MaxEvictableIdleTimeMillis;
@JSONField(name = "LogDifferentThread")
private boolean LogDifferentThread;
@JSONField(name = "RecycleErrorCount")
private int RecycleErrorCount;
@JSONField(name = "PreparedStatementOpenCount")
private int PreparedStatementOpenCount;
@JSONField(name = "PreparedStatementClosedCount")
private int PreparedStatementClosedCount;
@JSONField(name = "UseUnfairLock")
private boolean UseUnfairLock;
@JSONField(name = "InitGlobalVariants")
private boolean InitGlobalVariants;
@JSONField(name = "InitVariants")
private boolean InitVariants;
@JSONField(name = "FilterClassNames")
private List<String> FilterClassNames;
@JSONField(name = "TransactionHistogram")
private List<Integer> TransactionHistogram;
@JSONField(name = "ConnectionHoldTimeHistogram")
private List<Integer> ConnectionHoldTimeHistogram;
}
@JSONField(name = "Identity")
private int Identity;
@JSONField(name = "Name")
private String Name;
@JSONField(name = "DbType")
private String DbType;
@JSONField(name = "DriverClassName")
private String DriverClassName;
@JSONField(name = "URL")
private String URL;
@JSONField(name = "UserName")
private String UserName;
@JSONField(name = "WaitThreadCount")
private int WaitThreadCount;
@JSONField(name = "NotEmptyWaitCount")
private int NotEmptyWaitCount;
@JSONField(name = "NotEmptyWaitMillis")
private int NotEmptyWaitMillis;
@JSONField(name = "PoolingCount")
private int PoolingCount;
@JSONField(name = "PoolingPeak")
private int PoolingPeak;
@JSONField(name = "PoolingPeakTime")
private String PoolingPeakTime;
@JSONField(name = "ActiveCount")
private int ActiveCount;
@JSONField(name = "ActivePeak")
private int ActivePeak;
@JSONField(name = "ActivePeakTime")
private String ActivePeakTime;
@JSONField(name = "InitialSize")
private int InitialSize;
@JSONField(name = "MinIdle")
private int MinIdle;
@JSONField(name = "MaxActive")
private int MaxActive;
@JSONField(name = "QueryTimeout")
private int QueryTimeout;
@JSONField(name = "TransactionQueryTimeout")
private int TransactionQueryTimeout;
@JSONField(name = "LoginTimeout")
private int LoginTimeout;
@JSONField(name = "ValidConnectionCheckerClassName")
private String ValidConnectionCheckerClassName;
@JSONField(name = "ExceptionSorterClassName")
private String ExceptionSorterClassName;
@JSONField(name = "TestOnBorrow")
private boolean TestOnBorrow;
@JSONField(name = "TestOnReturn")
private boolean TestOnReturn;
@JSONField(name = "TestWhileIdle")
private boolean TestWhileIdle;
@JSONField(name = "DefaultAutoCommit")
private boolean DefaultAutoCommit;
@JSONField(name = "DefaultReadOnly")
private Object DefaultReadOnly;
@JSONField(name = "DefaultTransactionIsolation")
private Object DefaultTransactionIsolation;
@JSONField(name = "LogicConnectCount")
private int LogicConnectCount;
@JSONField(name = "LogicCloseCount")
private int LogicCloseCount;
@JSONField(name = "LogicConnectErrorCount")
private int LogicConnectErrorCount;
@JSONField(name = "PhysicalConnectCount")
private int PhysicalConnectCount;
@JSONField(name = "PhysicalCloseCount")
private int PhysicalCloseCount;
@JSONField(name = "PhysicalConnectErrorCount")
private int PhysicalConnectErrorCount;
@JSONField(name = "ExecuteCount")
private int ExecuteCount;
@JSONField(name = "ExecuteUpdateCount")
private int ExecuteUpdateCount;
@JSONField(name = "ExecuteQueryCount")
private int ExecuteQueryCount;
@JSONField(name = "ExecuteBatchCount")
private int ExecuteBatchCount;
@JSONField(name = "ErrorCount")
private int ErrorCount;
@JSONField(name = "CommitCount")
private int CommitCount;
@JSONField(name = "RollbackCount")
private int RollbackCount;
@JSONField(name = "PSCacheAccessCount")
private int PSCacheAccessCount;
@JSONField(name = "PSCacheHitCount")
private int PSCacheHitCount;
@JSONField(name = "PSCacheMissCount")
private int PSCacheMissCount;
@JSONField(name = "StartTransactionCount")
private int StartTransactionCount;
@JSONField(name = "RemoveAbandoned")
private boolean RemoveAbandoned;
@JSONField(name = "ClobOpenCount")
private int ClobOpenCount;
@JSONField(name = "BlobOpenCount")
private int BlobOpenCount;
@JSONField(name = "KeepAliveCheckCount")
private int KeepAliveCheckCount;
@JSONField(name = "KeepAlive")
private boolean KeepAlive;
@JSONField(name = "FailFast")
private boolean FailFast;
@JSONField(name = "MaxWait")
private int MaxWait;
@JSONField(name = "MaxWaitThreadCount")
private int MaxWaitThreadCount;
@JSONField(name = "PoolPreparedStatements")
private boolean PoolPreparedStatements;
@JSONField(name = "MaxPoolPreparedStatementPerConnectionSize")
private int MaxPoolPreparedStatementPerConnectionSize;
@JSONField(name = "MinEvictableIdleTimeMillis")
private int MinEvictableIdleTimeMillis;
@JSONField(name = "MaxEvictableIdleTimeMillis")
private int MaxEvictableIdleTimeMillis;
@JSONField(name = "LogDifferentThread")
private boolean LogDifferentThread;
@JSONField(name = "RecycleErrorCount")
private int RecycleErrorCount;
@JSONField(name = "PreparedStatementOpenCount")
private int PreparedStatementOpenCount;
@JSONField(name = "PreparedStatementClosedCount")
private int PreparedStatementClosedCount;
@JSONField(name = "UseUnfairLock")
private boolean UseUnfairLock;
@JSONField(name = "InitGlobalVariants")
private boolean InitGlobalVariants;
@JSONField(name = "InitVariants")
private boolean InitVariants;
@JSONField(name = "FilterClassNames")
private List<String> FilterClassNames;
@JSONField(name = "TransactionHistogram")
private List<Integer> TransactionHistogram;
@JSONField(name = "ConnectionHoldTimeHistogram")
private List<Integer> ConnectionHoldTimeHistogram;
}
}
@@ -14,107 +14,157 @@ import java.util.List;
@Data
public class SqlDetailResult {
@JSONField(name = "ResultCode")
private int ResultCode;
@JSONField(name = "Content")
private ContentBean Content;
@JSONField(name = "ResultCode")
private int ResultCode;
@JSONField(name = "Content")
private ContentBean Content;
@NoArgsConstructor
@Data
public static class ContentBean {
@JSONField(name = "ExecuteAndResultSetHoldTime")
private int ExecuteAndResultSetHoldTime;
@JSONField(name = "LastErrorMessage")
private Object LastErrorMessage;
@JSONField(name = "InputStreamOpenCount")
private int InputStreamOpenCount;
@JSONField(name = "BatchSizeTotal")
private int BatchSizeTotal;
@JSONField(name = "FetchRowCountMax")
private int FetchRowCountMax;
@JSONField(name = "ErrorCount")
private int ErrorCount;
@JSONField(name = "BatchSizeMax")
private int BatchSizeMax;
@JSONField(name = "URL")
private Object URL;
@JSONField(name = "Name")
private Object Name;
@JSONField(name = "LastErrorTime")
private Object LastErrorTime;
@JSONField(name = "ReaderOpenCount")
private int ReaderOpenCount;
@JSONField(name = "parsedRelationships")
private String parsedRelationships;
@JSONField(name = "EffectedRowCountMax")
private int EffectedRowCountMax;
@JSONField(name = "LastErrorClass")
private Object LastErrorClass;
@JSONField(name = "InTransactionCount")
private int InTransactionCount;
@JSONField(name = "LastErrorStackTrace")
private Object LastErrorStackTrace;
@JSONField(name = "ResultSetHoldTime")
private int ResultSetHoldTime;
@JSONField(name = "TotalTime")
private int TotalTime;
@JSONField(name = "ID")
private int ID;
@JSONField(name = "ConcurrentMax")
private int ConcurrentMax;
@JSONField(name = "RunningCount")
private int RunningCount;
@JSONField(name = "FetchRowCount")
private int FetchRowCount;
@JSONField(name = "parsedFields")
private String parsedFields;
@JSONField(name = "MaxTimespanOccurTime")
private String MaxTimespanOccurTime;
@JSONField(name = "LastSlowParameters")
private Object LastSlowParameters;
@JSONField(name = "ReadBytesLength")
private int ReadBytesLength;
@JSONField(name = "formattedSql")
private String formattedSql;
@JSONField(name = "DbType")
private String DbType;
@JSONField(name = "DataSource")
private Object DataSource;
@JSONField(name = "SQL")
private String SQL;
@JSONField(name = "HASH")
private long HASH;
@JSONField(name = "LastError")
private Object LastError;
@JSONField(name = "MaxTimespan")
private int MaxTimespan;
@JSONField(name = "parsedTable")
private String parsedTable;
@JSONField(name = "parsedOrderbycolumns")
private String parsedOrderbycolumns;
@JSONField(name = "BlobOpenCount")
private int BlobOpenCount;
@JSONField(name = "ExecuteCount")
private int ExecuteCount;
@JSONField(name = "EffectedRowCount")
private int EffectedRowCount;
@JSONField(name = "ReadStringLength")
private int ReadStringLength;
@JSONField(name = "File")
private Object File;
@JSONField(name = "ClobOpenCount")
private int ClobOpenCount;
@JSONField(name = "LastTime")
private String LastTime;
@JSONField(name = "parsedConditions")
private String parsedConditions;
@JSONField(name = "EffectedRowCountHistogram")
private List<Integer> EffectedRowCountHistogram;
@JSONField(name = "Histogram")
private List<Integer> Histogram;
@JSONField(name = "ExecuteAndResultHoldTimeHistogram")
private List<Integer> ExecuteAndResultHoldTimeHistogram;
@JSONField(name = "FetchRowCountHistogram")
private List<Integer> FetchRowCountHistogram;
}
@NoArgsConstructor
@Data
public static class ContentBean {
@JSONField(name = "ExecuteAndResultSetHoldTime")
private int ExecuteAndResultSetHoldTime;
@JSONField(name = "LastErrorMessage")
private Object LastErrorMessage;
@JSONField(name = "InputStreamOpenCount")
private int InputStreamOpenCount;
@JSONField(name = "BatchSizeTotal")
private int BatchSizeTotal;
@JSONField(name = "FetchRowCountMax")
private int FetchRowCountMax;
@JSONField(name = "ErrorCount")
private int ErrorCount;
@JSONField(name = "BatchSizeMax")
private int BatchSizeMax;
@JSONField(name = "URL")
private Object URL;
@JSONField(name = "Name")
private Object Name;
@JSONField(name = "LastErrorTime")
private Object LastErrorTime;
@JSONField(name = "ReaderOpenCount")
private int ReaderOpenCount;
@JSONField(name = "parsedRelationships")
private String parsedRelationships;
@JSONField(name = "EffectedRowCountMax")
private int EffectedRowCountMax;
@JSONField(name = "LastErrorClass")
private Object LastErrorClass;
@JSONField(name = "InTransactionCount")
private int InTransactionCount;
@JSONField(name = "LastErrorStackTrace")
private Object LastErrorStackTrace;
@JSONField(name = "ResultSetHoldTime")
private int ResultSetHoldTime;
@JSONField(name = "TotalTime")
private int TotalTime;
@JSONField(name = "ID")
private int ID;
@JSONField(name = "ConcurrentMax")
private int ConcurrentMax;
@JSONField(name = "RunningCount")
private int RunningCount;
@JSONField(name = "FetchRowCount")
private int FetchRowCount;
@JSONField(name = "parsedFields")
private String parsedFields;
@JSONField(name = "MaxTimespanOccurTime")
private String MaxTimespanOccurTime;
@JSONField(name = "LastSlowParameters")
private Object LastSlowParameters;
@JSONField(name = "ReadBytesLength")
private int ReadBytesLength;
@JSONField(name = "formattedSql")
private String formattedSql;
@JSONField(name = "DbType")
private String DbType;
@JSONField(name = "DataSource")
private Object DataSource;
@JSONField(name = "SQL")
private String SQL;
@JSONField(name = "HASH")
private long HASH;
@JSONField(name = "LastError")
private Object LastError;
@JSONField(name = "MaxTimespan")
private int MaxTimespan;
@JSONField(name = "parsedTable")
private String parsedTable;
@JSONField(name = "parsedOrderbycolumns")
private String parsedOrderbycolumns;
@JSONField(name = "BlobOpenCount")
private int BlobOpenCount;
@JSONField(name = "ExecuteCount")
private int ExecuteCount;
@JSONField(name = "EffectedRowCount")
private int EffectedRowCount;
@JSONField(name = "ReadStringLength")
private int ReadStringLength;
@JSONField(name = "File")
private Object File;
@JSONField(name = "ClobOpenCount")
private int ClobOpenCount;
@JSONField(name = "LastTime")
private String LastTime;
@JSONField(name = "parsedConditions")
private String parsedConditions;
@JSONField(name = "EffectedRowCountHistogram")
private List<Integer> EffectedRowCountHistogram;
@JSONField(name = "Histogram")
private List<Integer> Histogram;
@JSONField(name = "ExecuteAndResultHoldTimeHistogram")
private List<Integer> ExecuteAndResultHoldTimeHistogram;
@JSONField(name = "FetchRowCountHistogram")
private List<Integer> FetchRowCountHistogram;
}
}
@@ -14,101 +14,145 @@ import java.util.List;
@Data
public class SqlListResult {
@JSONField(name = "ResultCode")
private int ResultCode;
@JSONField(name = "Content")
private List<ContentBean> Content;
@JSONField(name = "ResultCode")
private int ResultCode;
@NoArgsConstructor
@Data
public static class ContentBean {
@JSONField(name = "Content")
private List<ContentBean> Content;
private String serviceId;
private String address;
@NoArgsConstructor
@Data
public static class ContentBean {
private Integer port;
private String serviceId;
private String address;
private Integer port;
@JSONField(name = "ExecuteAndResultSetHoldTime")
private int ExecuteAndResultSetHoldTime;
@JSONField(name = "LastErrorMessage")
private Object LastErrorMessage;
@JSONField(name = "InputStreamOpenCount")
private int InputStreamOpenCount;
@JSONField(name = "BatchSizeTotal")
private int BatchSizeTotal;
@JSONField(name = "FetchRowCountMax")
private int FetchRowCountMax;
@JSONField(name = "ErrorCount")
private int ErrorCount;
@JSONField(name = "BatchSizeMax")
private int BatchSizeMax;
@JSONField(name = "URL")
private Object URL;
@JSONField(name = "Name")
private Object Name;
@JSONField(name = "LastErrorTime")
private Object LastErrorTime;
@JSONField(name = "ReaderOpenCount")
private int ReaderOpenCount;
@JSONField(name = "EffectedRowCountMax")
private int EffectedRowCountMax;
@JSONField(name = "LastErrorClass")
private Object LastErrorClass;
@JSONField(name = "InTransactionCount")
private int InTransactionCount;
@JSONField(name = "LastErrorStackTrace")
private Object LastErrorStackTrace;
@JSONField(name = "ResultSetHoldTime")
private int ResultSetHoldTime;
@JSONField(name = "TotalTime")
private int TotalTime;
@JSONField(name = "ID")
private int ID;
@JSONField(name = "ConcurrentMax")
private int ConcurrentMax;
@JSONField(name = "RunningCount")
private int RunningCount;
@JSONField(name = "FetchRowCount")
private int FetchRowCount;
@JSONField(name = "MaxTimespanOccurTime")
private String MaxTimespanOccurTime;
@JSONField(name = "LastSlowParameters")
private Object LastSlowParameters;
@JSONField(name = "ReadBytesLength")
private int ReadBytesLength;
@JSONField(name = "DbType")
private String DbType;
@JSONField(name = "DataSource")
private Object DataSource;
@JSONField(name = "SQL")
private String SQL;
@JSONField(name = "HASH")
private long HASH;
@JSONField(name = "LastError")
private Object LastError;
@JSONField(name = "MaxTimespan")
private int MaxTimespan;
@JSONField(name = "BlobOpenCount")
private int BlobOpenCount;
@JSONField(name = "ExecuteCount")
private int ExecuteCount;
@JSONField(name = "EffectedRowCount")
private int EffectedRowCount;
@JSONField(name = "ReadStringLength")
private int ReadStringLength;
@JSONField(name = "File")
private Object File;
@JSONField(name = "ClobOpenCount")
private int ClobOpenCount;
@JSONField(name = "LastTime")
private String LastTime;
@JSONField(name = "EffectedRowCountHistogram")
private List<Integer> EffectedRowCountHistogram;
@JSONField(name = "Histogram")
private List<Integer> Histogram;
@JSONField(name = "ExecuteAndResultHoldTimeHistogram")
private List<Integer> ExecuteAndResultHoldTimeHistogram;
@JSONField(name = "FetchRowCountHistogram")
private List<Integer> FetchRowCountHistogram;
}
@JSONField(name = "ExecuteAndResultSetHoldTime")
private int ExecuteAndResultSetHoldTime;
@JSONField(name = "LastErrorMessage")
private Object LastErrorMessage;
@JSONField(name = "InputStreamOpenCount")
private int InputStreamOpenCount;
@JSONField(name = "BatchSizeTotal")
private int BatchSizeTotal;
@JSONField(name = "FetchRowCountMax")
private int FetchRowCountMax;
@JSONField(name = "ErrorCount")
private int ErrorCount;
@JSONField(name = "BatchSizeMax")
private int BatchSizeMax;
@JSONField(name = "URL")
private Object URL;
@JSONField(name = "Name")
private Object Name;
@JSONField(name = "LastErrorTime")
private Object LastErrorTime;
@JSONField(name = "ReaderOpenCount")
private int ReaderOpenCount;
@JSONField(name = "EffectedRowCountMax")
private int EffectedRowCountMax;
@JSONField(name = "LastErrorClass")
private Object LastErrorClass;
@JSONField(name = "InTransactionCount")
private int InTransactionCount;
@JSONField(name = "LastErrorStackTrace")
private Object LastErrorStackTrace;
@JSONField(name = "ResultSetHoldTime")
private int ResultSetHoldTime;
@JSONField(name = "TotalTime")
private int TotalTime;
@JSONField(name = "ID")
private int ID;
@JSONField(name = "ConcurrentMax")
private int ConcurrentMax;
@JSONField(name = "RunningCount")
private int RunningCount;
@JSONField(name = "FetchRowCount")
private int FetchRowCount;
@JSONField(name = "MaxTimespanOccurTime")
private String MaxTimespanOccurTime;
@JSONField(name = "LastSlowParameters")
private Object LastSlowParameters;
@JSONField(name = "ReadBytesLength")
private int ReadBytesLength;
@JSONField(name = "DbType")
private String DbType;
@JSONField(name = "DataSource")
private Object DataSource;
@JSONField(name = "SQL")
private String SQL;
@JSONField(name = "HASH")
private long HASH;
@JSONField(name = "LastError")
private Object LastError;
@JSONField(name = "MaxTimespan")
private int MaxTimespan;
@JSONField(name = "BlobOpenCount")
private int BlobOpenCount;
@JSONField(name = "ExecuteCount")
private int ExecuteCount;
@JSONField(name = "EffectedRowCount")
private int EffectedRowCount;
@JSONField(name = "ReadStringLength")
private int ReadStringLength;
@JSONField(name = "File")
private Object File;
@JSONField(name = "ClobOpenCount")
private int ClobOpenCount;
@JSONField(name = "LastTime")
private String LastTime;
@JSONField(name = "EffectedRowCountHistogram")
private List<Integer> EffectedRowCountHistogram;
@JSONField(name = "Histogram")
private List<Integer> Histogram;
@JSONField(name = "ExecuteAndResultHoldTimeHistogram")
private List<Integer> ExecuteAndResultHoldTimeHistogram;
@JSONField(name = "FetchRowCountHistogram")
private List<Integer> FetchRowCountHistogram;
}
}
@@ -16,104 +16,138 @@ import java.util.List;
@NoArgsConstructor
public class WallResult {
@JSONField(name = "ResultCode")
private int ResultCode;
@JSONField(name = "Content")
private ContentBean Content = new ContentBean();
@JSONField(name = "ResultCode")
private int ResultCode;
@NoArgsConstructor
@Data
public static class ContentBean {
@JSONField(name = "checkCount")
private int checkCount;
@JSONField(name = "hardCheckCount")
private int hardCheckCount;
@JSONField(name = "violationCount")
private int violationCount;
@JSONField(name = "violationEffectRowCount")
private int violationEffectRowCount;
@JSONField(name = "blackListHitCount")
private int blackListHitCount;
@JSONField(name = "blackListSize")
private int blackListSize;
@JSONField(name = "whiteListHitCount")
private int whiteListHitCount;
@JSONField(name = "whiteListSize")
private int whiteListSize;
@JSONField(name = "syntaxErrorCount")
private int syntaxErrorCount;
@JSONField(name = "tables")
private List<TablesBean> tables = new ArrayList<>();
@JSONField(name = "functions")
private List<FunctionsBean> functions = new ArrayList<>();
@JSONField(name = "blackList")
private List<Object> blackList = new ArrayList<>();
@JSONField(name = "whiteList")
private List<WhiteListBean> whiteList = new ArrayList<>();
@JSONField(name = "Content")
private ContentBean Content = new ContentBean();
@NoArgsConstructor
@Data
public static class TablesBean {
@NoArgsConstructor
@Data
public static class ContentBean {
@JSONField(name = "name")
private String name;
@JSONField(name = "checkCount")
private int checkCount;
@JSONField(name = "selectCount")
private int selectCount;
@JSONField(name = "hardCheckCount")
private int hardCheckCount;
@JSONField(name = "fetchRowCount")
private int fetchRowCount;
@JSONField(name = "violationCount")
private int violationCount;
@JSONField(name = "fetchRowCountHistogram")
private List<Integer> fetchRowCountHistogram;
}
@JSONField(name = "violationEffectRowCount")
private int violationEffectRowCount;
@NoArgsConstructor
@Data
public static class FunctionsBean {
@JSONField(name = "name")
private String name;
@JSONField(name = "invokeCount")
private int invokeCount;
}
@JSONField(name = "blackListHitCount")
private int blackListHitCount;
@NoArgsConstructor
@Data
public static class WhiteListBean {
@JSONField(name = "sql")
private String sql;
@JSONField(name = "sample")
private String sample;
@JSONField(name = "executeCount")
private int executeCount;
@JSONField(name = "fetchRowCount")
private int fetchRowCount;
}
}
@JSONField(name = "blackListSize")
private int blackListSize;
/**
* 累加结果
*
* @param wallResult 需要累加的对象
* @param sumResult 累加后的对象
*/
public void sum(WallResult wallResult, WallResult sumResult) {
sumResult.getContent().setCheckCount(sumResult.getContent().getCheckCount() + wallResult.getContent().getCheckCount());
sumResult.getContent().setHardCheckCount(sumResult.getContent().getHardCheckCount() + wallResult.getContent().getHardCheckCount());
sumResult.getContent().setViolationCount(sumResult.getContent().getViolationCount() + wallResult.getContent().getViolationCount());
sumResult.getContent().setViolationEffectRowCount(sumResult.getContent().getViolationEffectRowCount() + wallResult.getContent().getViolationEffectRowCount());
sumResult.getContent().setBlackListHitCount(sumResult.getContent().getBlackListHitCount() + wallResult.getContent().getBlackListHitCount());
sumResult.getContent().setBlackListSize(sumResult.getContent().getBlackListSize() + wallResult.getContent().getBlackListSize());
sumResult.getContent().setWhiteListHitCount(sumResult.getContent().getWhiteListHitCount() + wallResult.getContent().getWhiteListHitCount());
sumResult.getContent().setWhiteListSize(sumResult.getContent().getWhiteListSize() + wallResult.getContent().getWhiteListSize());
sumResult.getContent().setSyntaxErrorCount(sumResult.getContent().getSyntaxErrorCount() + wallResult.getContent().getSyntaxErrorCount());
@JSONField(name = "whiteListHitCount")
private int whiteListHitCount;
@JSONField(name = "whiteListSize")
private int whiteListSize;
@JSONField(name = "syntaxErrorCount")
private int syntaxErrorCount;
@JSONField(name = "tables")
private List<TablesBean> tables = new ArrayList<>();
@JSONField(name = "functions")
private List<FunctionsBean> functions = new ArrayList<>();
@JSONField(name = "blackList")
private List<Object> blackList = new ArrayList<>();
@JSONField(name = "whiteList")
private List<WhiteListBean> whiteList = new ArrayList<>();
@NoArgsConstructor
@Data
public static class TablesBean {
@JSONField(name = "name")
private String name;
@JSONField(name = "selectCount")
private int selectCount;
@JSONField(name = "fetchRowCount")
private int fetchRowCount;
@JSONField(name = "fetchRowCountHistogram")
private List<Integer> fetchRowCountHistogram;
}
@NoArgsConstructor
@Data
public static class FunctionsBean {
@JSONField(name = "name")
private String name;
@JSONField(name = "invokeCount")
private int invokeCount;
}
@NoArgsConstructor
@Data
public static class WhiteListBean {
@JSONField(name = "sql")
private String sql;
@JSONField(name = "sample")
private String sample;
@JSONField(name = "executeCount")
private int executeCount;
@JSONField(name = "fetchRowCount")
private int fetchRowCount;
}
}
/**
* 累加结果
* @param wallResult 需要累加的对象
* @param sumResult 累加后的对象
*/
public void sum(WallResult wallResult, WallResult sumResult) {
sumResult.getContent()
.setCheckCount(sumResult.getContent().getCheckCount() + wallResult.getContent().getCheckCount());
sumResult.getContent().setHardCheckCount(
sumResult.getContent().getHardCheckCount() + wallResult.getContent().getHardCheckCount());
sumResult.getContent().setViolationCount(
sumResult.getContent().getViolationCount() + wallResult.getContent().getViolationCount());
sumResult.getContent().setViolationEffectRowCount(sumResult.getContent().getViolationEffectRowCount()
+ wallResult.getContent().getViolationEffectRowCount());
sumResult.getContent().setBlackListHitCount(
sumResult.getContent().getBlackListHitCount() + wallResult.getContent().getBlackListHitCount());
sumResult.getContent().setBlackListSize(
sumResult.getContent().getBlackListSize() + wallResult.getContent().getBlackListSize());
sumResult.getContent().setWhiteListHitCount(
sumResult.getContent().getWhiteListHitCount() + wallResult.getContent().getWhiteListHitCount());
sumResult.getContent().setWhiteListSize(
sumResult.getContent().getWhiteListSize() + wallResult.getContent().getWhiteListSize());
sumResult.getContent().setSyntaxErrorCount(
sumResult.getContent().getSyntaxErrorCount() + wallResult.getContent().getSyntaxErrorCount());
sumResult.getContent().getTables().addAll(wallResult.getContent().getTables() == null ? Collections.emptyList()
: wallResult.getContent().getTables());
sumResult.getContent().getFunctions().addAll(wallResult.getContent().getFunctions() == null
? Collections.emptyList() : wallResult.getContent().getFunctions());
sumResult.getContent().getBlackList().addAll(wallResult.getContent().getBlackList() == null
? Collections.emptyList() : wallResult.getContent().getBlackList());
sumResult.getContent().getWhiteList().addAll(wallResult.getContent().getWhiteList() == null
? Collections.emptyList() : wallResult.getContent().getWhiteList());
}
sumResult.getContent().getTables().addAll(wallResult.getContent().getTables() == null ? Collections.emptyList() : wallResult.getContent().getTables());
sumResult.getContent().getFunctions().addAll(wallResult.getContent().getFunctions() == null ? Collections.emptyList() :
wallResult.getContent().getFunctions());
sumResult.getContent().getBlackList().addAll(wallResult.getContent().getBlackList() == null ? Collections.emptyList() :
wallResult.getContent().getBlackList());
sumResult.getContent().getWhiteList().addAll(wallResult.getContent().getWhiteList() == null ? Collections.emptyList() : wallResult.getContent().getWhiteList());
}
}
@@ -14,63 +14,91 @@ import java.util.List;
@Data
public class WebResult {
@JSONField(name = "ResultCode")
private int ResultCode;
@JSONField(name = "Content")
private List<ContentBean> Content;
@JSONField(name = "ResultCode")
private int ResultCode;
@JSONField(name = "Content")
private List<ContentBean> Content;
@NoArgsConstructor
@Data
public static class ContentBean {
@JSONField(name = "URI")
private String URI;
@JSONField(name = "RunningCount")
private int RunningCount;
@JSONField(name = "ConcurrentMax")
private int ConcurrentMax;
@JSONField(name = "RequestCount")
private int RequestCount;
@JSONField(name = "RequestTimeMillis")
private int RequestTimeMillis;
@JSONField(name = "ErrorCount")
private int ErrorCount;
@JSONField(name = "LastAccessTime")
private String LastAccessTime;
@JSONField(name = "JdbcCommitCount")
private int JdbcCommitCount;
@JSONField(name = "JdbcRollbackCount")
private int JdbcRollbackCount;
@JSONField(name = "JdbcExecuteCount")
private int JdbcExecuteCount;
@JSONField(name = "JdbcExecuteErrorCount")
private int JdbcExecuteErrorCount;
@JSONField(name = "JdbcExecutePeak")
private int JdbcExecutePeak;
@JSONField(name = "JdbcExecuteTimeMillis")
private int JdbcExecuteTimeMillis;
@JSONField(name = "JdbcFetchRowCount")
private int JdbcFetchRowCount;
@JSONField(name = "JdbcFetchRowPeak")
private int JdbcFetchRowPeak;
@JSONField(name = "JdbcUpdateCount")
private int JdbcUpdateCount;
@JSONField(name = "JdbcUpdatePeak")
private int JdbcUpdatePeak;
@JSONField(name = "JdbcPoolConnectionOpenCount")
private int JdbcPoolConnectionOpenCount;
@JSONField(name = "JdbcPoolConnectionCloseCount")
private int JdbcPoolConnectionCloseCount;
@JSONField(name = "JdbcResultSetOpenCount")
private int JdbcResultSetOpenCount;
@JSONField(name = "JdbcResultSetCloseCount")
private int JdbcResultSetCloseCount;
@JSONField(name = "RequestTimeMillisMax")
private int RequestTimeMillisMax;
@JSONField(name = "RequestTimeMillisMaxOccurTime")
private String RequestTimeMillisMaxOccurTime;
@JSONField(name = "Histogram")
private List<Integer> Histogram;
@JSONField(name = "Profiles")
private List<?> Profiles;
}
@NoArgsConstructor
@Data
public static class ContentBean {
@JSONField(name = "URI")
private String URI;
@JSONField(name = "RunningCount")
private int RunningCount;
@JSONField(name = "ConcurrentMax")
private int ConcurrentMax;
@JSONField(name = "RequestCount")
private int RequestCount;
@JSONField(name = "RequestTimeMillis")
private int RequestTimeMillis;
@JSONField(name = "ErrorCount")
private int ErrorCount;
@JSONField(name = "LastAccessTime")
private String LastAccessTime;
@JSONField(name = "JdbcCommitCount")
private int JdbcCommitCount;
@JSONField(name = "JdbcRollbackCount")
private int JdbcRollbackCount;
@JSONField(name = "JdbcExecuteCount")
private int JdbcExecuteCount;
@JSONField(name = "JdbcExecuteErrorCount")
private int JdbcExecuteErrorCount;
@JSONField(name = "JdbcExecutePeak")
private int JdbcExecutePeak;
@JSONField(name = "JdbcExecuteTimeMillis")
private int JdbcExecuteTimeMillis;
@JSONField(name = "JdbcFetchRowCount")
private int JdbcFetchRowCount;
@JSONField(name = "JdbcFetchRowPeak")
private int JdbcFetchRowPeak;
@JSONField(name = "JdbcUpdateCount")
private int JdbcUpdateCount;
@JSONField(name = "JdbcUpdatePeak")
private int JdbcUpdatePeak;
@JSONField(name = "JdbcPoolConnectionOpenCount")
private int JdbcPoolConnectionOpenCount;
@JSONField(name = "JdbcPoolConnectionCloseCount")
private int JdbcPoolConnectionCloseCount;
@JSONField(name = "JdbcResultSetOpenCount")
private int JdbcResultSetOpenCount;
@JSONField(name = "JdbcResultSetCloseCount")
private int JdbcResultSetCloseCount;
@JSONField(name = "RequestTimeMillisMax")
private int RequestTimeMillisMax;
@JSONField(name = "RequestTimeMillisMaxOccurTime")
private String RequestTimeMillisMaxOccurTime;
@JSONField(name = "Histogram")
private List<Integer> Histogram;
@JSONField(name = "Profiles")
private List<?> Profiles;
}
}
@@ -34,14 +34,21 @@ import java.util.stream.Collectors;
public class MonitorStatService implements DruidStatServiceMBean {
public final static int RESULT_CODE_SUCCESS = 1;
public final static int RESULT_CODE_ERROR = -1;
private final static int DEFAULT_PAGE = 1;
private final static int DEFAULT_PER_PAGE_COUNT = Integer.MAX_VALUE;
private static final String ORDER_TYPE_DESC = "desc";
private static final String ORDER_TYPE_ASC = "asc";
private static final String DEFAULT_ORDER_TYPE = ORDER_TYPE_ASC;
private static final String DEFAULT_ORDERBY = "SQL";
/**
* 以consul注册的服务的id为key,value为某个微服务节点
*/
@@ -55,7 +62,6 @@ public class MonitorStatService implements DruidStatServiceMBean {
/**
* 获取所有服务信息
*
* @return
*/
public Map<String, ServiceNode> getAllServiceNodeMap() {
@@ -67,7 +73,8 @@ public class MonitorStatService implements DruidStatServiceMBean {
String host = instance.getHost();
String instanceId = instance.getInstanceId();
if (instanceId == null) {
instanceId = instance.getMetadata().get("nacos.instanceId").replaceAll("#", "-").replaceAll("@@", "-");
instanceId = instance.getMetadata().get("nacos.instanceId").replaceAll("#", "-").replaceAll("@@",
"-");
}
int port = instance.getPort();
String serviceId = instance.getServiceId();
@@ -83,13 +90,13 @@ public class MonitorStatService implements DruidStatServiceMBean {
}
}
}
return serviceNodes.parallelStream().collect(Collectors.toMap(i -> i.getServiceName() + "-" + i.getAddress() + "-" + i.getPort(),
Function.identity(), (v1, v2) -> v2));
return serviceNodes.parallelStream()
.collect(Collectors.toMap(i -> i.getServiceName() + "-" + i.getAddress() + "-" + i.getPort(),
Function.identity(), (v1, v2) -> v2));
}
/**
* 获取指定服务名的所有节点
*
* @param parameters
* @return
*/
@@ -104,7 +111,8 @@ public class MonitorStatService implements DruidStatServiceMBean {
String host = instance.getHost();
String instanceId = instance.getInstanceId();
if (instanceId == null) {
instanceId = instance.getMetadata().get("nacos.instanceId").replaceAll("#", "-").replaceAll("@@", "-");
instanceId = instance.getMetadata().get("nacos.instanceId").replaceAll("#", "-").replaceAll("@@",
"-");
}
int port = instance.getPort();
String serviceId = instance.getServiceId();
@@ -120,8 +128,9 @@ public class MonitorStatService implements DruidStatServiceMBean {
}
}
}
return serviceNodes.parallelStream().collect(Collectors.toMap(i -> i.getServiceName() + "-" + i.getAddress() + "-" + i.getPort(),
Function.identity(), (v1, v2) -> v2));
return serviceNodes.parallelStream()
.collect(Collectors.toMap(i -> i.getServiceName() + "-" + i.getAddress() + "-" + i.getPort(),
Function.identity(), (v1, v2) -> v2));
}
@Override
@@ -137,7 +146,6 @@ public class MonitorStatService implements DruidStatServiceMBean {
return getDataSourceStatData();
}
if (url.startsWith("/datasource-")) {
String serviceName = StringUtils.subString(url, "serviceName=", "&sql-");
Integer id = StringUtils.subStringToInteger(url, "datasource-", ".");
@@ -210,7 +218,6 @@ public class MonitorStatService implements DruidStatServiceMBean {
return JSONUtils.toJSONString(dataMap);
}
public String getWallStatMap(Map<String, String> parameters) {
Map<String, ServiceNode> allNodeMap = getServiceAllNodeMap(parameters);
List<WallResult> countResult = new ArrayList<>();
@@ -228,7 +235,6 @@ public class MonitorStatService implements DruidStatServiceMBean {
return JSON.toJSONString(lastCount);
}
private List<Map<String, Object>> getSpringStatDataList(Map<String, String> parameters) {
List<Map<String, Object>> array = SpringStatManager.getInstance().getMethodStatData();
return comparatorOrderBy(array, parameters);
@@ -246,7 +252,8 @@ public class MonitorStatService implements DruidStatServiceMBean {
List<WebResult.ContentBean> nodeContent = dataSourceResult.getContent();
if (nodeContent != null) {
for (WebResult.ContentBean contentBean : nodeContent) {
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(contentBean), Map.class);
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(contentBean),
Map.class);
arrayMap.add(map);
}
}
@@ -285,7 +292,6 @@ public class MonitorStatService implements DruidStatServiceMBean {
/**
* 获取sql详情
*
* @param id
* @param serviceId consul获取的服务id
* @return
@@ -301,14 +307,14 @@ public class MonitorStatService implements DruidStatServiceMBean {
public String getPoolingConnectionInfoByDataSourceId(Integer id, String serviceId) {
getAllServiceNodeMap();
ServiceNode serviceNode = serviceIdMap.get(serviceId);
String url = "http://" + serviceNode.getAddress() + ":" + serviceNode.getPort() + "/druid/connectionInfo-" + id + ".json";
String url = "http://" + serviceNode.getAddress() + ":" + serviceNode.getPort() + "/druid/connectionInfo-" + id
+ ".json";
ConnectionResult connectionResult = JSONObject.parseObject(HttpUtil.get(url), ConnectionResult.class);
return JSON.toJSONString(connectionResult);
}
/**
* SQL监控列表
*
* @param parameters
* @return
*/
@@ -345,10 +351,8 @@ public class MonitorStatService implements DruidStatServiceMBean {
return jsonObject.toJSONString();
}
/**
* 数据源监控
*
* @param
* @return
*/
@@ -379,10 +383,8 @@ public class MonitorStatService implements DruidStatServiceMBean {
return JSON.toJSONString(lastResult);
}
/**
* 拼接url
*
* @param parameters
* @param serviceNode
* @param prefix
@@ -408,7 +410,6 @@ public class MonitorStatService implements DruidStatServiceMBean {
/**
* 处理请求参数
*
* @param url
* @return
*/
@@ -438,7 +439,8 @@ public class MonitorStatService implements DruidStatServiceMBean {
return parameters;
}
private List<Map<String, Object>> comparatorOrderBy(List<Map<String, Object>> array, Map<String, String> parameters) {
private List<Map<String, Object>> comparatorOrderBy(List<Map<String, Object>> array,
Map<String, String> parameters) {
// when open the stat page before executing some sql
if (array == null || array.isEmpty()) {
return null;
@@ -453,7 +455,8 @@ public class MonitorStatService implements DruidStatServiceMBean {
orderType = DEFAULT_ORDER_TYPE;
page = DEFAULT_PAGE;
perPageCount = DEFAULT_PER_PAGE_COUNT;
} else {
}
else {
orderBy = parameters.get("orderBy");
orderType = parameters.get("orderType");
String pageParam = parameters.get("page");
@@ -488,4 +491,5 @@ public class MonitorStatService implements DruidStatServiceMBean {
return array.subList(fromIndex, toIndex);
}
}
@@ -14,22 +14,22 @@ import javax.servlet.ServletException;
@Slf4j
public class MonitorViewServlet extends ResourceServlet {
private MonitorStatService monitorStatService;
private MonitorStatService monitorStatService;
public MonitorViewServlet() {
super("druid");
}
public MonitorViewServlet() {
super("druid");
}
@Override
public void init() throws ServletException {
log.info("init MonitorViewServlet");
super.init();
monitorStatService = SpringContextHolder.getBean(MonitorStatService.class);
}
@Override
public void init() throws ServletException {
log.info("init MonitorViewServlet");
super.init();
monitorStatService = SpringContextHolder.getBean(MonitorStatService.class);
}
@Override
protected String process(String url) {
return monitorStatService.service(url);
}
@Override
protected String process(String url) {
return monitorStatService.service(url);
}
}