查询存在仿真接口增加筛选功能
This commit is contained in:
parent
83bd55d67f
commit
d04d8dd4b4
@ -1,13 +1,11 @@
|
||||
package club.joylink.rtss.controller.test;
|
||||
|
||||
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
|
||||
import club.joylink.rtss.controller.advice.Role;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.ModbusTcpTestService;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.PlcGatewayConnectManager;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import io.netty.channel.Channel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@ -33,4 +31,18 @@ public class ModbusTestController {
|
||||
this.modbusTcpTestService.writeSingleCoil(this.plcGatewayConnectManager.getChannel(code), addr, val);
|
||||
}
|
||||
|
||||
@Role(SuperAdmin)
|
||||
@PostMapping("/writeCoil/test")
|
||||
public void modbusWriteSignalCoilTest() throws InterruptedException {
|
||||
int start = 96;
|
||||
Channel channel = this.plcGatewayConnectManager.getChannel("Test");
|
||||
this.modbusTcpTestService.writeSingleCoil(channel, start, true);
|
||||
Thread.sleep(1000);
|
||||
for (int i = start + 1; i < start + 24; i++) {
|
||||
this.modbusTcpTestService.writeSingleCoil(channel, i, true);
|
||||
this.modbusTcpTestService.writeSingleCoil(channel, i - 1, false);
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
this.modbusTcpTestService.writeSingleCoil(channel, start + 23, false);
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import club.joylink.rtss.simulation.vo.SimulationFaultVO;
|
||||
import club.joylink.rtss.simulation.vo.SimulationInfoVO;
|
||||
import club.joylink.rtss.simulation.vo.SimulationMemberVO;
|
||||
import club.joylink.rtss.simulation.vo.SimulationUserVO;
|
||||
import club.joylink.rtss.vo.client.simulationv1.SimulationInfoQueryVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -12,6 +13,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 仿真通用接口
|
||||
@ -25,12 +27,20 @@ public class SimulationCommonController {
|
||||
private SimulationOperationDispatcher simulationOperationDispatcher;
|
||||
|
||||
@GetMapping("/list")
|
||||
public List<SimulationInfoVO> queryInfo() {
|
||||
public List<SimulationInfoVO> queryInfo(SimulationInfoQueryVO queryVO) {
|
||||
List<Simulation> simulationList = this.simulationManager.getSimulationList();
|
||||
List<SimulationInfoVO> list = simulationList.stream()
|
||||
.map(Simulation::convertToVO)
|
||||
.collect(Collectors.toList());
|
||||
return list;
|
||||
Stream<Simulation> stream = simulationList.stream();
|
||||
if (StringUtils.hasText(queryVO.getGroup())) {
|
||||
stream = stream.filter(simulation -> simulation.getId().contains(queryVO.getGroup()));
|
||||
}
|
||||
if (StringUtils.hasText(queryVO.getUserName())) {
|
||||
stream = stream.filter(simulation -> simulation.getSimulationUsers().stream().anyMatch(user -> ((SimulationUser) user).getName().contains(queryVO.getUserName())));
|
||||
}
|
||||
if (StringUtils.hasText(queryVO.getPrdType())) {
|
||||
stream = stream.filter(simulation -> simulation instanceof club.joylink.rtss.simulation.cbtc.Simulation
|
||||
&& queryVO.getPrdType().equals(((club.joylink.rtss.simulation.cbtc.Simulation) simulation).getBuildParams().getProdType().getCode()));
|
||||
}
|
||||
return stream.map(Simulation::convertToVO).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@PutMapping("/{id}/pause")
|
||||
|
@ -268,7 +268,7 @@ public class StationOperateHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
* 引导总锁
|
||||
* 引导总锁(大铁)
|
||||
* @param stationCode 车站
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Station_Master_Lock)
|
||||
@ -277,7 +277,7 @@ public class StationOperateHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
* 解除引导总锁
|
||||
* 解除引导总锁(大铁)
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Station_Master_Unlock)
|
||||
public void masterUnlock(Simulation simulation, String stationCode, Station.Throat throat) {
|
||||
|
@ -242,11 +242,6 @@ public class Route extends MapNamedElement {
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (Objects.nonNull(this.overlap)) {
|
||||
// if (this.overlap.containRpSwitch()) { // 延续保护存在反位道岔
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -6,15 +6,21 @@ import club.joylink.rtss.simulation.vo.SimulationInfoVO;
|
||||
import club.joylink.rtss.vo.map.MapVO;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
public class OldSimulationInfoVO extends SimulationInfoVO {
|
||||
private String prodType;
|
||||
private MapVO map;
|
||||
private LocalDateTime createTime;
|
||||
|
||||
public OldSimulationInfoVO(Simulation simulation) {
|
||||
super(simulation);
|
||||
SimulationBuildParams buildParams = simulation.getBuildParams();
|
||||
if (buildParams.getProdType() != null) {
|
||||
this.prodType = buildParams.getProdType().getCode();
|
||||
}
|
||||
this.map = buildParams.getMap().buildBasicInfo();
|
||||
this.createTime = buildParams.getCreateTime();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
package club.joylink.rtss.vo.client.simulationv1;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SimulationInfoQueryVO {
|
||||
private String group;
|
||||
|
||||
private String userName;
|
||||
|
||||
private String prdType;
|
||||
}
|
Loading…
Reference in New Issue
Block a user