diff options
| author | fangshunjian <[email protected]> | 2019-01-22 12:13:38 +0600 |
|---|---|---|
| committer | fangshunjian <[email protected]> | 2019-01-22 12:14:14 +0600 |
| commit | 9b39c65447fc174d9c4bec51ea290b4eb2b9a811 (patch) | |
| tree | 7d1dc0ef331fd20475aa17628b25b70747ddf0e3 /src | |
| parent | 97248b92bac0c7c83f34880c7f7ee195700f18c8 (diff) | |
1、新增 inline-device 历史流量折线图k18-1.0
2、优化交换机监测折线图 查询语句
3、修改 监测设置,一个字段只能设置一个告警配置的限制
4、修改首页菜单宽度
Diffstat (limited to 'src')
5 files changed, 178 insertions, 29 deletions
diff --git a/src/com/nms/thread/DetectInsertTimeOutThread.java b/src/com/nms/thread/DetectInsertTimeOutThread.java index 39b21a8..556bc93 100644 --- a/src/com/nms/thread/DetectInsertTimeOutThread.java +++ b/src/com/nms/thread/DetectInsertTimeOutThread.java @@ -6,7 +6,7 @@ import com.nms.thread.common.ThreadPoolCommon; import com.nms.thread.socket.SSLClient; public class DetectInsertTimeOutThread implements Runnable{ - private static final Logger logger = Logger.getLogger(DetectDatasTimeoutAlarmThread.class); + private static final Logger logger = Logger.getLogger(DetectInsertTimeOutThread.class); private String ip; private int port; private long timeout; diff --git a/src/nis/nms/web/actions/detection/InlineDeviceAction.java b/src/nis/nms/web/actions/detection/InlineDeviceAction.java index aac6215..d92784b 100644 --- a/src/nis/nms/web/actions/detection/InlineDeviceAction.java +++ b/src/nis/nms/web/actions/detection/InlineDeviceAction.java @@ -13,13 +13,17 @@ import org.hibernate.SQLQuery; import com.nis.util.StringUtil;
+import edu.emory.mathcs.backport.java.util.Arrays;
+import nis.nms.domains.CheckTypeInfo;
+import nis.nms.domains.Metadata;
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")
+ @Result(name = "inlineInfoList", value = "/page/detection/monitorData/inlineInfoList.jsp"),
+ @Result(name = "inlineSwitchportMonitorInfo", value = "/page/detection/monitorData/inlineSwitchportMonitorInfo.jsp")
})
@SuppressWarnings("all")
public class InlineDeviceAction extends BaseAction{
@@ -34,6 +38,12 @@ public class InlineDeviceAction extends BaseAction{ private String nodeIp;//查询条件:节点ip
private String addrCode; //查询条件:地域编码
private String ispKeyCode;//查询条件:运营商唯一标识
+ private String sqId;
+ private String ctId;
+ private String detectionSetInfoId;
+ private List metadataList;
+ private List dataList;
+ private String dsiId;
@Override
public String executeAction() throws Exception {
@@ -41,6 +51,8 @@ public class InlineDeviceAction extends BaseAction{ //查询运营商等信息
if("query".equalsIgnoreCase(this.action)) {
result = inlineInfoList();
+ }else if("drawPic".equalsIgnoreCase(this.action)) {
+ result = ajaxDrawDateSource();
}
return result;
}
@@ -180,6 +192,57 @@ public class InlineDeviceAction extends BaseAction{ this.getRequest().setAttribute("page", devicePage);
return "inlineInfoList";
}
+
+
+ public String ajaxDrawDateSource() {
+ String resu = "";
+ try {
+
+ String deviceId = this.getRequest().getParameter("deviceId");//sys_device_info表的id deviceId
+ dsiId = this.getRequest().getParameter("dsiId");
+ sqId = this.getRequest().getParameter("sqId");
+ ctId = this.getRequest().getParameter("checkTypeId");
+ detectionSetInfoId=this.getRequest().getParameter("detectionSetInfoId");
+ CheckTypeInfo checkTypeInfo = (CheckTypeInfo) this.commonService.get(CheckTypeInfo.class,Long.parseLong(ctId));
+
+ String tString = "select * from metadata where table_name = "
+ + "(select table_name from check_type_info where id="
+ + "(select check_type_id from detection_set_info where id=" + dsiId + ")) "
+ + " and chart_state = '0'";
+
+ metadataList = this.commonService.executeSQL(tString, Metadata.class);
+
+ String sql = "SELECT " +
+ " sdi.*,nt.* " +
+ " FROM " +
+ " sys_device_info sdi " +
+ " 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 and sdi.id = ?";
+ List<Map<String,Object>> list = commonService.executeSQLMap(sql, deviceId);
+ if(list != null && list.size()>0) {
+ Map<String, Object> deviceMap = list.get(0);
+ String portName = deviceMap.get("port_name")+"";
+ if(!StringUtil.isBlank(portName)) {
+ String[] split = portName.split(",");
+ dataList = Arrays.asList(split);
+ }
+ }
+ // 针对多项监测都使用分类标识,所以取消判断是否为snmp监控
+ // 得到分类标识字段
+ return "inlineSwitchportMonitorInfo";
+ } catch (Exception e) {
+ e.printStackTrace();
+ logger.error(e.getStackTrace());
+ outHtmlString(
+ "<script type=\"text/javascript\">alert('i18n_MonitorDataAction.emportCurrentXlsAbnormalSet.faild_n81i');this.location='detectionSet.do?action=query&pageNo="
+ + pageNo + "&pageSize=" + pageSize + "'</script>");
+ }
+ return resu;
+
+ }
+
+
+
public CommonService getCommonService() {
return commonService;
@@ -245,5 +308,61 @@ public class InlineDeviceAction extends BaseAction{ this.ispKeyCode = ispKeyCode;
}
+ public SimpleDateFormat getSdf() {
+ return sdf;
+ }
+
+ public void setSdf(SimpleDateFormat sdf) {
+ this.sdf = sdf;
+ }
+
+ public String getSqId() {
+ return sqId;
+ }
+
+ public void setSqId(String sqId) {
+ this.sqId = sqId;
+ }
+
+ public String getCtId() {
+ return ctId;
+ }
+
+ public void setCtId(String ctId) {
+ this.ctId = ctId;
+ }
+
+ public String getDetectionSetInfoId() {
+ return detectionSetInfoId;
+ }
+
+ public void setDetectionSetInfoId(String detectionSetInfoId) {
+ this.detectionSetInfoId = detectionSetInfoId;
+ }
+
+ public List getMetadataList() {
+ return metadataList;
+ }
+
+ public void setMetadataList(List metadataList) {
+ this.metadataList = metadataList;
+ }
+
+ public List getDataList() {
+ return dataList;
+ }
+
+ public void setDataList(List dataList) {
+ this.dataList = dataList;
+ }
+
+ public String getDsiId() {
+ return dsiId;
+ }
+
+ public void setDsiId(String dsiId) {
+ this.dsiId = dsiId;
+ }
+
}
diff --git a/src/nis/nms/web/actions/detection/MonitorDataAction.java b/src/nis/nms/web/actions/detection/MonitorDataAction.java index 90ed064..df751c3 100644 --- a/src/nis/nms/web/actions/detection/MonitorDataAction.java +++ b/src/nis/nms/web/actions/detection/MonitorDataAction.java @@ -12,6 +12,8 @@ import java.util.List; import java.util.Map;
import java.util.Set;
+import javax.servlet.http.HttpServletResponse;
+
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.apache.struts2.config.Result;
@@ -37,6 +39,7 @@ import nis.nms.domains.OptionTable; import nis.nms.domains.VDetectionInfoNew;
import nis.nms.service.CommonService;
import nis.nms.util.BaseAction;
+import nis.nms.util.Common;
import nis.nms.util.Constant;
import nis.nms.util.DateUtil;
import nis.nms.util.ExportUtils;
@@ -1013,18 +1016,25 @@ public class MonitorDataAction extends BaseAction { try {
String[] linStrings = lines.split(",");// 选择的端口,可能是多个
String temp = "";
- String source = "select max(to_char(data_check_time,'yyyy-mm-dd HH24:mi')) maxTime," + sortFiledType[0]
- + " from " + checkTypeInfo.getTableName() + " t where " + metadata.getFiledName() + " is not null"
+ String source = "select to_char(din.data_check_time,'yyyy-mm-dd HH24:mi') maxTime," + sortFiledType[0]
+ + " from " + checkTypeInfo.getTableName() + " t "
+ + " left join detection_info_new din on t.DETECTION_INFO_ID = din.DETECTION_INFO_ID "
+ + "where " + metadata.getFiledName() + " is not null"
// +" and t.data_check_time >= trunc(sysdate-30)"
- + " and t.detection_info_id in "
+ /*+ " and t.detection_info_id in "
+ "(select d.id from detection_info d where d.detection_set_info_id=" + dsiId + " and d.seq_id = "
- + seqId + ")";
-
+ + seqId + ")";*/
+ + " and din.seq_id =" + seqId
+ + " and din.detection_set_info_id=" +dsiId ;
if (null != startTime && !startTime.equals("") && null != endTime && !endTime.equals("")) {
source += " and to_char(data_check_time,'yyyy-mm-dd')>= '" + startTime
+ "' and to_char(data_check_time,'yyyy-mm-dd')<='" + endTime + "'";
} else {
- source += " and t.data_check_time >= trunc(sysdate-1) ";
+ if(Constant.IS_MYSQL) {
+ source += " and t.data_check_time >= '" + Common.getDateStr(new Date(), "yyyy-MM-dd 00:00:00") +"' " ;
+ }else {
+ source += " and t.data_check_time >= trunc(sysdate-1) ";
+ }
}
if (sortFiledType[1].toString().equals("NUMBER") || sortFiledType[1].toString().equals("Number")) {
temp = lines.substring(0, lines.length() - 1);
@@ -1043,25 +1053,32 @@ public class MonitorDataAction extends BaseAction { // ------------------以上确定最后一个数据点----------------------------
if (lastList != null && lastList.size() > 0) {
Object[] row = (Object[]) lastList.get(0);
- String lastSource = "select * from ( select to_char(data_check_time,'yyyy-mm-dd HH24:mi'),"
- + metadata.getFiledName() + " from " + checkTypeInfo.getTableName() + " t where "
+ String lastSource = "select * from ( select to_char(t.data_check_time,'yyyy-mm-dd HH24:mi') data_check_time ,"
+ + metadata.getFiledName() + " from " + checkTypeInfo.getTableName() + " t "
+ + " where "
+ metadata.getFiledName() + " is not null"
// +" and t.data_check_time >= trunc(sysdate-30)"
- + " and t.detection_info_id in "
+ /*+ " and t.detection_info_id in "
+ "(select d.id from detection_info d where d.detection_set_info_id=" + dsiId
- + " and d.seq_id = " + seqId + ")";
-
+ + " and d.seq_id = " + seqId + ")";*/
+ + " and t.seq_id =" + seqId
+ + " and t.detection_set_info_id=" +dsiId ;
if (null != startTime && !startTime.equals("") && null != endTime && !endTime.equals("")) {
- lastSource += " and to_char(data_check_time,'yyyy-mm-dd')>= '" + startTime
- + "' and to_char(data_check_time,'yyyy-mm-dd')<='" + endTime + "'";
+ lastSource += " and to_char(t.data_check_time,'yyyy-mm-dd')>= '" + startTime
+ + "' and to_char(t.data_check_time,'yyyy-mm-dd')<='" + endTime + "'";
} else {
- lastSource += " and t.data_check_time >= trunc(sysdate-1) ";
+ if(Constant.IS_MYSQL) {
+ lastSource += " and t.data_check_time >= '" + Common.getDateStr(new Date(), "yyyy-MM-dd 00:00:00") +"' " ;
+ }else {
+ lastSource += " and t.data_check_time >= trunc(sysdate-1) ";
+ }
}
if (sortFiledType[1].toString().equals("NUMBER") || sortFiledType[1].toString().equals("Number")) {
- lastSource += " and " + sortFiledType[0] + " = " + row[1] + " order by data_check_time desc) ttt ";
+ lastSource += " and " + sortFiledType[0] + " = " + row[1] + " order by din.data_check_time desc ) ttt ";
} else if (sortFiledType[1].toString().indexOf("VARCHAR2") != -1) {
- lastSource += " and " + sortFiledType[0] + " = '" + row[1] + "' order by data_check_time desc) ttt ";
+ lastSource += " and " + sortFiledType[0] + " = '" + row[1] + "' order by din.data_check_time desc) ttt ";
}
+ lastSource += " order by data_check_time desc ";
/* lastSource += " where rownum < 21"; */
// @2018年4月10日18:45:00 fang 修改rownum 适配 mysql
@@ -2904,7 +2921,11 @@ public class MonitorDataAction extends BaseAction { source += " and to_char(data_check_time,'yyyy-mm-dd')>= '" + startTime
+ "' and to_char(data_check_time,'yyyy-mm-dd')<='" + endTime + "'";
} else {
- source += " and t.data_check_time >= trunc(sysdate-1) ";
+ if(Constant.IS_MYSQL) {
+ source += " and t.data_check_time >= '" + Common.getDateStr(new Date(), "yyyy-MM-dd 00:00:00") +"' " ;
+ }else {
+ source += " and t.data_check_time >= trunc(sysdate-1) ";
+ }
}
if (sortFiledType[1].toString().equals("NUMBER")
|| sortFiledType[1].toString().equals("Number")) {
@@ -2930,11 +2951,12 @@ public class MonitorDataAction extends BaseAction { source += " order by data_check_time_digital desc) tttt ";
// @2018年4月10日18:45:00 fang 修改rownum 适配 mysql
- if (Constant.IS_MYSQL) {
+ /*if (Constant.IS_MYSQL) {
source = source + " order by data_check_time_digital asc limit 20";
} else {
source += " where rownum < 21 order by data_check_time_digital asc";// 查询最近时间的21条数据
- }
+ }*/
+ source += " order by data_check_time_digital asc";
System.out.println("------NoFirstInSource--------sql:" + source);
List lineSourceList = this.commonService.executeSQL(source);
@@ -3012,7 +3034,11 @@ public class MonitorDataAction extends BaseAction { source += " and to_char(data_check_time,'yyyy-mm-dd')>= '" + startTime
+ "' and to_char(data_check_time,'yyyy-mm-dd')<='" + endTime + "'";
} else {
- source += " and t.data_check_time >= trunc(sysdate-1) ";// 默认查询一天的数据
+ if(Constant.IS_MYSQL) {
+ source += " and t.data_check_time >= '" + Common.getDateStr(new Date(), "yyyy-MM-dd 00:00:00") +"' " ;
+ }else {
+ source += " and t.data_check_time >= trunc(sysdate-1) ";
+ }
}
if (sortFiledType[1].toString().equals("NUMBER")
|| sortFiledType[1].toString().equals("Number")) {
@@ -3032,11 +3058,12 @@ public class MonitorDataAction extends BaseAction { * ;//查询最近时间的21条数据
*/
// @2018年4月10日18:45:00 fang 修改rownum 适配 mysql
- if (Constant.IS_MYSQL) {
+ /*if (Constant.IS_MYSQL) {
source = source + " order by data_check_time_digital asc limit 20";
} else {
source += " where rownum < 21 order by data_check_time_digital asc";// 查询最近时间的21条数据
- }
+ }*/
+ source = source + " order by data_check_time_digital asc";
System.out.println("------source--------sql:" + source);
List lineSourceList = this.commonService.executeSQL(source);
@@ -3097,7 +3124,9 @@ public class MonitorDataAction extends BaseAction { String jsonStr = JSONArray.fromObject(returnList).toString();
System.out.println(jsonStr);
- this.getResponse().setCharacterEncoding("utf-8");
+ HttpServletResponse response = this.getResponse();
+ response.setCharacterEncoding("utf-8");
+ response.setContentType("application/json");
PrintWriter printWriter = this.getResponse().getWriter();
printWriter.write(jsonStr);
printWriter.close();
diff --git a/src/nis/nms/web/actions/detection/PoliceSetAction.java b/src/nis/nms/web/actions/detection/PoliceSetAction.java index 0bc3ec2..db0e985 100644 --- a/src/nis/nms/web/actions/detection/PoliceSetAction.java +++ b/src/nis/nms/web/actions/detection/PoliceSetAction.java @@ -235,10 +235,10 @@ public class PoliceSetAction extends BaseAction { + dataPoliceRelation.getMetadata().getId();
List list = this.commonService.executeSQL(sql);
int num = Integer.parseInt(list.get(0).toString());
- if (num > 0) {
+ /*if (num > 0) {
this.outHtmlString("<script>alert('i18n_PoliceSetAction.queryPoliceSetInfo.recordExists_n81i');this.location='policeSet.do?action=query&pIden="+pIden+"&ctn="+ctn+"&ip="+ip+"&pageNo="+pageNo+"&pageSize="+pageSize+"&setId="+setId+"'</script>");
return;
- }
+ }*/
Metadata metadata = (Metadata) this.commonService.get(
Metadata.class, dataPoliceRelation.getMetadata().getId());
@@ -286,10 +286,10 @@ public class PoliceSetAction extends BaseAction { "from DataPoliceRelation where detectionSetInfo.id=? and metadata.id=? and id<>?",
Long.valueOf(detectionSetInfoId), dataPoliceRelation.getMetadata().getId(), dataPoliceRelation
.getId());
- if (list != null && list.size() > 0) {
+ /*if (list != null && list.size() > 0) {
this.outHtmlString("<script>alert('i18n_PoliceSetAction.queryPoliceSetInfo.recordExists_n81i');this.location='policeSet.do?action=openUpdate&ids="+policeRelationId+"&detectionSetInfoId="+detectionSetInfoId+"'</script>");
return;
- }
+ }*/
DataPoliceRelation dpRelation = (DataPoliceRelation) this.commonService
.get(DataPoliceRelation.class, dataPoliceRelation.getId());
DetectionSetInfo ds = null;
diff --git a/src/nis/nms/web/actions/detection/SwitchDetectionAction.java b/src/nis/nms/web/actions/detection/SwitchDetectionAction.java index 6757af9..964ed69 100644 --- a/src/nis/nms/web/actions/detection/SwitchDetectionAction.java +++ b/src/nis/nms/web/actions/detection/SwitchDetectionAction.java @@ -167,6 +167,7 @@ public class SwitchDetectionAction extends BaseAction { if (!com.nis.util.StringUtil.isBlank(requestType) && requestType.equals("topo")) {
resultpage = totalSwitchInfoStatisticsForTopo();
} else {
+ this.networElementType = "1";
resultpage = totalSwitchInfoStatistics();
}
|
