【增加警告信息打印,修改方法名称】

This commit is contained in:
weizhihong 2023-07-17 14:16:59 +08:00
parent cf49960128
commit ead852b955
6 changed files with 17 additions and 9 deletions

View File

@ -61,7 +61,7 @@ public class LineGraphicDataRepository {
* @param sectionName 区段名称 * @param sectionName 区段名称
* @return 公里标 * @return 公里标
*/ */
public static List<Long> getSectionDefaultKmCodeList(int lineId, String sectionName) { public static List<Long> getKilometerCodeList(int lineId, String sectionName) {
Map<String, Map<String, Builder>> lineDataMap = lineGraphMap.get(lineId); Map<String, Map<String, Builder>> lineDataMap = lineGraphMap.get(lineId);
if (CollectionUtils.isNotEmpty(lineDataMap)) { if (CollectionUtils.isNotEmpty(lineDataMap)) {
Map<String, Builder> sectionMap = lineDataMap.get(DeviceType.Section.name()); Map<String, Builder> sectionMap = lineDataMap.get(DeviceType.Section.name());
@ -71,6 +71,14 @@ public class LineGraphicDataRepository {
return builder.getConvertKilometerList(); return builder.getConvertKilometerList();
} }
} }
Map<String, Builder> turnoutMap = lineDataMap.get(DeviceType.Turnout.name());
for (Builder v : turnoutMap.values()) {
DeviceInfoProto.Turnout.Builder builder = (DeviceInfoProto.Turnout.Builder) v;
if (Objects.equals(builder.getCode(), sectionName)) {
return builder.getConvertKilometerList();
}
}
} }
return List.of(); return List.of();
} }

View File

@ -51,7 +51,7 @@ public class LineNetTrainInitConvertor extends DeviceStatusConvertor {
// 获取到当前区段公里标 // 获取到当前区段公里标
if (DeviceType.DEVICE_TYPE_TRACK.equals(trainCell.getDevType())) { if (DeviceType.DEVICE_TYPE_TRACK.equals(trainCell.getDevType())) {
List<Long> kmCodeList = List<Long> kmCodeList =
LineGraphicDataRepository.getSectionDefaultKmCodeList( LineGraphicDataRepository.getKilometerCodeList(
response.getLineId(), trainCell.getDevName()); response.getLineId(), trainCell.getDevName());
if (CollectionUtils.isNotEmpty(kmCodeList)) { if (CollectionUtils.isNotEmpty(kmCodeList)) {
offset.setShow(true); // 是否显示 offset.setShow(true); // 是否显示

View File

@ -45,7 +45,7 @@ public class LineNetTrainRecordConvertor extends DeviceStatusConvertor {
offset.setShow(false); offset.setShow(false);
// 获取到当前区段公里标 // 获取到当前区段公里标
List<Long> kmCodeList = List<Long> kmCodeList =
LineGraphicDataRepository.getSectionDefaultKmCodeList( LineGraphicDataRepository.getKilometerCodeList(
response.getLineId(), response.getTrackName()); response.getLineId(), response.getTrackName());
if (CollectionUtils.isNotEmpty(kmCodeList)) { if (CollectionUtils.isNotEmpty(kmCodeList)) {
offset.setShow(true); // 如果公里标存在则 offset.setShow(true); // 如果公里标存在则
@ -58,6 +58,8 @@ public class LineNetTrainRecordConvertor extends DeviceStatusConvertor {
kilometer = kmCodeList.get(0); kilometer = kmCodeList.get(0);
} }
offset.setKilometerCode(kilometer); offset.setKilometerCode(kilometer);
} else {
log.warn(String.format("设备%s没有公里标信息", response.getTrackName()));
} }
buildList.add(offset); buildList.add(offset);
} }

View File

@ -17,9 +17,7 @@ import java.util.List;
import java.util.Objects; import java.util.Objects;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
/** /** 列车信息移除时,线网信息处理 */
* 列车信息移除时线网信息处理
*/
@Slf4j @Slf4j
public class LineNetTrainRemoveConvertor extends DeviceStatusConvertor { public class LineNetTrainRemoveConvertor extends DeviceStatusConvertor {
@ -50,7 +48,7 @@ public class LineNetTrainRemoveConvertor extends DeviceStatusConvertor {
// 获取到当前区段公里标 // 获取到当前区段公里标
if (DeviceType.DEVICE_TYPE_TRACK.equals(response.getDevType())) { if (DeviceType.DEVICE_TYPE_TRACK.equals(response.getDevType())) {
List<Long> kmCodeList = List<Long> kmCodeList =
LineGraphicDataRepository.getSectionDefaultKmCodeList( LineGraphicDataRepository.getKilometerCodeList(
response.getLineId(), response.getDevName()); response.getLineId(), response.getDevName());
if (CollectionUtils.isNotEmpty(kmCodeList)) { if (CollectionUtils.isNotEmpty(kmCodeList)) {
offset.setKilometerCode(kmCodeList.get(0)); offset.setKilometerCode(kmCodeList.get(0));

View File

@ -48,7 +48,7 @@ public class LineNetTrainUpdateConvertor extends DeviceStatusConvertor {
// 获取到当前区段公里标 // 获取到当前区段公里标
if (DeviceType.DEVICE_TYPE_TRACK.equals(response.getDevType())) { if (DeviceType.DEVICE_TYPE_TRACK.equals(response.getDevType())) {
List<Long> kmCodeList = List<Long> kmCodeList =
LineGraphicDataRepository.getSectionDefaultKmCodeList( LineGraphicDataRepository.getKilometerCodeList(
response.getLineId(), response.getDevName()); response.getLineId(), response.getDevName());
if (CollectionUtils.isNotEmpty(kmCodeList)) { if (CollectionUtils.isNotEmpty(kmCodeList)) {
offset.setShow(true); // 是否显示 offset.setShow(true); // 是否显示

@ -1 +1 @@
Subproject commit 874a6fe4fafcda375e7479e7da0d67d1061ab2f1 Subproject commit e8ac23070828a1eca3bd68b6f78e4e419123d139