Commit 7da69ca4 by 李小龙

fix:

parent 887b4201
......@@ -155,7 +155,9 @@ public class FallAlarm implements IAlarm {
if(duration1 != 0) {
alarmRedisDTO.setAlarm(CommonEnum.YES.getValue());
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 {
return;
}
......
......@@ -171,23 +171,28 @@ public class PushCallback implements MqttCallback {
}
@Transactional
@TenantIdIgnore
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()
.set(PlatDevice::getStatus,messageType.toLowerCase())
.eq(PlatDevice::getOriDeviceId,deviceId));
platDeviceService.update(new UpdateWrapper<PlatDevice>().lambda()
.set(PlatDevice::getStatus, messageType.toLowerCase())
.eq(PlatDevice::getOriDeviceId, deviceId));
LambdaQueryWrapper<PlatDevice> deviceLambdaQueryWrapper = new LambdaQueryWrapper<>();
deviceLambdaQueryWrapper.eq(PlatDevice::getOriDeviceId,deviceId);
List<PlatDevice> deviceList = platDeviceService.list(deviceLambdaQueryWrapper);
if(CollectionUtils.isEmpty(deviceList)){
return;
}
for (PlatDevice platDevice : deviceList) {
platDevice.setStatus(messageType.toLowerCase());
LambdaQueryWrapper<PlatDevice> deviceLambdaQueryWrapper = new LambdaQueryWrapper<>();
deviceLambdaQueryWrapper.eq(PlatDevice::getOriDeviceId, deviceId);
List<PlatDevice> deviceList = platDeviceService.list(deviceLambdaQueryWrapper);
if (CollectionUtils.isEmpty(deviceList)) {
return;
}
for (PlatDevice platDevice : deviceList) {
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