修改nms上报接口支持批量提交,修改为阀门中域添加额外属性时的阀门库编号

This commit is contained in:
RenKaiGe-Office
2018-09-25 18:06:49 +08:00
parent 9937dc1f8a
commit ebd2932596
5 changed files with 57 additions and 32 deletions

View File

@@ -1,21 +1,19 @@
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.domain.restful.TrafficNmsServerStatisticList;
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;
@@ -38,30 +36,28 @@ public class NmsInfoController extends BaseRestController {
@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) {
public Map<String, Object> saveServerStatus(
@RequestBody TrafficNmsServerStatisticList trafficNmsServerStatisticList, 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);
trafficNmsServerStatisticList);
try {
TrafficNmsServerStatistic saveNmsServer = trafficNmsServerStatisticService
.saveNmsServer(trafficNmsServerStatistic);
try {
trafficNmsServerStatisticService.saveAbnormalMachine(saveNmsServer.getId(),
saveNmsServer.getAbnormalMachineList());
} catch (Exception e) {
trafficNmsServerStatisticService.delNmsServer(saveNmsServer);
throw e;
if (trafficNmsServerStatisticList != null && trafficNmsServerStatisticList.getTrafficNmsServerList() != null
&& trafficNmsServerStatisticList.getTrafficNmsServerList().size() > 0) {
trafficNmsServerStatisticService.saveNmsInfo(trafficNmsServerStatisticList.getTrafficNmsServerList());
} else {
throw new RestServiceException(thread, System.currentTimeMillis() - start, "参数trafficNmsServerList不能为空",
RestBusinessCode.missing_args.getValue());
}
} 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);
Constants.IS_DEBUG ? trafficNmsServerStatisticList : null);
}
}