|
|
|
|
@ -110,6 +110,7 @@ public class DeviceServiceImpl implements DeviceService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public DeviceDO createDevice(DeviceSaveReqVO createReqVO) {
|
|
|
|
|
@ -303,10 +304,7 @@ public class DeviceServiceImpl implements DeviceService {
|
|
|
|
|
deviceRespVO.setOperatingStatus(DeviceStatusEnum.OFFLINE.getName());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return deviceRespVOPageResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -611,21 +609,30 @@ public class DeviceServiceImpl implements DeviceService {
|
|
|
|
|
@Override
|
|
|
|
|
public PageResult<LineDeviceRespVO> lineDevicePage(LineDeviceRequestVO pageReqVO) {
|
|
|
|
|
|
|
|
|
|
Page<LineDeviceRespVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
|
|
|
|
// Page<LineDeviceRespVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
|
|
|
|
|
|
|
|
|
IPage<LineDeviceRespVO> lineDeviceRespVO = deviceMapper.lineDevicePage(page,pageReqVO);
|
|
|
|
|
List<LineDeviceRespVO> records = lineDeviceRespVO.getRecords();
|
|
|
|
|
for (LineDeviceRespVO record : records) {
|
|
|
|
|
Map<String, Object> latestDeviceData = tdengineService.getLatestDeviceData(record.getDeviceId());
|
|
|
|
|
// IPage<LineDeviceRespVO> lineDeviceRespVO = deviceMapper.lineDevicePage(page,pageReqVO);
|
|
|
|
|
PageResult<DeviceRespVO> pageResult = getDevicePage(BeanUtils.toBean(pageReqVO, DevicePageReqVO.class));
|
|
|
|
|
|
|
|
|
|
List<LineDeviceRespVO> list = new ArrayList<>();
|
|
|
|
|
for (DeviceRespVO record : pageResult.getList()) {
|
|
|
|
|
LineDeviceRespVO lineDeviceRespVO = new LineDeviceRespVO();
|
|
|
|
|
lineDeviceRespVO.setDeviceCode(record.getDeviceCode());
|
|
|
|
|
lineDeviceRespVO.setDeviceName(record.getDeviceName());
|
|
|
|
|
lineDeviceRespVO.setStatus(record.getStatus());
|
|
|
|
|
lineDeviceRespVO.setCollectionTime(String.valueOf(record.getCollectionTime()));
|
|
|
|
|
lineDeviceRespVO.setId(record.getId());
|
|
|
|
|
Map<String, Object> latestDeviceData = tdengineService.getLatestDeviceData(record.getId());
|
|
|
|
|
if(latestDeviceData != null) {
|
|
|
|
|
record.setCollectionTime((String) latestDeviceData.get("timestamp"));
|
|
|
|
|
lineDeviceRespVO.setCollectionTime((String) latestDeviceData.get("timestamp"));
|
|
|
|
|
}
|
|
|
|
|
lineDeviceRespVO.setLineName(deviceMapper.lineDeviceLedgerPage(record.getId()));
|
|
|
|
|
list.add(lineDeviceRespVO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PageResult<LineDeviceRespVO> lineDeviceRespVOPageResult = new PageResult<>(lineDeviceRespVO.getRecords(), lineDeviceRespVO.getTotal());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return lineDeviceRespVOPageResult;
|
|
|
|
|
if (list.isEmpty()) {
|
|
|
|
|
return PageResult.empty(); // 返回空Page
|
|
|
|
|
}
|
|
|
|
|
return new PageResult<>(list, pageResult.getTotal());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|