1、jar包直接放在lib文件夹下

2、增加hibernate interceptor 修改sql语句适配mycat
3、部分页面修改
4、增加分中心只显示数据展示分中心角色菜单
This commit is contained in:
fangshunjian
2018-12-21 22:13:42 +06:00
parent f248aa0ddc
commit df150d4dd7
170 changed files with 16335 additions and 13879 deletions

View File

@@ -12,12 +12,14 @@ import nis.nms.util.ConnectionOracle;
import nis.nms.util.HttpClientUtil;
import org.apache.log4j.Logger;
import org.nutz.json.Json;
import org.nutz.json.JsonFormat;
import com.nms.thread.service.NmsReportService;
public class NmsPortThread implements Runnable {
private Logger logger = Logger.getLogger(NmsPortThread.class);
private static Logger logger = Logger.getLogger(NmsPortThread.class);
@Override
public void run() {
@@ -38,7 +40,7 @@ public class NmsPortThread implements Runnable {
NmsReportService service = new NmsReportService(connection);
ArrayList<Map<String, String>> nmsPortInfo = service.getNmsPortInfo(nowLong, nowLong-interval*1000);
if (nmsPortInfo != null && nmsPortInfo.size() > 0) {
logger.debug(String.format("查询数量:%s", nmsPortInfo.size()));
Map<String, List<Map<String, String>>> data = new HashMap<String, List<Map<String, String>>>();
List<Map<String, String>> results = new ArrayList<Map<String, String>>();
@@ -56,13 +58,14 @@ public class NmsPortThread implements Runnable {
result.put("inpktsSpeed", info.get("INPKTSSPEED") == null ? "" : info.get("INPKTSSPEED"));
result.put("outpktsSpeed", info.get("OUTPKTSSPEED") == null ? "" : info.get("OUTPKTSSPEED"));
result.put("recvTime", info.get("DATA_CHECK_TIME") == null ? "" : info.get("DATA_CHECK_TIME"));
result.put("entranceId", info.get("ADDR") == null ? "" : info.get("ADDR"));
results.add(result);
}
data.put("trafficNetflowPortInfoList", results);
HttpClientUtil httpUtil = new HttpClientUtil();
JSONObject fromObject = JSONObject.fromObject(data);
httpUtil.post(BaseAction.rb.getString("nms.port.url"), fromObject.toString());
String dataStr = Json.toJson(data,JsonFormat.tidy());
logger.debug("url:" +BaseAction.rb.getString("nms.port.url") + ",data :" + dataStr);
httpUtil.post(BaseAction.rb.getString("nms.port.url"), dataStr);
logger.info("port上报完毕");
} else {
logger.info("暂无可上报的port数据");

View File

@@ -6,19 +6,19 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONObject;
import nis.nms.util.BaseAction;
import nis.nms.util.ConnectionOracle;
import nis.nms.util.DateUtil;
import nis.nms.util.HttpClientUtil;
import org.apache.log4j.Logger;
import org.nutz.json.Json;
import org.nutz.json.JsonFormat;
import com.nms.thread.service.NmsReportService;
import nis.nms.util.BaseAction;
import nis.nms.util.ConnectionOracle;
import nis.nms.util.HttpClientUtil;
public class NmsRuleThread implements Runnable {
private Logger logger = Logger.getLogger(NmsRuleThread.class);
private static Logger logger = Logger.getLogger(NmsRuleThread.class);
@Override
public void run() {
@@ -39,7 +39,7 @@ public class NmsRuleThread implements Runnable {
NmsReportService service = new NmsReportService(connection);
ArrayList<Map<String, String>> nmsRuleInfo = service.getNmsRuleInfo(nowLong, nowLong-interval*1000);
if (nmsRuleInfo != null && nmsRuleInfo.size() > 0) {
logger.debug(String.format("查询数量:%s", nmsRuleInfo.size()));
Map<String, List<Map<String, String>>> data = new HashMap<String, List<Map<String, String>>>();
List<Map<String, String>> results = new ArrayList<Map<String, String>>();
@@ -67,9 +67,9 @@ public class NmsRuleThread implements Runnable {
}
data.put("nmsDiRuleList", results);
HttpClientUtil httpUtil = new HttpClientUtil();
JSONObject fromObject = JSONObject.fromObject(data);
httpUtil.post(BaseAction.rb.getString("nms.rule.url"), fromObject.toString());
String dataStr = Json.toJson(data,JsonFormat.tidy());
logger.debug("url:" +BaseAction.rb.getString("nms.rule.url") + ",data :" + dataStr);
httpUtil.post(BaseAction.rb.getString("nms.rule.url"), dataStr);
logger.info("rule上报完毕");
} else {
logger.info("暂无可上报的rule数据");

View File

@@ -7,11 +7,12 @@ import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.nutz.json.Json;
import org.nutz.json.JsonFormat;
import com.nis.util.StringUtil;
import com.nms.thread.service.NmsReportService;
import net.sf.json.JSONObject;
import nis.nms.util.BaseAction;
import nis.nms.util.ConnectionOracle;
import nis.nms.util.DateUtil;
@@ -19,7 +20,7 @@ import nis.nms.util.HttpClientUtil;
public class NmsStatusThread implements Runnable {
private Logger logger = Logger.getLogger(NmsStatusThread.class);
private static Logger logger = Logger.getLogger(NmsStatusThread.class);
@Override
public void run() {
@@ -38,8 +39,8 @@ public class NmsStatusThread implements Runnable {
try {
connection = ConnectionOracle.getConnection();
NmsReportService service = new NmsReportService(connection);
ArrayList<Map<String, String>> nmsReportInfo = service.getNmsStatusInfo(setId);
logger.debug(String.format("查询设备数量:%s", nmsReportInfo == null ? 0 : nmsReportInfo.size()));
Map<String, List<Map<String, String>>> tmp = new HashMap<String, List<Map<String, String>>>();
tmp.put("unknown", new ArrayList<Map<String, String>>());
for (Map<String, String> info : nmsReportInfo) {
@@ -91,10 +92,9 @@ public class NmsStatusThread implements Runnable {
Map<String, List<Map>> map = new HashMap<String, List<Map>>();
map.put("trafficNmsServerList", results);
HttpClientUtil httpUtil = new HttpClientUtil();
JSONObject fromObject = JSONObject.fromObject(map);
logger.info(BaseAction.rb.getString("nms.status.url"));
httpUtil.post(BaseAction.rb.getString("nms.status.url"), fromObject.toString());
String data = Json.toJson(map,JsonFormat.tidy());
logger.debug("url:" +BaseAction.rb.getString("nms.status.url") + ",data :" + data);
httpUtil.post(BaseAction.rb.getString("nms.status.url"), data);
logger.info("status上报完毕");
} catch (Exception e) {
logger.error(e);

View File

@@ -13,6 +13,10 @@ public class ThreadPoolConfig {
public static final Integer DC_HANDSHAKE_PERIOD = StringUtils.isNotBlank(BaseAction.rb.getString("dc.handshake.period"))? Integer.parseInt(BaseAction.rb.getString("dc.handshake.period")):60*5;
public static final String DETEC_TIMEOUT_CHECK_MANAGER = "DETEC_TIMEOUT_CHECK_MANAGER";
public static final Integer DETEC_TIMEOUT_ALARM_PERIOD_TIMES =2;
/**
* 超时告警 延迟时间,为了防止 国家中心,分中心 两个web 同时判断生成多条 记录
*/
public static final Integer DETEC_TIMEOUT_ALARM_PERIOD_DELAY =StringUtils.isNotBlank(BaseAction.rb.getString("detec.timeout.alarm.period.delay"))? Integer.parseInt(BaseAction.rb.getString("detec.timeout.alarm.period.delay")): 5;
public static final Integer DETEC_TIMEOUT_CHECK_PERIOD = StringUtils.isNotBlank(BaseAction.rb.getString("detec.timeout.check.period"))? Integer.parseInt(BaseAction.rb.getString("detec.timeout.check.period")): 15*60;
public static final Integer FLAG_DETEC_TIMEOUT = StringUtils.isNotBlank(BaseAction.rb.getString("flag_detec_timeout"))? Integer.parseInt(BaseAction.rb.getString("flag_detec_timeout")): 1;

View File

@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import nis.nms.util.BaseAction;
import nis.nms.util.ConnectionOracle;
import org.apache.log4j.Logger;
@@ -17,15 +18,21 @@ public class NmsReportService {
}
public ArrayList<Map<String, String>> getNmsStatusInfo(String setId) {
Integer systemId = null;
try {
systemId = Integer.parseInt(BaseAction.rb.getString("addr.system.id"));
} catch (Exception e) {
systemId = 100017;
}
//detectioned_state=1时正常
String sql = "select nt.node_ip, ds.host_name, din.detectioned_state, st.system_name "
String sql = "select nt.node_ip, ds.host_name, din.detectioned_state, st.addr as system_name "
+ "from node_table nt "
+ "left join detection_info_new din on din.SEQ_ID=nt.seq_id "
+ "left join di_systeminfo ds on nt.SEQ_ID=ds.SEQ_ID "
+ "left join system_table st ON nt.system_id=st.system_id "
+ "where nt.node_state=0 AND din.DETECTION_SET_INFO_ID=" + setId + " "
+ "group by nt.node_ip";
+ "where nt.node_state=0 AND din.DETECTION_SET_INFO_ID=" + setId
+ " and st.system_id < " + systemId
+ " group by nt.node_ip";
ArrayList<String> fields = new ArrayList<String>();
fields.add("node_ip");
fields.add("host_name");
@@ -77,10 +84,12 @@ public class NmsReportService {
public ArrayList<Map<String, String>> getNmsPortInfo(Long end, Long start) {
//end=1539073220004l,start=1539064699984l
String sql = "SELECT nt.node_ip, nt.node_name, ds.ifindex, ds.IFDESCR, ds.IFSPEED, ds.IFINOCTETS, ds.IFOUTOCTETS,ds.INOCTETSSPEED,ds.INPKTSSPEED,ds.OUTOCTETSSPEED, ds.OUTPKTSSPEED, ds.DATA_CHECK_TIME "
//只查询 网元类型为 特种设备1的端口信息
String sql = "SELECT DISTINCT nt.node_ip, nt.node_name, ds.ifindex, ds.IFDESCR, ds.IFSPEED, ds.IFINOCTETS, ds.IFOUTOCTETS,ds.INOCTETSSPEED,ds.INPKTSSPEED,ds.OUTOCTETSSPEED, ds.OUTPKTSSPEED, ds.DATA_CHECK_TIME,st.ADDR "
+ "FROM di_switchport ds "
+ "LEFT JOIN node_table nt ON nt.seq_id=ds.seq_id "
+ "WHERE nt.node_state=0 AND ds.data_check_time_digital<" + end + " AND ds.data_check_time_digital>=" + start;
+ " left join system_table st on st.system_id = nt.system_id "
+ "WHERE nt.network_element_type = 1 and nt.node_state=0 AND ds.data_check_time_digital<" + end + " AND ds.data_check_time_digital>=" + start;
ArrayList<String> fields = new ArrayList<String>();
fields.add("node_ip");
fields.add("node_name");
@@ -94,6 +103,7 @@ public class NmsReportService {
fields.add("OUTOCTETSSPEED");
fields.add("OUTPKTSSPEED");
fields.add("DATA_CHECK_TIME");
fields.add("ADDR");
try {
ArrayList<Map<String, String>> dbSelect = dao.dbSelect(sql, fields);

View File

@@ -297,6 +297,7 @@ public class ThreadService {
public List<String []> detectDatasTimeoutCheck(SetInfo setInfo,Date startTime,String errorSeqIds){
List<String []> alarmInfoList = new ArrayList<String[]>();
String sql = null;
Integer delay = ThreadPoolConfig.DETEC_TIMEOUT_ALARM_PERIOD_DELAY;
//无效状态跳过
if(!(StringUtils.isNotEmpty(setInfo.getCheckState()) && "1".equals(setInfo.getCheckState())))return alarmInfoList;//监测设置的状态是否有效,无效则不检查,返回空列表
int periodTimes = ThreadPoolConfig.DETEC_TIMEOUT_ALARM_PERIOD_TIMES;
@@ -307,7 +308,7 @@ public class ThreadService {
sql="select nt0.seq_id,nt0.node_ip,nt0.NODE_TYPE from " +
"(select distinct nt.seq_id,nt.node_ip,nt.NODE_TYPE from node_table nt left join nodegroup_table ngt on ngt.group_id = nt.node_group_id where nvl(ngt.is_valid, '1') = '1' and nt.node_id in (-9999,"+setInfo.getNodeIpsId()+", -9999) and nt.node_state = 0 " + systemidSql + ") nt0" +
" where (not exists (select din.seq_id from detection_info_new din where nt0.seq_id = din.seq_id and din.detection_set_info_id = '"+setInfo.getId()+"') " +
" or exists (select din.seq_id from detection_info_new din where nt0.seq_id = din.seq_id and din.detection_set_info_id = '"+setInfo.getId()+"' and din.DATA_CHECK_TIME < sysdate - "+((setInfo.getCheckGap()==null?5:setInfo.getCheckGap())*periodTimes+5)+"/24/60 ))";
" or exists (select din.seq_id from detection_info_new din where nt0.seq_id = din.seq_id and din.detection_set_info_id = '"+setInfo.getId()+"' and din.DATA_CHECK_TIME < sysdate - "+((setInfo.getCheckGap()==null?5:setInfo.getCheckGap())*periodTimes+delay)+"/24/60 ))";
// sql = "select din.seq_id from detection_info_new din where " +
// "(din.seq_id not in(select distinct nt.seq_id from node_table nt left join nodegroup_table ngt on ngt.group_id = nt.node_group_id where nvl(ngt.is_valid,'1') = '1' and nt.node_id in (0,"+setInfo.getNodeIpsId()+",0) and nt.node_state =0) or (din.seq_id in(select distinct nt.seq_id from node_table nt left join nodegroup_table ngt on ngt.group_id = nt.node_group_id where nvl(ngt.is_valid,'1') = '1' and nt.node_id in (0,"+setInfo.getNodeIpsId()+",0) and nt.node_state =0) and sysdate - din.DATA_CHECK_TIME - "+((setInfo.getCheckGap()==null?5:setInfo.getCheckGap())*Constants.DETEC_TIMEOUT_ALARM_PERIOD_TIMES+5)+"/24/60> 0 ) )"+
// " and din.detection_set_info_id = "+setInfo.getId();
@@ -326,7 +327,7 @@ public class ThreadService {
sql="select nt0.seq_id,nt0.node_ip,nt0.NODE_TYPE from " +
"(select distinct nt.seq_id,nt.node_ip,nt.NODE_TYPE from node_table nt left join nodegroup_table ngt on ngt.group_id = nt.node_group_id where nvl(ngt.is_valid, '1') = '1' and nt.node_group_id in ("+ids+") and nt.node_state = 0 " + systemidSql + ") nt0" +
" where (not exists (select din.seq_id from detection_info_new din where nt0.seq_id = din.seq_id and din.detection_set_info_id = '"+setInfo.getId()+"') " +
" or exists (select din.seq_id from detection_info_new din where nt0.seq_id = din.seq_id and din.detection_set_info_id = '"+setInfo.getId()+"' and din.DATA_CHECK_TIME < sysdate - "+((setInfo.getCheckGap()==null?5:setInfo.getCheckGap())*periodTimes+5)+"/24/60 ))";
" or exists (select din.seq_id from detection_info_new din where nt0.seq_id = din.seq_id and din.detection_set_info_id = '"+setInfo.getId()+"' and din.DATA_CHECK_TIME < sysdate - "+((setInfo.getCheckGap()==null?5:setInfo.getCheckGap())*periodTimes+delay)+"/24/60 ))";
/* sql="select nt0.seq_id,nt0.node_ip,nt0.NODE_TYPE from " +
"(select distinct nt.seq_id,nt.node_ip,nt.NODE_TYPE from node_table nt left join nodegroup_table ngt on ngt.group_id = nt.node_group_id where nvl(ngt.is_valid, '1') = '1' and nt.node_group_id in (select nt.group_id from NODEGROUP_TABLE nt where nt.leaf_group = 1 start with nt.group_id in (-9999,"+setInfo.getNodeGroupsId()+", -9999) connect by prior nt.group_id = nt.parent_group_id) and nt.node_state = 0) nt0" +
" where (not exists (select din.seq_id from detection_info_new din where nt0.seq_id = din.seq_id and din.detection_set_info_id = '"+setInfo.getId()+"') " +
@@ -903,7 +904,7 @@ public class ThreadService {
diStmt.setObject(14, alarms[10]);
String idstr=computeId(alarms[5], alarms[1], alarms[0]);
Long id =Long.parseLong(idstr);
System.out.println("id -> " + id);
// System.out.println("id -> " + id);
diwStmt.setObject(1, id);
diStmt.setObject(1, id);
@@ -1230,6 +1231,7 @@ public class ThreadService {
// publicInfo.put("notice_flag".toLowerCase(), "1");// 1已发送 0未发送
//-- 获取ID
//2018年12月1日20:45:42 id 改為 主鍵自增
ArrayList<String> fields = new ArrayList<String>();
String searchIdSql = "select seq_detection_info.nextval id from dual";
fields.add("id");