作者 钟来

模块整理

package com.zhonglai.luhui.api.controller.data;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils;
import com.zhonglai.luhui.api.controller.data.mapper.DeviceSensorDataMapper;
import io.swagger.annotations.*;
... ... @@ -32,7 +33,7 @@ public class SensorDataController {
@ApiImplicitParam(name = "interval", value = "间隔时间")
})
@RequestMapping(value = "", method = RequestMethod.GET)
public String getDeviceTimeData(String deviceInfoId, String dataType, String date, int interval) {
public AjaxResult getDeviceTimeData(String deviceInfoId, String dataType, String date, int interval) {
String dataTypestr = dataType;
... ... @@ -40,19 +41,20 @@ public class SensorDataController {
//间隔时间补全
String day = date;
StringBuffer stringBuffer10 = SensorData.deviceSensorDataListToIntervalCompletion(deviceSensorDataList, Integer.parseInt(DateUtils.dateTime("yyyyMMdd",day).getTime() / 1000 + ""), interval, day);
return stringBuffer10.toString();
return AjaxResult.success().put("data",stringBuffer10.toString());
}
@ApiOperation(value = "获取设备历史数据", notes = "获取设备历史数据")
@RequestMapping(value = "getDeviceHistoryData", method = RequestMethod.GET)
public String getDeviceHistoryData(
public AjaxResult getDeviceHistoryData(
@ApiParam(name = "startTime", value = "开始时间(时间戳)", required = true) @RequestParam(name = "startTime") int startTime,
@ApiParam(name = "endTime", value = "结束时间(时间戳)", required = true) @RequestParam(name = "endTime") int endTime,
@ApiParam(name = "interval", value = "取点颗粒(单位分钟)", required = true) @RequestParam(name = "interval") int interval,
@ApiParam(name = "deviceInfoId", value = "设备信息表id", required = true) @RequestParam(name = "deviceInfoId") String deviceInfoId,
@ApiParam(name = "dataType", value = "数据类型", required = true) @RequestParam(name = "dataType") String dataType,HttpServletResponse response) throws IOException {
return dataService.getDeviceHistoryData(response,startTime,endTime,interval,deviceInfoId,dataType);
String str = dataService.getDeviceHistoryData(response,startTime,endTime,interval,deviceInfoId,dataType);
return AjaxResult.success().put("data",str);
}
/**
... ...