This commit is contained in:
wangshilong 2024-12-10 15:20:42 +08:00
parent 8558b0f951
commit 6f0ef7bd3d
1 changed files with 6 additions and 6 deletions

View File

@ -93,7 +93,7 @@ public class AutoCollectJobs {
} }
resultList.stream() resultList.stream()
.filter(item -> { .filter(item -> {
String gatewaySn = MapUtil.getStr(item, "identifier"); String gatewaySn = StringUtils.trim(MapUtil.getStr(item, "identifier"));
String gatewayIdentifier = this.equipmentIPProperties.put(gatewaySn); String gatewayIdentifier = this.equipmentIPProperties.put(gatewaySn);
if (Objects.nonNull(ModbusTCPController.nettyServer.getGroup() if (Objects.nonNull(ModbusTCPController.nettyServer.getGroup()
.get(gatewayIdentifier))) { .get(gatewayIdentifier))) {
@ -103,7 +103,7 @@ public class AutoCollectJobs {
log.warn("Gateway {} is disconnected and does not collect data", gatewaySn); log.warn("Gateway {} is disconnected and does not collect data", gatewaySn);
return false; return false;
}) })
.collect(Collectors.groupingBy(item -> MapUtil.getStr(item, "deviceId"))) .collect(Collectors.groupingBy(item -> StringUtils.trim(MapUtil.getStr(item, "deviceId"))))
.forEach((deviceId, commandList) -> { .forEach((deviceId, commandList) -> {
Map<String, List<Map<String, Object>>> refTypeCommandListMap = commandList.stream() Map<String, List<Map<String, Object>>> refTypeCommandListMap = commandList.stream()
.collect(Collectors.groupingBy(item -> MapUtil.getStr(item, "refType"))); .collect(Collectors.groupingBy(item -> MapUtil.getStr(item, "refType")));
@ -114,15 +114,15 @@ public class AutoCollectJobs {
if (ObjectUtils.isNotEmpty(deviceCommandList)) { if (ObjectUtils.isNotEmpty(deviceCommandList)) {
List<ModbusCommandDto> collectCommondList = deviceCommandList.stream() List<ModbusCommandDto> collectCommondList = deviceCommandList.stream()
.map(item -> { .map(item -> {
String identifier = MapUtil.getStr(item, "identifier"); String identifier = StringUtils.trim(MapUtil.getStr(item, "identifier"));
return ModbusCommandDto.builder() return ModbusCommandDto.builder()
.command(MapUtil.getStr(item, "command")) .command(StringUtils.trim(MapUtil.getStr(item, "command")))
.identifier(identifier) .identifier(identifier)
.length(MapUtil.getInt(item, "messageLength")) .length(MapUtil.getInt(item, "messageLength"))
.type(CommandTypeComparable.CommandType.COLLECTION) .type(CommandTypeComparable.CommandType.COLLECTION)
.key(StringUtils.joinWith("/", identifier, .key(StringUtils.joinWith("/", identifier,
MapUtil.getStr(item, "deviceId"), StringUtils.trim(MapUtil.getStr(item, "deviceId")),
MapUtil.getStr(item, "commandId"), StringUtils.trim(MapUtil.getStr(item, "commandId")),
timestamp)) timestamp))
.build(); .build();
}) })