|
|
|
@ -474,7 +474,7 @@ public class CommonOpt { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public Map<String, DeviceInfo> queryDeviceInfo111Map(List<String> deviceIdList111) { |
|
|
|
public Map<String, DeviceInfo> queryDeviceInfoMap(List<String> deviceIdList111) { |
|
|
|
if (CollectionUtils.isEmpty(deviceIdList111)) { |
|
|
|
return Collections.emptyMap(); |
|
|
|
} |
|
|
|
@ -492,13 +492,13 @@ public class CommonOpt { |
|
|
|
)); |
|
|
|
} |
|
|
|
|
|
|
|
public Map<String, DeviceRawdataRealtime> queryRealtime111Map(List<String> deviceIdList111) { |
|
|
|
if (CollectionUtils.isEmpty(deviceIdList111)) { |
|
|
|
public Map<String, DeviceRawdataRealtime> queryRealtimeMap(List<String> deviceIdList) { |
|
|
|
if (CollectionUtils.isEmpty(deviceIdList)) { |
|
|
|
return Collections.emptyMap(); |
|
|
|
} |
|
|
|
|
|
|
|
DeviceRawdataRealtimeExample example = new DeviceRawdataRealtimeExample(); |
|
|
|
example.createCriteria().andDeviceIdIn(deviceIdList111); |
|
|
|
example.createCriteria().andDeviceIdIn(deviceIdList); |
|
|
|
|
|
|
|
return deviceRawdataRealtimeMapperExt |
|
|
|
.selectByExampleWithBLOBs(example) |
|
|
|
@ -527,18 +527,18 @@ public class CommonOpt { |
|
|
|
.map(DeviceInfo::getDataMapping) |
|
|
|
.orElse(null); |
|
|
|
|
|
|
|
return mapStatus111(objectMapper, dataMapping111, realtime111); |
|
|
|
return mapFirstValue(objectMapper, dataMapping111, realtime111); |
|
|
|
} |
|
|
|
|
|
|
|
public String mapStatus111(ObjectMapper mapper, |
|
|
|
public String mapFirstValue(ObjectMapper mapper, |
|
|
|
String dataMapping, |
|
|
|
DeviceRawdataRealtime realtime111) { |
|
|
|
if (StringUtils.isBlank(dataMapping) || realtime111 == null) { |
|
|
|
DeviceRawdataRealtime deviceRawdataRealtime) { |
|
|
|
if (StringUtils.isBlank(dataMapping) || deviceRawdataRealtime == null) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
String statusValue = extractFirstValue(mapper, realtime111.getRawData()); |
|
|
|
String statusValue = extractFirstValue(mapper, deviceRawdataRealtime.getRawData()); |
|
|
|
JsonNode root = mapper.readTree(dataMapping); |
|
|
|
return root.path("default").path(statusValue).asText(null); |
|
|
|
} catch (Exception e) { |
|
|
|
@ -548,4 +548,12 @@ public class CommonOpt { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String buildRawFirstValue(String deviceId, Map<String, String> deviceId85To111Map, |
|
|
|
Map<String, DeviceRawdataRealtime> realtime111Map, ObjectMapper mapper) { |
|
|
|
return Optional.ofNullable(deviceId85To111Map.get(deviceId)) |
|
|
|
.map(realtime111Map::get) |
|
|
|
.map(DeviceRawdataRealtime::getRawData) |
|
|
|
.map(data -> extractFirstValue(mapper, data)) |
|
|
|
.orElse(null); |
|
|
|
} |
|
|
|
} |
|
|
|
|