|
@@ -112,6 +112,8 @@ public class IotStaticController {
|
|
private IotOpeationFillMapper iotOpeationFillMapper;
|
|
private IotOpeationFillMapper iotOpeationFillMapper;
|
|
@Autowired
|
|
@Autowired
|
|
private IotDeviceRunLogMapper iotDeviceRunLogMapper;
|
|
private IotDeviceRunLogMapper iotDeviceRunLogMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private TDDeviceMapper deviceMapper;
|
|
|
|
|
|
@GetMapping("/main/day")
|
|
@GetMapping("/main/day")
|
|
public CommonResult<Map<String, Object>> getMaintainDay() {
|
|
public CommonResult<Map<String, Object>> getMaintainDay() {
|
|
@@ -384,12 +386,18 @@ public class IotStaticController {
|
|
}
|
|
}
|
|
Timestamp start1 = generateTimestamp(beginTime);
|
|
Timestamp start1 = generateTimestamp(beginTime);
|
|
Timestamp end1 = generateTimestamp(endTime);
|
|
Timestamp end1 = generateTimestamp(endTime);
|
|
- List<DeviceVO> deviceVOS = tdDeviceMapper.selectAllBtTimeAndIdentifier(deviceName.toLowerCase(), identifier, start1, end1);
|
|
|
|
- deviceVOS.forEach(deviceVO->{
|
|
|
|
- deviceVO.setTimestamp(deviceVO.getTs().getTime());
|
|
|
|
- deviceVO.setValue(Double.valueOf(deviceVO.getLogValue()));
|
|
|
|
- });
|
|
|
|
- return CommonResult.success(deviceVOS.stream().sorted(Comparator.comparing(DeviceVO::getTimestamp).reversed()).collect(Collectors.toList()));
|
|
|
|
|
|
+ Integer i = deviceMapper.tableIfExist(deviceName.toLowerCase());
|
|
|
|
+ if (i==1) {
|
|
|
|
+ List<DeviceVO> deviceVOS = tdDeviceMapper.selectAllBtTimeAndIdentifier(deviceName.toLowerCase(), identifier, start1, end1);
|
|
|
|
+ deviceVOS.forEach(deviceVO->{
|
|
|
|
+ deviceVO.setTimestamp(deviceVO.getTs().getTime());
|
|
|
|
+ deviceVO.setValue(Double.valueOf(deviceVO.getLogValue()));
|
|
|
|
+ });
|
|
|
|
+ return CommonResult.success(deviceVOS.stream().sorted(Comparator.comparing(DeviceVO::getTimestamp).reversed()).collect(Collectors.toList()));
|
|
|
|
+ } else {
|
|
|
|
+ List<DeviceVO> deviceVOS = new ArrayList<>();
|
|
|
|
+ return CommonResult.success(deviceVOS);
|
|
|
|
+ }
|
|
// DeviceHistoryParam deviceHistoryParam = new DeviceHistoryParam();
|
|
// DeviceHistoryParam deviceHistoryParam = new DeviceHistoryParam();
|
|
// List<IotDeviceDO> iotDeviceDOS = iotDeviceMapper.selectByCodeIn(ImmutableList.of(deviceName));
|
|
// List<IotDeviceDO> iotDeviceDOS = iotDeviceMapper.selectByCodeIn(ImmutableList.of(deviceName));
|
|
// if (CollUtil.isEmpty(iotDeviceDOS)) {return CommonResult.success(new JSONArray());}
|
|
// if (CollUtil.isEmpty(iotDeviceDOS)) {return CommonResult.success(new JSONArray());}
|