1:修改asn统计计算数据偏小的问题
2:修改pps去除小数点后面的数据时,当是整数时出现异常的问题
This commit is contained in:
@@ -149,9 +149,12 @@ public class LocalLogJDBCByDruid {
|
||||
if (!allPps.equals("0")) {
|
||||
ntcConnRecordPercent.setPpsPercent(
|
||||
num.format(Double.valueOf(ntcConnRecordPercent.getPps()) / Double.valueOf(allPps)));
|
||||
int idx = ntcConnRecordPercent.getPps().lastIndexOf(".");//查找小数点的位置
|
||||
String strNum = ntcConnRecordPercent.getPps().substring(0,idx);//截取从字符串开始到小数点位置的字符串,就是整数部分
|
||||
ntcConnRecordPercent.setPps(strNum);
|
||||
String ppsNum =ntcConnRecordPercent.getPps();
|
||||
if(ntcConnRecordPercent.getPps().contains(".")) {
|
||||
int idx =ntcConnRecordPercent.getPps().lastIndexOf(".");//查找小数点的位置
|
||||
ppsNum= ntcConnRecordPercent.getPps().substring(0,idx);//截取从字符串开始到小数点位置的字符串,就是整数部分
|
||||
}
|
||||
ntcConnRecordPercent.setPps(ppsNum);
|
||||
} else {
|
||||
ntcConnRecordPercent.setPpsPercent("0%");
|
||||
}
|
||||
@@ -191,8 +194,13 @@ public class LocalLogJDBCByDruid {
|
||||
NtcAsnRecord ntcAsnRecord = new NtcAsnRecord();
|
||||
String bps = rs.getString("bps");
|
||||
String pps = rs.getString("pps");
|
||||
String ppsNum =pps;
|
||||
if(pps.contains(".")) {
|
||||
int idx =pps.lastIndexOf(".");//查找小数点的位置
|
||||
ppsNum= pps.substring(0,idx);//截取从字符串开始到小数点位置的字符串,就是整数部分
|
||||
}
|
||||
ntcAsnRecord.setBps(subStr(bps));
|
||||
ntcAsnRecord.setPps(subStr(pps));
|
||||
ntcAsnRecord.setPps(ppsNum);
|
||||
ntcAsnRecord.setAsn(rs.getString("asn"));
|
||||
list.add(ntcAsnRecord);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class LogDataService {
|
||||
}
|
||||
long second = endTime - startTime;
|
||||
StringBuffer sql = new StringBuffer();
|
||||
sql.append("SELECT SUM(s2c_pkt_num + s2c_pkt_num)*8/");
|
||||
sql.append("SELECT SUM(s2c_pkt_num + s2c_pkt_num)/");
|
||||
sql.append(second);
|
||||
sql.append(" AS pps , SUM(c2s_byte_num + s2c_byte_num)*8/1024/1024/1024/");
|
||||
sql.append(second);
|
||||
@@ -98,9 +98,9 @@ public class LogDataService {
|
||||
|
||||
long second = endTime - startTime;
|
||||
StringBuffer sql = new StringBuffer();
|
||||
sql.append("SELECT SUM(s2c_pkt_num + s2c_pkt_num)*8/");
|
||||
sql.append("SELECT SUM(s2c_pkt_num + s2c_pkt_num)/");
|
||||
sql.append(second);
|
||||
sql.append(" AS pps , SUM(c2s_byte_num + s2c_byte_num)*8/1024/1024/");
|
||||
sql.append(" AS pps , SUM(c2s_byte_num + s2c_byte_num)*8/1024/1024/1024/");
|
||||
sql.append(second);
|
||||
sql.append(" AS bps,");
|
||||
sql.append(asn);
|
||||
@@ -124,8 +124,9 @@ public class LogDataService {
|
||||
countSql.append("group by ");
|
||||
countSql.append(asn + ")");
|
||||
Integer startNum = 0;
|
||||
Integer limitCount = startNum + 20;
|
||||
sql.append(" limit " + limitCount + " ) ");
|
||||
// Integer limitCount = startNum + 20;
|
||||
// sql.append(" limit " + limitCount + " ) ");
|
||||
sql.append(" ) ");
|
||||
if (searchAsn != null && !searchAsn.equals("")) {
|
||||
sql.append(" and " + asn + "='" + searchAsn + "'");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user