1.网元监测页面新增节点组 网元类型过滤

2.修复服务器监测 查看详细信息等返回无监测类别回显的bug
This commit is contained in:
wangwenrui
2019-01-04 19:12:07 +08:00
parent 6914855e4b
commit 0eaefb3deb
4 changed files with 111 additions and 100 deletions

View File

@@ -67,6 +67,8 @@
<input type="hidden" name="stateInfo" id="stateInfo" value="${stateInfo}" />
<input type="hidden" name="pageNo" value="${pageNo }" />
<input type="hidden" name="pageSize" value="${pageSize }" />
<input type="hidden" name="checkType" value="${checkType }" />
<input type="hidden" name="netElementType" value="${netElementType }" />
<!-- type为空服务器检测type=1网元检测 type=2:异常网元 -->
<input type="hidden" value="${type }" name="type" id="type" />
<c:forEach items="${ids}" var="ids" varStatus="vs">

View File

@@ -258,6 +258,8 @@
value="${police_level }" />
<input type="hidden" name="mypageNo" value="${mypageNo }" />
<input type="hidden" name="mypageSize" value="${mypageSize }" />
<input type="hidden" name="checkType" value="${checkType }" />
<input type="hidden" name="netElementType" value="${netElementType }" />
<div id="divTop">
<div class="box_1">
<label class="divTopText"><font class="selectText">i18n_dil.text.startTime_n81i</font>:

View File

