义乌iscs调整

This commit is contained in:
joylink_zhangsai 2021-10-12 14:56:21 +08:00
parent 7511b23764
commit a828a2a03e
21 changed files with 86 additions and 79 deletions

View File

@ -57,6 +57,8 @@ public enum ProjectDeviceType {
CCTV,
/** 虚拟电子沙盘 */
SANDBOX,
/** 派班工作站 */
SCHEDULING,
/* -----------client device end---------- */
;

View File

@ -231,8 +231,8 @@ public class DeviceController {
this.deviceService.addOrUpdateSdyDeviceConfig(accountVO);
}
@PostMapping("/richor/addOrUpdate")
public void addOrUpdateRichorDeviceConfig(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
@PostMapping("/zjd/addOrUpdate")
public void addOrUpdateZjdDeviceConfig(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
AccountVO accountVO) {
this.deviceService.addOrUpdateRichorDeviceConfig(accountVO);
}

View File

@ -290,7 +290,8 @@ public class AuthenticateService implements IAuthenticateService {
case LW:
case DEPOT:
case DRIVE:
case CW: {
case CW:
case SCHEDULING:{
// 工作站登录
this.projectJointSimulationService.handleWorkStationLogin(loginUserInfo);
break;

View File

@ -391,19 +391,19 @@ public class DeviceServiceImpl implements DeviceService {
.map(Enum::name).collect(Collectors.toList()));
this.projectDeviceDAO.deleteByExample(example);
// 保存新配置
List<ProjectDevice> list = this.buildRichorProjectDevices(accountVO);
List<ProjectDevice> list = this.buildZjdProjectDevices(accountVO);
for (ProjectDevice projectDevice : list) {
this.projectDeviceDAO.insert(projectDevice);
}
}
private List<ProjectDevice> buildRichorProjectDevices(AccountVO accountVO) {
private List<ProjectDevice> buildZjdProjectDevices(AccountVO accountVO) {
LocalDateTime now = LocalDateTime.now();
List<ProjectDevice> list = new ArrayList<>();
// PLC网关
ProjectDevice plcGateway = new ProjectDevice();
plcGateway.setProjectCode(Project.RICHOR_JOINT.name());
plcGateway.setCode("richorJoint-gateway");
plcGateway.setCode("zjd-gateway");
plcGateway.setType(ProjectDeviceType.PLC_GATEWAY.name());
plcGateway.setCreator(accountVO.getId());
plcGateway.setCreateTime(now);
@ -413,7 +413,7 @@ public class DeviceServiceImpl implements DeviceService {
// 屏蔽门
ProjectDevice psd = new ProjectDevice();
psd.setProjectCode(Project.RICHOR_JOINT.name());
psd.setCode("richorJoint-psd");
psd.setCode("zjd-psd");
psd.setType(ProjectDeviceType.PSD.name());
psd.setCreator(accountVO.getId());
psd.setCreateTime(now);
@ -423,7 +423,7 @@ public class DeviceServiceImpl implements DeviceService {
// IBP盘
ProjectDevice ibp = new ProjectDevice();
ibp.setProjectCode(Project.RICHOR_JOINT.name());
ibp.setCode("richorJoint-ibp");
ibp.setCode("zjd-ibp");
ibp.setType(ProjectDeviceType.IBP.name());
ibp.setCreator(accountVO.getId());
ibp.setCreateTime(now);
@ -433,7 +433,7 @@ public class DeviceServiceImpl implements DeviceService {
// PSL
ProjectDevice psl = new ProjectDevice();
psl.setProjectCode(Project.RICHOR_JOINT.name());
psl.setCode("richorJoint-psl");
psl.setCode("zjd-psl");
psl.setType(ProjectDeviceType.PSL.name());
psl.setCreator(accountVO.getId());
psl.setCreateTime(now);

View File

@ -142,12 +142,6 @@ public class SimulationManager {
}
}
public void addSimulationMember(String id, SimulationMember member) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(member);
Simulation simulation = this.getById(id);
simulation.addSimulationMember(member);
}
public void memberPlayedByUser(String id, String memberId, String userId) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(memberId);
Simulation simulation = this.getById(id);

View File

@ -212,6 +212,9 @@ public class ProjectJointSimulationServiceImpl implements ProjectJointSimulation
this.memberManager.playRole(simulation, loginUserInfo.getAccountVO().getId(), depoter.getId());
break;
}
case SCHEDULING:{
}
}
loginUserInfo.setGroup(simulation.getId());
}

View File

@ -2,7 +2,6 @@ package club.joylink.rtss.simulation.cbtc.data.vo.iscs;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
public class IscsIbpStatusVO extends IscsStatusVO {
@ -12,26 +11,27 @@ public class IscsIbpStatusVO extends IscsStatusVO {
/** 下行状态 */
private DirectionalStatus downStatus;
public IscsIbpStatusVO(String code, DeviceType deviceType,
public IscsIbpStatusVO(String code, String stationCode,
DirectionalStatus upStatus, DirectionalStatus downStatus) {
super(code, deviceType);
super(code, IscsStatusVO.DeviceType.IBP, stationCode);
this.upStatus = upStatus;
this.downStatus = downStatus;
}
@Getter
@NoArgsConstructor
public static class DirectionalStatus {
/** 操作允许 */
private boolean operate;
private boolean operate = true;
/** 开门命令 */
private boolean openCommand;
private boolean openCommand = true;
/** 开边门命令 */
private boolean openSideCommand;
private boolean openSideCommand = true;
/** 关门命令 */
private boolean closeCommand;
private boolean closeCommand = true;
public DirectionalStatus(boolean operate, boolean openCommand,
boolean openSideCommand, boolean closeCommand) {

View File

@ -1,6 +1,7 @@
package club.joylink.rtss.simulation.cbtc.data.vo.iscs;
import lombok.Getter;
import lombok.NoArgsConstructor;
@Getter
public class IscsPsdStatusVO extends IscsStatusVO{
@ -8,9 +9,9 @@ public class IscsPsdStatusVO extends IscsStatusVO{
private DirectionalStatus downStatus;
public IscsPsdStatusVO(String code, DeviceType deviceType,
public IscsPsdStatusVO(String code, String stationCode,
DirectionalStatus upStatus, DirectionalStatus downStatus) {
super(code, deviceType);
super(code, IscsStatusVO.DeviceType.SLIDING_DOOR, stationCode);
this.upStatus = upStatus;
this.downStatus = downStatus;
}
@ -23,10 +24,11 @@ public class IscsPsdStatusVO extends IscsStatusVO{
}
@Getter
@NoArgsConstructor
public static class DirectionalStatus {
private Status status;
private Status status = Status.CLOSE;
private boolean isolationMode;
private boolean isolationMode = false;
public DirectionalStatus(Status status, boolean isolationMode) {
this.status = status;

View File

@ -2,7 +2,6 @@ package club.joylink.rtss.simulation.cbtc.data.vo.iscs;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
public class IscsPslStatusVO extends IscsStatusVO{
@ -10,26 +9,27 @@ public class IscsPslStatusVO extends IscsStatusVO{
private DirectionalStatus downStatus;
public IscsPslStatusVO(String code, DeviceType deviceType, DirectionalStatus upStatus,
DirectionalStatus downStatus) {
super(code, deviceType);
public IscsPslStatusVO(String code, String stationCode,
DirectionalStatus upStatus, DirectionalStatus downStatus) {
super(code, IscsStatusVO.DeviceType.PSL, stationCode);
this.upStatus = upStatus;
this.downStatus = downStatus;
}
@Getter
@NoArgsConstructor
public static class DirectionalStatus {
/** 操作允许 */
private boolean operate;
private boolean operate = true;
/** 开门命令 */
private boolean openCommand;
private boolean openCommand = true;
/** 关门命令 */
private boolean closeCommand;
private boolean closeCommand = true;
/** 互锁解除 */
private boolean interlockRelease;
private boolean interlockRelease = true;
public DirectionalStatus(boolean operate, boolean openCommand,
boolean closeCommand, boolean interlockRelease) {

View File

@ -1,8 +1,6 @@
package club.joylink.rtss.simulation.cbtc.data.vo.iscs;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
public class IscsSafetyCircleStatusVO extends IscsStatusVO{
@ -10,9 +8,9 @@ public class IscsSafetyCircleStatusVO extends IscsStatusVO{
private DirectionalStatus downStatus;
public IscsSafetyCircleStatusVO(String code, DeviceType deviceType,
public IscsSafetyCircleStatusVO(String code, DeviceType deviceType, String stationCode,
DirectionalStatus upStatus, DirectionalStatus downStatus) {
super(code, deviceType);
super(code, deviceType, stationCode);
this.upStatus = upStatus;
this.downStatus = downStatus;
}

View File

@ -9,9 +9,12 @@ public class IscsStatusVO extends Watchable {
private DeviceType deviceType;
public IscsStatusVO(String code, DeviceType deviceType) {
private String stationCode;
public IscsStatusVO(String code, DeviceType deviceType, String stationCode) {
this.code = code;
this.deviceType = deviceType;
this.stationCode = stationCode;
}
public enum DeviceType {

View File

@ -15,7 +15,7 @@ import java.util.Map;
*/
@Slf4j
@Component
public class RealDeviceServiceManager implements ApplicationContextAware {
public class RealDeviceServiceManager implements ApplicationContextAware {
private List<RealDeviceService> deviceServiceList;

View File

@ -5,7 +5,6 @@ import club.joylink.rtss.simulation.cbtc.CI.CiApiService;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.SimulationIscsDataRepository;
import club.joylink.rtss.simulation.cbtc.data.vo.iscs.IscsIbpStatusVO;
import club.joylink.rtss.simulation.cbtc.data.vo.iscs.IscsStatusVO;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityIbp;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.PlcGatewayService;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.RealDeviceService;
@ -133,23 +132,6 @@ public class ZjdIbpServiceImpl implements RealDeviceService {
boolean sxjjtcd = vrIbp.query(VirtualRealityIbp.Mean.jjtcLight, true).stream()
.allMatch(VirtualRealityIbp.IbpElement::isOn);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sx_jjtcd(), w_sx_jjtcd, sxjjtcd, channel);
// //输出
// if (r_sd) {
// plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sx_kcd(), w_sx_kcd, true, channel);
// plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sx_jjtcd(), w_sx_jjtcd, true, channel);
// plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_xx_kcd(), w_xx_kcd, true, channel);
// plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_xx_jjtcd(), w_xx_jjtcd, true, channel);
// } else {
// plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_fmq(), w_fmq, false, channel);
// boolean upHoldTrain = upStands.stream().anyMatch(Stand::isIbpHoldTrain);
// plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sx_kcd(), w_sx_kcd, upHoldTrain, channel);
// boolean upEc = upStands.stream().anyMatch(Stand::isEmergencyClosed);
// plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sx_jjtcd(), w_sx_jjtcd, upEc, channel);
// boolean downHoldTrain = downStands.stream().anyMatch(Stand::isIbpHoldTrain);
// plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_xx_kcd(), w_xx_kcd, downHoldTrain, channel);
// boolean downEc = downStands.stream().anyMatch(Stand::isEmergencyClosed);
// plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_xx_jjtcd(), w_xx_jjtcd, downEc, channel);
// }
//ISCS状态
SimulationIscsDataRepository iscsRepository = simulation.getIscsRepository();
String iscsCode = configVO.getIscsCode();
@ -158,7 +140,8 @@ public class ZjdIbpServiceImpl implements RealDeviceService {
if (iscsStatus == null) {
IscsIbpStatusVO.DirectionalStatus downStatus =
new IscsIbpStatusVO.DirectionalStatus(r_sx_czyx, r_sx_km, false, r_sx_gm);
iscsStatus = new IscsIbpStatusVO(iscsCode, IscsStatusVO.DeviceType.IBP, null, downStatus);
iscsStatus = new IscsIbpStatusVO(iscsCode,
vrIbp.getStation().getCode(), null, downStatus);
iscsRepository.addStatus(iscsStatus);
IscsStatusPublisher watcher = simulation.getMessagePublisher(IscsStatusPublisher.Name, IscsStatusPublisher.class);
simulation.watch(iscsStatus, watcher);

View File

@ -3,7 +3,6 @@ package club.joylink.rtss.simulation.cbtc.device.real.modbustcp.richor;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.SimulationIscsDataRepository;
import club.joylink.rtss.simulation.cbtc.data.vo.iscs.IscsPsdStatusVO;
import club.joylink.rtss.simulation.cbtc.data.vo.iscs.IscsStatusVO;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.RealDeviceService;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig;
import club.joylink.rtss.simulation.rt.iscs.IscsStatusPublisher;
@ -63,10 +62,10 @@ public class ZjdPsdServiceImpl implements RealDeviceService {
}
SimulationIscsDataRepository iscsRepository = simulation.getIscsRepository();
IscsPsdStatusVO iscsStatus = (IscsPsdStatusVO) iscsRepository.findStatus(iscsCode);
boolean change = false;
boolean change;
if (iscsStatus == null) {
IscsPsdStatusVO.DirectionalStatus downStatus = new IscsPsdStatusVO.DirectionalStatus(status, r_sx_glms);
iscsStatus = new IscsPsdStatusVO(iscsCode, IscsStatusVO.DeviceType.SLIDING_DOOR, null, downStatus);
iscsStatus = new IscsPsdStatusVO(iscsCode, "Station47718", null, downStatus);
iscsRepository.addStatus(iscsStatus);
IscsStatusPublisher watcher = simulation.getMessagePublisher(IscsStatusPublisher.Name, IscsStatusPublisher.class);
simulation.watch(iscsStatus, watcher);

View File

@ -5,7 +5,6 @@ import club.joylink.rtss.simulation.cbtc.CI.device.CiStandService;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.SimulationIscsDataRepository;
import club.joylink.rtss.simulation.cbtc.data.vo.iscs.IscsPslStatusVO;
import club.joylink.rtss.simulation.cbtc.data.vo.iscs.IscsStatusVO;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.RealDeviceService;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig;
@ -57,7 +56,8 @@ public class ZjdPslServiceImpl implements RealDeviceService {
boolean change;
if (iscsStatus == null) {
IscsPslStatusVO.DirectionalStatus downStatus = new IscsPslStatusVO.DirectionalStatus(r_sx_czyx, r_sx_km, r_sx_gm, r_sx_hsjc);
iscsStatus = new IscsPslStatusVO(iscsCode, IscsStatusVO.DeviceType.PSL, null, downStatus);
iscsStatus = new IscsPslStatusVO(iscsCode,
vrPsl.getStand().getStation().getCode(), null, downStatus);
iscsRepository.addStatus(iscsStatus);
IscsStatusPublisher watcher = simulation.getMessagePublisher(IscsStatusPublisher.Name, IscsStatusPublisher.class);
simulation.watch(iscsStatus, watcher);

View File

@ -64,6 +64,8 @@ public class MemberManager {
this.addRole(simulation, SimulationMember.Type.PARKING_LOT_SIGNAL_BUILDING);
// 上级部门
this.addRole(simulation, SimulationMember.Type.PARENT_DEPARTMENT);
// 派班员
this.addRole(simulation, SimulationMember.Type.SCHEDULING);
}
/**
@ -110,7 +112,8 @@ public class MemberManager {
SimulationMember.Type type,
String name, MapElement device) {
switch (type) {
case DISPATCHER:{
case DISPATCHER:
case SCHEDULING: {
break;
}
case DEPOT_DISPATCHER:{

View File

@ -127,6 +127,8 @@ public class SimulationMember extends club.joylink.rtss.simulation.SimulationMem
PARKING_LOT_SIGNAL_BUILDING,
/** 上级部门 */
PARENT_DEPARTMENT,
/** 派班员 */
SCHEDULING
}
public enum Gender {

View File

@ -4,15 +4,20 @@ import club.joylink.rtss.simulation.Simulation;
import club.joylink.rtss.simulation.SimulationTriggerMessagePublisher;
import club.joylink.rtss.simulation.Watchable;
import club.joylink.rtss.simulation.cbtc.data.SimulationIscsDataRepository;
import com.sun.source.tree.ReturnTree;
import club.joylink.rtss.simulation.cbtc.data.vo.iscs.IscsIbpStatusVO;
import club.joylink.rtss.simulation.cbtc.data.vo.iscs.IscsPsdStatusVO;
import club.joylink.rtss.simulation.cbtc.data.vo.iscs.IscsPslStatusVO;
import club.joylink.rtss.simulation.cbtc.data.vo.iscs.IscsStatusVO;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
public class IscsStatusPublisher extends SimulationTriggerMessagePublisher {
public static final String Name = "iscs";
public static final String Destination = String.format("%s/%s/%s", Simulation.MESSAGE_SUB_PREFIX, "iscs", "psd");
public static final String Destination = String.format("%s/%s/%s/%s", Simulation.MESSAGE_SUB_PREFIX, "iscs", "psd", "{stationCode}");
club.joylink.rtss.simulation.cbtc.Simulation simulation;
public IscsStatusPublisher(club.joylink.rtss.simulation.cbtc.Simulation simulation) {
@ -22,13 +27,31 @@ public class IscsStatusPublisher extends SimulationTriggerMessagePublisher {
@Override
public Object buildMessageOfSubscribe(String destination) {
List<String> list = this.getDestinationParamsMap().get(destination);
String s = list.get(1);
SimulationIscsDataRepository iscsRepository = simulation.getIscsRepository();
return iscsRepository.getAllStatus();
Collection<IscsStatusVO> allStatus = iscsRepository.getAllStatus();
List<IscsStatusVO> collect = allStatus.stream().filter(status -> status.getStationCode().equals(s)).collect(Collectors.toList());
if (collect.isEmpty()) {
collect.add(new IscsPsdStatusVO("", s, new IscsPsdStatusVO.DirectionalStatus(),
new IscsPsdStatusVO.DirectionalStatus()));
collect.add(new IscsPslStatusVO("", s, new IscsPslStatusVO.DirectionalStatus(),
new IscsPslStatusVO.DirectionalStatus()));
collect.add(new IscsIbpStatusVO("", s, new IscsIbpStatusVO.DirectionalStatus(),
new IscsIbpStatusVO.DirectionalStatus()));
}
return collect;
}
@Override
public List<String> getNeedBuildDestination(Watchable watchable) {
return new ArrayList<>(this.getDestinationParamsMap().keySet());
List<String> list = new ArrayList<>();
this.getDestinationParamsMap().forEach((destination, param) -> {
if (param.get(1).equals(((IscsStatusVO) watchable).getStationCode())) {
list.add(destination);
}
});
return list;
}
@Override

View File

@ -108,7 +108,7 @@ public class ProjectDeviceVO {
return sdyDeviceConfigConvert(voList);
}
case RICHOR_JOINT: {
return richorJointDeviceConfigConvert(voList);
return zjdDeviceConfigConvert(voList);
}
}
}
@ -116,7 +116,7 @@ public class ProjectDeviceVO {
return list;
}
private static List<RealDeviceConfig> richorJointDeviceConfigConvert(List<ProjectDeviceVO> voList) {
private static List<RealDeviceConfig> zjdDeviceConfigConvert(List<ProjectDeviceVO> voList) {
List<RealDeviceConfig> list = new ArrayList<>();
for (ProjectDeviceVO deviceVO : voList) {
switch (deviceVO.getType()) {

View File

@ -1,16 +1,13 @@
package club.joylink.rtss.vo.client.project.richor;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.project.RealConfigVO;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
public class ZjdIbpConfigVO extends RealConfigVO {
private String ibpCode = "Station25166_IBP";
private String ibpCode = "Station47718_IBP";
private String iscsCode = "ibp";

View File

@ -1,16 +1,13 @@
package club.joylink.rtss.vo.client.project.richor;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.project.RealConfigVO;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
public class ZjdPslConfigVO extends RealConfigVO {
private String pslCode = "PF59020_PSL";
private String pslCode = "PF47415_PSL";
private String iscsCode = "psl";