正在显示
1 个修改的文件
包含
6 行增加
和
4 行删除
| 1 | package com.zhonglai.luhui.api.controller.data; | 1 | package com.zhonglai.luhui.api.controller.data; |
| 2 | 2 | ||
| 3 | +import com.ruoyi.common.core.domain.AjaxResult; | ||
| 3 | import com.ruoyi.common.utils.DateUtils; | 4 | import com.ruoyi.common.utils.DateUtils; |
| 4 | import com.zhonglai.luhui.api.controller.data.mapper.DeviceSensorDataMapper; | 5 | import com.zhonglai.luhui.api.controller.data.mapper.DeviceSensorDataMapper; |
| 5 | import io.swagger.annotations.*; | 6 | import io.swagger.annotations.*; |
| @@ -32,7 +33,7 @@ public class SensorDataController { | @@ -32,7 +33,7 @@ public class SensorDataController { | ||
| 32 | @ApiImplicitParam(name = "interval", value = "间隔时间") | 33 | @ApiImplicitParam(name = "interval", value = "间隔时间") |
| 33 | }) | 34 | }) |
| 34 | @RequestMapping(value = "", method = RequestMethod.GET) | 35 | @RequestMapping(value = "", method = RequestMethod.GET) |
| 35 | - public String getDeviceTimeData(String deviceInfoId, String dataType, String date, int interval) { | 36 | + public AjaxResult getDeviceTimeData(String deviceInfoId, String dataType, String date, int interval) { |
| 36 | 37 | ||
| 37 | String dataTypestr = dataType; | 38 | String dataTypestr = dataType; |
| 38 | 39 | ||
| @@ -40,19 +41,20 @@ public class SensorDataController { | @@ -40,19 +41,20 @@ public class SensorDataController { | ||
| 40 | //间隔时间补全 | 41 | //间隔时间补全 |
| 41 | String day = date; | 42 | String day = date; |
| 42 | StringBuffer stringBuffer10 = SensorData.deviceSensorDataListToIntervalCompletion(deviceSensorDataList, Integer.parseInt(DateUtils.dateTime("yyyyMMdd",day).getTime() / 1000 + ""), interval, day); | 43 | StringBuffer stringBuffer10 = SensorData.deviceSensorDataListToIntervalCompletion(deviceSensorDataList, Integer.parseInt(DateUtils.dateTime("yyyyMMdd",day).getTime() / 1000 + ""), interval, day); |
| 43 | - return stringBuffer10.toString(); | 44 | + return AjaxResult.success().put("data",stringBuffer10.toString()); |
| 44 | } | 45 | } |
| 45 | 46 | ||
| 46 | @ApiOperation(value = "获取设备历史数据", notes = "获取设备历史数据") | 47 | @ApiOperation(value = "获取设备历史数据", notes = "获取设备历史数据") |
| 47 | @RequestMapping(value = "getDeviceHistoryData", method = RequestMethod.GET) | 48 | @RequestMapping(value = "getDeviceHistoryData", method = RequestMethod.GET) |
| 48 | - public String getDeviceHistoryData( | 49 | + public AjaxResult getDeviceHistoryData( |
| 49 | @ApiParam(name = "startTime", value = "开始时间(时间戳)", required = true) @RequestParam(name = "startTime") int startTime, | 50 | @ApiParam(name = "startTime", value = "开始时间(时间戳)", required = true) @RequestParam(name = "startTime") int startTime, |
| 50 | @ApiParam(name = "endTime", value = "结束时间(时间戳)", required = true) @RequestParam(name = "endTime") int endTime, | 51 | @ApiParam(name = "endTime", value = "结束时间(时间戳)", required = true) @RequestParam(name = "endTime") int endTime, |
| 51 | @ApiParam(name = "interval", value = "取点颗粒(单位分钟)", required = true) @RequestParam(name = "interval") int interval, | 52 | @ApiParam(name = "interval", value = "取点颗粒(单位分钟)", required = true) @RequestParam(name = "interval") int interval, |
| 52 | @ApiParam(name = "deviceInfoId", value = "设备信息表id", required = true) @RequestParam(name = "deviceInfoId") String deviceInfoId, | 53 | @ApiParam(name = "deviceInfoId", value = "设备信息表id", required = true) @RequestParam(name = "deviceInfoId") String deviceInfoId, |
| 53 | @ApiParam(name = "dataType", value = "数据类型", required = true) @RequestParam(name = "dataType") String dataType,HttpServletResponse response) throws IOException { | 54 | @ApiParam(name = "dataType", value = "数据类型", required = true) @RequestParam(name = "dataType") String dataType,HttpServletResponse response) throws IOException { |
| 54 | 55 | ||
| 55 | - return dataService.getDeviceHistoryData(response,startTime,endTime,interval,deviceInfoId,dataType); | 56 | + String str = dataService.getDeviceHistoryData(response,startTime,endTime,interval,deviceInfoId,dataType); |
| 57 | + return AjaxResult.success().put("data",str); | ||
| 56 | } | 58 | } |
| 57 | 59 | ||
| 58 | /** | 60 | /** |
-
请 注册 或 登录 后发表评论