Commit 58c7f767 by 李小龙 Committed by huangjy

fix:

parent 398f5b44
...@@ -155,7 +155,9 @@ public class FallAlarm implements IAlarm { ...@@ -155,7 +155,9 @@ public class FallAlarm implements IAlarm {
if(duration1 != 0) { if(duration1 != 0) {
alarmRedisDTO.setAlarm(CommonEnum.YES.getValue()); alarmRedisDTO.setAlarm(CommonEnum.YES.getValue());
RedisUtil.set(RedisConst.ALARM_DEVICE_BEHAVIOR_ID + deviceId, alarmRedisDTO); RedisUtil.set(RedisConst.ALARM_DEVICE_BEHAVIOR_ID + deviceId, alarmRedisDTO);
notice(platAlarmCheckDTO); PlatAlarmCheckDTO platAlarmCheckDTO_behavior = BeanDtoVoUtils.convert(platAlarmCheckDTO, PlatAlarmCheckDTO.class);
platAlarmCheckDTO_behavior.setPlatAlarmConfig(config);
notice(platAlarmCheckDTO_behavior);
}else { }else {
return; return;
} }
......
...@@ -173,23 +173,28 @@ public class PushCallback implements MqttCallback { ...@@ -173,23 +173,28 @@ public class PushCallback implements MqttCallback {
} }
@Transactional @Transactional
@TenantIdIgnore
public void updateDeviceStatus(String messageType, String deviceId, String iot_tenantId) { public void updateDeviceStatus(String messageType, String deviceId, String iot_tenantId) {
if(StringUtils.equalsAnyIgnoreCase(messageType, DeviceState.offline.getValue(),DeviceState.online.getValue())){ try {
if (StringUtils.equalsAnyIgnoreCase(messageType, DeviceState.offline.getValue(), DeviceState.online.getValue())) {
platDeviceService.update(new UpdateWrapper<PlatDevice>().lambda() platDeviceService.update(new UpdateWrapper<PlatDevice>().lambda()
.set(PlatDevice::getStatus,messageType.toLowerCase()) .set(PlatDevice::getStatus, messageType.toLowerCase())
.eq(PlatDevice::getOriDeviceId,deviceId)); .eq(PlatDevice::getOriDeviceId, deviceId));
LambdaQueryWrapper<PlatDevice> deviceLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PlatDevice> deviceLambdaQueryWrapper = new LambdaQueryWrapper<>();
deviceLambdaQueryWrapper.eq(PlatDevice::getOriDeviceId,deviceId); deviceLambdaQueryWrapper.eq(PlatDevice::getOriDeviceId, deviceId);
List<PlatDevice> deviceList = platDeviceService.list(deviceLambdaQueryWrapper); List<PlatDevice> deviceList = platDeviceService.list(deviceLambdaQueryWrapper);
if(CollectionUtils.isEmpty(deviceList)){ if (CollectionUtils.isEmpty(deviceList)) {
return; return;
} }
for (PlatDevice platDevice : deviceList) { for (PlatDevice platDevice : deviceList) {
platDevice.setStatus(messageType.toLowerCase()); platDevice.setStatus(messageType.toLowerCase());
}
deviceCacheUtil.putAll(deviceList);
} }
deviceCacheUtil.putAll(deviceList); }catch (Exception e){
logger.error("更新设备状态:",e);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment