|
|
package com.topsail.influxdb.controller;
|
|
|
|
|
|
import com.topsail.influxdb.entity.DeviceHistoryData;
|
|
|
import com.topsail.influxdb.entity.DeviceHistoryVo;
|
|
|
import com.topsail.influxdb.result.Result;
|
|
|
import com.topsail.influxdb.service.DeviceDataService;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.BindException;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.text.ParseException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
@ResponseBody
|
|
|
@CrossOrigin
|
|
|
@RequestMapping(value = "/deviceData")
|
|
|
public class DeviceDataController {
|
|
|
private Logger logger = LoggerFactory.getLogger(DeviceDataController.class);
|
|
|
|
|
|
@Autowired
|
|
|
private DeviceDataService deviceDataService;
|
|
|
|
|
|
/**
|
|
|
* 查询单个设备历史数据(根据设备号查询设备历史数据)
|
|
|
* devices/history
|
|
|
*/
|
|
|
@GetMapping(value = "/getShengDiLanHistory")
|
|
|
public Result getHistoryData(@RequestParam(name = "uid", required = false) String uid, @RequestParam(name = "pageNo", required = false) Integer pageNo, @RequestParam(name = "pageSize", required = false) Integer pageSize, @RequestParam(name = "startTime", required = false) String startTime, @RequestParam(name = "endTime", required = false) String endTime, @RequestParam(name = "imei") String imei) throws ParseException, BindException {
|
|
|
List<DeviceHistoryVo> list = new ArrayList<>();
|
|
|
list = deviceDataService.getDeviceHistoryData(uid, pageNo, pageSize, startTime, endTime, imei);
|
|
|
Map<String, Object> map = Result.returnPageMap(list);
|
|
|
return Result.success(map);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 删除所有的设备历史数据
|
|
|
*/
|
|
|
@RequestMapping(value = "/shengDiLanDelete", method = RequestMethod.GET)
|
|
|
public Result<List<DeviceHistoryData>> deleteDeviceData() throws ParseException, BindException {
|
|
|
List<DeviceHistoryData> list = new ArrayList<>();
|
|
|
// deviceDataService.deleteDeviceData();
|
|
|
return Result.success(list);
|
|
|
}
|
|
|
}
|