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.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,
|
||||
|
||||
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(),
|
||||
trafficNmsServerStatistic.getAbnormalMachineList());
|
||||
}
|
||||
Integer.parseInt(null);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user