1:完成nms另外两个接口
2:修改swagger中index.html页面自动识别url
This commit is contained in:
@@ -20,6 +20,8 @@ import com.nis.util.Constants;
|
|||||||
import com.nis.web.controller.BaseRestController;
|
import com.nis.web.controller.BaseRestController;
|
||||||
import com.nis.web.service.AuditLogThread;
|
import com.nis.web.service.AuditLogThread;
|
||||||
import com.nis.web.service.ServicesRequestLogService;
|
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.nis.web.service.restful.TrafficNmsServerStatisticService;
|
||||||
import com.wordnik.swagger.annotations.Api;
|
import com.wordnik.swagger.annotations.Api;
|
||||||
import com.wordnik.swagger.annotations.ApiOperation;
|
import com.wordnik.swagger.annotations.ApiOperation;
|
||||||
@@ -33,6 +35,10 @@ public class NmsInfoController extends BaseRestController {
|
|||||||
protected ServicesRequestLogService servicesRequestLogService;
|
protected ServicesRequestLogService servicesRequestLogService;
|
||||||
@Autowired
|
@Autowired
|
||||||
TrafficNmsServerStatisticService trafficNmsServerStatisticService;
|
TrafficNmsServerStatisticService trafficNmsServerStatisticService;
|
||||||
|
@Autowired
|
||||||
|
NmsDiRuleService nmsDiRuleService;
|
||||||
|
@Autowired
|
||||||
|
TrafficNetflowPortInfoService trafficNetflowPortInfoService;
|
||||||
|
|
||||||
@RequestMapping(value = "/nms/v1/saveServerStatus", method = RequestMethod.POST)
|
@RequestMapping(value = "/nms/v1/saveServerStatus", method = RequestMethod.POST)
|
||||||
@ApiOperation(value = "存储NMS系统上报的服务器状态接口", httpMethod = "POST", response = Map.class, notes = "接收NMS系统上报的服务器状态信息")
|
@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,
|
AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request,
|
||||||
nmsDiRuleList);
|
nmsDiRuleList);
|
||||||
try {
|
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) {
|
} catch (Exception e) {
|
||||||
throw new RestServiceException(thread, System.currentTimeMillis() - start,
|
throw new RestServiceException(thread, System.currentTimeMillis() - start,
|
||||||
"上报NmsDiRule信息异常:" + e.getMessage(), RestBusinessCode.unknow_error.getValue());
|
"上报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,
|
AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request,
|
||||||
trafficNetflowPortInfoList);
|
trafficNetflowPortInfoList);
|
||||||
try {
|
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) {
|
} catch (Exception e) {
|
||||||
throw new RestServiceException(thread, System.currentTimeMillis() - start,
|
throw new RestServiceException(thread, System.currentTimeMillis() - start,
|
||||||
|
|||||||
7
src/main/java/com/nis/web/dao/NmsDiRuleDao.java
Normal file
7
src/main/java/com/nis/web/dao/NmsDiRuleDao.java
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package com.nis.web.dao;
|
||||||
|
|
||||||
|
import com.nis.domain.restful.NmsDiRule;
|
||||||
|
|
||||||
|
@MyBatisDao
|
||||||
|
public interface NmsDiRuleDao extends CrudDao<NmsDiRule> {
|
||||||
|
}
|
||||||
44
src/main/java/com/nis/web/dao/NmsDiRuleDao.xml
Normal file
44
src/main/java/com/nis/web/dao/NmsDiRuleDao.xml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
|
<mapper namespace="com.nis.web.dao.NmsDiRuleDao">
|
||||||
|
<insert id="insert" parameterType="nmsDiRule">
|
||||||
|
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})
|
||||||
|
</insert>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.nis.web.dao;
|
||||||
|
|
||||||
|
import com.nis.domain.restful.TrafficNetflowPortInfo;
|
||||||
|
|
||||||
|
@MyBatisDao
|
||||||
|
public interface TrafficNetflowPortInfoDao extends CrudDao<TrafficNetflowPortInfo> {
|
||||||
|
}
|
||||||
32
src/main/java/com/nis/web/dao/TrafficNetflowPortInfoDao.xml
Normal file
32
src/main/java/com/nis/web/dao/TrafficNetflowPortInfoDao.xml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
|
<mapper namespace="com.nis.web.dao.TrafficNetflowPortInfoDao">
|
||||||
|
<insert id="insert" parameterType="trafficNetflowPortInfo">
|
||||||
|
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})
|
||||||
|
</insert>
|
||||||
|
</mapper>
|
||||||
@@ -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<NmsDiRule> nmsDiRuleList) {
|
||||||
|
for (NmsDiRule nmsDiRule : nmsDiRuleList) {
|
||||||
|
nmsDiRuleDao.insert(nmsDiRule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<TrafficNetflowPortInfo> trafficNetflowPortInfoList) {
|
||||||
|
for (TrafficNetflowPortInfo trafficNetflowPortInfo : trafficNetflowPortInfoList) {
|
||||||
|
trafficNetflowPortInfoDao.insert(trafficNetflowPortInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,6 +21,5 @@ public class TrafficNmsServerStatisticService {
|
|||||||
trafficNmsServerStatisticDao.insertAbnormalMachine(trafficNmsServerStatistic.getId(),
|
trafficNmsServerStatisticDao.insertAbnormalMachine(trafficNmsServerStatistic.getId(),
|
||||||
trafficNmsServerStatistic.getAbnormalMachineList());
|
trafficNmsServerStatistic.getAbnormalMachineList());
|
||||||
}
|
}
|
||||||
Integer.parseInt(null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,49 +1,61 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="x-ua-compatible" content="IE=edge">
|
<meta http-equiv="x-ua-compatible" content="IE=edge">
|
||||||
<title>Galaxy UI</title>
|
<title>Galaxy UI</title>
|
||||||
<link rel="icon" type="image/png" href="images/favicon-32x32.png" sizes="32x32" />
|
<link rel="icon" type="image/png" href="images/favicon-32x32.png"
|
||||||
<link rel="icon" type="image/png" href="images/favicon-16x16.png" sizes="16x16" />
|
sizes="32x32" />
|
||||||
<link href='css/typography.css' media='screen' rel='stylesheet' type='text/css'/>
|
<link rel="icon" type="image/png" href="images/favicon-16x16.png"
|
||||||
<link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
|
sizes="16x16" />
|
||||||
<link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
|
<link href='css/typography.css' media='screen' rel='stylesheet'
|
||||||
<link href='css/reset.css' media='print' rel='stylesheet' type='text/css'/>
|
type='text/css' />
|
||||||
<link href='css/print.css' media='print' rel='stylesheet' type='text/css'/>
|
<link href='css/reset.css' media='screen' rel='stylesheet'
|
||||||
|
type='text/css' />
|
||||||
|
<link href='css/screen.css' media='screen' rel='stylesheet'
|
||||||
|
type='text/css' />
|
||||||
|
<link href='css/reset.css' media='print' rel='stylesheet'
|
||||||
|
type='text/css' />
|
||||||
|
<link href='css/print.css' media='print' rel='stylesheet'
|
||||||
|
type='text/css' />
|
||||||
|
|
||||||
<script src='lib/object-assign-pollyfill.js' type='text/javascript'></script>
|
<script src='lib/object-assign-pollyfill.js' type='text/javascript'></script>
|
||||||
<script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script>
|
<script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script>
|
||||||
<script src='lib/jquery.slideto.min.js' type='text/javascript'></script>
|
<script src='lib/jquery.slideto.min.js' type='text/javascript'></script>
|
||||||
<script src='lib/jquery.wiggle.min.js' type='text/javascript'></script>
|
<script src='lib/jquery.wiggle.min.js' type='text/javascript'></script>
|
||||||
<script src='lib/jquery.ba-bbq.min.js' type='text/javascript'></script>
|
<script src='lib/jquery.ba-bbq.min.js' type='text/javascript'></script>
|
||||||
<script src='lib/handlebars-4.0.5.js' type='text/javascript'></script>
|
<script src='lib/handlebars-4.0.5.js' type='text/javascript'></script>
|
||||||
<script src='lib/lodash.min.js' type='text/javascript'></script>
|
<script src='lib/lodash.min.js' type='text/javascript'></script>
|
||||||
<script src='lib/backbone-min.js' type='text/javascript'></script>
|
<script src='lib/backbone-min.js' type='text/javascript'></script>
|
||||||
<script src='swagger-ui.js' type='text/javascript'></script>
|
<script src='swagger-ui.js' type='text/javascript'></script>
|
||||||
<script src='lib/highlight.9.1.0.pack.js' type='text/javascript'></script>
|
<script src='lib/highlight.9.1.0.pack.js' type='text/javascript'></script>
|
||||||
<script src='lib/highlight.9.1.0.pack_extended.js' type='text/javascript'></script>
|
<script src='lib/highlight.9.1.0.pack_extended.js'
|
||||||
<script src='lib/jsoneditor.min.js' type='text/javascript'></script>
|
type='text/javascript'></script>
|
||||||
<script src='lib/marked.js' type='text/javascript'></script>
|
<script src='lib/jsoneditor.min.js' type='text/javascript'></script>
|
||||||
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
|
<script src='lib/marked.js' type='text/javascript'></script>
|
||||||
|
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
|
||||||
|
|
||||||
<!-- Some basic translations -->
|
<!-- Some basic translations -->
|
||||||
<!-- <script src='lang/translator.js' type='text/javascript'></script> -->
|
<!-- <script src='lang/translator.js' type='text/javascript'></script> -->
|
||||||
<!-- <script src='lang/ru.js' type='text/javascript'></script> -->
|
<!-- <script src='lang/ru.js' type='text/javascript'></script> -->
|
||||||
<!-- <script src='lang/en.js' type='text/javascript'></script> -->
|
<!-- <script src='lang/en.js' type='text/javascript'></script> -->
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
var url = window.location.search.match(/url=([^&]+)/);
|
//获取当前网址,如:
|
||||||
if (url && url.length > 1) {
|
var curWwwPath=window.document.location.href;
|
||||||
url = decodeURIComponent(url[1]);
|
//获取主机地址之后的目录如:/galaxy-service/api-docs
|
||||||
} else {
|
var pathName=window.document.location.pathname;
|
||||||
url = "http://127.0.0.1:8080/galaxy/api-docs";
|
var pos=curWwwPath.indexOf(pathName);
|
||||||
}
|
//获取主机地址,如:http://127.0.0.1:8080
|
||||||
|
var localhostPaht=curWwwPath.substring(0,pos);
|
||||||
hljs.configure({
|
//获取带"/"的项目名,如:http://127.0.0.1:8080/galaxy-service/api-docs的pathName=/galaxy-service/api-docs,项目名是galaxy-service
|
||||||
highlightSizeThreshold: 5000
|
var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1);
|
||||||
});
|
var url =window.location.protocol+"//"+window.location.host+projectName+"/api-docs";
|
||||||
|
url = decodeURIComponent(url);
|
||||||
|
hljs.configure({
|
||||||
|
highlightSizeThreshold: 5000
|
||||||
|
});
|
||||||
|
|
||||||
// Pre load translate...
|
// Pre load translate...
|
||||||
if(window.SwaggerTranslator) {
|
if(window.SwaggerTranslator) {
|
||||||
@@ -91,18 +103,25 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="swagger-section">
|
<body class="swagger-section">
|
||||||
<div id='header'>
|
<div id='header'>
|
||||||
<div class="swagger-ui-wrap">
|
<div class="swagger-ui-wrap">
|
||||||
<a id="logo" href="/galaxy/api-docs"><img class="logo__img" alt="swagger" height="30" width="30" src="images/logo_small.png" /><span class="logo__title">swagger</span></a>
|
<a id="logo" href="/galaxy/api-docs"><img class="logo__img"
|
||||||
<form id='api_selector'>
|
alt="swagger" height="30" width="30" src="images/logo_small.png" /><span
|
||||||
<div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div>
|
class="logo__title">swagger</span></a>
|
||||||
<div id='auth_container'></div>
|
<form id='api_selector'>
|
||||||
<div class='input'><a id="explore" class="header__btn" href="#" data-sw-translate>Explore</a></div>
|
<div class='input'>
|
||||||
</form>
|
<input placeholder="http://example.com/api" id="input_baseUrl"
|
||||||
</div>
|
name="baseUrl" type="text" />
|
||||||
</div>
|
</div>
|
||||||
|
<div id='auth_container'></div>
|
||||||
|
<div class='input'>
|
||||||
|
<a id="explore" class="header__btn" href="#" data-sw-translate>Explore</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="message-bar" class="swagger-ui-wrap" data-sw-translate> </div>
|
<div id="message-bar" class="swagger-ui-wrap" data-sw-translate> </div>
|
||||||
<div id="swagger-ui-container" class="swagger-ui-wrap"></div>
|
<div id="swagger-ui-container" class="swagger-ui-wrap"></div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user