From 9b10be7f8f20805554cd93b4de9bb7dd1048a754 Mon Sep 17 00:00:00 2001 From: RenKaiGe-Office Date: Wed, 26 Sep 2018 20:06:30 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E8=A7=A3=E5=86=B3clickhouse=E8=B6=85?= =?UTF-8?q?=E6=97=B6=E9=97=AE=E9=A2=98,=E5=9C=A8url=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E4=B8=B2=E5=90=8E=E9=9D=A2=E6=B7=BB=E5=8A=A0socket=5Ftimeout?= =?UTF-8?q?=3D600000=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/jdbc.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/jdbc.properties b/src/main/resources/jdbc.properties index 30a988d..152d615 100644 --- a/src/main/resources/jdbc.properties +++ b/src/main/resources/jdbc.properties @@ -75,7 +75,7 @@ jdbc.clickhouse.driver=ru.yandex.clickhouse.ClickHouseDriver #域名测试环境 #jdbc.clickhouse.url=jdbc:clickhouse://clickhouse.baifendian.com:80/k18_ods #亦庄演示环境 -jdbc.clickhouse.url=jdbc:clickhouse://10.3.45.5:8123/k18_ods +jdbc.clickhouse.url=jdbc:clickhouse://10.3.45.5:8123/k18_ods?socket_timeout=600000 jdbc.clickhouse.username= jdbc.clickhouse.key= jdbc.clickhouse.password= From df9ab11a9cfa1cf9fbb16d7947f7f0326e4626c4 Mon Sep 17 00:00:00 2001 From: zhangdongxu Date: Thu, 27 Sep 2018 17:44:41 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E8=AF=81=E4=B9=A6=E7=AD=96=E7=95=A5?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E5=85=A5redis=E6=8E=A5=E5=8F=A3=E6=97=B6redi?= =?UTF-8?q?sFile=5Fprivate=5Fkey=5Ffile=E3=80=81redisFile=5Fpublic=5Fkey?= =?UTF-8?q?=5Ffile=E4=B8=A4=E4=B8=AA=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/commonSources/applicationConfig-parser.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/resources/commonSources/applicationConfig-parser.xml b/src/main/resources/commonSources/applicationConfig-parser.xml index 232b06a..c2b5947 100644 --- a/src/main/resources/commonSources/applicationConfig-parser.xml +++ b/src/main/resources/commonSources/applicationConfig-parser.xml @@ -149,6 +149,8 @@ + + From 861b962199807d85d2b92d6c587849300d9db094 Mon Sep 17 00:00:00 2001 From: RenKaiGe-Office Date: Thu, 27 Sep 2018 18:00:27 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E6=B7=BB=E5=8A=A0520=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=90=91redis=E4=B8=AD=E5=AD=98=E6=94=BE?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/nis/restful/RestBusinessCode.java | 9 ++ src/main/java/com/nis/util/File2Redis.java | 50 +++++++++ src/main/java/com/nis/util/MD5Utils.java | 106 ++++++++++-------- .../restful/ConfigJedisServiceimpl.java | 41 ++++++- .../maatXml/applicationConfig-maatRedis.xml | 2 +- 5 files changed, 155 insertions(+), 53 deletions(-) create mode 100644 src/main/java/com/nis/util/File2Redis.java diff --git a/src/main/java/com/nis/restful/RestBusinessCode.java b/src/main/java/com/nis/restful/RestBusinessCode.java index 3f2c39e..fb41663 100644 --- a/src/main/java/com/nis/restful/RestBusinessCode.java +++ b/src/main/java/com/nis/restful/RestBusinessCode.java @@ -620,6 +620,15 @@ public enum RestBusinessCode { * Redis关联关系库中未找到配置对应的redisdb信息 */ RedisDBRelationNotExistsInRedis(5003005,"Redis关联关系库中未找到配置对应的redisdb信息"), + /** + * 保存文件到redis发生了异常 + */ + SaveFileToRedisError(5003006,"保存文件到redis发生了异常"), + + + + + /** * Map中缺少编译配置信息 diff --git a/src/main/java/com/nis/util/File2Redis.java b/src/main/java/com/nis/util/File2Redis.java new file mode 100644 index 0000000..d528ee4 --- /dev/null +++ b/src/main/java/com/nis/util/File2Redis.java @@ -0,0 +1,50 @@ +package com.nis.util; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.URL; + +import com.nis.restful.RestBusinessCode; +import com.nis.restful.ServiceRuntimeException; + +import redis.clients.jedis.Transaction; + +public class File2Redis { + + public static String file2Redis(String url, Transaction transaction) { + try { + byte[] fileByte = downLoadFromUrl(url); + String md5 = MD5Utils.getMd5ByIS(new ByteArrayInputStream(fileByte)); + String key = "redis://_FILE_" + md5; + transaction.set(key.getBytes(), fileByte); + return key; + } catch (Exception e) { + throw new ServiceRuntimeException("保存文件到redis发生了异常:" + e.getMessage(), + RestBusinessCode.SaveFileToRedisError.getValue()); + } + } + + public static byte[] downLoadFromUrl(String urlStr) throws IOException { + URL url = new URL(urlStr); + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + // 设置超时间为30秒 + conn.setConnectTimeout(3 * 10000); + // 防止屏蔽程序抓取而返回403错误 + conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)"); + // 得到输入流 + InputStream inputStream = conn.getInputStream(); + ByteArrayOutputStream baosOutputStream = new ByteArrayOutputStream(); + byte[] buffer = new byte[1024]; + int len; + while ((len = inputStream.read(buffer)) > -1) { + baosOutputStream.write(buffer, 0, len); + } + baosOutputStream.flush(); + return baosOutputStream.toByteArray(); + } + + +} diff --git a/src/main/java/com/nis/util/MD5Utils.java b/src/main/java/com/nis/util/MD5Utils.java index ce925d9..9a58bb4 100644 --- a/src/main/java/com/nis/util/MD5Utils.java +++ b/src/main/java/com/nis/util/MD5Utils.java @@ -3,81 +3,95 @@ */ package com.nis.util; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import java.util.List; -import java.util.Locale; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.servlet.http.HttpServletRequest; - -import org.apache.commons.lang3.StringEscapeUtils; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; -import org.springframework.web.servlet.LocaleResolver; - -import com.ckfinder.connector.ServletContextFactory; -import com.google.common.collect.Lists; -import com.nis.web.service.SpringContextHolder; +import org.apache.commons.codec.digest.DigestUtils; /** * 字符串工具类, 继承org.apache.commons.lang3.StringUtils类 * @author ThinkGem * @version 2013-05-22 */ -public class MD5Utils{ - +public class MD5Utils { + /** * 字符串转为MD532位小写 * @param plain * @return */ - public static String md5LowerCase(String plain) throws Exception{ + public static String md5LowerCase(String plain) throws Exception { String re_md5 = new String(); - MessageDigest md = MessageDigest.getInstance("MD5"); - md.update(plain.getBytes()); - byte b[] = md.digest(); - - int i; - - StringBuffer buf = new StringBuffer(""); - for (int offset = 0; offset < b.length; offset++) { + MessageDigest md = MessageDigest.getInstance("MD5"); + md.update(plain.getBytes()); + byte b[] = md.digest(); + + int i; + + StringBuffer buf = new StringBuffer(""); + for (int offset = 0; offset < b.length; offset++) { i = b[offset]; if (i < 0) - i += 256; + i += 256; if (i < 16) - buf.append("0"); + buf.append("0"); buf.append(Integer.toHexString(i)); - } - - re_md5 = buf.toString(); - return re_md5; } - public static byte[] createChecksum(String filename) throws IOException, NoSuchAlgorithmException{ - InputStream fis=new FileInputStream(filename); - byte[] buffer=new byte[1024]; - MessageDigest complete=MessageDigest.getInstance("MD5"); + + re_md5 = buf.toString(); + return re_md5; + } + + public static byte[] createChecksum(String filename) throws IOException, NoSuchAlgorithmException { + InputStream fis = new FileInputStream(filename); + byte[] buffer = new byte[1024]; + MessageDigest complete = MessageDigest.getInstance("MD5"); int numRead; - do{ - numRead=fis.read(buffer); - if(numRead>0){ - complete.update(buffer,0,numRead); + do { + numRead = fis.read(buffer); + if (numRead > 0) { + complete.update(buffer, 0, numRead); } - }while(numRead!=-1); + } while (numRead != -1); fis.close(); return complete.digest(); } - public static String getMD5Checksum(String filename) throws NoSuchAlgorithmException, IOException{ - byte[] b=createChecksum(filename); - StringBuffer result=new StringBuffer(); - for(int i=0;i urlList = new ArrayList(); for (String valStr : valSplit) { if (!StringUtils.isEmpty(valStr) && valStr.trim().startsWith("[")) { valStr = valStr.trim().replace("[", "").replace("]", ""); - valBF.append(map.get(valStr)); +// if (service == 520) { +// if (valStr.equals("private_key_file") +// || valStr.equals("public_key_file")) { +// String fileUrl = map.get(valStr); +// urlList.add(fileUrl); +// } +// } +// if(valStr.equals("op_time")) { +// if (urlList.size() > 0) { +// for (String fileUrl : urlList) { +// String key = File2Redis.file2Redis(fileUrl, transaction); +// logger.info("向{}号redis数据库添加了一条文件配置,key是{}",redisDBIndex,key); +// valBF.append(key); +// valBF.append("\t"); +// } +// } +// } + + if(valStr.contains("redisFile_")) { + String key = File2Redis.file2Redis(map.get(valStr), transaction); + logger.info("向{}号redis数据库添加了一条文件配置,key是{}",redisDBIndex,key); + valBF.append(key); + //valBF.append("\t"); + }else { + valBF.append(map.get(valStr)); + } } else if (valStr.equals(" ")) { valBF.append(" "); } else if (valStr.equals("\\t")) {// xml中是字符串的\t这里判断的时候需要转义为\\t,但是添加的时候需要添加\t不是\\t @@ -270,7 +297,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService { && redisStatisticsRealDBIndex < Configurations.getIntProperty("maxRedisDBIndex", 16)) { List list = configMap.get(redisDBIndex); if (list != null && list.size() > 0) { - transaction.select(redisStatisticsRealDBIndex);//选择实时统计库 + transaction.select(redisStatisticsRealDBIndex);// 选择实时统计库 String redisStatisticsReal = Configurations.getStringProperty("redis-statisticsReal", "[COMPILE_ID];\t;[SERVICE];\t;[ACTION];\t;[CONT_TYPE];\t;[ATTR_TYPE];\t;[CONT_LABEL];\t;[TASK_ID];\t;[AFFAIR_ID];\t;[DO_BLACKLIST];\t;[DO_LOG];\t;[EFFECTIVE_RANGE];\t;[START_TIME];\t;[END_TIME];\t;[USER_REGION];\t;[IS_VALID];\t;[GROUP_NUM];\t;[FATHER_CFG_ID];\t;[OP_TIME]"); String[] redisStatisticsRealArr = redisStatisticsReal.split(";"); @@ -461,11 +488,13 @@ public class ConfigJedisServiceimpl implements ConfigRedisService { int service = maatConfig.getService(); if (ServiceAndRDBIndexReal.isAddASU(service)) { if (!keySet.contains(TAPREDISDB)) { - throw new ServiceRuntimeException("业务类型:" + service + ",需要向阀门" + TAPREDISDB + "号库分发,但是当前只往" - + keySet + "库下发,请检查阀门编号或者当前业务对应的配置文件是否正确",RestBusinessCode.PropertiesIsError.getValue()); + throw new ServiceRuntimeException( + "业务类型:" + service + ",需要向阀门" + TAPREDISDB + "号库分发,但是当前只往" + keySet + + "库下发,请检查阀门编号或者当前业务对应的配置文件是否正确", + RestBusinessCode.PropertiesIsError.getValue()); } } - + MaatXmlConfig maatXmlConfig = ReadMaatXmlUtil.getMaatConfigByService(service); setConfig(maatConfig, maatXmlConfig, maatVersion, service, transaction, redisDBIndex); @@ -695,7 +724,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService { } } } - } else if (isReuse && (type == 12 || type == 13 || type == 14|| type == 15|| type == 18)) {// 将数据往临时库复制一份,无论临时库里有没有都可以直接写,有则覆盖,不影响 + } else if (isReuse && (type == 12 || type == 13 || type == 14 || type == 15 || type == 18)) {// 将数据往临时库复制一份,无论临时库里有没有都可以直接写,有则覆盖,不影响 int tmpStorageReuseRegionDB = Configurations.getIntProperty("tmpStorageReuseRegionDB", 15); transaction.select(tmpStorageReuseRegionDB); transaction.set(maatKey.toUpperCase(), valBF.toString()); diff --git a/src/main/resources/maatXml/applicationConfig-maatRedis.xml b/src/main/resources/maatXml/applicationConfig-maatRedis.xml index f70c50e..54853f9 100644 --- a/src/main/resources/maatXml/applicationConfig-maatRedis.xml +++ b/src/main/resources/maatXml/applicationConfig-maatRedis.xml @@ -139,7 +139,7 @@ EFFECTIVE_RULE;:;{un_maat_table_name};,;[cfg_id] - [cfg_id];\t;[service];\t;[keyring_name];\t;[keyring_type];\t;[private_key_file];\t;[public_key_file];\t;[expire_after];\t;[public_key_algo];\t;[crl];\t;[is_valid];\t;[op_time];&nbsp;0;\n + [cfg_id];\t;[service];\t;[keyring_name];\t;[keyring_type];\t;[private_key_file];\t;[public_key_file];\t;[expire_after];\t;[public_key_algo];\t;[crl];\t;[is_valid];\t;[redisFile_private_key_file];\t;[redisFile_public_key_file];\t;[op_time];&nbsp;0;\n 1 From efeadc3f39a18a93d7709749e6cd33ae2a51c95b Mon Sep 17 00:00:00 2001 From: RenKaiGe-Office Date: Thu, 27 Sep 2018 19:07:27 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E6=B7=BB=E5=8A=A0nms=E5=8F=A6=E5=A4=96?= =?UTF-8?q?=E4=B8=A4=E4=B8=AA=E6=8E=A5=E5=8F=A3,=E5=8F=AA=E5=86=99?= =?UTF-8?q?=E4=BA=86controller=E5=92=8Cbean,service=E5=92=8Cdao=E8=BF=98?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=86=99,=E5=85=88=E4=BE=9B=E5=8A=B2?= =?UTF-8?q?=E6=9D=BE=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/nis/domain/restful/NmsDiRule.java | 190 ++++++++++++++++++ .../com/nis/domain/restful/NmsDiRuleList.java | 19 ++ .../restful/TrafficNetflowPortInfo.java | 108 ++++++++++ .../restful/TrafficNetflowPortInfoList.java | 19 ++ .../controller/restful/NmsInfoController.java | 40 +++- 5 files changed, 375 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/nis/domain/restful/NmsDiRule.java create mode 100644 src/main/java/com/nis/domain/restful/NmsDiRuleList.java create mode 100644 src/main/java/com/nis/domain/restful/TrafficNetflowPortInfo.java create mode 100644 src/main/java/com/nis/domain/restful/TrafficNetflowPortInfoList.java diff --git a/src/main/java/com/nis/domain/restful/NmsDiRule.java b/src/main/java/com/nis/domain/restful/NmsDiRule.java new file mode 100644 index 0000000..4882051 --- /dev/null +++ b/src/main/java/com/nis/domain/restful/NmsDiRule.java @@ -0,0 +1,190 @@ +package com.nis.domain.restful; + +import java.io.Serializable; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.wordnik.swagger.annotations.ApiModelProperty; + +public class NmsDiRule implements Serializable { + + private static final long serialVersionUID = 1L; + @JsonIgnore + private long id; + private long detectionInfoId; + private long serviceIndex; + private long serviceCode; + private String serviceDesc; + private long agedTime; + private String clientNum; + private String refluxPort; + private String ruleNumber; + private String usedRuleNum; + private String leftRuleNum; + private String hitTotalNum; + private String detectionedState; + private long seqId; + private long detectionSetInfoId; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "dataCheckTime", notes = "") + private Date dataCheckTime; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "dataArriveTime", notes = "") + private Date dataArriveTime; + private long dataCheckTimeDigital; + private long dataArriveTimeDigital; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public long getDetectionInfoId() { + return detectionInfoId; + } + + public void setDetectionInfoId(long detectionInfoId) { + this.detectionInfoId = detectionInfoId; + } + + public long getServiceIndex() { + return serviceIndex; + } + + public void setServiceIndex(long serviceIndex) { + this.serviceIndex = serviceIndex; + } + + public long getServiceCode() { + return serviceCode; + } + + public void setServiceCode(long serviceCode) { + this.serviceCode = serviceCode; + } + + public String getServiceDesc() { + return serviceDesc; + } + + public void setServiceDesc(String serviceDesc) { + this.serviceDesc = serviceDesc; + } + + public long getAgedTime() { + return agedTime; + } + + public void setAgedTime(long agedTime) { + this.agedTime = agedTime; + } + + public String getClientNum() { + return clientNum; + } + + public void setClientNum(String clientNum) { + this.clientNum = clientNum; + } + + public String getRefluxPort() { + return refluxPort; + } + + public void setRefluxPort(String refluxPort) { + this.refluxPort = refluxPort; + } + + public String getRuleNumber() { + return ruleNumber; + } + + public void setRuleNumber(String ruleNumber) { + this.ruleNumber = ruleNumber; + } + + public String getUsedRuleNum() { + return usedRuleNum; + } + + public void setUsedRuleNum(String usedRuleNum) { + this.usedRuleNum = usedRuleNum; + } + + public String getLeftRuleNum() { + return leftRuleNum; + } + + public void setLeftRuleNum(String leftRuleNum) { + this.leftRuleNum = leftRuleNum; + } + + public String getHitTotalNum() { + return hitTotalNum; + } + + public void setHitTotalNum(String hitTotalNum) { + this.hitTotalNum = hitTotalNum; + } + + public String getDetectionedState() { + return detectionedState; + } + + public void setDetectionedState(String detectionedState) { + this.detectionedState = detectionedState; + } + + public long getSeqId() { + return seqId; + } + + public void setSeqId(long seqId) { + this.seqId = seqId; + } + + public long getDetectionSetInfoId() { + return detectionSetInfoId; + } + + public void setDetectionSetInfoId(long detectionSetInfoId) { + this.detectionSetInfoId = detectionSetInfoId; + } + + public Date getDataCheckTime() { + return dataCheckTime; + } + + public void setDataCheckTime(Date dataCheckTime) { + this.dataCheckTime = dataCheckTime; + } + + public Date getDataArriveTime() { + return dataArriveTime; + } + + public void setDataArriveTime(Date dataArriveTime) { + this.dataArriveTime = dataArriveTime; + } + + public long getDataCheckTimeDigital() { + return dataCheckTimeDigital; + } + + public void setDataCheckTimeDigital(long dataCheckTimeDigital) { + this.dataCheckTimeDigital = dataCheckTimeDigital; + } + + public long getDataArriveTimeDigital() { + return dataArriveTimeDigital; + } + + public void setDataArriveTimeDigital(long dataArriveTimeDigital) { + this.dataArriveTimeDigital = dataArriveTimeDigital; + } + +} diff --git a/src/main/java/com/nis/domain/restful/NmsDiRuleList.java b/src/main/java/com/nis/domain/restful/NmsDiRuleList.java new file mode 100644 index 0000000..3f2c7a7 --- /dev/null +++ b/src/main/java/com/nis/domain/restful/NmsDiRuleList.java @@ -0,0 +1,19 @@ +package com.nis.domain.restful; + +import java.io.Serializable; +import java.util.List; + +public class NmsDiRuleList implements Serializable { + + private static final long serialVersionUID = 1L; + private List nmsDiRuleList; + + public List getNmsDiRuleList() { + return nmsDiRuleList; + } + + public void setNmsDiRuleList(List nmsDiRuleList) { + this.nmsDiRuleList = nmsDiRuleList; + } + +} diff --git a/src/main/java/com/nis/domain/restful/TrafficNetflowPortInfo.java b/src/main/java/com/nis/domain/restful/TrafficNetflowPortInfo.java new file mode 100644 index 0000000..d78dc32 --- /dev/null +++ b/src/main/java/com/nis/domain/restful/TrafficNetflowPortInfo.java @@ -0,0 +1,108 @@ +package com.nis.domain.restful; + +import java.io.Serializable; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.wordnik.swagger.annotations.ApiModelProperty; + +public class TrafficNetflowPortInfo implements Serializable { + + private static final long serialVersionUID = 1L; + @JsonIgnore + private long stat_id; + private long port; + private String nodeName; + private String nodeIp; + private String portDesc; + private long bandwidth; + private long inoctets; + private long outoctets; + private long inoctetsSpeed; + private long outoctetsSpeed; + private long inpktsSpeed; + private long outpktsSpeed; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "dataArriveTime", notes = "") + private Date recvTime; + public long getStat_id() { + return stat_id; + } + public void setStat_id(long stat_id) { + this.stat_id = stat_id; + } + public long getPort() { + return port; + } + public void setPort(long port) { + this.port = port; + } + public String getNodeName() { + return nodeName; + } + public void setNodeName(String nodeName) { + this.nodeName = nodeName; + } + public String getNodeIp() { + return nodeIp; + } + public void setNodeIp(String nodeIp) { + this.nodeIp = nodeIp; + } + public String getPortDesc() { + return portDesc; + } + public void setPortDesc(String portDesc) { + this.portDesc = portDesc; + } + public long getBandwidth() { + return bandwidth; + } + public void setBandwidth(long bandwidth) { + this.bandwidth = bandwidth; + } + public long getInoctets() { + return inoctets; + } + public void setInoctets(long inoctets) { + this.inoctets = inoctets; + } + public long getOutoctets() { + return outoctets; + } + public void setOutoctets(long outoctets) { + this.outoctets = outoctets; + } + public long getInoctetsSpeed() { + return inoctetsSpeed; + } + public void setInoctetsSpeed(long inoctetsSpeed) { + this.inoctetsSpeed = inoctetsSpeed; + } + public long getOutoctetsSpeed() { + return outoctetsSpeed; + } + public void setOutoctetsSpeed(long outoctetsSpeed) { + this.outoctetsSpeed = outoctetsSpeed; + } + public long getInpktsSpeed() { + return inpktsSpeed; + } + public void setInpktsSpeed(long inpktsSpeed) { + this.inpktsSpeed = inpktsSpeed; + } + public long getOutpktsSpeed() { + return outpktsSpeed; + } + public void setOutpktsSpeed(long outpktsSpeed) { + this.outpktsSpeed = outpktsSpeed; + } + public Date getRecvTime() { + return recvTime; + } + public void setRecvTime(Date recvTime) { + this.recvTime = recvTime; + } + +} diff --git a/src/main/java/com/nis/domain/restful/TrafficNetflowPortInfoList.java b/src/main/java/com/nis/domain/restful/TrafficNetflowPortInfoList.java new file mode 100644 index 0000000..f10ac22 --- /dev/null +++ b/src/main/java/com/nis/domain/restful/TrafficNetflowPortInfoList.java @@ -0,0 +1,19 @@ +package com.nis.domain.restful; + +import java.io.Serializable; +import java.util.List; + +public class TrafficNetflowPortInfoList implements Serializable { + + private static final long serialVersionUID = 1L; + private List trafficNetflowPortInfoList; + + public List getTrafficNetflowPortInfoList() { + return trafficNetflowPortInfoList; + } + + public void setTrafficNetflowPortInfoList(List trafficNetflowPortInfoList) { + this.trafficNetflowPortInfoList = trafficNetflowPortInfoList; + } + +} diff --git a/src/main/java/com/nis/web/controller/restful/NmsInfoController.java b/src/main/java/com/nis/web/controller/restful/NmsInfoController.java index 7523cef..8a7cc7c 100644 --- a/src/main/java/com/nis/web/controller/restful/NmsInfoController.java +++ b/src/main/java/com/nis/web/controller/restful/NmsInfoController.java @@ -11,7 +11,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; -import com.nis.domain.restful.TrafficNmsServerStatistic; +import com.nis.domain.restful.NmsDiRuleList; +import com.nis.domain.restful.TrafficNetflowPortInfoList; import com.nis.domain.restful.TrafficNmsServerStatisticList; import com.nis.restful.RestBusinessCode; import com.nis.restful.RestServiceException; @@ -60,4 +61,41 @@ public class NmsInfoController extends BaseRestController { Constants.IS_DEBUG ? trafficNmsServerStatisticList : null); } + @RequestMapping(value = "/nms/v1/saveNmsDiRule", method = RequestMethod.POST) + @ApiOperation(value = "存储NmsDiRule接口", httpMethod = "POST", response = Map.class, notes = "接收NMS系统上报的di信息") + @ApiParam(value = "存储NmsDiRule接口", name = "saveServerStatus", required = true) + public Map saveNmsDiRule(@RequestBody NmsDiRuleList nmsDiRuleList, HttpServletRequest request, + HttpServletResponse response) { + long start = System.currentTimeMillis(); + AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, + nmsDiRuleList); + try { + + } catch (Exception e) { + throw new RestServiceException(thread, System.currentTimeMillis() - start, + "上报NmsDiRule信息异常:" + e.getMessage(), RestBusinessCode.unknow_error.getValue()); + } + return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "上报NmsDiRule信息成功", + Constants.IS_DEBUG ? nmsDiRuleList : null); + } + + @RequestMapping(value = "/nms/v1/rafficNetflowPortInfo", method = RequestMethod.POST) + @ApiOperation(value = "存储trafficNetflowPortInfo接口", httpMethod = "POST", response = Map.class, notes = "接收NMS系统上报的trafficNetflowPort信息") + @ApiParam(value = "存储trafficNetflowPortInfo接口", name = "saveTrafficNetflowPortInfo", required = true) + public Map saveTrafficNetflowPortInfo( + @RequestBody TrafficNetflowPortInfoList trafficNetflowPortInfoList, HttpServletRequest request, + HttpServletResponse response) { + long start = System.currentTimeMillis(); + AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, + trafficNetflowPortInfoList); + try { + + } catch (Exception e) { + throw new RestServiceException(thread, System.currentTimeMillis() - start, + "上报trafficNetflowPort信息异常:" + e.getMessage(), RestBusinessCode.unknow_error.getValue()); + } + return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, + "上报trafficNetflowPort信息成功", Constants.IS_DEBUG ? trafficNetflowPortInfoList : null); + } + } From 51e88c9239031bdff827a9a60dccf89e21ee8783 Mon Sep 17 00:00:00 2001 From: doufenghu Date: Sat, 29 Sep 2018 09:35:05 +0800 Subject: [PATCH 05/11] =?UTF-8?q?fix(pom):=E5=A2=9E=E5=8A=A0fastdfs=20jar?= =?UTF-8?q?=20=E5=8C=85=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 850ac1b..6eb02c3 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ nexus Team Nexus Repository - http://10.0.6.30:8044/content/groups/public + http://192.168.10.125:8099/content/groups/public @@ -562,7 +562,7 @@ org.csource fastdfs-client-java - 1.27-SNAPSHOT + 1.27 From bafa001514f423f0d7a442bdcb9e18a6f2bd5058 Mon Sep 17 00:00:00 2001 From: zhangdongxu Date: Sat, 29 Sep 2018 20:56:17 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=EF=BC=9B=E6=B7=BB=E5=8A=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=88=B0Minio=E6=9C=8D=E5=8A=A1=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/nis/util/Constants.java | 5 ++- .../restful/ConfigSourcesController.java | 39 +++++++++++++------ .../service/restful/ConfigSourcesService.java | 2 +- src/main/resources/fastdfs-client.properties | 8 ++-- src/main/resources/fdfs_client.conf | 4 +- src/main/resources/jdbc.properties | 22 +++++------ src/main/resources/nis.properties | 4 +- 7 files changed, 53 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/nis/util/Constants.java b/src/main/java/com/nis/util/Constants.java index 4257cbb..5d5f45c 100644 --- a/src/main/java/com/nis/util/Constants.java +++ b/src/main/java/com/nis/util/Constants.java @@ -203,5 +203,8 @@ public final class Constants { * 样例文件存放目录 */ public static final String MM_SAMPLE_DST_PATH = Configurations.getStringProperty("mmSampleDstPath", "/home/mesasoft/{tableType}/full/{fileName}"); - + /** + *是否使用Minio + */ + public static final Boolean IS_USE_MINIO = Configurations.getBooleanProperty("isUseMinio", true); } diff --git a/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java b/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java index c29856d..7bbd1bb 100644 --- a/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java +++ b/src/main/java/com/nis/web/controller/restful/ConfigSourcesController.java @@ -29,6 +29,7 @@ import com.nis.restful.RestServiceException; import com.nis.restful.ServiceRuntimeException; import com.nis.util.Constants; import com.nis.util.FileUtils; +import com.nis.util.MinioUtil; import com.nis.util.StringUtil; import com.nis.util.StringUtils; import com.nis.web.controller.BaseRestController; @@ -289,16 +290,20 @@ public class ConfigSourcesController extends BaseRestController { throw new RestServiceException("checksum与文件MD5值不一致", RestBusinessCode.CheckSumIsWrong.getValue()); } String ext = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1); - FastDFSFile fdsfile = new FastDFSFile(file.getBytes(), file.getOriginalFilename(), ext); - // NameValuePair[] meta_list = new NameValuePair[5]; - // meta_list[0] = new NameValuePair("fileName", file.getOriginalFilename()); - // meta_list[1] = new NameValuePair("fileLength", - // String.valueOf(file.getSize())); - // meta_list[2] = new NameValuePair("fileExt", ext); - // meta_list[3] = new NameValuePair("fileAuthor", "rkg"); - // meta_list[4] = new NameValuePair("fileMd5", md5); logger.info("-----------------调用接口上传文件---------------"); - filePath = FileManager.upload(fdsfile, null); + if(Constants.IS_USE_MINIO){ + filePath = MinioUtil.uploadFile(file.getInputStream(), file.getOriginalFilename(), ext); + }else{ + FastDFSFile fdsfile = new FastDFSFile(file.getBytes(), file.getOriginalFilename(), ext); + // NameValuePair[] meta_list = new NameValuePair[5]; + // meta_list[0] = new NameValuePair("fileName", file.getOriginalFilename()); + // meta_list[1] = new NameValuePair("fileLength", + // String.valueOf(file.getSize())); + // meta_list[2] = new NameValuePair("fileExt", ext); + // meta_list[3] = new NameValuePair("fileAuthor", "rkg"); + // meta_list[4] = new NameValuePair("fileMd5", md5); + filePath = FileManager.upload(fdsfile, null); + } } }catch (IOException e) { // TODO Auto-generated catch block @@ -337,6 +342,7 @@ public class ConfigSourcesController extends BaseRestController { AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, file, null); JSONObject resultObject = new JSONObject(); + String filePath=""; try { if (file == null) { throw new RestServiceException("请上传获取摘要的文件到file参数", RestBusinessCode.FileIsNull.getValue()); @@ -353,9 +359,20 @@ public class ConfigSourcesController extends BaseRestController { RestBusinessCode.CheckSumIsWrong.getValue()); } String ext = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1); - FastDFSFile fdsfile = new FastDFSFile(file.getBytes(), file.getOriginalFilename(), ext); logger.info("-----------------调用接口上传文件---------------"); - String filePath = FileManager.upload(fdsfile, null); + if(Constants.IS_USE_MINIO){ + filePath = MinioUtil.uploadFile(file.getInputStream(), file.getOriginalFilename(), ext); + }else{ + FastDFSFile fdsfile = new FastDFSFile(file.getBytes(), file.getOriginalFilename(), ext); + // NameValuePair[] meta_list = new NameValuePair[5]; + // meta_list[0] = new NameValuePair("fileName", file.getOriginalFilename()); + // meta_list[1] = new NameValuePair("fileLength", + // String.valueOf(file.getSize())); + // meta_list[2] = new NameValuePair("fileExt", ext); + // meta_list[3] = new NameValuePair("fileAuthor", "rkg"); + // meta_list[4] = new NameValuePair("fileMd5", md5); + filePath = FileManager.upload(fdsfile, null); + } resultObject.put("accessUrl", filePath); } }catch (IOException e) { diff --git a/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java b/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java index 19d59c3..02a46a9 100644 --- a/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java +++ b/src/main/java/com/nis/web/service/restful/ConfigSourcesService.java @@ -482,7 +482,7 @@ public class ConfigSourcesService extends BaseService { maatTableName.substring(maatTableName.lastIndexOf("_") + 1)); dstStr = dstPath.replace("{fileName}", dstStr.substring(dstStr.lastIndexOf("/") + 1)); } else if ("file_id".equals(commonSourceFieldCfg.getDstName())) { - dstStr = dstStr.substring(dstStr.indexOf("group")); + //dstStr = dstStr.substring(dstStr.indexOf("group")); } } switch (commonSourceFieldCfg.getFieldType()) { diff --git a/src/main/resources/fastdfs-client.properties b/src/main/resources/fastdfs-client.properties index 86c5bfb..0b83f1e 100644 --- a/src/main/resources/fastdfs-client.properties +++ b/src/main/resources/fastdfs-client.properties @@ -10,11 +10,11 @@ fastdfs.http_secret_key = FastDFS1234567890 fastdfs.http_tracker_http_port = 80 #元辰鑫内网 -fastdfs.tracker_servers = 10.0.6.249:22122 -fastDfsHttpAddr= 10.0.6.249 +#fastdfs.tracker_servers = 10.0.6.249:22122 +#fastDfsHttpAddr= 10.0.6.249 #元辰鑫外网 -#fastdfs.tracker_servers=192.168.10.205:22122 -#fastDfsHttpAddr=192.168.10.205 +fastdfs.tracker_servers=192.168.10.205:22122 +fastDfsHttpAddr=192.168.10.205 #亦庄演示环境 #fastdfs.tracker_servers = 10.3.34.1:22122 #fastDfsHttpAddr = 10.3.34.1 \ No newline at end of file diff --git a/src/main/resources/fdfs_client.conf b/src/main/resources/fdfs_client.conf index 00b5f6a..25a71ff 100644 --- a/src/main/resources/fdfs_client.conf +++ b/src/main/resources/fdfs_client.conf @@ -7,8 +7,8 @@ http.secret_key = FastDFS1234567890 #元辰鑫内网 -tracker_server=10.0.6.249:22122 +#tracker_server=10.0.6.249:22122 #元辰鑫外网 -#tracker_server=192.168.10.205:22122 +tracker_server=192.168.10.205:22122 #亦庄演示环境 #tracker_server=10.3.34.1:22122 diff --git a/src/main/resources/jdbc.properties b/src/main/resources/jdbc.properties index 152d615..84e7f92 100644 --- a/src/main/resources/jdbc.properties +++ b/src/main/resources/jdbc.properties @@ -1,11 +1,11 @@ #==========日志库 Mysql======================= jdbc.log.driver=com.mysql.jdbc.Driver #元辰鑫内网 -jdbc.log.url=jdbc:mysql://10.0.6.249:3306/galaxy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull +#jdbc.log.url=jdbc:mysql://10.0.6.249:3306/galaxy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull #华严 #jdbc.log.url=jdbc:mysql://192.168.11.242:3306/galaxy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull #元辰鑫外网 -#jdbc.log.url=jdbc:mysql://192.168.10.204:3306/galaxy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull +jdbc.log.url=jdbc:mysql://192.168.10.204:3306/galaxy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull #亦庄演示环境 #jdbc.log.url=jdbc:mysql://10.3.48.5:3306/galaxy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull jdbc.log.username=root @@ -42,11 +42,11 @@ jdbc.hive.DBName=maat #A版日志库 jdbc.hive.driver=org.apache.hive.jdbc.HiveDriver #元辰鑫内网 -jdbc.hive.url=jdbc:hive2://10.0.6.202:10000/maat +#jdbc.hive.url=jdbc:hive2://10.0.6.202:10000/maat #华严 #jdbc.hive.url=jdbc:hive2://192.168.11.243:2181,192.168.10.76:2181,192.168.10.77:2181/maat;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2 #元辰鑫外网 -#jdbc.hive.url=jdbc:hive2://192.168.10.22:10000/maat +jdbc.hive.url=jdbc:hive2://192.168.10.22:10000/maat #亦庄演示环境高可用集群连接,注意使用此种方法需要配置hosts,主机名与ip的对应关系 #jdbc.hive.url=jdbc:hive2://10.3.48.2:2181,10.3.48.3:2181,10.3.48.4:2181/maat;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2 jdbc.hive.username=xa_z2_mesa @@ -75,7 +75,7 @@ jdbc.clickhouse.driver=ru.yandex.clickhouse.ClickHouseDriver #域名测试环境 #jdbc.clickhouse.url=jdbc:clickhouse://clickhouse.baifendian.com:80/k18_ods #亦庄演示环境 -jdbc.clickhouse.url=jdbc:clickhouse://10.3.45.5:8123/k18_ods?socket_timeout=600000 +jdbc.clickhouse.url=jdbc:clickhouse://10.3.45.5:8123/k18_ods jdbc.clickhouse.username= jdbc.clickhouse.key= jdbc.clickhouse.password= @@ -122,13 +122,13 @@ druid.log.filters=stat ##minio地址 ######################################################################### ##minio的地址,注意前面的http://不要忘记写 -minioUrl=http://192.168.10.61:9000 +minio_url=http://192.168.10.205:9000 ##minio的accessKey -minio_accessKey= +minio_accessKey=minio ##minio的secretKey -minio_secretKey= +minio_secretKey=123456789 ##minio的bucketName -minio_bucketName=test +minio_bucketName=maat-redis @@ -136,11 +136,11 @@ minio_bucketName=test ##redis连接 ##################################################################################################################################### #元辰鑫内网 -redis.host=10.0.6.249 +#redis.host=10.0.6.249 #华严 #redis.host=192.168.11.243 #元辰鑫外网 -#redis.host=192.168.10.205 +redis.host=192.168.10.205 #亦庄测试环境 #redis.host=192.168.10.215 #亦庄演示环境 diff --git a/src/main/resources/nis.properties b/src/main/resources/nis.properties index 426350c..e1b2dc5 100644 --- a/src/main/resources/nis.properties +++ b/src/main/resources/nis.properties @@ -202,4 +202,6 @@ maatTestLogPath=c:/maat/mmat.log mmSampleDstPath=/home/mesasoft/{tableType}/full/{fileName} ##定时将redis主从库的实时统计数据同步到redis集群中 -syncRedisToClusterCron=0/10 * * * * ? \ No newline at end of file +syncRedisToClusterCron=0/10 * * * * ? +#文件服务器是否使用Minio +isUseMinio=true \ No newline at end of file From 9d6f4f4a43d7f8979dad063c9a761c99e7dffff0 Mon Sep 17 00:00:00 2001 From: doufenghu Date: Mon, 8 Oct 2018 11:18:51 +0800 Subject: [PATCH 07/11] =?UTF-8?q?fix(=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=EF=BC=89=E5=A2=9E=E5=8A=A0=E5=BC=80=E5=8F=91=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=EF=BC=8C=E6=B8=85=E9=99=A4=E4=B8=AD=E6=96=87=E7=A9=BA=E6=A0=BC?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/applicationContext-redis.xml | 18 ++--- .../resources/applicationContext-shiro.xml | 78 +++++++++---------- src/main/resources/jdbc.properties | 8 +- 3 files changed, 54 insertions(+), 50 deletions(-) diff --git a/src/main/resources/applicationContext-redis.xml b/src/main/resources/applicationContext-redis.xml index 065dc9d..7b58b76 100644 --- a/src/main/resources/applicationContext-redis.xml +++ b/src/main/resources/applicationContext-redis.xml @@ -1,11 +1,11 @@ - + + ignore-unresolvable="true" location="classpath:jdbc.properties" /> @@ -30,7 +30,7 @@ + type="int" /> diff --git a/src/main/resources/applicationContext-shiro.xml b/src/main/resources/applicationContext-shiro.xml index ae0a624..2e0b2b8 100644 --- a/src/main/resources/applicationContext-shiro.xml +++ b/src/main/resources/applicationContext-shiro.xml @@ -1,14 +1,14 @@ - + - + default-lazy-init="true"> + Shiro Configuration - - + + @@ -17,18 +17,18 @@ - + - + - + - + @@ -39,18 +39,18 @@ /login = authc /logout = logout ${adminPath}/** = user - - + - - + + @@ -66,42 +66,42 @@ - + - - - - + + + + - + - + - + - + - + - - - + + + - + - + @@ -109,25 +109,25 @@ - + - + - + - + - + - - + + @@ -164,9 +164,9 @@ - - - + + + diff --git a/src/main/resources/jdbc.properties b/src/main/resources/jdbc.properties index 84e7f92..21bf214 100644 --- a/src/main/resources/jdbc.properties +++ b/src/main/resources/jdbc.properties @@ -4,8 +4,10 @@ jdbc.log.driver=com.mysql.jdbc.Driver #jdbc.log.url=jdbc:mysql://10.0.6.249:3306/galaxy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull #华严 #jdbc.log.url=jdbc:mysql://192.168.11.242:3306/galaxy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull +#元辰鑫外网-开发环境 +jdbc.log.url=jdbc:mysql://192.168.10.204:3306/galaxy-dev?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull #元辰鑫外网 -jdbc.log.url=jdbc:mysql://192.168.10.204:3306/galaxy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull +#jdbc.log.url=jdbc:mysql://192.168.10.204:3306/galaxy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull #亦庄演示环境 #jdbc.log.url=jdbc:mysql://10.3.48.5:3306/galaxy?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull jdbc.log.username=root @@ -139,8 +141,10 @@ minio_bucketName=maat-redis #redis.host=10.0.6.249 #华严 #redis.host=192.168.11.243 +#元辰鑫外网-开发环境 +redis.host=192.168.10.12 #元辰鑫外网 -redis.host=192.168.10.205 +#redis.host=192.168.10.205 #亦庄测试环境 #redis.host=192.168.10.215 #亦庄演示环境 From 1ef91b55923980f5f8a0fc21f71c8cc14306e427 Mon Sep 17 00:00:00 2001 From: renkaige Date: Tue, 9 Oct 2018 10:26:22 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=AD=96=E7=95=A5=E7=B1=BB=E9=85=8D=E7=BD=AE=E5=B0=86=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=AD=98=E5=82=A8=E5=88=B0redis=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 6 +++--- .../com/nis/web/service/restful/ConfigJedisServiceimpl.java | 2 +- .../resources/commonSources/applicationConfig-parser.xml | 1 + src/main/resources/jdbc.properties | 6 ++++-- src/main/resources/maatXml/applicationConfig-maatRedis.xml | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 6eb02c3..10f28ba 100644 --- a/pom.xml +++ b/pom.xml @@ -14,9 +14,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 war - galaxy - com.nis.springmvc - galaxy + galaxy-service + com.nis.galaxy + galaxy-service 0.0.1-SNAPSHOT diff --git a/src/main/java/com/nis/web/service/restful/ConfigJedisServiceimpl.java b/src/main/java/com/nis/web/service/restful/ConfigJedisServiceimpl.java index 0d88606..be6fa1f 100644 --- a/src/main/java/com/nis/web/service/restful/ConfigJedisServiceimpl.java +++ b/src/main/java/com/nis/web/service/restful/ConfigJedisServiceimpl.java @@ -90,7 +90,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService { } StringBuffer valBF = new StringBuffer(); String[] valSplit = maatXmlExpr.getValueExpression().split(";"); - List urlList = new ArrayList(); +// List urlList = new ArrayList(); for (String valStr : valSplit) { if (!StringUtils.isEmpty(valStr) && valStr.trim().startsWith("[")) { valStr = valStr.trim().replace("[", "").replace("]", ""); diff --git a/src/main/resources/commonSources/applicationConfig-parser.xml b/src/main/resources/commonSources/applicationConfig-parser.xml index c2b5947..cda88fe 100644 --- a/src/main/resources/commonSources/applicationConfig-parser.xml +++ b/src/main/resources/commonSources/applicationConfig-parser.xml @@ -161,6 +161,7 @@ + diff --git a/src/main/resources/jdbc.properties b/src/main/resources/jdbc.properties index 21bf214..67984b0 100644 --- a/src/main/resources/jdbc.properties +++ b/src/main/resources/jdbc.properties @@ -77,7 +77,7 @@ jdbc.clickhouse.driver=ru.yandex.clickhouse.ClickHouseDriver #域名测试环境 #jdbc.clickhouse.url=jdbc:clickhouse://clickhouse.baifendian.com:80/k18_ods #亦庄演示环境 -jdbc.clickhouse.url=jdbc:clickhouse://10.3.45.5:8123/k18_ods +jdbc.clickhouse.url=jdbc:clickhouse://10.3.45.5:8123/k18_ods?socket_timeout=90000 jdbc.clickhouse.username= jdbc.clickhouse.key= jdbc.clickhouse.password= @@ -123,7 +123,9 @@ druid.log.filters=stat ######################################################################### ##minio地址 ######################################################################### -##minio的地址,注意前面的http://不要忘记写 +##华严minio的地址,注意前面的http://不要忘记写 +#minio_url=http://192.168.10.61:9000 +##元辰鑫外网minio的地址,注意前面的http://不要忘记写 minio_url=http://192.168.10.205:9000 ##minio的accessKey minio_accessKey=minio diff --git a/src/main/resources/maatXml/applicationConfig-maatRedis.xml b/src/main/resources/maatXml/applicationConfig-maatRedis.xml index 54853f9..060d35c 100644 --- a/src/main/resources/maatXml/applicationConfig-maatRedis.xml +++ b/src/main/resources/maatXml/applicationConfig-maatRedis.xml @@ -159,7 +159,7 @@ EFFECTIVE_RULE;:;{un_maat_table_name};,;[cfg_id] - [cfg_id];\t;[service];\t;[file_desc];\t;[content_type];\t;[content_length];\t;[file_path];\t;[is_valid];\t;[op_time];&nbsp;0;\n + [cfg_id];\t;[service];\t;[file_desc];\t;[content_type];\t;[content_length];\t;[file_path];\t;[is_valid];\t;[redisFile_file_path];\t;[op_time];&nbsp;0;\n 1 From c6576215a60e443d2875c0815dfcae1cbe23074c Mon Sep 17 00:00:00 2001 From: renkaige Date: Tue, 9 Oct 2018 14:12:07 +0800 Subject: [PATCH 09/11] =?UTF-8?q?1:=E5=AE=8C=E6=88=90nms=E5=8F=A6=E5=A4=96?= =?UTF-8?q?=E4=B8=A4=E4=B8=AA=E6=8E=A5=E5=8F=A3=202:=E4=BF=AE=E6=94=B9swag?= =?UTF-8?q?ger=E4=B8=ADindex.html=E9=A1=B5=E9=9D=A2=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E8=AF=86=E5=88=ABurl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/restful/NmsInfoController.java | 22 +++- .../java/com/nis/web/dao/NmsDiRuleDao.java | 7 + .../java/com/nis/web/dao/NmsDiRuleDao.xml | 44 +++++++ .../web/dao/TrafficNetflowPortInfoDao.java | 7 + .../nis/web/dao/TrafficNetflowPortInfoDao.xml | 32 +++++ .../web/service/restful/NmsDiRuleService.java | 23 ++++ .../TrafficNetflowPortInfoService.java | 23 ++++ .../TrafficNmsServerStatisticService.java | 1 - src/main/webapp/swagger/index.html | 121 ++++++++++-------- 9 files changed, 227 insertions(+), 53 deletions(-) create mode 100644 src/main/java/com/nis/web/dao/NmsDiRuleDao.java create mode 100644 src/main/java/com/nis/web/dao/NmsDiRuleDao.xml create mode 100644 src/main/java/com/nis/web/dao/TrafficNetflowPortInfoDao.java create mode 100644 src/main/java/com/nis/web/dao/TrafficNetflowPortInfoDao.xml create mode 100644 src/main/java/com/nis/web/service/restful/NmsDiRuleService.java create mode 100644 src/main/java/com/nis/web/service/restful/TrafficNetflowPortInfoService.java diff --git a/src/main/java/com/nis/web/controller/restful/NmsInfoController.java b/src/main/java/com/nis/web/controller/restful/NmsInfoController.java index 8a7cc7c..702931d 100644 --- a/src/main/java/com/nis/web/controller/restful/NmsInfoController.java +++ b/src/main/java/com/nis/web/controller/restful/NmsInfoController.java @@ -20,6 +20,8 @@ import com.nis.util.Constants; import com.nis.web.controller.BaseRestController; import com.nis.web.service.AuditLogThread; import com.nis.web.service.ServicesRequestLogService; +import com.nis.web.service.restful.NmsDiRuleService; +import com.nis.web.service.restful.TrafficNetflowPortInfoService; import com.nis.web.service.restful.TrafficNmsServerStatisticService; import com.wordnik.swagger.annotations.Api; import com.wordnik.swagger.annotations.ApiOperation; @@ -33,6 +35,10 @@ public class NmsInfoController extends BaseRestController { protected ServicesRequestLogService servicesRequestLogService; @Autowired TrafficNmsServerStatisticService trafficNmsServerStatisticService; + @Autowired + NmsDiRuleService nmsDiRuleService; + @Autowired + TrafficNetflowPortInfoService trafficNetflowPortInfoService; @RequestMapping(value = "/nms/v1/saveServerStatus", method = RequestMethod.POST) @ApiOperation(value = "存储NMS系统上报的服务器状态接口", httpMethod = "POST", response = Map.class, notes = "接收NMS系统上报的服务器状态信息") @@ -70,7 +76,13 @@ public class NmsInfoController extends BaseRestController { AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, nmsDiRuleList); try { - + if (nmsDiRuleList != null && nmsDiRuleList.getNmsDiRuleList() != null + && nmsDiRuleList.getNmsDiRuleList().size() > 0) { + nmsDiRuleService.saveNmsDiRuleInfo(nmsDiRuleList.getNmsDiRuleList()); + } else { + throw new RestServiceException(thread, System.currentTimeMillis() - start, "参数nmsDiRuleList不能为空", + RestBusinessCode.missing_args.getValue()); + } } catch (Exception e) { throw new RestServiceException(thread, System.currentTimeMillis() - start, "上报NmsDiRule信息异常:" + e.getMessage(), RestBusinessCode.unknow_error.getValue()); @@ -89,6 +101,14 @@ public class NmsInfoController extends BaseRestController { AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request, trafficNetflowPortInfoList); try { + if (trafficNetflowPortInfoList != null && trafficNetflowPortInfoList.getTrafficNetflowPortInfoList() != null + && trafficNetflowPortInfoList.getTrafficNetflowPortInfoList().size() > 0) { + trafficNetflowPortInfoService + .saveTrafficNetflowPortInfo(trafficNetflowPortInfoList.getTrafficNetflowPortInfoList()); + } else { + throw new RestServiceException(thread, System.currentTimeMillis() - start, + "参数trafficNetflowPortInfoList不能为空", RestBusinessCode.missing_args.getValue()); + } } catch (Exception e) { throw new RestServiceException(thread, System.currentTimeMillis() - start, diff --git a/src/main/java/com/nis/web/dao/NmsDiRuleDao.java b/src/main/java/com/nis/web/dao/NmsDiRuleDao.java new file mode 100644 index 0000000..a63d4dc --- /dev/null +++ b/src/main/java/com/nis/web/dao/NmsDiRuleDao.java @@ -0,0 +1,7 @@ +package com.nis.web.dao; + +import com.nis.domain.restful.NmsDiRule; + +@MyBatisDao +public interface NmsDiRuleDao extends CrudDao { +} \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/NmsDiRuleDao.xml b/src/main/java/com/nis/web/dao/NmsDiRuleDao.xml new file mode 100644 index 0000000..ad4e1c8 --- /dev/null +++ b/src/main/java/com/nis/web/dao/NmsDiRuleDao.xml @@ -0,0 +1,44 @@ + + + + + INSERT INTO + nms_di_rule(detection_info_id , + serviceindex , + servicecode , + servicedesc, + agedtime , + clientnum , + refluxport , + rulenumber , + usedrulenum , + leftrulenum , + hittotalnum , + detectioned_state , + seq_id , + detection_set_info_id , + data_check_time , + data_arrive_time , + data_check_time_digital , + data_arrive_time_digital + ) VALUES ( + #{detectionInfoId}, + #{serviceIndex}, + #{serviceCode}, + #{serviceDesc}, + #{agedTime}, + #{clientNum}, + #{refluxPort}, + #{ruleNumber}, + #{usedRuleNum}, + #{leftRuleNum}, + #{hitTotalNum}, + #{detectionedState}, + #{seqId}, + #{detectionSetInfoId}, + #{dataCheckTime}, + #{dataArriveTime}, + #{dataCheckTimeDigital}, + #{dataArriveTimeDigital}) + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/TrafficNetflowPortInfoDao.java b/src/main/java/com/nis/web/dao/TrafficNetflowPortInfoDao.java new file mode 100644 index 0000000..e32286c --- /dev/null +++ b/src/main/java/com/nis/web/dao/TrafficNetflowPortInfoDao.java @@ -0,0 +1,7 @@ +package com.nis.web.dao; + +import com.nis.domain.restful.TrafficNetflowPortInfo; + +@MyBatisDao +public interface TrafficNetflowPortInfoDao extends CrudDao { +} \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/TrafficNetflowPortInfoDao.xml b/src/main/java/com/nis/web/dao/TrafficNetflowPortInfoDao.xml new file mode 100644 index 0000000..362b2e9 --- /dev/null +++ b/src/main/java/com/nis/web/dao/TrafficNetflowPortInfoDao.xml @@ -0,0 +1,32 @@ + + + + + INSERT INTO + traffic_netflow_port_info(PORT , + NODE_NAME , + NODE_IP , + PORT_DESC, + BANDWIDTH , + INOCTETS , + OUTOCTETS , + INOCTETS_SPEED , + OUTOCTETS_SPEED , + INPKTS_SPEED , + OUTPKTS_SPEED , + RECV_TIME + ) VALUES ( + #{port}, + #{nodeName}, + #{nodeIp}, + #{portDesc}, + #{bandwidth}, + #{inoctets}, + #{outoctets}, + #{inoctetsSpeed}, + #{outoctetsSpeed}, + #{inpktsSpeed}, + #{outpktsSpeed}, + #{recvTime}) + + \ No newline at end of file diff --git a/src/main/java/com/nis/web/service/restful/NmsDiRuleService.java b/src/main/java/com/nis/web/service/restful/NmsDiRuleService.java new file mode 100644 index 0000000..8288812 --- /dev/null +++ b/src/main/java/com/nis/web/service/restful/NmsDiRuleService.java @@ -0,0 +1,23 @@ +package com.nis.web.service.restful; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.nis.domain.restful.NmsDiRule; +import com.nis.web.dao.NmsDiRuleDao; + +@Service +public class NmsDiRuleService { + @Autowired + NmsDiRuleDao nmsDiRuleDao; + + @Transactional + public void saveNmsDiRuleInfo(List nmsDiRuleList) { + for (NmsDiRule nmsDiRule : nmsDiRuleList) { + nmsDiRuleDao.insert(nmsDiRule); + } + } +} diff --git a/src/main/java/com/nis/web/service/restful/TrafficNetflowPortInfoService.java b/src/main/java/com/nis/web/service/restful/TrafficNetflowPortInfoService.java new file mode 100644 index 0000000..62cf482 --- /dev/null +++ b/src/main/java/com/nis/web/service/restful/TrafficNetflowPortInfoService.java @@ -0,0 +1,23 @@ +package com.nis.web.service.restful; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.nis.domain.restful.TrafficNetflowPortInfo; +import com.nis.web.dao.TrafficNetflowPortInfoDao; + +@Service +public class TrafficNetflowPortInfoService { + @Autowired + TrafficNetflowPortInfoDao trafficNetflowPortInfoDao; + + @Transactional + public void saveTrafficNetflowPortInfo(List trafficNetflowPortInfoList) { + for (TrafficNetflowPortInfo trafficNetflowPortInfo : trafficNetflowPortInfoList) { + trafficNetflowPortInfoDao.insert(trafficNetflowPortInfo); + } + } +} diff --git a/src/main/java/com/nis/web/service/restful/TrafficNmsServerStatisticService.java b/src/main/java/com/nis/web/service/restful/TrafficNmsServerStatisticService.java index 93ca9b8..0cee95e 100644 --- a/src/main/java/com/nis/web/service/restful/TrafficNmsServerStatisticService.java +++ b/src/main/java/com/nis/web/service/restful/TrafficNmsServerStatisticService.java @@ -21,6 +21,5 @@ public class TrafficNmsServerStatisticService { trafficNmsServerStatisticDao.insertAbnormalMachine(trafficNmsServerStatistic.getId(), trafficNmsServerStatistic.getAbnormalMachineList()); } - Integer.parseInt(null); } } diff --git a/src/main/webapp/swagger/index.html b/src/main/webapp/swagger/index.html index e45f1e4..344fdf0 100644 --- a/src/main/webapp/swagger/index.html +++ b/src/main/webapp/swagger/index.html @@ -1,49 +1,61 @@ - - - Galaxy UI - - - - - - - + + +Galaxy UI + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - + + + + -