1:添加nms上报服务器信息的接口
2:修改读取app*-rule.properties的方法
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
package com.nis.web.controller.restful;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
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.restful.RestBusinessCode;
|
||||
import com.nis.restful.RestConstants;
|
||||
import com.nis.restful.RestServiceException;
|
||||
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.TrafficNmsServerStatisticService;
|
||||
import com.wordnik.swagger.annotations.Api;
|
||||
import com.wordnik.swagger.annotations.ApiOperation;
|
||||
import com.wordnik.swagger.annotations.ApiParam;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("${servicePath}")
|
||||
@Api(value = "NmsInfoController", description = "接收nms提交的系统状态等数据,将数据入库供服务推送给大屏")
|
||||
public class NmsInfoController extends BaseRestController {
|
||||
@Autowired
|
||||
protected ServicesRequestLogService servicesRequestLogService;
|
||||
@Autowired
|
||||
TrafficNmsServerStatisticService trafficNmsServerStatisticService;
|
||||
|
||||
@RequestMapping(value = "/nms/v1/saveServerStatus", method = RequestMethod.POST)
|
||||
@ApiOperation(value = "存储NMS系统上报的服务器状态接口", httpMethod = "POST", response = Map.class, notes = "接收NMS系统上报的服务器状态信息")
|
||||
@ApiParam(value = "存储NMS系统上报的服务器状态接口", name = "saveServerStatus", required = true)
|
||||
public Map<String, Object> saveServerStatus(@RequestBody TrafficNmsServerStatistic trafficNmsServerStatistic,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
long start = System.currentTimeMillis();
|
||||
AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_POST, request,
|
||||
trafficNmsServerStatistic);
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(RestConstants.REST_SERVICE_HTTP_STATUS, HttpStatus.OK);
|
||||
try {
|
||||
TrafficNmsServerStatistic saveNmsServer = trafficNmsServerStatisticService
|
||||
.saveNmsServer(trafficNmsServerStatistic);
|
||||
try {
|
||||
trafficNmsServerStatisticService.saveAbnormalMachine(saveNmsServer.getId(),
|
||||
saveNmsServer.getAbnormalMachineList());
|
||||
} catch (Exception e) {
|
||||
trafficNmsServerStatisticService.delNmsServer(saveNmsServer);
|
||||
throw e;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RestServiceException(thread, System.currentTimeMillis() - start, "上报服务器状态信息异常:" + e.getMessage(),
|
||||
RestBusinessCode.unknow_error.getValue());
|
||||
}
|
||||
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response, "上报服务器状态信息成功",
|
||||
Constants.IS_DEBUG ? trafficNmsServerStatistic : null);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user