增加用水数据接口

This commit is contained in:
wyw
2024-08-16 02:32:02 +08:00
parent 0d42fc0785
commit 0388cd8aba
6 changed files with 137 additions and 10 deletions

View File

@ -133,6 +133,9 @@ public class DeviceServiceImpl implements IDeviceService {
@Override
public Device selectDeviceByDeviceId(Long deviceId) {
Device device = deviceMapper.selectDeviceByDeviceId(deviceId);
if (device == null) {
return null;
}
List<ValueItem> list = itslValueCache.getCacheDeviceStatus(device.getProductId(), device.getSerialNumber());
if (list != null && list.size() > 0) {
// redis中获取设备状态物模型值
@ -1600,12 +1603,10 @@ public class DeviceServiceImpl implements IDeviceService {
ArrayList<Map<String, Object>> resultList = new ArrayList<>();
devices.setProductId(136L);
List<Device> deviceList = selectDeviceList(devices);
for (Device device : deviceList) {
HashMap<String, Object> itemMap = new HashMap<>();
resultList.add(itemMap);
Integer integer = 0;
itemMap.put("device",device);
if (device.getStatus() != null) {
if (device.getStatus().equals(4)) {
@ -1613,7 +1614,6 @@ public class DeviceServiceImpl implements IDeviceService {
}
}
itemMap.put("online",integer);
}
return resultList;
}