【列车获取公里标条件修改】
This commit is contained in:
parent
b5e7def287
commit
a5c2b0a202
@ -1,7 +1,6 @@
|
|||||||
package club.joylink.xiannccda.ats.cache;
|
package club.joylink.xiannccda.ats.cache;
|
||||||
|
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceInfoProto;
|
import club.joylink.xiannccda.dto.protos.DeviceInfoProto;
|
||||||
import club.joylink.xiannccda.dto.protos.DeviceInfoProto.Turnout;
|
|
||||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto;
|
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto;
|
||||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.KilometerSystem;
|
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.KilometerSystem;
|
||||||
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.RelatedRef.DeviceType;
|
import club.joylink.xiannccda.dto.protos.LayoutGraphicsProto.RelatedRef.DeviceType;
|
||||||
@ -10,7 +9,6 @@ import club.joylink.xiannccda.entity.PublishedGi;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
import com.google.protobuf.GeneratedMessageV3.Builder;
|
import com.google.protobuf.GeneratedMessageV3.Builder;
|
||||||
import com.google.protobuf.InvalidProtocolBufferException;
|
import com.google.protobuf.InvalidProtocolBufferException;
|
||||||
import io.swagger.v3.oas.models.security.SecurityScheme.In;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -33,16 +31,6 @@ public class LineGraphicDataRepository {
|
|||||||
private static final Map<Integer, Map<String, CoordinateConvertor>> lineCoordinateMain =
|
private static final Map<Integer, Map<String, CoordinateConvertor>> lineCoordinateMain =
|
||||||
new HashMap<>();
|
new HashMap<>();
|
||||||
|
|
||||||
/**
|
|
||||||
* 线路信息是否存在
|
|
||||||
*
|
|
||||||
* @param lineCode 线路信息
|
|
||||||
* @return 是否存在
|
|
||||||
*/
|
|
||||||
public static boolean lineDataExists(Integer lineCode) {
|
|
||||||
return lineGraphMap.containsKey(lineCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 缓存线路数据信息
|
* 缓存线路数据信息
|
||||||
*
|
*
|
||||||
@ -434,15 +422,6 @@ public class LineGraphicDataRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 转换类型,这里根据两个坐标系来定
|
|
||||||
*
|
|
||||||
* @return 类型字符串
|
|
||||||
*/
|
|
||||||
private String getConvertorKey() {
|
|
||||||
return generateConvertorKey(configType, convertorType);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成转换Key
|
* 生成转换Key
|
||||||
*
|
*
|
||||||
|
@ -18,9 +18,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 LineNetTrainInitConvertor extends DeviceStatusConvertor {
|
public class LineNetTrainInitConvertor extends DeviceStatusConvertor {
|
||||||
|
|
||||||
@ -56,6 +54,7 @@ public class LineNetTrainInitConvertor extends DeviceStatusConvertor {
|
|||||||
LineGraphicDataRepository.getSectionDefaultKmCodeList(
|
LineGraphicDataRepository.getSectionDefaultKmCodeList(
|
||||||
response.getLineId(), trainCell.getDevName());
|
response.getLineId(), trainCell.getDevName());
|
||||||
if (CollectionUtils.isNotEmpty(kmCodeList)) {
|
if (CollectionUtils.isNotEmpty(kmCodeList)) {
|
||||||
|
offset.setShow(true); // 是否显示
|
||||||
offset.setKilometerCode(kmCodeList.get(0));
|
offset.setKilometerCode(kmCodeList.get(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,17 +42,18 @@ public class LineNetTrainRecordConvertor extends DeviceStatusConvertor {
|
|||||||
offset.setLineId(response.getLineId()); // 线路id
|
offset.setLineId(response.getLineId()); // 线路id
|
||||||
offset.setGroupId(response.getGroupId()); // 车组号
|
offset.setGroupId(response.getGroupId()); // 车组号
|
||||||
offset.setDir(response.getDirection().getValue()); // 初始设置无运行方向
|
offset.setDir(response.getDirection().getValue()); // 初始设置无运行方向
|
||||||
offset.setShow(true); // 显示
|
offset.setShow(false);
|
||||||
// 获取到当前区段公里标
|
// 获取到当前区段公里标
|
||||||
List<Long> kmCodeList =
|
List<Long> kmCodeList =
|
||||||
LineGraphicDataRepository.getSectionDefaultKmCodeList(
|
LineGraphicDataRepository.getSectionDefaultKmCodeList(
|
||||||
response.getLineId(), response.getTrackName());
|
response.getLineId(), response.getTrackName());
|
||||||
if (CollectionUtils.isNotEmpty(kmCodeList)) {
|
if (CollectionUtils.isNotEmpty(kmCodeList)) {
|
||||||
|
offset.setShow(true); // 如果公里标存在则
|
||||||
long kilometer;
|
long kilometer;
|
||||||
if (offset.getDir() == 1) { // 下行取大值
|
if (offset.getDir() == 1) { // 下行取大值
|
||||||
kilometer = kmCodeList.stream().max(Long::compareTo).get();
|
|
||||||
} else if (offset.getDir() == 2) { // 上行取小值
|
|
||||||
kilometer = kmCodeList.stream().min(Long::compareTo).get();
|
kilometer = kmCodeList.stream().min(Long::compareTo).get();
|
||||||
|
} else if (offset.getDir() == 2) { // 上行取小值
|
||||||
|
kilometer = kmCodeList.stream().max(Long::compareTo).get();
|
||||||
} else { // 无方向获取第一个
|
} else { // 无方向获取第一个
|
||||||
kilometer = kmCodeList.get(0);
|
kilometer = kmCodeList.get(0);
|
||||||
}
|
}
|
||||||
|
@ -18,9 +18,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 LineNetTrainUpdateConvertor extends DeviceStatusConvertor {
|
public class LineNetTrainUpdateConvertor extends DeviceStatusConvertor {
|
||||||
|
|
||||||
@ -47,13 +45,13 @@ public class LineNetTrainUpdateConvertor extends DeviceStatusConvertor {
|
|||||||
offset.setLineId(response.getLineId()); // 线路id
|
offset.setLineId(response.getLineId()); // 线路id
|
||||||
offset.setTrainIndex(response.getTrainIndex()); // 列车标示号,全线唯一
|
offset.setTrainIndex(response.getTrainIndex()); // 列车标示号,全线唯一
|
||||||
offset.setGroupId(response.getGroupId()); // 车组号
|
offset.setGroupId(response.getGroupId()); // 车组号
|
||||||
offset.setShow(true); // 是否显示
|
|
||||||
// 获取到当前区段公里标
|
// 获取到当前区段公里标
|
||||||
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.getSectionDefaultKmCodeList(
|
||||||
response.getLineId(), response.getDevName());
|
response.getLineId(), response.getDevName());
|
||||||
if (CollectionUtils.isNotEmpty(kmCodeList)) {
|
if (CollectionUtils.isNotEmpty(kmCodeList)) {
|
||||||
|
offset.setShow(true); // 是否显示
|
||||||
offset.setKilometerCode(kmCodeList.get(0));
|
offset.setKilometerCode(kmCodeList.get(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user