|
|
@@ -72,6 +72,11 @@ public class IotSensorServiceImpl extends ServiceImpl<IotSensorMapper, IotSensor
|
|
|
if (ObjectUtil.isNull(orgId)) {
|
|
|
return;
|
|
|
}
|
|
|
+ final List<IotSensor> sensors = baseMapper.selectList(new LambdaQueryWrapper<IotSensor>().eq(IotSensor::getSource, 1).eq(IotSensor::getOrgId, orgId));
|
|
|
+ final List<String> collect = sensors.stream().map(IotSensor::getDeviceCode).distinct().collect(Collectors.toList());
|
|
|
+ if (ObjectUtil.isNotEmpty(collect)) {
|
|
|
+ iotSensorLogService.remove(new LambdaQueryWrapper<IotSensorLog>().eq(IotSensorLog::getOrgId, orgId).in(IotSensorLog::getDeviceCode, collect));
|
|
|
+ }
|
|
|
baseMapper.updateDelByOrgId(orgId);
|
|
|
}
|
|
|
|
|
|
@@ -181,8 +186,12 @@ public class IotSensorServiceImpl extends ServiceImpl<IotSensorMapper, IotSensor
|
|
|
} else {
|
|
|
obj.put("unit", attributesEnum.getEnumText());
|
|
|
final Map extraMap = JSON.parseObject(attributesEnum.getEnumText(), Map.class);
|
|
|
- final String o = (String) extraMap.get(val);
|
|
|
- obj.put("res", o);
|
|
|
+ for (Object o : extraMap.keySet()) {
|
|
|
+ if (String.valueOf(o).equals(val)) {
|
|
|
+ obj.put("res", (String) extraMap.get(o));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
return JSON.toJSONString(jsonArray);
|