diff --git a/WebRoot/i18n/globalMessages_en_US.properties b/WebRoot/i18n/globalMessages_en_US.properties
index dd30a29..26cc7bf 100644
--- a/WebRoot/i18n/globalMessages_en_US.properties
+++ b/WebRoot/i18n/globalMessages_en_US.properties
@@ -7406,3 +7406,6 @@ xt_mk_jbxx.604.mkmc=Advanced
xt_mk_jbxx.604.mkms=Advanced configuration function menu
pidFile.keyword.allblank=PID file and keyword can not all blank
network.throughput=Network Throughput
+isp=ISP
+addr=Entrance
+deviceType=Device Type
\ No newline at end of file
diff --git a/WebRoot/i18n/globalMessages_ru_RU.properties b/WebRoot/i18n/globalMessages_ru_RU.properties
index 0f3c5b9..bce713e 100644
--- a/WebRoot/i18n/globalMessages_ru_RU.properties
+++ b/WebRoot/i18n/globalMessages_ru_RU.properties
@@ -6532,4 +6532,7 @@ topoManage.TopoNameSetting=\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u04
xt_mk_jbxx.604.mkmc=\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430
xt_mk_jbxx.604.mkms=\u041c\u0435\u043d\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438
pidFile.keyword.allblank=Процесс файл PID и процесс поиска ключевых слов не могут быть пустыми одновременно
-network.throughput=Пропускная Способность Сети
\ No newline at end of file
+network.throughput=Пропускная Способность Сети
+isp=Оператор
+addr=Регион
+deviceType=Тип Оборудования
\ No newline at end of file
diff --git a/WebRoot/i18n/globalMessages_zh_CN.properties b/WebRoot/i18n/globalMessages_zh_CN.properties
index 5a0c6dc..75dbc47 100644
--- a/WebRoot/i18n/globalMessages_zh_CN.properties
+++ b/WebRoot/i18n/globalMessages_zh_CN.properties
@@ -7417,4 +7417,7 @@ topoManage.TopoNameSetting=\u62d3\u6251\u56fe\u540d\u79f0
xt_mk_jbxx.604.mkmc=\u9ad8\u7ea7\u914d\u7f6e
xt_mk_jbxx.604.mkms=\u9ad8\u7ea7\u914d\u7f6e\u529f\u80fd\u83dc\u5355
pidFile.keyword.allblank=PID文件和进程关键字不能同时为空
-network.throughput=流量展示
\ No newline at end of file
+network.throughput=流量展示
+isp=运营商
+addr=地域
+deviceType=设备类型
\ No newline at end of file
diff --git a/WebRoot/page/detection/monitorData/inlineInfoList.jsp b/WebRoot/page/detection/monitorData/inlineInfoList.jsp
new file mode 100644
index 0000000..2d33b17
--- /dev/null
+++ b/WebRoot/page/detection/monitorData/inlineInfoList.jsp
@@ -0,0 +1,147 @@
+<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
+<%@ taglib prefix="c" uri="/jstl/c"%>
+<%@ taglib prefix="fn" uri="/jstl/fn"%>
+<%@ taglib prefix="fmt" uri="/jstl/fmt"%>
+<%
+ String path = request.getContextPath();
+ String basePath = request.getScheme() + "://"
+ + request.getServerName() + ":" + request.getServerPort()
+ + path + "/";
+%>
+
+
+
+
+ inline device info
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/WebRoot/page/detection/switchInfo/switchInfoList.jsp b/WebRoot/page/detection/switchInfo/switchInfoList.jsp
index fa40b42..edf8507 100644
--- a/WebRoot/page/detection/switchInfo/switchInfoList.jsp
+++ b/WebRoot/page/detection/switchInfo/switchInfoList.jsp
@@ -397,7 +397,7 @@
<%=(si.getIfHighSpeed() ==null?MyNumberFormat.formatStr1(new BigDecimal(si.getIfSpeed()),0,1000):si.getIfHighSpeed()+"Mbps") %>
- ${si.ifOperStatus}
+ ${si.ifOperStatus==1?'up':'down'}
<%=MyNumberFormat.formatStr1(si.getIfInOctetsSpeed()==null?null:(new BigDecimal(si.getIfInOctetsSpeed()).multiply(new BigDecimal(8))),0,1024) %>
diff --git a/src/nis/nms/service/CommonService.java b/src/nis/nms/service/CommonService.java
index dd1b890..d243f08 100644
--- a/src/nis/nms/service/CommonService.java
+++ b/src/nis/nms/service/CommonService.java
@@ -8,12 +8,8 @@ import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.math.BigDecimal;
-import java.sql.CallableStatement;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
-import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
@@ -37,6 +33,7 @@ import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.SQLQuery;
import org.hibernate.criterion.Expression;
+import org.hibernate.transform.Transformers;
import org.springframework.dao.DataAccessResourceFailureException;
import org.springframework.util.Assert;
@@ -203,6 +200,29 @@ public class CommonService extends HibernateGeneralDaoImpl{
return page;
}
+ public Page findByPageForSqlMap(String sql, int pageNo, int pageSize, Object... values) throws Exception {
+ Assert.hasText(sql);
+ Assert.isTrue(pageNo >= 1, "pageNo should start from 1");
+ // Count查询
+ if (values != null && values.length == 0) {
+ values = null;
+ }
+ List countlist = null;
+ long totalCount = 0;
+ String countQueryString = " select count(*) as totalCount from ( " + sql + " ) trySearch ";
+ totalCount = (Long)createSQLQuery(countQueryString, values)
+ .addScalar("totalCount", Hibernate.LONG)
+ .uniqueResult();
+ if (totalCount < 1) return new Page();
+ // 实际查询返回分页对象
+ int startIndex = Page.getStartOfPage(pageNo, pageSize);
+ Query query = createSQLQuery(sql, values);
+ List list = query.setFirstResult(startIndex).setMaxResults(pageSize).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).list();
+ Page page = new Page(startIndex, totalCount, pageSize, list);
+ return page;
+ }
+
+
public List executeSQL(String sql,Class entity) throws Exception {
Assert.hasText(sql);
Query query = createSQLQuery(sql).addEntity(entity);
diff --git a/src/nis/nms/web/actions/detection/InlineDeviceAction.java b/src/nis/nms/web/actions/detection/InlineDeviceAction.java
new file mode 100644
index 0000000..aac6215
--- /dev/null
+++ b/src/nis/nms/web/actions/detection/InlineDeviceAction.java
@@ -0,0 +1,249 @@
+package nis.nms.web.actions.detection;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.apache.struts2.config.Result;
+import org.apache.struts2.config.Results;
+import org.hibernate.SQLQuery;
+
+import com.nis.util.StringUtil;
+
+import nis.nms.service.CommonService;
+import nis.nms.util.BaseAction;
+import nis.nms.util.Constant;
+import nis.nms.util.Page;
+
+@Results({
+ @Result(name = "inlineInfoList", value = "/page/detection/monitorData/inlineInfoList.jsp")
+})
+@SuppressWarnings("all")
+public class InlineDeviceAction extends BaseAction{
+ private static final Logger logger = Logger.getLogger(InlineDeviceAction.class);
+ private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ private static final long serialVersionUID = 1L;
+ private CommonService commonService;
+ private int pageNo = 1;
+ private int pageSize = this.getDefaultPageSize(); // 每页显示的记录条数
+ private Page page;
+ private String action;
+ private String nodeIp;//查询条件:节点ip
+ private String addrCode; //查询条件:地域编码
+ private String ispKeyCode;//查询条件:运营商唯一标识
+
+ @Override
+ public String executeAction() throws Exception {
+ String result = "inlineInfoList";
+ //查询运营商等信息
+ if("query".equalsIgnoreCase(this.action)) {
+ result = inlineInfoList();
+ }
+ return result;
+ }
+
+ /**
+ * 查询 串联设备运营商等信息
+ * @return
+ * @throws Exception
+ */
+ public String inlineInfoList() throws Exception {
+ Long systemID = this.getSystemID();//当前登录的 视图 id
+ //运营商信息
+ String sql = "select * from sys_isp_info order by id";
+ List ispList = commonService.executeSQLMap(sql);
+ this.getRequest().setAttribute("ispList", ispList);
+ //地域信息
+ sql = "select * from sys_addr_info order by id";
+ List addrList = commonService.executeSQLMap(sql);
+ this.getRequest().setAttribute("addrList", addrList);
+
+ StringBuilder sbSql = new StringBuilder();
+ sql = "SELECT " +
+ " sdi.*, sii.isp_key_name, sai.addr_name, nt.* " +
+ " FROM " +
+ " sys_device_info sdi " +
+ " LEFT JOIN sys_isp_info sii ON sdi.isp = sii.isp_key_code " +
+ " LEFT JOIN sys_addr_info sai ON sdi.entrance_id = sai.addr_code " +
+ " LEFT JOIN ( SELECT node_ip, seq_id FROM node_table GROUP BY node_ip ) nt ON nt.node_ip = sdi.ip_addr " +
+ "where sdi.status != 0 ";
+ sbSql.append(sql);
+ if(systemID != -1) {
+ sbSql.append(" and sdi.system_id = ").append(systemID);
+ }
+ if(!StringUtil.isBlank(nodeIp)) {
+ sbSql.append(" and sdi.ip_addr like '%").append(nodeIp).append("%' ");
+ }
+ if(!StringUtil.isBlank(addrCode)) {
+ sbSql.append(" and sdi.entrance_id = ").append(addrCode);
+ }
+ if(!StringUtil.isBlank(ispKeyCode)) {
+ sbSql.append(" and sdi.isp = ").append(ispKeyCode);
+ }
+ sbSql.append(" order by sdi.ip_addr,sdi.link_id");
+ Page devicePage = commonService.findByPageForSqlMap(sbSql.toString(), pageNo, pageSize);
+ //List> deviceList = commonService.executeSQLMap();
+
+ //查询所有的 串联设备 bypass 状态
+ sql = "SELECT " +
+ " dp.* " +
+ "FROM " +
+ " di_propmstatus dp " +
+ " LEFT JOIN detection_info_new din ON dp.detection_info_id = din.DETECTION_INFO_ID " +
+ " LEFT JOIN node_table nt ON nt.seq_id = din.SEQ_ID " +
+ "WHERE " +
+ " nt.network_element_type = 1 " +
+ " AND node_type = 1 " +
+ " AND node_state = 0 " ;
+ sbSql.setLength(0);
+ sbSql.append(sql);
+ if(systemID != -1) {
+ sbSql.append(" and nt.system_id = ").append(systemID);
+ }
+ List> byPassList = commonService.executeSQLMap(sbSql.toString());
+ Map> byPassMap = new HashMap>(byPassList.size());
+ for(Map map : byPassList) {
+ String seqId = map.get("SEQ_ID")+"";
+ String status = map.get("propmStatus")+"";
+ String index = map.get("popmIndex")+"";
+ byPassMap.put(seqId+index, map);
+ }
+
+ //查询所有的串联设备的 端口数据
+ sql = "SELECT " +
+ " dp.* " +
+ "FROM " +
+ " di_switchport dp " +
+ " LEFT JOIN detection_info_new din ON dp.detection_info_id = din.DETECTION_INFO_ID " +
+ " LEFT JOIN node_table nt ON nt.seq_id = din.SEQ_ID " +
+ "WHERE " +
+ " nt.network_element_type = 1 " +
+ " AND node_type = 1 " +
+ " AND node_state = 0 " ;
+ sbSql.setLength(0);
+ sbSql.append(sql);
+ if(systemID != -1) {
+ sbSql.append(" and nt.system_id = ").append(systemID);
+ }
+ List> portList = commonService.executeSQLMap(sbSql.toString());
+ Map> portMap = new HashMap>(byPassList.size());
+ for(Map map : portList) {
+ String seqId = map.get("SEQ_ID")+"";
+ String ifdescr = map.get("IFDESCR")+"";
+ portMap.put(seqId+ifdescr, map);
+ }
+
+ List> deviceList = (List>)devicePage.getResult();
+ for(Map device : deviceList) {
+ String seqId = device.get("seq_id")+"";
+ String linkIndex = device.get("link_id")+"";
+ String portName = device.get("port_name")+"";
+
+ Map map = byPassMap.get(seqId+linkIndex);
+ if(map != null) {
+ String s = map.get("propmStatus")+"";
+ s = (s == null ? "No Data": (s.equals("1") ? "pass" : "bypass"));
+ device.put("propmStatus", s);
+ }
+ if(!StringUtil.isBlank(portName)) {
+ String[] portArr = portName.split(",");
+ long inoctetsspeed = 0l;//输入
+ long inpktsspeed = 0l;//输入包速率
+ String checkTime = null;
+ for(String port : portArr) {
+ Map p = portMap.get(seqId+ port);
+ if(p != null) {
+ Object inOct = p.get("INOCTETSSPEED");
+ Object inPac = p.get("INPKTSSPEED");
+ if(inOct != null) {
+ inoctetsspeed += Long.valueOf(inOct+"");
+ }
+ if(inPac != null) {
+ inpktsspeed += Long.valueOf(inPac+"");
+ }
+ if(checkTime == null) {
+ checkTime = p.get("DATA_CHECK_TIME_DIGITAL") +"";
+ Date date = new Date(Long.valueOf(checkTime));
+ checkTime = sdf.format(date);
+ }
+ }
+ }
+
+ device.put("INOCTETSSPEED", String.format("%.2f", inoctetsspeed/1024.0/1024.0) +" Mbps");
+ device.put("INPKTSSPEED", inpktsspeed +" pps");
+ device.put("DATA_CHECK_TIME",checkTime);
+ }
+ }
+ this.getRequest().setAttribute("page", devicePage);
+ return "inlineInfoList";
+ }
+
+ public CommonService getCommonService() {
+ return commonService;
+ }
+
+ public void setCommonService(CommonService commonService) {
+ this.commonService = commonService;
+ }
+
+ public int getPageNo() {
+ return pageNo;
+ }
+
+ public void setPageNo(int pageNo) {
+ this.pageNo = pageNo;
+ }
+
+ public int getPageSize() {
+ return pageSize;
+ }
+
+ public void setPageSize(int pageSize) {
+ this.pageSize = pageSize;
+ }
+
+ public Page getPage() {
+ return page;
+ }
+
+ public void setPage(Page page) {
+ this.page = page;
+ }
+
+ public String getAction() {
+ return action;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ public String getNodeIp() {
+ return nodeIp;
+ }
+
+ public void setNodeIp(String nodeIp) {
+ this.nodeIp = nodeIp;
+ }
+
+ public String getAddrCode() {
+ return addrCode;
+ }
+
+ public void setAddrCode(String addrCode) {
+ this.addrCode = addrCode;
+ }
+
+ public String getIspKeyCode() {
+ return ispKeyCode;
+ }
+
+ public void setIspKeyCode(String ispKeyCode) {
+ this.ispKeyCode = ispKeyCode;
+ }
+
+
+}
diff --git a/src/nis/nms/web/actions/detection/SwitchDetectionAction.java b/src/nis/nms/web/actions/detection/SwitchDetectionAction.java
index b306223..6757af9 100644
--- a/src/nis/nms/web/actions/detection/SwitchDetectionAction.java
+++ b/src/nis/nms/web/actions/detection/SwitchDetectionAction.java
@@ -860,10 +860,9 @@ public class SwitchDetectionAction extends BaseAction {
si.setIfAdminStatus(objs[6] == null ? null : ((BigDecimal) objs[6]).intValue());
si.setIfOperStatus(objs[7] == null ? null : ((BigDecimal) objs[7]).intValue());
// si.setIfLastChange(objs[8]==null?null:Long.parseLong((String)objs[8]));
-
- si.setIfInOctets(objs[9] == null ? null : ((BigDecimal) objs[9]).doubleValue());
- si.setIfInUcastPkts(objs[10] == null ? null : ((BigDecimal) objs[10]).doubleValue());
- si.setIfInNUcastPkts(objs[11] == null ? null : ((BigDecimal) objs[11]).doubleValue());
+ si.setIfInOctets(objs[9] == null ? 0.00d : ((BigDecimal) objs[9]).doubleValue());
+ si.setIfInUcastPkts(objs[10] == null ? 0.00d : ((BigDecimal) objs[10]).doubleValue());
+ si.setIfInNUcastPkts(objs[11] == null ? 0.00d : ((BigDecimal) objs[11]).doubleValue());
// logger.debug((objs[10]==null?null:((BigDecimal)objs[10]).doubleValue())+"
// vs
// "+(objs[11]==null?null:((BigDecimal)objs[11]).doubleValue()));
@@ -871,7 +870,7 @@ public class SwitchDetectionAction extends BaseAction {
si.setIfInErrors(objs[13] == null ? null : ((BigDecimal) objs[13]).doubleValue());
si.setIfInUnknownProtos(objs[14] == null ? null : ((BigDecimal) objs[14]).doubleValue());
- si.setIfOutOctets(objs[15] == null ? null : ((BigDecimal) objs[15]).doubleValue());
+ si.setIfOutOctets(objs[15] == null ? 0.00d : ((BigDecimal) objs[15]).doubleValue());
si.setIfOutUcastPkts(objs[16] == null ? null : ((BigDecimal) objs[16]).doubleValue());
si.setIfOutNUcastPkts(objs[17] == null ? null : ((BigDecimal) objs[17]).doubleValue());
@@ -1050,8 +1049,7 @@ public class SwitchDetectionAction extends BaseAction {
portInfo.setIfInNUcastPkts(news.getIfInNUcastPkts() == null ? 0 : news.getIfInNUcastPkts().longValue());
portInfo.setIfInDiscards(news.getIfInDiscards() == null ? 0 : news.getIfInDiscards().longValue());
portInfo.setIfInErrors(news.getIfInErrors() == null ? 0 : news.getIfInErrors().longValue());
- portInfo.setIfInUnknownProtos(
- news.getIfInUnknownProtos() == null ? 0 : news.getIfInUnknownProtos().longValue());
+ portInfo.setIfInUnknownProtos(news.getIfInUnknownProtos() == null ? 0 : news.getIfInUnknownProtos().longValue());
portInfo.setIfOutOctets(news.getIfOutOctets() == null ? 0 : news.getIfOutOctets().longValue());
portInfo.setIfOutUcastPkts(news.getIfOutUcastPkts() == null ? 0 : news.getIfOutUcastPkts().longValue());
portInfo.setIfOutNUcastPkts(news.getIfOutNUcastPkts() == null ? 0 : news.getIfOutNUcastPkts().longValue());
@@ -1208,8 +1206,7 @@ public class SwitchDetectionAction extends BaseAction {
}
double dOutPks = oupks + onupks;
- BigDecimal outPksSpeed = new BigDecimal(dOutPks * 1000).divide(new BigDecimal(waitTime), 2,
- RoundingMode.HALF_UP);
+ BigDecimal outPksSpeed = new BigDecimal(dOutPks * 1000).divide(new BigDecimal(waitTime), 2,RoundingMode.HALF_UP);
// logger.debug("outdata:>"+"("+ifOutUcastPkts_n+"-"+ifOutUcastPkts_o+")+("+ifOutNucastPkts_n+"-"+ifOutNucastPkts_o+")="+((ifOutUcastPkts_n
// - ifOutUcastPkts_o)+(ifOutNucastPkts_n - ifOutNucastPkts_o))+" /
// timss"+waitTime+" values "+ (new
@@ -1227,7 +1224,7 @@ public class SwitchDetectionAction extends BaseAction {
logger.debug("端口数据计算抛弃数据:输入包速度与输入字节速度计算式:(" + inPksSpeed_a + " * " + minPacketSize + " > "
+ ifinoctetsspeed_a + ")");
logger.debug("端口数据计算抛弃数据-------");
- inPksSpeed_a = null;
+ inPksSpeed_a = 0.0;
}
Double outPksSpeed_a = outPksSpeed.doubleValue(); // --单位pps
@@ -1237,7 +1234,7 @@ public class SwitchDetectionAction extends BaseAction {
logger.debug("端口数据计算抛弃数据:输出包速度与输入字节速度计算式:(" + outPksSpeed_a + " * " + minPacketSize + " > "
+ ifoutoctetsspeed_a + ")");
logger.debug("端口数据计算抛弃数据-------");
- outPksSpeed_a = null;
+ outPksSpeed_a = 0.0;
}
double maxSpeed = (portInfo.getIfHighSpeed() == null || portInfo.getIfHighSpeed().longValue() == 0)
@@ -1251,7 +1248,7 @@ public class SwitchDetectionAction extends BaseAction {
logger.debug("端口数据计算抛弃数据:时间:(" + news.getLastLongTime() + "-" + old.getLastLongTime() + ")");
logger.debug("端口数据计算抛弃数据:输入字节速度和带宽:(" + ifinoctetsspeed_a + " vs " + maxSpeed + ")");
logger.debug("端口数据计算抛弃数据-------");
- portInfo.setIfInOctetsSpeed(null);
+ portInfo.setIfInOctetsSpeed(0.0);
}
// System.out.println(" date "+portInfo.getIfDescr()+"
// "+portInfo.getIfInOctetsSpeed() +" "+ifinoctetsspeed_a);
@@ -1264,7 +1261,7 @@ public class SwitchDetectionAction extends BaseAction {
logger.debug("端口数据计算抛弃数据:时间:(" + news.getLastLongTime() + "-" + old.getLastLongTime() + ")");
logger.debug("端口数据计算抛弃数据:输出字节速度和带宽:(" + ifoutoctetsspeed_a + " vs " + maxSpeed + ")");
logger.debug("端口数据计算抛弃数据-------");
- portInfo.setIfOutOctetsSpeed(null);
+ portInfo.setIfOutOctetsSpeed(0.0);
}
portInfo.setInpktsspeed(inPksSpeed_a);
portInfo.setOutpktsspeed(outPksSpeed_a);