修改获取仿真日志接口的实现;站台设置停站时间增加对列车设置停站时间功能
This commit is contained in:
parent
c362c47fcd
commit
b6a6bd1c89
@ -806,4 +806,15 @@ public interface BusinessConsts {
|
|||||||
WITHIN_A_WEEK,
|
WITHIN_A_WEEK,
|
||||||
WEEKEND,
|
WEEKEND,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum Regulation{
|
||||||
|
/** 时刻表调度 */
|
||||||
|
TIME_TABLE_REGULATION,
|
||||||
|
/** 行车间隔调度 - 前调 */
|
||||||
|
HEADWAY_REGULATION_FRONT,
|
||||||
|
/** 行车间隔调度 - 前调 + 后调 */
|
||||||
|
HEADWAY_REGULATION_FRONT_AND_BACK,
|
||||||
|
/** 关闭自动调度 */
|
||||||
|
REGULATION_OFF,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -392,6 +392,8 @@ public class Operation {
|
|||||||
Train_Set_Deviation,
|
Train_Set_Deviation,
|
||||||
/** 取消偏离【泰雷兹】 */
|
/** 取消偏离【泰雷兹】 */
|
||||||
Train_Cancel_Deviation,
|
Train_Cancel_Deviation,
|
||||||
|
/** 列车调度 */
|
||||||
|
Train_Regulation,
|
||||||
|
|
||||||
//--------------------------- 司机 ---------------------------
|
//--------------------------- 司机 ---------------------------
|
||||||
/** 改变列车的牵引/制动力 */
|
/** 改变列车的牵引/制动力 */
|
||||||
|
@ -125,8 +125,8 @@ public class StandOperateHandler {
|
|||||||
* 设置停站时间
|
* 设置停站时间
|
||||||
*/
|
*/
|
||||||
@OperateHandlerMapping(type = Operation.Type.Stand_Set_Park_Time)
|
@OperateHandlerMapping(type = Operation.Type.Stand_Set_Park_Time)
|
||||||
public void setParkTime(Simulation simulation, String standCode, int parkingTime, boolean parkingAlwaysValid) {
|
public void setParkTime(Simulation simulation, String standCode, int parkingTime, boolean parkingAlwaysValid, String groupNumber) {
|
||||||
atsStandService.setParkTime(simulation, standCode, parkingTime, parkingAlwaysValid);
|
atsStandService.setParkTime(simulation, standCode, parkingTime, parkingAlwaysValid, groupNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package club.joylink.rtss.simulation.cbtc.ATS.operation.handler;
|
package club.joylink.rtss.simulation.cbtc.ATS.operation.handler;
|
||||||
|
|
||||||
|
import club.joylink.rtss.constants.BusinessConsts;
|
||||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
|
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
|
||||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandler;
|
import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandler;
|
||||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandlerMapping;
|
import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandlerMapping;
|
||||||
@ -377,4 +378,9 @@ public class TrainOperateHandler {
|
|||||||
public void cancelCBTCRoute(Simulation simulation, List<String> routeCodes) {
|
public void cancelCBTCRoute(Simulation simulation, List<String> routeCodes) {
|
||||||
atsTrainService.cancelCBTCRoute(simulation, routeCodes);
|
atsTrainService.cancelCBTCRoute(simulation, routeCodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateHandlerMapping(type = Operation.Type.Train_Regulation)
|
||||||
|
public void regulation(Simulation simulation, String groupNumber, BusinessConsts.Regulation regulation) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,13 +37,16 @@ public class AtsStandService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CiApiService ciApiService;
|
private CiApiService ciApiService;
|
||||||
|
|
||||||
public int trainParkingAndGetParkTime(Simulation simulation, Section section) {
|
public int trainParkingAndGetParkTime(Simulation simulation, Section section, String groupNumber) {
|
||||||
List<Stand> standList = section.getStandList();
|
List<Stand> standList = section.getStandList();
|
||||||
int parkTime = -1;
|
int parkTime = -1;
|
||||||
for (Stand stand : standList) {
|
for (Stand stand : standList) {
|
||||||
log.debug(String.format("站台[%s(%s)]列车停靠", stand.getName(), stand.getCode()));
|
log.debug(String.format("站台[%s(%s)]列车停靠", stand.getName(), stand.getCode()));
|
||||||
stand.setTrainParking(true);
|
stand.setTrainParking(true);
|
||||||
if (stand.getParkingTime() > 0) {
|
Integer integer = stand.getParkingTimeMap().get(groupNumber);
|
||||||
|
if (integer != null) {
|
||||||
|
parkTime = integer;
|
||||||
|
} else {
|
||||||
parkTime = stand.getParkingTime();
|
parkTime = stand.getParkingTime();
|
||||||
if (!stand.isParkingAlwaysValid()) { // 如果停站时间一次有效,清除
|
if (!stand.isParkingAlwaysValid()) { // 如果停站时间一次有效,清除
|
||||||
stand.setParkingTime(-1);
|
stand.setParkingTime(-1);
|
||||||
@ -232,9 +235,13 @@ public class AtsStandService {
|
|||||||
/**
|
/**
|
||||||
* 设置停站时间
|
* 设置停站时间
|
||||||
*/
|
*/
|
||||||
public void setParkTime(Simulation simulation, String standCode, int parkingTime, boolean parkingAlwaysValid) {
|
public void setParkTime(Simulation simulation, String standCode, int parkingTime, boolean parkingAlwaysValid, String groupNumber) {
|
||||||
Stand stand = getStand(simulation, standCode);
|
Stand stand = getStand(simulation, standCode);
|
||||||
|
if (StringUtils.hasText(groupNumber)) {
|
||||||
|
stand.addTrainParkingTime(groupNumber, parkingTime);
|
||||||
|
} else {
|
||||||
stand.setParkingTime(parkingTime);
|
stand.setParkingTime(parkingTime);
|
||||||
|
}
|
||||||
stand.setParkingAlwaysValid(parkingAlwaysValid);
|
stand.setParkingAlwaysValid(parkingAlwaysValid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ public class AtsTrainMonitorService {
|
|||||||
this.realRunRecordService.recordTrainRealRun(simulation, train, station, standTrack, true);
|
this.realRunRecordService.recordTrainRealRun(simulation, train, station, standTrack, true);
|
||||||
train.updateArriveInfo(systemTime.toLocalTime(), station, standTrack);
|
train.updateArriveInfo(systemTime.toLocalTime(), station, standTrack);
|
||||||
if (!CollectionUtils.isEmpty(standTrack.getStandList())) {
|
if (!CollectionUtils.isEmpty(standTrack.getStandList())) {
|
||||||
int parkTime = this.atsStandService.trainParkingAndGetParkTime(simulation, standTrack);
|
int parkTime = this.atsStandService.trainParkingAndGetParkTime(simulation, standTrack, train.getGroupNumber());
|
||||||
if (parkTime < 0) {
|
if (parkTime < 0) {
|
||||||
parkTime = this.getParkTimeOf(simulation, train, standTrack);
|
parkTime = this.getParkTimeOf(simulation, train, standTrack);
|
||||||
}
|
}
|
||||||
|
@ -1002,29 +1002,10 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||||||
@Override
|
@Override
|
||||||
public PageVO<SimulationLog> getLog(String group, SimulationLogPagedQueryVO queryVO) {
|
public PageVO<SimulationLog> getLog(String group, SimulationLogPagedQueryVO queryVO) {
|
||||||
List<SimulationLog> logs = getSimulationByGroup(group).getLogs();
|
List<SimulationLog> logs = getSimulationByGroup(group).getLogs();
|
||||||
//根据时间筛选
|
|
||||||
if (!CollectionUtils.isEmpty(logs)) {
|
|
||||||
if (queryVO.getStartTime() != null || queryVO.getEndTime() != null) {
|
|
||||||
logs = logs.stream().filter(log -> {
|
|
||||||
boolean flag = true;
|
|
||||||
if (queryVO.getStartTime() != null) {
|
|
||||||
flag = flag && !log.getTime().isBefore(queryVO.getStartTime());
|
|
||||||
}
|
|
||||||
if (queryVO.getEndTime() != null) {
|
|
||||||
flag = flag && !log.getTime().isAfter(queryVO.getEndTime());
|
|
||||||
}
|
|
||||||
return flag;
|
|
||||||
}).collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PageVO<SimulationLog> pageVO = new PageVO<>();
|
PageVO<SimulationLog> pageVO = new PageVO<>();
|
||||||
pageVO.setPageSize(queryVO.getPageSize());
|
pageVO.setPageSize(queryVO.getPageSize());
|
||||||
if (CollectionUtils.isEmpty(logs)) {
|
//根据时间筛选
|
||||||
pageVO.setPageNum(1);
|
if (!CollectionUtils.isEmpty(logs)) {
|
||||||
pageVO.setList(new ArrayList<>());
|
|
||||||
pageVO.setTotal(0);
|
|
||||||
} else {
|
|
||||||
//根据分页信息筛选
|
//根据分页信息筛选
|
||||||
int maxPageNum = logs.size() / queryVO.getPageSize() + 1;
|
int maxPageNum = logs.size() / queryVO.getPageSize() + 1;
|
||||||
int pageNum = Math.min(maxPageNum, queryVO.getPageNum());
|
int pageNum = Math.min(maxPageNum, queryVO.getPageNum());
|
||||||
@ -1033,13 +1014,22 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||||||
int end = pageNum * queryVO.getPageSize();
|
int end = pageNum * queryVO.getPageSize();
|
||||||
start = Math.min(start, logs.size() - 1);
|
start = Math.min(start, logs.size() - 1);
|
||||||
end = Math.min(end, logs.size());
|
end = Math.min(end, logs.size());
|
||||||
if (start >= logs.size()) {
|
logs = logs.stream()
|
||||||
start = logs.size() - 1;
|
.filter(log -> {
|
||||||
}
|
if (queryVO.getStartTime() != null && log.getTime().isBefore(queryVO.getStartTime()))
|
||||||
|
return false;
|
||||||
pageVO.setPageNum(pageNum);
|
if (queryVO.getEndTime() != null && log.getTime().isAfter(queryVO.getEndTime()))
|
||||||
pageVO.setTotal(logs.size());
|
return false;
|
||||||
pageVO.setList(logs.subList(start, end));
|
return true;
|
||||||
|
})
|
||||||
|
.skip(start)
|
||||||
|
.limit(end - start)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
pageVO.setList(logs);
|
||||||
|
} else {
|
||||||
|
pageVO.setPageNum(1);
|
||||||
|
pageVO.setList(new ArrayList<>());
|
||||||
|
pageVO.setTotal(0);
|
||||||
}
|
}
|
||||||
return pageVO;
|
return pageVO;
|
||||||
}
|
}
|
||||||
|
@ -5,14 +5,13 @@ import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl;
|
|||||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityScreenDoor;
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityScreenDoor;
|
||||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||||
|
import io.netty.util.internal.ConcurrentSet;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.*;
|
||||||
import java.util.HashSet;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 站台
|
* 站台
|
||||||
@ -109,7 +108,7 @@ public class Stand extends MayOutOfOrderDevice {
|
|||||||
/**
|
/**
|
||||||
* 指定跳停车辆编号(车组号)
|
* 指定跳停车辆编号(车组号)
|
||||||
*/
|
*/
|
||||||
private Set<String> skipSet = Collections.synchronizedSet(new HashSet());
|
private Set<String> skipSet = Collections.synchronizedSet(new HashSet<>());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跳停一直有效?
|
* 跳停一直有效?
|
||||||
@ -138,6 +137,9 @@ public class Stand extends MayOutOfOrderDevice {
|
|||||||
*/
|
*/
|
||||||
private int parkingTime;
|
private int parkingTime;
|
||||||
|
|
||||||
|
/** 列车-停站时间map */
|
||||||
|
private final Map<String, Integer> parkingTimeMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 停车设置状态(一直有效/一次有效)
|
* 停车设置状态(一直有效/一次有效)
|
||||||
*/
|
*/
|
||||||
@ -184,6 +186,7 @@ public class Stand extends MayOutOfOrderDevice {
|
|||||||
this.runLevelTime = 0;
|
this.runLevelTime = 0;
|
||||||
this.runLevelTimeForever = false;
|
this.runLevelTimeForever = false;
|
||||||
this.parkingTime = -1;
|
this.parkingTime = -1;
|
||||||
|
this.clearTrainParkingTime();
|
||||||
this.parkingAlwaysValid = false;
|
this.parkingAlwaysValid = false;
|
||||||
this.typeStrategy = this.defaultTypeStrategy;
|
this.typeStrategy = this.defaultTypeStrategy;
|
||||||
this.noStatus = false;
|
this.noStatus = false;
|
||||||
@ -334,6 +337,14 @@ public class Stand extends MayOutOfOrderDevice {
|
|||||||
this.setRemainTime(0);
|
this.setRemainTime(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addTrainParkingTime(String groupNumber, int parkingTime) {
|
||||||
|
this.parkingTimeMap.put(groupNumber, parkingTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearTrainParkingTime() {
|
||||||
|
this.parkingTimeMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 站台折返类型策略
|
* 站台折返类型策略
|
||||||
*/
|
*/
|
||||||
|
@ -10,9 +10,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.*;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 站台状态
|
* 站台状态
|
||||||
@ -76,6 +74,8 @@ public class StandStatus extends DeviceStatus {
|
|||||||
/**停车时间(自动为-1)*/
|
/**停车时间(自动为-1)*/
|
||||||
private int parkingTime;
|
private int parkingTime;
|
||||||
|
|
||||||
|
private Map<String, Integer> parkingTimeMap;
|
||||||
|
|
||||||
/**停车设置状态(一直有效/一次有效)*/
|
/**停车设置状态(一直有效/一次有效)*/
|
||||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||||
private boolean parkingAlwaysValid;
|
private boolean parkingAlwaysValid;
|
||||||
@ -116,6 +116,7 @@ public class StandStatus extends DeviceStatus {
|
|||||||
this.runLevelTimeForever = stand.isRunLevelTimeForever();
|
this.runLevelTimeForever = stand.isRunLevelTimeForever();
|
||||||
this.trainLimit = stand.getTrainLimit();
|
this.trainLimit = stand.getTrainLimit();
|
||||||
this.parkingTime = stand.getParkingTime();
|
this.parkingTime = stand.getParkingTime();
|
||||||
|
this.parkingTimeMap = new HashMap<>(stand.getParkingTimeMap());
|
||||||
this.parkingAlwaysValid = stand.isParkingAlwaysValid();
|
this.parkingAlwaysValid = stand.isParkingAlwaysValid();
|
||||||
this.typeStrategy = stand.getTypeStrategy();
|
this.typeStrategy = stand.getTypeStrategy();
|
||||||
this.noStatus = stand.isNoStatus();
|
this.noStatus = stand.isNoStatus();
|
||||||
@ -182,6 +183,7 @@ public class StandStatus extends DeviceStatus {
|
|||||||
if (Objects.isNull(this.skipSet) ||
|
if (Objects.isNull(this.skipSet) ||
|
||||||
(this.skipSet.size() != stand.getSkipSet().size())) {
|
(this.skipSet.size() != stand.getSkipSet().size())) {
|
||||||
this.skipSet = new HashSet<>(stand.getSkipSet());
|
this.skipSet = new HashSet<>(stand.getSkipSet());
|
||||||
|
status.setSkipSet(this.skipSet);
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
status.setSkipSet(this.skipSet );
|
status.setSkipSet(this.skipSet );
|
||||||
@ -210,6 +212,11 @@ public class StandStatus extends DeviceStatus {
|
|||||||
status.setParkingTime(this.parkingTime);
|
status.setParkingTime(this.parkingTime);
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
|
if (!Objects.equals(this.parkingTimeMap, stand.getParkingTimeMap())) {
|
||||||
|
this.parkingTimeMap = new HashMap<>(stand.getParkingTimeMap());
|
||||||
|
status.setParkingTimeMap(parkingTimeMap);
|
||||||
|
change = true;
|
||||||
|
}
|
||||||
if (!Objects.equals(this.parkingAlwaysValid, stand.isParkingAlwaysValid())) {
|
if (!Objects.equals(this.parkingAlwaysValid, stand.isParkingAlwaysValid())) {
|
||||||
this.parkingAlwaysValid = stand.isParkingAlwaysValid();
|
this.parkingAlwaysValid = stand.isParkingAlwaysValid();
|
||||||
status.setParkingAlwaysValid(this.parkingAlwaysValid);
|
status.setParkingAlwaysValid(this.parkingAlwaysValid);
|
||||||
|
@ -7,6 +7,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,6 +74,9 @@ public class StandStatusVO extends DeviceStatusVO {
|
|||||||
/**停车时间(自动为-1)*/
|
/**停车时间(自动为-1)*/
|
||||||
private Integer parkingTime;
|
private Integer parkingTime;
|
||||||
|
|
||||||
|
/** 列车-停站时间 */
|
||||||
|
private Map<String, Integer> parkingTimeMap;
|
||||||
|
|
||||||
/**停车设置状态(一直有效/一次有效)*/
|
/**停车设置状态(一直有效/一次有效)*/
|
||||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||||
private Boolean parkingAlwaysValid;
|
private Boolean parkingAlwaysValid;
|
||||||
|
Loading…
Reference in New Issue
Block a user