【修改行车日志实际时间】

This commit is contained in:
weizhihong 2022-06-21 16:55:24 +08:00
parent 56aefb9db4
commit 49b6899df3
2 changed files with 20 additions and 22 deletions

View File

@ -63,9 +63,7 @@ public class CtcStationRunPlanLogService {
if (!StringUtils.isEmpty(p.getDepartSectionCode())) {
RouteSequence.Line departLine = simulation.getCtcRepository()
.getRouteSequenceLine(stationCode, runPlanLog.getTripNumber(), true);
if ((departLine != null && departLine.getRoute().isLock())) {
return true;
}
return departLine != null && departLine.getRoute().isLock();
}
return false;
});
@ -74,7 +72,7 @@ public class CtcStationRunPlanLogService {
}
}
List<CtcStationRunPlanLog> runPlanLogList = new ArrayList<>(planParamList.size());
planParamList.stream().forEach(p -> {
planParamList.forEach(p -> {
CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, p.getRunPlanCode());
if (runPlanLog != null) { // 修改删除
if (modifyRunPlanInfo(simulation, runPlanLog, p)) { // 是否修改过股道
@ -110,7 +108,7 @@ public class CtcStationRunPlanLogService {
Map<String, CtcRunPlanParam> stationRunPlanMap = simulation.getCtcRepository().getSimulationRunPlanEditAreaMap()
.getOrDefault(stationCode, new ConcurrentHashMap<>(64));
boolean isEmpty = CollectionUtils.isEmpty(stationRunPlanMap);
runPlanParamList.stream().forEach(p -> {
runPlanParamList.forEach(p -> {
String tripNumber = StringUtils.isEmpty(p.getArriveTripNumber()) ? p.getDepartTripNumber() : p.getArriveTripNumber();
p.setTripNumber(tripNumber);
p.setRunPlanCode(tripNumber);
@ -139,10 +137,11 @@ public class CtcStationRunPlanLogService {
* @param runPlanCode 车次
*/
public void removeRunPlanFromEditArea(Simulation simulation, String stationCode, String runPlanCode) {
Map<String, CtcRunPlanParam> stationRunLogTripNumberMap = simulation.getCtcRepository()
.getSimulationRunPlanEditAreaMap().getOrDefault(stationCode, new ConcurrentHashMap<>());
Map<String, CtcRunPlanParam> stationRunLogTripNumberMap = simulation.getCtcRepository().getSimulationRunPlanEditAreaMap().get(stationCode);
if (!CollectionUtils.isEmpty(stationRunLogTripNumberMap)) {
stationRunLogTripNumberMap.remove(runPlanCode);
}
}
/**
* 全部清空
@ -170,7 +169,7 @@ public class CtcStationRunPlanLogService {
p.setRunPlanCode(tripNumber);
});
Map<String, CtcRunPlanParam> planParamMap
= runPlanParamList.stream().collect(Collectors.toMap(p -> p.getRunPlanCode(), (p) -> p));
= runPlanParamList.stream().collect(Collectors.toMap(CtcRunPlanParam::getRunPlanCode, (p) -> p));
simulation.getCtcRepository().getSimulationRunPlanEditAreaMap().put(stationCode, planParamMap);
}
@ -205,8 +204,7 @@ public class CtcStationRunPlanLogService {
Map<String, CtcRunPlanParam> runPlanParamMap = simulation.getCtcRepository().getSimulationRunPlanEffectAreaMap()
.get(stationCode);
if (!CollectionUtils.isEmpty(runPlanParamMap)) {
List<CtcRunPlanParam> runPlanParamList = runPlanParamMap.values().stream().collect(Collectors.toList());
modifyBatchRunPlan(simulation, stationCode, runPlanParamList, 1);
modifyBatchRunPlan(simulation, stationCode, new ArrayList<>(runPlanParamMap.values()), 1);
}
}
@ -224,13 +222,13 @@ public class CtcStationRunPlanLogService {
CtcStationRunPlanLog ctcStationRunPlanLog =
simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode);
if (ctcStationRunPlanLog.getArriveRunPlan() != null) {
String arriveTimeStr = arriveTime != null ? "" : arriveTime.toString();
String arriveTimeStr = arriveTime != null ? arriveTime.toString() : "";
if (!Objects.equals(arriveTimeStr, ctcStationRunPlanLog.getArriveRunPlan().getActualTime())) {
ctcStationRunPlanLog.getArriveRunPlan().setActualTime(arriveTimeStr);
}
}
if (ctcStationRunPlanLog.getDepartRunPlan() != null) {
String departTimeStr = departTime != null ? "" : departTime.toString();
String departTimeStr = departTime != null ? departTime.toString() : "";
if (!Objects.equals(departTimeStr, ctcStationRunPlanLog.getArriveRunPlan().getActualTime())) {
ctcStationRunPlanLog.getDepartRunPlan().setActualTime(departTimeStr);
}
@ -308,15 +306,15 @@ public class CtcStationRunPlanLogService {
* @param simulation 仿真
* @param runPlanLog 运行计划
* @param planParam 修改参数
* @return
* @return 是否发生变化
*/
private boolean modifyRunPlanInfo(Simulation simulation, CtcStationRunPlanLog runPlanLog, CtcRunPlanParam planParam) {
boolean change = false;
boolean change;
if (planParam.getStatus() == -1) {
runPlanLog.setDelete(Boolean.TRUE);
}
// 到达
change = change || modifyRunPlanItemInfo(simulation, runPlanLog.getArriveRunPlan(), planParam, true);
change = modifyRunPlanItemInfo(simulation, runPlanLog.getArriveRunPlan(), planParam, true);
// 出发
change = change || modifyRunPlanItemInfo(simulation, runPlanLog.getDepartRunPlan(), planParam, false);
// 是否客运
@ -400,10 +398,10 @@ public class CtcStationRunPlanLogService {
/**
* 增加行车日志
*
* @param simulation
* @param stationCode
* @param paramInfo
* @return
* @param simulation 仿真实体
* @param stationCode 车站编码
* @param paramInfo 参数
* @return 行车日志
*/
private CtcStationRunPlanLog createRunPlanLog(Simulation simulation, String stationCode, CtcRunPlanParam paramInfo) {
String tripNumber = paramInfo.getTripNumber();

View File

@ -130,7 +130,7 @@ public class CtcRepository {
* 添加至仿真中的行车计划
*/
public void addRunPlanListToSimulationMap(List<CtcStationRunPlanLog> runPlanLogList) {
runPlanLogList.forEach(runPlanLog -> addRunPlanToSimulationMap(runPlanLog));
runPlanLogList.forEach(this::addRunPlanToSimulationMap);
}
/**
@ -150,7 +150,7 @@ public class CtcRepository {
* 添加至仿真中的行车计划
*/
public void addRunPlanListToOriginMap(List<CtcStationRunPlanLog> runPlanLogList) {
runPlanLogList.forEach(runPlanLog -> addRunPlanToOriginMap(runPlanLog));
runPlanLogList.forEach(this::addRunPlanToOriginMap);
}
/**