Compare commits

4 Commits

6 changed files with 30 additions and 9 deletions

View File

@ -4,6 +4,7 @@ import lombok.Data;
/** /**
* 报警信息 * 报警信息
* 0-强制报警1-撞击闯入2-自动报警3-电子围栏告警
* *
* @author: 默苍璃 * @author: 默苍璃
* @date: 2025-09-0114:24 * @date: 2025-09-0114:24
@ -21,7 +22,6 @@ public class AlarmInformationVo {
*/ */
private Integer processingAlarm = 0; private Integer processingAlarm = 0;
/** /**
* 今日报警总数 * 今日报警总数
*/ */
@ -32,7 +32,6 @@ public class AlarmInformationVo {
*/ */
private Integer processingAlarmToday = 0; private Integer processingAlarmToday = 0;
/** /**
* 强制报警 * 强制报警
*/ */
@ -44,12 +43,12 @@ public class AlarmInformationVo {
private Integer intrusionImpact = 0; private Integer intrusionImpact = 0;
/** /**
* 动报警 * 动报警
*/ */
private Integer alarmManual = 0; private Integer alarmAuto = 0;
/** /**
* * 电子围栏告警
*/ */
private Integer fenceElectronic = 0; private Integer fenceElectronic = 0;

View File

@ -43,10 +43,10 @@ public class AlarmStatisticsVo implements Serializable {
private Integer intrusionImpactAlarms = 0; private Integer intrusionImpactAlarms = 0;
/** /**
* 动报警数量 * 动报警数量
* device_action = 2 * device_action = 2
*/ */
private Integer manualAlarms = 0; private Integer autoAlarms = 0;
/** /**
* 电子围栏告警数量 * 电子围栏告警数量

View File

@ -33,4 +33,7 @@ public class DeviceLocationVo {
@Schema(description = "进入的电子围栏信息") @Schema(description = "进入的电子围栏信息")
private DeviceGeoFence fenceInfo; 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); IDeviceGeoFenceService geoFenceService = SpringUtils.getBean(IDeviceGeoFenceService.class);
// 注入设备告警Mapper
DeviceAlarmMapper deviceAlarmMapper = SpringUtils.getBean(DeviceAlarmMapper.class);
for (Device device : devices) { for (Device device : devices) {
DeviceLocationVo vo = new DeviceLocationVo(); DeviceLocationVo vo = new DeviceLocationVo();
@ -808,6 +810,23 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
vo.setInFence(false); 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); result.add(vo);
} }

View File

@ -76,7 +76,7 @@
(SELECT COUNT(1) FROM device_alarm WHERE treatment_state = 0) AS processedAlarms, (SELECT COUNT(1) FROM device_alarm WHERE treatment_state = 0) AS processedAlarms,
(SELECT COUNT(1) FROM device_alarm WHERE device_action = 0) AS forcedAlarms, (SELECT COUNT(1) FROM device_alarm WHERE device_action = 0) AS forcedAlarms,
(SELECT COUNT(1) FROM device_alarm WHERE device_action = 1) AS intrusionImpactAlarms, (SELECT COUNT(1) FROM device_alarm WHERE device_action = 1) AS intrusionImpactAlarms,
(SELECT COUNT(1) FROM device_alarm WHERE device_action = 2) AS manualAlarms, (SELECT COUNT(1) FROM device_alarm WHERE device_action = 2) AS autoAlarms,
(SELECT COUNT(1) FROM device_alarm WHERE device_action = 3) AS geoFenceAlarms (SELECT COUNT(1) FROM device_alarm WHERE device_action = 3) AS geoFenceAlarms
</select> </select>

View File

@ -406,7 +406,7 @@
SELECT COUNT (1) SELECT COUNT (1)
FROM device_alarm FROM device_alarm
WHERE device_action = 2 WHERE device_action = 2
) AS alarmManual ) AS alarmAuto
, ( , (
SELECT COUNT (1) SELECT COUNT (1)
FROM device_alarm FROM device_alarm