Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
thesai 2021-12-06 21:17:19 +08:00
commit b9dbb891ce
18 changed files with 153 additions and 64 deletions

View File

@ -38,12 +38,14 @@ public enum Project {
ZZWWTEST,
/** 中航锐创(第三方教学合作,第三方登录) */
RICHOR,
/** 中航锐创(实训室,连设备,设备登录) */
/** 中航锐创(义乌现场)(实训室,连设备,设备登录) */
RICHOR_JOINT,
/** 上饶沙盘 */
SR_SANDBOX,
/** 江西工贸 */
JXGM,
/** 扬工院 */
RICHOR_YGY,
;
public static boolean isDefault(Project project) {

View File

@ -13,6 +13,9 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 项目域名管理接口
*/
@Slf4j
@RestController
@RequestMapping("/api/projectServer")
@ -47,4 +50,10 @@ public class ProjectServerController {
this.serverService.update(id, vo, accountVO);
}
@Role(RoleEnum.SuperAdmin)
@DeleteMapping("/{id}")
public void delete(@PathVariable Long id) {
this.serverService.delete(id);
}
}

View File

@ -7,11 +7,13 @@ import club.joylink.rtss.vo.project.ProjectServerQueryVO;
import club.joylink.rtss.vo.project.ProjectServerVO;
public interface ServerService {
public ProjectServerVO getByProject(Project project);
ProjectServerVO getByProject(Project project);
PageVO<ProjectServerVO> pagingQuery(ProjectServerQueryVO queryVO);
String create(ProjectServerVO vo, AccountVO accountVO);
void update(Long id, ProjectServerVO vo, AccountVO accountVO);
void delete(Long id);
}

View File

@ -14,6 +14,7 @@ import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime;
import java.util.List;
@ -32,7 +33,14 @@ public class ServerServiceImpl implements ServerService {
example.createCriteria()
.andProjectEqualTo(project.name());
List<ProjectServer> projectServerList = this.projectServerDAO.selectByExample(example);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(projectServerList);
if (CollectionUtils.isEmpty(projectServerList)) {
example.clear();
example.createCriteria().andProjectEqualTo(Project.DEFAULT.name());
projectServerList = this.projectServerDAO.selectByExample(example);
}
if (CollectionUtils.isEmpty(projectServerList)) {
return null;
}
return new ProjectServerVO(projectServerList.get(0));
}
@ -78,4 +86,9 @@ public class ServerServiceImpl implements ServerService {
this.projectServerDAO.updateByPrimaryKey(projectServer);
}
}
@Override
public void delete(Long id) {
projectServerDAO.deleteByPrimaryKey(id);
}
}

View File

