|
|
@ -40,57 +40,38 @@ public class NiecSensorController extends BasicController {
|
|
|
|
@ApiParam("每页数量") @RequestParam(value = "pageSize", required = false) Integer pageSize) {
|
|
|
|
@ApiParam("每页数量") @RequestParam(value = "pageSize", required = false) Integer pageSize) {
|
|
|
|
pageNum = this.initPageNum(pageNum);
|
|
|
|
pageNum = this.initPageNum(pageNum);
|
|
|
|
pageSize = this.initPageSize(pageSize);
|
|
|
|
pageSize = this.initPageSize(pageSize);
|
|
|
|
try {
|
|
|
|
|
|
|
|
Page<NiecSensor> result = service.list(pageNum, pageSize);
|
|
|
|
Page<NiecSensor> result = service.list(pageNum, pageSize);
|
|
|
|
return Response.success(result);
|
|
|
|
return Response.success(result);
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
return Response.fail(ex.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("listAll")
|
|
|
|
@GetMapping("listAll")
|
|
|
|
@ApiOperation("查询全部列表")
|
|
|
|
@ApiOperation("查询全部列表")
|
|
|
|
public Response<List<NiecSensor>> listAll() {
|
|
|
|
public Response<List<NiecSensor>> listAll() {
|
|
|
|
try {
|
|
|
|
|
|
|
|
List<NiecSensor> result = service.listAll();
|
|
|
|
List<NiecSensor> result = service.listAll();
|
|
|
|
return Response.success(result);
|
|
|
|
return Response.success(result);
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
return Response.fail(ex.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("getTree")
|
|
|
|
@GetMapping("getTree")
|
|
|
|
@ApiOperation("查询树")
|
|
|
|
@ApiOperation("查询树")
|
|
|
|
public Response<List<NiecSensor>> getTree() {
|
|
|
|
public Response<List<NiecSensor>> getTree() {
|
|
|
|
try {
|
|
|
|
|
|
|
|
List<NiecSensor> result = service.getTree();
|
|
|
|
List<NiecSensor> result = service.getTree();
|
|
|
|
return Response.success(result);
|
|
|
|
return Response.success(result);
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
log.error("getTree Exception.", ex);
|
|
|
|
|
|
|
|
return Response.fail(ex.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("detail")
|
|
|
|
@GetMapping("detail")
|
|
|
|
@ApiOperation("查询单个装置采集到的数据")
|
|
|
|
@ApiOperation("查询单个装置采集到的数据")
|
|
|
|
public Response<SensorDetail> getDetail(@Validated ConditionModel model) {
|
|
|
|
public Response<SensorDetail> getDetail(@Validated ConditionModel model) throws Exception {
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (model.getPageNum() != null || model.getPageSize() != null) {
|
|
|
|
if (model.getPageNum() != null || model.getPageSize() != null) {
|
|
|
|
model.setPageNum(this.initPageNum(model.getPageNum()));
|
|
|
|
model.setPageNum(this.initPageNum(model.getPageNum()));
|
|
|
|
model.setPageSize(this.initPageSize(model.getPageSize()));
|
|
|
|
model.setPageSize(this.initPageSize(model.getPageSize()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SensorDetail result = service.getDetail(model);
|
|
|
|
SensorDetail result = service.getDetail(model);
|
|
|
|
return Response.success(result);
|
|
|
|
return Response.success(result);
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
log.error("getDetail Exception.", ex);
|
|
|
|
|
|
|
|
return Response.fail(ex.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("export")
|
|
|
|
@GetMapping("export")
|
|
|
|
@ApiOperation("导出单个装置采集到的数据")
|
|
|
|
@ApiOperation("导出单个装置采集到的数据")
|
|
|
|
public void export(@Validated ConditionModel model, HttpServletResponse response) {
|
|
|
|
public void export(@Validated ConditionModel model, HttpServletResponse response) throws Exception {
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (model.getPageNum() != null || model.getPageSize() != null) {
|
|
|
|
if (model.getPageNum() != null || model.getPageSize() != null) {
|
|
|
|
model.setPageNum(this.initPageNum(model.getPageNum()));
|
|
|
|
model.setPageNum(this.initPageNum(model.getPageNum()));
|
|
|
|
model.setPageSize(this.initPageSize(model.getPageSize()));
|
|
|
|
model.setPageSize(this.initPageSize(model.getPageSize()));
|
|
|
@ -101,9 +82,6 @@ public class NiecSensorController extends BasicController {
|
|
|
|
response.setContentType("application/vnd.ms-excel");
|
|
|
|
response.setContentType("application/vnd.ms-excel");
|
|
|
|
response.setCharacterEncoding("utf-8");
|
|
|
|
response.setCharacterEncoding("utf-8");
|
|
|
|
reportService.exportSensor(detail, response.getOutputStream());
|
|
|
|
reportService.exportSensor(detail, response.getOutputStream());
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
log.error("exportDetail Exception.", ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|