1:添加通联关系日志百分比查询接口
2:用户行为统计删除只取前10个
This commit is contained in:
@@ -623,7 +623,7 @@
|
||||
</choose>
|
||||
|
||||
</where>
|
||||
group by NAS_IP order by num desc limit 10;
|
||||
group by NAS_IP order by num desc
|
||||
</select>
|
||||
<select id="findAccounList" parameterType="com.nis.domain.restful.NtcRadiusReport"
|
||||
resultMap="NtcRadiusReportMap">
|
||||
@@ -639,7 +639,7 @@
|
||||
</choose>
|
||||
|
||||
</where>
|
||||
group by account order by num desc limit 10;
|
||||
group by account order by num desc
|
||||
</select>
|
||||
|
||||
<select id="findNtcRadiusReport" parameterType="com.nis.domain.restful.NtcRadiusReport"
|
||||
@@ -664,6 +664,6 @@
|
||||
</choose>
|
||||
</where>
|
||||
ORDER BY
|
||||
REPORT_TIME ASC limit 10
|
||||
REPORT_TIME ASC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -9,6 +9,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -24,7 +25,7 @@ import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.domain.restful.NtcConnRecordPercent;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
import com.zdjizhi.utils.StringUtil;
|
||||
|
||||
@@ -110,6 +111,48 @@ public class LocalLogJDBCByDruid {
|
||||
}
|
||||
}
|
||||
|
||||
public NtcConnRecordPercent getNtcConnRecordPercentData(NtcConnRecordPercent ntcConnRecordPercent, String sql,
|
||||
boolean isPersent) throws Exception {
|
||||
try {
|
||||
conn = getConnection();
|
||||
logger.info("连接数据中心日志库成功--------------------------");
|
||||
st = conn.createStatement();
|
||||
logger.info("开始执行日志查询语句sql={}", sql);
|
||||
rs = st.executeQuery(sql);
|
||||
NumberFormat num = NumberFormat.getPercentInstance();
|
||||
num.setMinimumFractionDigits(2);// 保留两位小数
|
||||
while (rs.next()) {
|
||||
if (isPersent) {
|
||||
String allBps = rs.getString("bps");
|
||||
if (!allBps.equals("0")) {
|
||||
ntcConnRecordPercent.setBpsPercent(
|
||||
num.format(Double.valueOf(ntcConnRecordPercent.getBps()) / Double.valueOf(allBps)));
|
||||
ntcConnRecordPercent.setBps(num.format(Double.valueOf(ntcConnRecordPercent.getBps())));
|
||||
} else {
|
||||
ntcConnRecordPercent.setBpsPercent("0%");
|
||||
}
|
||||
String allPps = rs.getString("pps");
|
||||
if (!allPps.equals("0")) {
|
||||
ntcConnRecordPercent.setPpsPercent(
|
||||
num.format(Double.valueOf(ntcConnRecordPercent.getPps()) / Double.valueOf(allPps)));
|
||||
ntcConnRecordPercent.setPps(num.format(Double.valueOf(ntcConnRecordPercent.getPps())));
|
||||
} else {
|
||||
ntcConnRecordPercent.setPpsPercent("0%");
|
||||
}
|
||||
} else {
|
||||
String bps = rs.getString("bps");
|
||||
String pps = rs.getString("pps");
|
||||
ntcConnRecordPercent.setBps(bps);
|
||||
ntcConnRecordPercent.setPps(pps);
|
||||
}
|
||||
}
|
||||
logger.info("执行日志查询语句成功,sql={}", sql);
|
||||
} finally {
|
||||
closeConn();
|
||||
}
|
||||
return ntcConnRecordPercent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭数据库连接
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user