@ -9,6 +9,7 @@ import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.Route;
import club.joylink.rtss.simulation.cbtc.data.map.Section;
import club.joylink.rtss.simulation.cbtc.data.map.Stand;
import club.joylink.rtss.simulation.cbtc.data.map.Station;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySectionAxleCounter;
import club.joylink.rtss.simulation.cbtc.tool.DeviceStatusModifyTool;
import club.joylink.rtss.vo.client.training.TrainingNewVO;
@ -34,9 +35,20 @@ public class SectionGeneratorNew implements GeneratorNew {
List<TrainingNewVO> trainingVOList = new ArrayList<>();
List<Section> sectionList = simulation.getRepository().getSectionList();
for (Section section : sectionList) {
if (section.getStation() != null && section.getStation().isDepot()) {
//若区段/所属计轴区段所在集中站是车辆段跳过
//为什么不用station字段只有功能轨的station字段有值
Station deviceStation = section.getDeviceStation();
if (deviceStation != null && deviceStation.isDepot()) {
continue;
}
Section axleCounterSection = section.findAxleCounterSection();
if (axleCounterSection != null) {
Station axleDeviceStation = axleCounterSection.getDeviceStation();
if (axleDeviceStation != null && axleDeviceStation.isDepot()) {
continue;
}
}
if(StringUtils.isEmpty(section.getName())){
continue;
}
@ -106,16 +118,18 @@ public class SectionGeneratorNew implements GeneratorNew {
case Section_Confirm_Axis_Valid:
// 设置计轴失效ARB
if (Objects.nonNull(section.getParent())) {
section.getParent().judgeAsNctOccupied();
section.getParent().judgeAsNctOccupied(simulation);
} else {
section.judgeAsNctOccupied();
section.judgeAsNctOccupied(simulation);
}
break;
case Section_Fault_Unlock:
// 设置区段故障锁闭这只是区故解的一种情况后面再补其他情况
// section.setFaultLock(true);
section.setRouteLock(true);
if (section.isShowLogic()) {
if (section.isCross()) {
section.getLogicList().get(0).setRouteLock(true);
} else if (section.isShowLogic()) {
section.getLogicList().forEach(s -> {
// s.setFaultLock(true);
s.setRouteLock(true);
@ -123,10 +137,10 @@ public class SectionGeneratorNew implements GeneratorNew {
}
break;
case Section_Axis_Pre_Reset:
if(!section.isAxleCounter()){
if(!section.isAxleCounter() && !section.isCross()){
continue;
}
VirtualRealitySectionAxleCounter virtualAxleCounter = section.getVirtualAxleCounter();
VirtualRealitySectionAxleCounter virtualAxleCounter = section.findAxleCounterSection().getVirtualAxleCounter();
virtualAxleCounter.setOccupy(true);
virtualAxleCounter.setPreReset(false);
virtualAxleCounter.setLeftCount(2);

View File

@ -277,6 +277,11 @@ public class StationGeneratorNew implements GeneratorNew {
param.put("stationCode", station.getCode());
atsOperationDispatcher.execute(simulation, member, operate, param);
station.setInterlockMachineStarting(true);
if(station.isCentralized()) {
station.setControlMode(Station.ControlMode.Local);
}else{
station.getDeviceStation().setControlMode(Station.ControlMode.Local);
}
break;
}
case Station_Release: {

View File

@ -115,7 +115,7 @@ public class SwitchGeneratorNew implements GeneratorNew {
}
case Switch_Confirm_Axis_Valid:{
// 背景为道岔计轴失效
aSwitch.getA().getParent().judgeAsNctOccupied();
aSwitch.getA().getParent().judgeAsNctOccupied(simulation);
break;
}
case Switch_Squeeze_Recovery:

View File

@ -141,7 +141,7 @@ public class AtpSectionService {
section.setFault(Section.AxleFault.FAULT);
}
} else if (Section.AxleFault.FAULT.equals(section.getFault()) && section.getVirtualAxleCounter().isOccupy()) {
section.judgeAsNctOccupied();
section.judgeAsNctOccupied(simulation);
}
// if (/*!section.isInvalid() &&*/ section.isNctOccupied()) {
// if (!sectionList.contains(section)) {

View File

@ -34,6 +34,10 @@ public class DriverOperateHandler {
VirtualRealityTrain train = simulation.getRepository().getOnlineTrainBy(groupNumber);
// if (train.isSignalEB() && percent == -2)
// ATPService.cancelSignalEB(train);
// 门选不是零位不给牵引力
if (!train.getDoorSelection().equals(VirtualRealityTrain.DoorSelection.Z)) {
return;
}
if ((percent <= 1 && percent >= -1) || percent == -2) {
train.setLeverPosition(percent);
}

View File

@ -516,12 +516,15 @@ public class AtsStationService {
station.setRestartTime(LocalTime.now());
Station.Fault.INTERLOCK_FAULT.fix(station); //恢复联锁机故障
SimulationDataRepository repository = simulation.getRepository();
for (StatusDevice value : station.getDeviceMap().values()) {
if (value instanceof Section) { //联锁区所有区段故障锁闭
Section section = (Section) value;
section.recursivelySetFaultLock(true);
} else if (value instanceof Station) { //联锁区所有车站交出控制权
Station station1 = (Station) value;
//该站范围内区段故障锁闭
station.getDeviceMap().values().stream()
.filter(v -> v instanceof Section)
.map(v -> (Section) v)
.forEach(section -> section.recursivelySetFaultLock(true));
//车站交出控制权
station.setControlMode(Station.ControlMode.None);
for (Station station1 : repository.getStationList()) {
if (Objects.equals(station, station1.getDeviceStation())) {
station1.setControlMode(Station.ControlMode.None);
}
}

View File

@ -54,10 +54,16 @@ public class CiDeviceStatusCollector {
}
private void collectSwitch(SimulationDataRepository repository, List<Switch> switchList) {
// 道岔位置状态
switchList.forEach(aSwitch -> {
// 道岔位置状态
VirtualRealitySwitch vrSwitch = aSwitch.getVirtualSwitch();
aSwitch.updatePos(vrSwitch.getP());
// 道岔预复位状态
Section axleSection = aSwitch.getA().findAxleCounterSection();
if (axleSection != null) {
boolean preReset = axleSection.getVirtualAxleCounter().isPreReset();
aSwitch.setPreReset(preReset);
}
});
}

View File

@ -408,7 +408,9 @@ public class CiRouteService {
*/
public void sectionFaultUnlock(Simulation simulation, Section section, Route route) {
if (route != null) {
if (route.getStart().isApproachLock() || section.isOverlapLock()) {
if (route.getStart().isApproachLock()
|| section.isOverlapLock()
|| route.getSectionList().stream().anyMatch(Section::isOccupied)) {
// 区段延时解锁
this.delayUnlockStart(simulation, route, section);
return;
@ -460,10 +462,10 @@ public class CiRouteService {
Collections.reverse(logicList);
}
for (Section logic : logicList) {
if (!logic.isOccupied() && !logic.isInvalid() && logic.isRouteLockOn(right)) {
if (!logic.isOccupied() && /*!logic.isInvalid() &&*/ logic.isRouteLockOn(right)) {
logic.routeUnlocking(route);
logic.overlapUnlocking();
} else if(logic.isOccupied() || logic.isInvalid()) {
} else if(logic.isOccupied() /*|| logic.isInvalid()*/) {
break;
}
}

View File

@ -287,7 +287,7 @@ public class CiService {
public boolean isRouteSwitchLost(Simulation simulation, Route route) {
for (SwitchElement switchElement : route.getSwitchList()) {
if (switchElement.getASwitch().isFaultOnPosition(switchElement.isNormal())) {
if (switchElement.getASwitch().isLoss()) {
return true;
}
}
@ -297,7 +297,7 @@ public class CiService {
for (RouteFls.FlsElement flsElement : routeFls.getLevel1List()) {
SwitchElement pSwitch = flsElement.getPSwitch();
if (pSwitch != null) {
if (pSwitch.getASwitch().isFaultOnPosition(pSwitch.isNormal())) {
if (pSwitch.getASwitch().isLoss()) {
return true;
}
}

View File

@ -35,4 +35,8 @@ public abstract class DelayUnlockDevice extends MayOutOfOrderDevice {
public void recover(int remain) {
this.remain = remain;
}
public int getRemainInSeconds() {
return this.remain / 1000;
}
}

View File

@ -1,6 +1,7 @@
package club.joylink.rtss.simulation.cbtc.data.map;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
import club.joylink.rtss.simulation.cbtc.data.support.RoutePath;
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
@ -11,7 +12,10 @@ import lombok.Getter;
import lombok.Setter;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
* 区段
@ -226,7 +230,7 @@ public class Section extends DelayUnlockDevice {
private Integer speedLimitBeforeFault;
/**
* 延时解锁
* 延时解锁延时解锁根据remain判定该字段可以考虑删除
*/
private boolean delayUnlock;
@ -466,9 +470,9 @@ public class Section extends DelayUnlockDevice {
public void axleCounterOccupy(boolean right) {
this.trainRight = right;
this.setNctOccupied(true);
if (isSwitchAxleCounterSection()) {
nctOccupiedBySwitchPosition();
}
// if (isSwitchAxleCounterSection()) {
// nctOccupiedBySwitchPosition();
// }
}
/**
@ -821,14 +825,15 @@ public class Section extends DelayUnlockDevice {
/**
* 判定为非通信车占用
* @param simulation
*/
public void judgeAsNctOccupied() {
public void judgeAsNctOccupied(Simulation simulation) {
if (!this.isAxleCounter()) {
return;
}
this.setNctOccupied(true);
if (this.isSwitchAxleCounterSection()) { // 道岔计轴区段
nctOccupiedBySwitchPosition();
nctOccupiedBySwitchPosition(simulation);
} else if (!CollectionUtils.isEmpty(this.logicList)) {
for (Section logic : this.logicList) {
logic.setNctOccupied(true);
@ -838,25 +843,42 @@ public class Section extends DelayUnlockDevice {
/**
* 根据道岔位置设置非通信车占用
* @param simulation
*/
private void nctOccupiedBySwitchPosition() {
private void nctOccupiedBySwitchPosition(Simulation simulation) {
List<Switch> relSwitchList = this.getRelSwitchList();
for (Switch aSwitch : relSwitchList) {
aSwitch.getA().setNctOccupied(true);
if (aSwitch.isPosN()) {
aSwitch.getB().setNctOccupied(true);
aSwitch.getC().setNctOccupied(false);
} else if (aSwitch.isPosR()) {
aSwitch.getC().setNctOccupied(true);
aSwitch.getB().setNctOccupied(false);
} else {
aSwitch.getB().setNctOccupied(true);
aSwitch.getC().setNctOccupied(true);
if (relSwitchList.size() == 2 && simulation.getRepository().getConfig().isSwitchSingleHandle()) {
// 道岔计轴区段两个道岔有一个反位
if (!relSwitchList.stream().allMatch(Switch::isPosN)) {
for (Switch aSwitch : relSwitchList) {
if (aSwitch.isPosN()) {
continue;
}
setSwitchNctOccupied(aSwitch);
}
Section cross = queryCross();
if (cross != null) {
cross.crossJudgeOccupied();
}
return;
}
}
Section cross = queryCross();
if (cross != null) {
cross.crossJudgeOccupied();
for (Switch aSwitch : relSwitchList) {
setSwitchNctOccupied(aSwitch);
}
}
private void setSwitchNctOccupied(Switch aSwitch) {
aSwitch.getA().setNctOccupied(true);
if (aSwitch.isPosN()) {
aSwitch.getB().setNctOccupied(true);
aSwitch.getC().setNctOccupied(false);
} else if (aSwitch.isPosR()) {
aSwitch.getC().setNctOccupied(true);
aSwitch.getB().setNctOccupied(false);
} else {
aSwitch.getB().setNctOccupied(true);
aSwitch.getC().setNctOccupied(true);
}
}
@ -871,7 +893,10 @@ public class Section extends DelayUnlockDevice {
boolean leftSectionNctOccupied = leftSection.isNctOccupied() && leftSection.getParent().equals(this.parent);
Section rightSection = logic.getRightSection();
boolean rightSectionNctOccupied = rightSection.isNctOccupied() && rightSection.getParent().equals(this.parent);
logic.setNctOccupied(leftSectionNctOccupied || rightSectionNctOccupied);
if (leftSectionNctOccupied || rightSectionNctOccupied) {
logic.setNctOccupied(true);
setNctOccupied(true);
}
});
}

View File

@ -1,7 +1,6 @@
package club.joylink.rtss.simulation.cbtc.data.status;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice;
import club.joylink.rtss.simulation.cbtc.data.map.Section;
import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO;
import club.joylink.rtss.simulation.cbtc.data.vo.SectionStatusVO;
@ -100,6 +99,8 @@ public class SectionStatus extends DeviceStatus {
@JsonSerialize(using = Boolean2NumSerializer.class)
private boolean closed;
private int remain;
private String fault;
public SectionStatus(Section section) {
@ -119,6 +120,7 @@ public class SectionStatus extends DeviceStatus {
this.preReset = section.isPreReset();
this.delayUnlock = section.isDelayUnlock();
this.closed = section.isClosed();
this.remain = section.getRemain();
this.fault = section.getFault() == null ? null : section.getFault().toString();
}
@ -202,6 +204,11 @@ public class SectionStatus extends DeviceStatus {
status.setClosed(this.closed);
change = true;
}
if (!Objects.equals(this.remain, section.getRemainInSeconds())) {
this.remain = section.getRemainInSeconds();
change = true;
}
status.setRemain(this.remain);
String fault = section.getFault() == null ? null : section.getFault().toString();
if (!Objects.equals(this.fault, fault)) {
this.fault = fault;

View File

@ -71,6 +71,8 @@ public class SectionStatusVO extends DeviceStatusVO {
@JsonInclude
private String fault;
private Integer remain;
public SectionStatusVO(Section section) {
super(section.getCode(), section.getDeviceType());
}

View File

@ -136,29 +136,20 @@ public class VRTrainRunningService {
return;
//进入计轴区段判断
Section headAxleCounterSectionNew = headPositionNew.getSection();
if (!headAxleCounterSectionNew.isAxleCounter()) {
headAxleCounterSectionNew = headAxleCounterSectionNew.getParent();
}
if (!headAxleCounterSectionNew.isAxleCounter()) { //当是物理区段-岔心-道岔计轴区段三层结构的时候需要多这次判断
headAxleCounterSectionNew = headAxleCounterSectionNew.getParent();
}
if (headAxleCounterSectionNew != null && headAxleCounterSectionNew.isAxleCounter()) { //新的区段是计轴区段
Section headSectionOld = headPosition.getSection();
if (!headAxleCounterSectionNew.equals(headSectionOld) && !headAxleCounterSectionNew.equals(headSectionOld.getParent())) { //新计轴区段和老区段不一样
Section headAxleCounterSectionNew = headPositionNew.getSection().findAxleCounterSection();
if (headAxleCounterSectionNew != null) {
Section headAxleCounterSection = headPosition.getSection().findAxleCounterSection();
if (!headAxleCounterSectionNew.equals(headAxleCounterSection)) { //车头所在计轴区段发生变化
headAxleCounterSectionNew.getVirtualAxleCounter().trainIn(trainRight);
}
}
//离开计轴区段判断
SectionPosition tailPositionOld = CalculateService.calculateNextPositionByStartAndLen(headPosition, !trainRight, train.getLen(), true);
Section tailAxleCounterSection = tailPositionOld.getSection();
if (!tailAxleCounterSection.isAxleCounter()) {
tailAxleCounterSection = tailAxleCounterSection.getParent();
}
if (tailAxleCounterSection != null && tailAxleCounterSection.isAxleCounter()) { //老的车尾区段是计轴区段
Section tailAxleCounterSection = tailPositionOld.getSection().findAxleCounterSection();
if (tailAxleCounterSection != null) {
SectionPosition tailPositionNew = CalculateService.calculateNextPositionByStartAndLen(headPositionNew, !trainRight, train.getLen(), true);
Section tailSectionNew = tailPositionNew.getSection();
if (!tailAxleCounterSection.equals(tailSectionNew) && !tailAxleCounterSection.equals(tailSectionNew.getParent())) { //老车尾计轴区段和新车尾区段不一样
Section tailAxleCounterSectionNew = tailPositionNew.getSection().findAxleCounterSection();
if (!tailAxleCounterSection.equals(tailAxleCounterSectionNew)) { //车尾所在计轴区段发生变化
tailAxleCounterSection.getVirtualAxleCounter().trainOut(trainRight);
}
}