@@ -514,8 +514,22 @@ $(function(){
<input type="hidden" name="stateInfo" title="i18n_mnel.message.staeInfo_n81i" value="${stateInfo}" id="stateInfo"
onkeyup="lianxiangStateInfokeyup();"/>
<%-- <div id='suggest2' class="ac_results" style="min-width: 200px; width: auto;"></div></label> --%>
<label class="divTopText"><font class="selectText">i18n_smiln.text.nodeGroup_n81i</font>
<input type="text" name="nodeGroupStr" title="i18n_smiln.message.nodeGroup_n81i" value="${nodeGroupStr}" id="nodeGroupStr"
onkeyup="lianxiangkeyup('groupName','NodegroupTable','String','nodeGroupStr','suggest1',this.value);" /></label>
<label class="divTopText"><font class="selectText">i18n_sitl.text.netType_n81i</font>
<select name="netElementType">
<option value="-1" <c:if test="${empty netElementType or netElementType eq -1}">selected ="selected"</c:if>>i18n_dwl.text.changeEmergentDefault_n81i</option>
<c:forEach items="${allnetElementType }" var="netElementTypeInfo">
<%-- <c:if test="${checkTypeInfo.isSnmp ne 1 or checkTypeInfo.id eq 7}"> --%>
<option value="${netElementTypeInfo.typeCode }" <c:if test="${netElementTypeInfo.typeCode eq netElementType}">selected ="selected"</c:if>>${netElementTypeInfo.typeValue }</option>
<%-- </c:if> --%>
</c:forEach>
</select>
</label>
<img src="<c:url value='/images/button_chaxun.png'/>"
class="img_middle2" onclick="javascript:qry();" />
</div>
<div class="box_2">
<input type="button" class=btn3_mouseout

View File

@@ -89,6 +89,7 @@ public class MonitorDataAction extends BaseAction {
private List<List> vnodeIpGroupList;
private List<List> nodeIpGroupListNew;
private List<CheckTypeInfo> allCheckTypeInfo;
private List<OptionTable> allnetElementType;//网元类型集合
private List<Metadata> metadataList;
private String metaId;
private String nodeIp;
@@ -149,6 +150,8 @@ public class MonitorDataAction extends BaseAction {
private String queryNEChild;
private String detectionSetInfoId;
private Integer netElementType;//网元类型
/**
* 入口action=(query queryNE queryAbnormalSet)几乎是统一业务逻辑,修改时同步修改
*/
@@ -173,9 +176,8 @@ public class MonitorDataAction extends BaseAction {
if (!StringUtil.isBlank(requestType) && requestType.equals("topo")) {
queryMonitorDataInfoNewForTopo();
resultpage = "queryMonitorDataInfoChild";
} else if(!StringUtil.isBlank(requestType) && requestType.equals("newTopo")){
queryMonitorDataInfoNewForTopoDetail();
resultpage = "queryMonitorDataInfoNewTopo";
} else if(!StringUtil.isBlank(requestType) && requestType.equals("newTopo")) {
resultpage=queryMonitorDataInfoNewForTopoChild();
} else {
this.queryServerMonitorDataInfoNew();// 服务器监测-自动加载
resultpage = "queryServerMonitorDataInfoChild";
@@ -197,6 +199,7 @@ public class MonitorDataAction extends BaseAction {
// 详情、时序图页面标识监测数据与异常设备菜单
type = "1";
queryCheckTypeInfo();
queryNetElementType();
this.queryNE();
resultpage = "queryNE";
} else if ("queryNEChild".equals(this.action)) {
@@ -1010,7 +1013,7 @@ 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]
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"
// +" and t.data_check_time >= trunc(sysdate-30)"
+ " and t.detection_info_id in "
@@ -1023,38 +1026,6 @@ public class MonitorDataAction extends BaseAction {
} 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);
source += " and " + sortFiledType[0] + " in (" + temp + ") group by " + sortFiledType[0]
+ " order by maxTime desc";
} else if (sortFiledType[1].toString().indexOf("VARCHAR2") != -1) {
for (int i = 0; i < linStrings.length; i++) {
temp += "'" + linStrings[i] + "',";
}
temp = temp.substring(0, temp.length() - 1);
source += " and " + sortFiledType[0] + " in (" + temp + ") group by " + sortFiledType[0]
+ " order by maxTime desc";
}*/
/*String source = "select max(to_char(t.data_check_time,'yyyy-mm-dd HH24:mi')) maxTime," + sortFiledType[0]
+ " from " + checkTypeInfo.getTableName() + " t,detection_info d where " + metadata.getFiledName() + " is not null"
// +" and t.data_check_time >= trunc(sysdate-30)"
+ " and t.detection_info_id =d.id "
+ " and d.detection_set_info_id=" + dsiId + " and d.seq_id = "
+ seqId;*/
/**
* 2018年12月6日17:50:54 fang 在 astana 优化
*/
String source = "select max(to_char(t.data_check_time,'yyyy-mm-dd HH24:mi')) maxTime," + sortFiledType[0]
+ " from " + checkTypeInfo.getTableName() + " t where " + metadata.getFiledName() + " is not null "
// +" and t.data_check_time >= trunc(sysdate-30)"
+ " and t.detection_set_info_id=" + dsiId + " and t.seq_id = "
+ seqId;
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 (sortFiledType[1].toString().equals("NUMBER") || sortFiledType[1].toString().equals("Number")) {
temp = lines.substring(0, lines.length() - 1);
source += " and " + sortFiledType[0] + " in (" + temp + ") group by " + sortFiledType[0]
@@ -1067,11 +1038,12 @@ public class MonitorDataAction extends BaseAction {
source += " and " + sortFiledType[0] + " in (" + temp + ") group by " + sortFiledType[0]
+ " order by maxTime desc";
}
List lastList = this.commonService.executeSQL(source);
// ------------------以上确定最后一个数据点----------------------------
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'),"
String lastSource = "select * from ( select to_char(data_check_time,'yyyy-mm-dd HH24:mi'),"
+ metadata.getFiledName() + " from " + checkTypeInfo.getTableName() + " t where "
+ metadata.getFiledName() + " is not null"
// +" and t.data_check_time >= trunc(sysdate-30)"
@@ -1089,32 +1061,6 @@ public class MonitorDataAction extends BaseAction {
lastSource += " and " + sortFiledType[0] + " = " + row[1] + " order by 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 ";
}*/
/*String lastSource = "select to_char(t.data_check_time,'yyyy-mm-dd HH24:mi'),"
+ metadata.getFiledName() + " from " + checkTypeInfo.getTableName() + " t,detection_info d where "
+ metadata.getFiledName() + " is not null"
// +" and t.data_check_time >= trunc(sysdate-30)"
+ " and t.detection_info_id = d.id "
+ "and d.detection_set_info_id=" + dsiId
+ " and d.seq_id = " + seqId;*/
/**
* 2018年12月6日17:52:54 fang 在 astana 优化
*/
String lastSource = "select to_char(t.data_check_time,'yyyy-mm-dd HH24:mi'),"
+ metadata.getFiledName() + " from " + checkTypeInfo.getTableName() + " t where "
+ metadata.getFiledName() + " is not null "
+ "and t.detection_set_info_id=" + dsiId
+ " and t.seq_id = " + seqId;
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 + "'";
} 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 t.data_check_time desc ";
} else if (sortFiledType[1].toString().indexOf("VARCHAR2") != -1) {
lastSource += " and " + sortFiledType[0] + " = '" + row[1] + "' order by t.data_check_time desc ";
}
/* lastSource += " where rownum < 21"; */
@@ -1233,21 +1179,20 @@ public class MonitorDataAction extends BaseAction {
String[] cbStrings = checkLins(metadata, checkTypeInfo, sortFiledType, dsiId, seqId, linStrings[i]);
String source = "";
if (linStrings[i].equals(cbStrings[0])) {// 这是最后的那个
/*source = "select * from ( select to_char(data_check_time,'yyyy-mm-dd HH24:mi') checkTime,"
+ metadata.getFiledName() + " from " + checkTypeInfo.getTableName() + " t where "
+ metadata.getFiledName() + " is not null"
+ " 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 + ")";*/
/**
* 2018年12月6日18:22:39 fang 在astana 优化
*/
source = "select * from ( select to_char(data_check_time,'yyyy-mm-dd HH24:mi') checkTime,"
+ metadata.getFiledName() + " from " + checkTypeInfo.getTableName() + " t where "
+ metadata.getFiledName() + " is not null "
+ " and t.detection_set_info_id=" + dsiId
+ " and t.seq_id = " + seqId;
+ metadata.getFiledName() + " is not null"
// +
// " and t.data_check_time >=
// to_date(to_char((sysdate-4),'yyyy-mm-dd'),'yyyy-mm-dd
// hh24:mi')"+
// +" and t.data_check_time >=
// trunc(sysdate-30)"
// + " and rownum <= 20"
+ " 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 + ")";
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 + "'";
@@ -1270,17 +1215,15 @@ public class MonitorDataAction extends BaseAction {
// source += " where rownum < 21 ";
// }
} else {
/*source = "select * from ( select to_char(data_check_time,'yyyy-mm-dd HH24:mi') checkTime,"
+ metadata.getFiledName() + " from " + checkTypeInfo.getTableName() + " t where "
+ metadata.getFiledName() + " is not null"
+ " 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 + ")";*/
source = "select * from ( select to_char(data_check_time,'yyyy-mm-dd HH24:mi') checkTime,"
+ metadata.getFiledName() + " from " + checkTypeInfo.getTableName() + " t where "
+ metadata.getFiledName() + " is not null"
+ " and t.detection_set_info_id=" + dsiId
+ " and t.seq_id = " + seqId;
// +" and t.data_check_time >=
// trunc(sysdate-30)"
+ " 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 + ")";
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 + "'";
@@ -1363,19 +1306,14 @@ public class MonitorDataAction extends BaseAction {
+ " is not null and seq_id=" + seqId + " and DETECTION_SET_INFO_ID= "+dsiId+" order by " + sortFiledType[0].toString();
dataList = this.commonService.executeSQL(getAllSort);
if (dataList != null && dataList.size() > 0) {
/*String source = "select * from (select to_char(data_check_time,'yyyy-mm-dd HH24:mi') checkTime,"
String source = "select * from (select to_char(data_check_time,'yyyy-mm-dd HH24:mi') checkTime,"
+ 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 "
+ "(select d.id from detection_info d where d.detection_set_info_id=" + dsiId
+ " and d.seq_id = " + seqId + ")";*/
String source = "select * from (select to_char(data_check_time,'yyyy-mm-dd HH24:mi') checkTime,"
+ metadata.getFiledName() + " from " + checkTypeInfo.getTableName() + " t where "
+ metadata.getFiledName() + " is not null"
+ " and t.detection_set_info_id=" + dsiId
+ " and t.seq_id = " + seqId;
+ " and d.seq_id = " + seqId + ")";
if (null != startTime && !startTime.equals("") && null != endTime && !endTime.equals("")) {
source += " and to_char(data_check_time,'yyyy-mm-dd')>= '" + startTime
@@ -1650,8 +1588,21 @@ public class MonitorDataAction extends BaseAction {
sqlBuffer.append(" left join check_type_info cti");
sqlBuffer.append(" on dsi.check_type_id = cti.id");
// @2018-3-9 fang 修改 首先查询符合条件的id在拼接sql适配mysql
String groupIdSql = "select group_id from nodegroup_table t where 1=1 ";
String ids = this.commonService.getGroupIdStartWith(groupIdSql, "t.group_id = " + nodeGroupId);
String groupIdSql = "select node_id from node_table where node_id not in (select type_id from topo_node_info where type=2) and node_state=0 and node_group_id="+nodeGroupId;
StringBuffer queryIds=new StringBuffer();
List<Long> nodeGroupIds = this.commonService.executeSQL(groupIdSql);
if(!nis.nms.util.StringUtil.objectIsNUll(nodeGroupIds)){
for(int i=0;i<nodeGroupIds.size();i++){
if(i==nodeGroupIds.size()-1){
queryIds.append(nodeGroupIds.get(i));
}else{
queryIds.append(nodeGroupIds.get(i));
queryIds.append(",");
}
}
}else{
queryIds.append(-1);
}
/*
* sqlBuffer.
* append(" left join (select distinct node_ip,seq_id,node_system_type,node_type,node_state,system_id ,ipn from NODE_TABLE WHERE node_group_id in "
@@ -1661,8 +1612,8 @@ public class MonitorDataAction extends BaseAction {
* " connect by prior t.group_id = t.parent_group_id)) nt");
*/
sqlBuffer
.append(" left join (select distinct node_ip,seq_id,node_system_type,node_type,node_state,system_id ,ipn from NODE_TABLE WHERE node_group_id in "
+ "(" + ids + ")) nt");
.append(" left join (select distinct node_ip,seq_id,node_system_type,node_type,node_state,system_id ,ipn from NODE_TABLE WHERE node_id in "
+ "(" + queryIds.toString() + ")) nt");
sqlBuffer.append(" on din.seq_id = nt.seq_id");
// ------------2013-1-23 hyx
// 对于无统计字段的监测类型,在监测数据列表里不显示折线图链接------------------start
@@ -1954,7 +1905,17 @@ public class MonitorDataAction extends BaseAction {
logger.error(e.getStackTrace());
}
}
//2019-01-04新增查询网元类型
private void queryNetElementType(){
try {
String hql="from OptionTable where typeIdentity='netelementtype'";
allnetElementType=this.commonService.find(hql);
} catch (Exception e) {
e.printStackTrace();
logger.error("query NetElement Type faild"+e);
}
}
// 添加此方法主要考虑使用HQL查询会因为表之间的关联关系而导致一条记录多次查询故修改为sql查询。
public void queryServerMonitorDataInfoNew() {
if (mypageNo > 0 && mypageSize > 0) {
@@ -2935,7 +2896,7 @@ public class MonitorDataAction extends BaseAction {
String linesLink = linkToString(linStrings, ",", "'");// lines要在checkLins方法后再做加单引号的处理因为checkLins方法里单个处理了
// for (int i = 0; i < linStrings.length; i++) {
String source = "";
source = "select data_check_time_digital ," + specialColumn + " from "
source = "select * from ( select data_check_time_digital ," + specialColumn + " from "
+ checkTypeInfo.getTableName() + " t where " + metadata.getFiledName() + " is not null"
+ " and t.detection_set_info_id=" + dsiId + " and t.seq_id = " + seqId + " ";
@@ -2966,7 +2927,7 @@ public class MonitorDataAction extends BaseAction {
* " order by data_check_time_digital desc) where rownum < 21 order by data_check_time_digital asc"
* ;
*/
//source += " order by data_check_time_digital asc ";
source += " order by data_check_time_digital desc) tttt ";
// @2018年4月10日18:45:00 fang 修改rownum 适配 mysql
if (Constant.IS_MYSQL) {
@@ -4371,7 +4332,7 @@ public class MonitorDataAction extends BaseAction {
sqlBuffer.append(" left join check_type_info cti");
sqlBuffer.append(" on dsi.check_type_id = cti.id");
sqlBuffer.append(
" left join (select distinct node_ip,seq_id,node_system_type,node_type,node_state,system_id ,ipn from NODE_TABLE) nt");
" left join (select distinct node_ip,seq_id,node_system_type,node_type,node_state,system_id ,ipn,network_element_type,node_group_id from NODE_TABLE) nt");
sqlBuffer.append(" on din.seq_id = nt.seq_id");
// ------------2013-1-23 hyx
// 对于无统计字段的监测类型,在监测数据列表里不显示折线图链接------------------start
@@ -4381,7 +4342,17 @@ public class MonitorDataAction extends BaseAction {
sqlBuffer.append(" on checkTypeCharState.ctId=cti.id ");
// ------------2013-1-23 hyx
// 对于无统计字段的监测类型,在监测数据列表里不显示折线图链接------------------end
//2019-01-04新增节点组名称查询过滤条件
if (nodeGroupStr != null && !"".equals(nodeGroupStr) && !"null".equals(nodeGroupStr)) {
// 节点组模糊名称不为空则根据节点组名称模糊查询所有节点组再依次查找其下面的节点得到节点id
// @2018-3-9 fang 修改 首先查询符合条件的id在拼接sql适配mysql
String groupIdSql = "select group_id from nodegroup_table t where 1=1 ";
String ids = this.commonService.getGroupIdStartWith(groupIdSql,
"lower(group_name) like lower('%" + nodeGroupStr + "%')");
sqlBuffer
.append(" right join (select distinct ngt.group_id from nodegroup_table ngt where ngt.group_id in ("
+ ids + ") ) ngt on nt.node_group_id=ngt.group_id");
}
sqlBuffer.append(
" where nt.node_ip is not null AND nt.node_type =1 and nt.node_state = 0 and dsi.detection_set_state ='1' and cti.crete_state=0 and din.valid=1");// 只显示有效的数据din.valid=1
if (!this.getAdminMark()) {
@@ -4397,6 +4368,10 @@ public class MonitorDataAction extends BaseAction {
if (checkType != null && !"".equals(checkType)&&checkType>=0) {
sqlBuffer.append(" and cti.id=" + checkType);
}
//2019-01-04 新增根据网元类型过滤
if(netElementType!=null&&netElementType!=-1){
sqlBuffer.append(" and nt.network_element_type="+netElementType);
}
if (StringUtils.isNotBlank(stateInfo)) {
sqlBuffer.append(" and din.detection_state_info like '%" + stateInfo + "%'");
}
@@ -5435,5 +5410,23 @@ public class MonitorDataAction extends BaseAction {
this.detectionSetInfoId = detectionSetInfoId;
}
public Integer getNetElementType() {
return netElementType;
}
public void setNetElementType(Integer netElementType) {
this.netElementType = netElementType;
}
public List<OptionTable> getAllnetElementType() {
return allnetElementType;
}
public void setAllnetElementType(List<OptionTable> allnetElementType) {
this.allnetElementType = allnetElementType;
}
}