武汉8号线列车位置显示功能调整

This commit is contained in:
tiger_zhou 2022-09-09 08:51:33 +08:00
parent 5d66e5ae09
commit eaf30840a1
2 changed files with 10 additions and 3 deletions

View File

@ -36,6 +36,8 @@ public class TrainPositionService {
*/
public void initTrainOrUpdate(String mapName,String json){
TrainPosition tp = JsonUtils.read(json, TrainPosition.class);
tp.setReceiveTime(System.currentTimeMillis());
log.info(tp.toString());
List<Simulation> simulationList = this.findSimulationList(mapName);
if(Objects.equals(true, CollectionUtils.isEmpty(simulationList))){
log.error("未找到对应的类型的仿真,无法渲染列车位置 param:{}",json);
@ -92,7 +94,7 @@ public class TrainPositionService {
list = list.stream().filter(d->d.getRoadType() == roadType && Objects.nonNull(d.getKmMin()))
.sorted(Comparator.comparing(Section::getKmMin)).collect(Collectors.toList());
// simulationManager.putSectionDirCache(key,list);
simulationManager.putSectionDirCache(key,list);
}
return list;
}

View File

@ -1,13 +1,14 @@
package club.joylink.rtss.vo.ws;
import club.joylink.rtss.simulation.cbtc.data.map.Section;
import club.joylink.rtss.util.JsonUtils;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
@Data
@NoArgsConstructor
@ToString
public class TrainPosition {
private String groupNum;
/**
@ -15,7 +16,7 @@ public class TrainPosition {
*/
private int direction;
private float location;
private Long receiveTime;
public Section.SectionRoadType getRoadType(){
Section.SectionRoadType type = Section.SectionRoadType.LEFT;
if(this.direction == 1){
@ -26,4 +27,8 @@ public class TrainPosition {
public boolean isRight(){
return this.direction == 1;
}
@Override
public String toString(){
return JsonUtils.writeValueNullableFieldAsString(this);
}
}