forked from dyf/fys-Multi-tenant
设备告警
This commit is contained in:
@ -38,7 +38,6 @@ import static com.fuyuanshen.global.mqtt.constants.DeviceRedisKeyConstants.*;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class BjqAlarmRule implements MqttMessageRule {
|
public class BjqAlarmRule implements MqttMessageRule {
|
||||||
|
|
||||||
|
|
||||||
private final IDeviceAlarmService deviceAlarmService;
|
private final IDeviceAlarmService deviceAlarmService;
|
||||||
private final DeviceService deviceService;
|
private final DeviceService deviceService;
|
||||||
|
|
||||||
@ -89,6 +88,8 @@ public class BjqAlarmRule implements MqttMessageRule {
|
|||||||
deviceAlarmBo.setFinishTime(new Date());
|
deviceAlarmBo.setFinishTime(new Date());
|
||||||
String durationBetween = DurationUtils.getDurationBetween(deviceAlarmVo.getStartTime(), deviceAlarmBo.getFinishTime());
|
String durationBetween = DurationUtils.getDurationBetween(deviceAlarmVo.getStartTime(), deviceAlarmBo.getFinishTime());
|
||||||
deviceAlarmBo.setDurationTime(durationBetween);
|
deviceAlarmBo.setDurationTime(durationBetween);
|
||||||
|
// 0已处理,1未处理
|
||||||
|
deviceAlarmBo.setTreatmentState(0);
|
||||||
deviceAlarmService.updateByBo(deviceAlarmBo);
|
deviceAlarmService.updateByBo(deviceAlarmBo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,12 +68,12 @@ public class DeviceAlarm extends TenantEntity {
|
|||||||
/**
|
/**
|
||||||
* 经度
|
* 经度
|
||||||
*/
|
*/
|
||||||
private Long longitude;
|
private Double longitude;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 纬度
|
* 纬度
|
||||||
*/
|
*/
|
||||||
private Long latitude;
|
private Double latitude;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报警位置
|
* 报警位置
|
||||||
@ -99,7 +99,7 @@ public class DeviceAlarm extends TenantEntity {
|
|||||||
* 0已处理,1未处理
|
* 0已处理,1未处理
|
||||||
* treatment_state
|
* treatment_state
|
||||||
*/
|
*/
|
||||||
private Long treatmentState;
|
private Integer treatmentState;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -351,13 +351,13 @@
|
|||||||
|
|
||||||
<!-- 获取告警信息 -->
|
<!-- 获取告警信息 -->
|
||||||
<select id="getAlarmInformation" resultType="com.fuyuanshen.equipment.domain.vo.AlarmInformationVo">
|
<select id="getAlarmInformation" resultType="com.fuyuanshen.equipment.domain.vo.AlarmInformationVo">
|
||||||
SELECT (SELECT COUNT(1) FROM device_alarm WHERE treatment_state = 0) AS alarmsTotal
|
SELECT (SELECT COUNT(1) FROM device_alarm) AS alarmsTotal
|
||||||
, (SELECT COUNT(1)
|
, (SELECT COUNT(1)
|
||||||
FROM device_alarm
|
FROM device_alarm
|
||||||
WHERE treatment_state = 0) AS processingAlarm
|
WHERE treatment_state = 0) AS processingAlarm
|
||||||
, (SELECT COUNT(1)
|
, (SELECT COUNT(1)
|
||||||
FROM device_alarm
|
FROM device_alarm
|
||||||
WHERE treatment_state = 0 AND
|
WHERE
|
||||||
DATE (create_time) = CURDATE()) AS alarmsTotalToday
|
DATE (create_time) = CURDATE()) AS alarmsTotalToday
|
||||||
, (
|
, (
|
||||||
SELECT COUNT (1)
|
SELECT COUNT (1)
|
||||||
@ -425,7 +425,9 @@
|
|||||||
|
|
||||||
<!-- 根据设备IMEI查询设备 -->
|
<!-- 根据设备IMEI查询设备 -->
|
||||||
<select id="selectDeviceByImei" resultType="com.fuyuanshen.equipment.domain.Device">
|
<select id="selectDeviceByImei" resultType="com.fuyuanshen.equipment.domain.Device">
|
||||||
SELECT * FROM device WHERE device_imei = #{deviceImei}
|
SELECT *
|
||||||
|
FROM device
|
||||||
|
WHERE device_imei = #{deviceImei}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user