若依微服务1.9.3

business:
1、手机端根据监控单元获取设备信息接口修改
dev 1.9.3
xins 1 year ago
parent a3e416bd35
commit 020afb92a8

@ -127,12 +127,12 @@ public class HwAppController extends BaseController {
* @date 2023-09-28 13:31
* @return AjaxResult
*/
@RequiresPermissions("business:app:monitorUnit")
// @RequiresPermissions("business:app:monitorUnit")
@GetMapping("/getDevicesInfoByMonitorUnitId/{monitorUnitId}")
public AjaxResult getDevicesInfoByMonitorUnitId(@PathVariable("monitorUnitId") Long monitorUnitId){
HwDevice queryDevice = new HwDevice();
queryDevice.setMonitorUnitId(monitorUnitId);
return success(hwDeviceService.selectDeviceNum(queryDevice));
// HwDevice queryDevice = new HwDevice();
// queryDevice.setMonitorUnitId(monitorUnitId);
return success(hwDeviceService.getDevicesInfoByMonitorUnitId(monitorUnitId));
}
/**

@ -641,11 +641,16 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
.collect(Collectors.groupingBy(HwDevice::getDeviceType));
List<HwDevice> gatewayDevices = hwDevicesMap.get(HwDictConstants.DEVICE_TYPE_GATEWAY_DEVICE);
List<HwDevice> subDevices = hwDevicesMap.get(HwDictConstants.DEVICE_TYPE_GATEWAY_SUB_EQUIPMENT);
List<HwDevice> directConnectDevices = hwDevicesMap.get(HwDictConstants.DEVICE_TYPE_DIRECT_CONNECT_DEVICE);
int onlineDevicesCount = 0;
int offlineDevicesCount = 0;
//网关设备和网关子设备,根据网关设备状态来判断网关子设备的状态
if (gatewayDevices != null && !gatewayDevices.isEmpty() && subDevices != null && !subDevices.isEmpty()) {
//根据关联网关设备ID进行分组
Map<Long, List<HwDevice>> releatedDeviceIdDevicesMap = subDevices.stream()
.collect(Collectors.groupingBy(HwDevice::getReleatedDeviceId));
int onlineDevicesCount = 0;
int offlineDevicesCount = 0;
for (HwDevice gatewayDevice : gatewayDevices) {
String onlineStatus = gatewayDevice.getOnlineStatus();
//获取关联子设备的数量
@ -658,6 +663,19 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
offlineDevicesCount += gatewaySubPublishedDevicesCount;
}
}
}
//直连设备直接获取设备状态
if (directConnectDevices != null && !directConnectDevices.isEmpty()) {
for (HwDevice directConnectDevice : directConnectDevices) {
String onlineStatus = directConnectDevice.getOnlineStatus();
if (onlineStatus.equals(HwDictConstants.DEVICE_ONLINE_STATUS_ONLINE)) {
onlineDevicesCount += 1;
} else if (onlineStatus.equals(HwDictConstants.DEVICE_ONLINE_STATUS_OFFLINE)) {
offlineDevicesCount += 1;
}
}
}
int alarmDevicesCount = hwAlarmInfoMapper.selectAlarmCountByMonitorUnitId(monitorUnitId);
int normalDevicesCount = onlineDevicesCount + offlineDevicesCount - alarmDevicesCount;

Loading…
Cancel
Save