修改ngy项目设备生成逻辑

This commit is contained in:
joylink_zhangsai 2023-08-18 15:10:55 +08:00
parent 8b85c0a63b
commit 99ecac0318
1 changed files with 48 additions and 4 deletions

View File

@ -8,6 +8,10 @@ import club.joylink.rtss.entity.ProjectDevice;
import club.joylink.rtss.entity.ProjectDeviceExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.IMapService;
import club.joylink.rtss.simulation.cbtc.device.real.udp.config.SandTableSectionConfigVO;
import club.joylink.rtss.simulation.cbtc.device.real.udp.config.SandTableSignalConfigVO;
import club.joylink.rtss.simulation.cbtc.device.real.udp.config.SandTableSwitchConfigVO;
import club.joylink.rtss.simulation.cbtc.device.real.udp.config.SandTableTrainConfigVO;
import club.joylink.rtss.simulation.cbtc.device.real.udp.thailand.service.ThailandSignalServiceImpl;
import club.joylink.rtss.simulation.cbtc.device.real.udp.thailand.service.ThailandSwitchServiceImpl;
import club.joylink.rtss.util.JsonUtils;
@ -1151,7 +1155,7 @@ public class DeviceServiceImpl implements DeviceService {
signal.setType(ProjectDeviceType.SIGNAL.name());
signal.setCreator(accountVO.getId());
signal.setCreateTime(now);
SrSignalConfigVO configVO = new SrSignalConfigVO(mapSignalNewVO.getCode(),
SandTableSignalConfigVO configVO = new SandTableSignalConfigVO(mapSignalNewVO.getCode(),
mapSignalNewVO.getSrCode());
signal.setConfig(JsonUtils.writeValueAsString(configVO));
list.add(signal);
@ -1166,7 +1170,7 @@ public class DeviceServiceImpl implements DeviceService {
aSwitch.setType(ProjectDeviceType.SWITCH.name());
aSwitch.setCreator(accountVO.getId());
aSwitch.setCreateTime(now);
ThailandSwitchConfigVO configVO = new ThailandSwitchConfigVO(mapSwitchVO.getCode(),
SandTableSwitchConfigVO configVO = new SandTableSwitchConfigVO(mapSwitchVO.getCode(),
mapSwitchVO.getSrCode());
aSwitch.setConfig(JsonUtils.writeValueAsString(configVO));
list.add(aSwitch);
@ -1182,9 +1186,10 @@ public class DeviceServiceImpl implements DeviceService {
section.setType(ProjectDeviceType.SECTION.name());
section.setCreator(accountVO.getId());
section.setCreateTime(now);
ThailandSectionConfigVO configVO = new ThailandSectionConfigVO(mapSectionNewVO.getCode(),
SandTableSectionConfigVO configVO = new SandTableSectionConfigVO(mapSectionNewVO.getCode(),
mapSectionNewVO.getSrCode());
section.setConfig(JsonUtils.writeValueAsString(configVO));
ngyFillTime(configVO, mapSectionNewVO);
list.add(section);
}
}
@ -1197,7 +1202,7 @@ public class DeviceServiceImpl implements DeviceService {
train.setType(ProjectDeviceType.TRAIN.name());
train.setCreator(accountVO.getId());
train.setCreateTime(now);
ThailandTrainConfigVO configVO = new ThailandTrainConfigVO(mapTrainVO.getGroupNumber(),
SandTableTrainConfigVO configVO = new SandTableTrainConfigVO(mapTrainVO.getGroupNumber(),
String.valueOf(Integer.parseInt(mapTrainVO.getGroupNumber())));
train.setConfig(JsonUtils.writeValueAsString(configVO));
list.add(train);
@ -1205,4 +1210,43 @@ public class DeviceServiceImpl implements DeviceService {
return list;
}
private void ngyFillTime(SandTableSectionConfigVO configVO, MapSectionNewVO section) {
Float headDelayTime = null;
Float tailDelayTime = null;
if (section.isStandTrack() || section.isReentryTrack() || section.isTransferTrack()) {
if (section.isStandTrack()) {
tailDelayTime = 1f;
} else {
tailDelayTime = 0f;
}
} else {
headDelayTime = 2f;
}
switch (section.getCode()) {
case "T68": // 43G
tailDelayTime = 1.4f;
break;
case "T62": //37G
tailDelayTime = 0.8f;
break;
case "T35": //9G
tailDelayTime = 1.3f;
break;
case "T33": //5G
tailDelayTime = 0.9f;
break;
case "T5": //8G
tailDelayTime = 0.8f;
break;
case "T7": //12G
tailDelayTime = 0.6f;
break;
case "T45": //24G
tailDelayTime = 0.8f;
break;
}
configVO.setHeadDelayTime(headDelayTime);
configVO.setTailDelayTime(tailDelayTime);
}
}