Merge remote-tracking branch 'liwenlong-fys/jingquan' into jingquan

This commit is contained in:
2025-09-28 16:11:52 +08:00
2 changed files with 22 additions and 0 deletions

View File

@ -33,4 +33,7 @@ public class DeviceLocationVo {
@Schema(description = "进入的电子围栏信息")
private DeviceGeoFence fenceInfo;
@Schema(description = "设备是否正在告警")
private Boolean isAlarming;
}

View File

@ -774,6 +774,8 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
// 注入电子围栏服务
IDeviceGeoFenceService geoFenceService = SpringUtils.getBean(IDeviceGeoFenceService.class);
// 注入设备告警Mapper
DeviceAlarmMapper deviceAlarmMapper = SpringUtils.getBean(DeviceAlarmMapper.class);
for (Device device : devices) {
DeviceLocationVo vo = new DeviceLocationVo();
@ -808,6 +810,23 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
vo.setInFence(false);
}
// 检查设备是否正在告警(只要当前设备处于报警状态,且不是电子围栏告警)
if (StringUtils.isNotBlank(device.getDeviceImei())) {
DeviceAlarmVo latestAlarm = deviceAlarmMapper.selectLatestByDeviceImei(device.getDeviceImei());
// 判断是否正在告警:未处理的告警(treatmentState=1)且不是电子围栏告警(deviceAction!=3)
if (latestAlarm != null &&
latestAlarm.getTreatmentState() != null &&
latestAlarm.getTreatmentState() == 1 &&
latestAlarm.getDeviceAction() != null &&
latestAlarm.getDeviceAction() != 3) {
vo.setIsAlarming(true);
} else {
vo.setIsAlarming(false);
}
} else {
vo.setIsAlarming(false);
}
result.add(vo);
}