1:修改jsp-api冲突导致swagger日志界面出现jsp报错的问题
2:修改日志查询为先查询总量在查询数据的逻辑
This commit is contained in:
4
pom.xml
4
pom.xml
@@ -498,6 +498,10 @@
|
|||||||
<groupId>org.mortbay.jetty</groupId>
|
<groupId>org.mortbay.jetty</groupId>
|
||||||
<artifactId>jsp-2.1</artifactId>
|
<artifactId>jsp-2.1</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.mortbay.jetty</groupId>
|
||||||
|
<artifactId>jsp-api-2.1</artifactId>
|
||||||
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -518,7 +518,7 @@ public class Page<T> {
|
|||||||
*/
|
*/
|
||||||
public Page<T> setList(List<T> list) {
|
public Page<T> setList(List<T> list) {
|
||||||
this.list = list;
|
this.list = list;
|
||||||
// initialize();
|
initialize();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import java.util.Map;
|
|||||||
import org.apache.ibatis.mapping.ResultMap;
|
import org.apache.ibatis.mapping.ResultMap;
|
||||||
import org.apache.ibatis.mapping.ResultMapping;
|
import org.apache.ibatis.mapping.ResultMapping;
|
||||||
import org.apache.ibatis.session.SqlSessionFactory;
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -28,8 +30,7 @@ import com.zdjizhi.utils.StringUtil;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class LogDataService {
|
public class LogDataService {
|
||||||
// private final static Logger logger =
|
private final static Logger logger = LoggerFactory.getLogger(LogDataService.class);
|
||||||
// LoggerFactory.getLogger(LogDataService.class);
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private LogJDBCByDruid logJDBCByDruid;
|
private LogJDBCByDruid logJDBCByDruid;
|
||||||
@@ -186,13 +187,14 @@ public class LogDataService {
|
|||||||
Integer startNum = (page.getPageNo() - 1) * page.getPageSize();
|
Integer startNum = (page.getPageNo() - 1) * page.getPageSize();
|
||||||
StringBuffer foundTimeSql = new StringBuffer();
|
StringBuffer foundTimeSql = new StringBuffer();
|
||||||
foundTimeSql.append("select found_time from " + tableName + " where ");
|
foundTimeSql.append("select found_time from " + tableName + " where ");
|
||||||
|
Integer limitCount = startNum + page.getPageSize();
|
||||||
if (whereSB.length() == 0) {// 没有其他查询条件只有默认的found_time条件
|
if (whereSB.length() == 0) {// 没有其他查询条件只有默认的found_time条件
|
||||||
if (whereFoundTime.length() > 0) {
|
if (whereFoundTime.length() > 0) {
|
||||||
int indexOf = whereFoundTime.indexOf("and") + "and".length();
|
int indexOf = whereFoundTime.indexOf("and") + "and".length();
|
||||||
countSql.append(whereFoundTime.substring(indexOf));
|
countSql.append(whereFoundTime.substring(indexOf));
|
||||||
|
|
||||||
foundTimeSql.append(whereFoundTime.substring(indexOf) + orderBy.toLowerCase() + " limit " + startNum
|
foundTimeSql
|
||||||
+ "," + page.getPageSize());
|
.append(whereFoundTime.substring(indexOf) + orderBy.toLowerCase() + " limit " + limitCount);
|
||||||
sql.append(" found_time in(" + foundTimeSql + ") ");
|
sql.append(" found_time in(" + foundTimeSql + ") ");
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("从clickhouse的" + tableName + "表查询时,必须要有一个where条件");
|
throw new RuntimeException("从clickhouse的" + tableName + "表查询时,必须要有一个where条件");
|
||||||
@@ -200,9 +202,8 @@ public class LogDataService {
|
|||||||
} else {
|
} else {
|
||||||
int foundIndexOf = whereFoundTime.append(whereSB).indexOf("and") + "and".length();
|
int foundIndexOf = whereFoundTime.append(whereSB).indexOf("and") + "and".length();
|
||||||
countSql.append(whereFoundTime.substring(foundIndexOf));
|
countSql.append(whereFoundTime.substring(foundIndexOf));
|
||||||
|
foundTimeSql
|
||||||
foundTimeSql.append(whereFoundTime.substring(foundIndexOf) + orderBy.toLowerCase() + " limit " + startNum
|
.append(whereFoundTime.substring(foundIndexOf) + orderBy.toLowerCase() + " limit " + limitCount);
|
||||||
+ "," + page.getPageSize());
|
|
||||||
|
|
||||||
int indexOf = whereSB.indexOf("and") + "and".length();
|
int indexOf = whereSB.indexOf("and") + "and".length();
|
||||||
sql.append(whereSB.substring(indexOf) + " and found_time in(" + foundTimeSql + ") ");
|
sql.append(whereSB.substring(indexOf) + " and found_time in(" + foundTimeSql + ") ");
|
||||||
@@ -361,12 +362,13 @@ public class LogDataService {
|
|||||||
*/
|
*/
|
||||||
private <T> void searchFromDataCenter(Page<T> page, Object bean, StringBuffer selSql, StringBuffer countSql)
|
private <T> void searchFromDataCenter(Page<T> page, Object bean, StringBuffer selSql, StringBuffer countSql)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
// new LogJDBCByDruid().getTableData(page, selSql.toString(), bean.getClass());
|
// if (Constants.ISOPENLOGCOUNTANDLAST) {
|
||||||
logJDBCByDruid.getTableData(page, selSql.toString(), bean.getClass());
|
|
||||||
if (Constants.ISOPENLOGCOUNTANDLAST) {
|
|
||||||
if (page.getList() != null && page.getList().size() > 0) {
|
|
||||||
logJDBCByDruid.getCount(page, countSql.toString().toLowerCase());
|
logJDBCByDruid.getCount(page, countSql.toString().toLowerCase());
|
||||||
}
|
// }
|
||||||
|
if (page.getCount() > 0) {
|
||||||
|
logJDBCByDruid.getTableData(page, selSql.toString(), bean.getClass());
|
||||||
|
} else {
|
||||||
|
logger.info("没有查询到数据,sql={}",countSql.toString().toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -187,11 +187,9 @@ redis.timeout=100000
|
|||||||
#一般当此值设置过大时,容易报:Too many Cluster redirections
|
#一般当此值设置过大时,容易报:Too many Cluster redirections
|
||||||
redis.maxRedirects=3
|
redis.maxRedirects=3
|
||||||
|
|
||||||
#3A-redis集群配置
|
#3A-redis集群配置,如果需要执行数据同步需要在集群中执行LPUSH SyncRedisToCluster "1"
|
||||||
redis.cluster.host1=192.168.10.205
|
redis.cluster.host1=192.168.10.192
|
||||||
redis.cluster.port1:7031
|
redis.cluster.host2=192.168.10.193
|
||||||
redis.cluster.port2:7032
|
redis.cluster.port1=7001
|
||||||
redis.cluster.port3:7033
|
redis.cluster.port2=7002
|
||||||
redis.cluster.port4:7034
|
redis.cluster.port3=7003
|
||||||
redis.cluster.port5:7035
|
|
||||||
redis.cluster.port6:7036
|
|
||||||
|
|||||||
Reference in New Issue
Block a user