Merge remote-tracking branch 'origin/test-training2' into test-training2
This commit is contained in:
commit
650625c19f
@ -53,14 +53,13 @@ public class TrainingV2PublishController {
|
||||
|
||||
|
||||
/**
|
||||
* 用户管理
|
||||
* 实训查询(用户)管理
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/manage/infos")
|
||||
public List<PublishedTraining2InfoRspVo> findTrainingListManageInfos(@RequestBody PublishedTrainingListRspVo vo){
|
||||
|
||||
return this.publishService.findTrainingInfo(vo);
|
||||
public PageVO<PublishedTraining2InfoRspVo> findTrainingListManageInfosForPage(@RequestBody PublishedTrainingListRspVo vo){
|
||||
return this.publishService.findTrainingInfoForPage(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -79,8 +78,8 @@ public class TrainingV2PublishController {
|
||||
*/
|
||||
@Role(value = RoleEnum.SuperAdmin)
|
||||
@GetMapping("/list")
|
||||
public List<PublishedTraining2InfoRspVo> findTrainingList(@ModelAttribute PublishedTrainingListRspVo vo){
|
||||
return this.publishService.findTrainingInfo(vo);
|
||||
public PageVO<PublishedTraining2InfoRspVo> findTrainingList(@ModelAttribute PublishedTrainingListRspVo vo){
|
||||
return this.publishService.findTrainingInfoForPage(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,5 +68,5 @@ public interface PublishedTraining2DAO {
|
||||
|
||||
List<Map<String, Long>> selectTrainingByRuleId(@Param("ruleIdList") List<Long> ruleIdList, @Param("mapIdList") List<Long> mapIdList);
|
||||
|
||||
List<Long> selectTrainingIdByRuleNameAndMapId(@Param("ruleNameList") List<String> ruleNameList, @Param("mapId") Long mapId);
|
||||
List<Long> selectTrainingIdByRuleNameAndMapId(@Param("ruleNameList") List<Map<String,String>> ruleNameMapList, @Param("mapId") Long mapId);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package club.joylink.rtss.services.training2;
|
||||
import club.joylink.rtss.constants.BusinessConsts;
|
||||
import club.joylink.rtss.dao.PublishedTraining2DAO;
|
||||
import club.joylink.rtss.entity.paper.question.PaperQuestionExample;
|
||||
import club.joylink.rtss.entity.paper.question.PaperQuestionWithBLOBs;
|
||||
import club.joylink.rtss.entity.training2.PublishedTraining2;
|
||||
import club.joylink.rtss.entity.training2.PublishedTraining2Example;
|
||||
import club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs;
|
||||
@ -208,10 +209,7 @@ public class Training2PublishService {
|
||||
return findTrainingInfo(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据地图ID和类型查询实训列表
|
||||
*/
|
||||
public List<PublishedTraining2InfoRspVo> findTrainingInfo(PublishedTrainingListRspVo reqVO) {
|
||||
private PublishedTraining2Example createQueryExample(PublishedTrainingListRspVo reqVO){
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
PublishedTraining2Example.Criteria criteria = example.createCriteria();
|
||||
if (reqVO.getMapId() != null) {
|
||||
@ -252,6 +250,25 @@ public class Training2PublishService {
|
||||
log.error("拼写查询标签错误 msg:" + e.getMessage(),e);
|
||||
}
|
||||
}*/
|
||||
|
||||
return example;
|
||||
}
|
||||
|
||||
public PageVO<PublishedTraining2InfoRspVo> findTrainingInfoForPage(PublishedTrainingListRspVo reqVO){
|
||||
PageHelper.startPage(reqVO.getPageNum(), reqVO.getPageSize());
|
||||
PublishedTraining2Example example = this.createQueryExample(reqVO);
|
||||
Page<PublishedTraining2> page = (Page<PublishedTraining2>)this.publishedDao.selectByExample(example);
|
||||
if(page.isEmpty()){
|
||||
return PageVO.convert(page,Collections.emptyList());
|
||||
}
|
||||
return PageVO.convert(page,Training2Convertor.convertFrom(page.getResult()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据地图ID和类型查询实训列表
|
||||
*/
|
||||
public List<PublishedTraining2InfoRspVo> findTrainingInfo(PublishedTrainingListRspVo reqVO) {
|
||||
PublishedTraining2Example example = this.createQueryExample(reqVO);
|
||||
List<PublishedTraining2> list = this.publishedDao.selectByExample(example);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return List.of();
|
||||
|
@ -237,9 +237,14 @@ public class Training2RuleService {
|
||||
// 获取客户端参数
|
||||
List<RtsMapFunction> entities = getRtsMapFunctions(k);
|
||||
if (!CollectionUtils.isEmpty(entities)) {
|
||||
List<String> ruleNameList = ruleList.stream().map(RtsTraining2Rule::getName).collect(Collectors.toList());
|
||||
List<Map<String,String>> ruleNameMapList = ruleList.stream().map(r -> {
|
||||
Map<String,String> map = new HashMap<>();
|
||||
map.put("ruleName", r.getName());
|
||||
map.put("client", r.getClient());
|
||||
return map;
|
||||
}).collect(Collectors.toList());
|
||||
// 需要删除的列表
|
||||
List<Long> delTrainingIdList = publishedTraining2DAO.selectTrainingIdByRuleNameAndMapId(ruleNameList, k);
|
||||
List<Long> delTrainingIdList = publishedTraining2DAO.selectTrainingIdByRuleNameAndMapId(ruleNameMapList, k);
|
||||
try {
|
||||
Simulation simulation = simulationService.createSimulationPojo(entities.get(0).getId(), loginUserInfoVO);
|
||||
errorMsgList.addAll(generateTraining(simulation, ruleList, delTrainingIdList, delPublishTrainingByIds));
|
||||
@ -308,8 +313,8 @@ public class Training2RuleService {
|
||||
if (StringUtils.isEmpty(rule.getSteps())) {
|
||||
continue;
|
||||
}
|
||||
Training2Rule training2Rule = new Training2Rule(rule);
|
||||
try {
|
||||
Training2Rule training2Rule = new Training2Rule(rule);
|
||||
List<MapNamedElement> deviceList = training2Rule.getDeviceRule().filterMapDeviceList(simulation);
|
||||
if (CollectionUtils.isEmpty(deviceList)) {
|
||||
continue;
|
||||
@ -323,12 +328,11 @@ public class Training2RuleService {
|
||||
publishedTraining2DAO.insertList(training2WithBLOBs);
|
||||
} catch (RuntimeException e) {
|
||||
log.error("实训反序列化失败", e);
|
||||
errorMsgList.add(String.format("地图%d实训[%s]反序列化,实训ID【%d】", mapId,
|
||||
training2Rule.getName(), training2Rule.getId(),Locale.ENGLISH));
|
||||
errorMsgList.add(String.format("地图%d实训[%s]反序列化,实训ID【%d】", mapId, rule.getName(), rule.getId(),Locale.ENGLISH));
|
||||
} catch (Exception e) {
|
||||
log.error("实训生成失败", e);
|
||||
errorMsgList.add(String.format("地图%d实训[%s]生成失败,设备信息【%s】,原因:%s", mapId,
|
||||
training2Rule.getName(), training2Rule.getDeviceRule(),e.getMessage(),Locale.ENGLISH));
|
||||
rule.getName(), rule.getDeviceRule(),e.getMessage(),Locale.ENGLISH));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import club.joylink.rtss.simulation.cbtc.ATS.service.TrainPositionTimeOverServic
|
||||
import club.joylink.rtss.simulation.cbtc.CI.CiLogic;
|
||||
import club.joylink.rtss.simulation.cbtc.DeviceStatusService;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.SimulationLifeCycleService;
|
||||
import club.joylink.rtss.simulation.cbtc.build.SimulationBuildParams;
|
||||
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
|
||||
import club.joylink.rtss.simulation.cbtc.build.UserConfigDataBuilder;
|
||||
@ -72,7 +73,8 @@ public class EmergencySimulationWorkServiceImpl implements SimulationWorkService
|
||||
public Simulation.Type getType() {
|
||||
return Simulation.Type.EMERGENCY;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private SimulationLifeCycleService simulationLifeCycleService;
|
||||
private SimulationBuildParams prepareSimulationParams(long mapId, SimulationWorkParamVO workParamVO, LoginUserInfoVO loginUserInfoVO) {
|
||||
// 获取地图数据
|
||||
MapVO mapVO = iMapService.getMapDetail(mapId);
|
||||
@ -206,15 +208,40 @@ public class EmergencySimulationWorkServiceImpl implements SimulationWorkService
|
||||
|
||||
@Override
|
||||
public void addMessagePublisher(Simulation simulation) {
|
||||
simulation.addMessagePublisher(new IscsStatusPublisher(simulation));
|
||||
simulation.addMessagePublisher(new PisStatusPublisher(simulation));
|
||||
// simulation.addMessagePublisher(new IscsStatusPublisher(simulation));
|
||||
// simulation.addMessagePublisher(new PisStatusPublisher(simulation));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Simulation simulation) {
|
||||
deviceStatusService.init(simulation);
|
||||
SimulationWorkParamVO workParamVO = simulation.getBuildParams().getWorkParamVO();
|
||||
Map<SimulationWorkParamVO.Item, String> itemMap = workParamVO.getItemMap();
|
||||
if (!CollectionUtils.isEmpty(itemMap)) {
|
||||
loadItem(simulation);
|
||||
}
|
||||
}
|
||||
private void loadItem(Simulation simulation) {
|
||||
SimulationWorkParamVO workParamVO = simulation.getBuildParams().getWorkParamVO();
|
||||
Map<SimulationWorkParamVO.Item, String> itemMap = workParamVO.getItemMap();
|
||||
itemMap.forEach((k, v) -> {
|
||||
switch (k) {
|
||||
case DEFAULT_MEMBER:
|
||||
simulationWorkServiceManager.playMember(simulation, v);
|
||||
break;
|
||||
case LPF:
|
||||
break;
|
||||
case REAL_DEVICE:
|
||||
break;
|
||||
case TRAINING:
|
||||
break;
|
||||
case EXAM:
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unexpected value: " + k);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runAsPlan(Simulation simulation, RunAsPlanParam param) {
|
||||
|
||||
@ -222,6 +249,7 @@ public class EmergencySimulationWorkServiceImpl implements SimulationWorkService
|
||||
|
||||
@Override
|
||||
public void reset(Simulation simulation) {
|
||||
simulationLifeCycleService.reset(simulation);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package club.joylink.rtss.vo.training2.publish;
|
||||
|
||||
import club.joylink.rtss.services.training2.Training2TypeEnum;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
@ -14,7 +15,7 @@ import java.util.List;
|
||||
* 已发布实训的所有信息
|
||||
*/
|
||||
@Data
|
||||
public class PublishedTrainingListRspVo {
|
||||
public class PublishedTrainingListRspVo extends PageQueryVO {
|
||||
private Long mapId;
|
||||
private Training2TypeEnum type;
|
||||
private String name;
|
||||
|
@ -1,13 +1,10 @@
|
||||
package club.joylink.rtss.vo.training2.rule;
|
||||
|
||||
import club.joylink.rtss.constants.BusinessConsts;
|
||||
import club.joylink.rtss.constants.MapPrdTypeEnum;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.RunLevel;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.SignalAspect;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.SwitchIndication;
|
||||
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
|
||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||
import club.joylink.rtss.simulation.cbtc.data.storage.StorageSimulation;
|
||||
@ -23,7 +20,6 @@ import club.joylink.rtss.util.JsonUtils;
|
||||
import lombok.Getter;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -37,7 +33,7 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
ROUTE_SET_BG_SCENE("排列进路背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Route route = (Route) mapElement;
|
||||
route.getSwitchList().forEach(switchElement -> switchElement.getASwitch().setSingleLock(false));
|
||||
return getBgScene(simulation);
|
||||
@ -45,14 +41,14 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
ROUTE_CANCEL_BG_SCENE("取消进路背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
openRouteDirect(simulation, (Route) mapElement);
|
||||
return getBgScene(simulation);
|
||||
}
|
||||
},
|
||||
ROUTE_OPEN_AUTO_SETTING_BG_SCENE("进路交自动控背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Route route = (Route) mapElement;
|
||||
route.setAtsControl(false);
|
||||
return getBgScene(simulation);
|
||||
@ -63,7 +59,7 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
BUTTON_BLOCK_BG_SCENE("解封按钮背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
signal.setBlockade(true);
|
||||
return getBgScene(simulation);
|
||||
@ -74,7 +70,7 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SWITCH_NP_BG_SCENE("道岔定位背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Switch iSwitch = (Switch) mapElement;
|
||||
setSingleSwitchPositionDirectly(iSwitch, false);
|
||||
return getBgScene(simulation);
|
||||
@ -85,7 +81,7 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SWITCH_RP_BG_SCENE("道岔反位背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Switch iSwitch = (Switch) mapElement;
|
||||
setSingleSwitchPositionDirectly(iSwitch, true);
|
||||
return getBgScene(simulation);
|
||||
@ -93,7 +89,7 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
SWITCH_NP_NB_BG_SCENE("宁波道岔定位背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Switch iSwitch = (Switch) mapElement;
|
||||
iSwitch.setAuto(false);
|
||||
iSwitch.setDispatcherReserve(true);
|
||||
@ -106,7 +102,7 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SWITCH_UNBLOCK_BG_SCENE("道岔解封背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Switch iSwitch = (Switch) mapElement;
|
||||
iSwitch.setBlockade(true);
|
||||
iSwitch.getAllSections().stream().forEach(section -> section.setBlockade(true));
|
||||
@ -119,7 +115,7 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SWITCH_SINGLE_BLOCK_BG_SCENE("道岔单锁背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Switch iSwitch = (Switch) mapElement;
|
||||
iSwitch.setSingleLock(false);
|
||||
return getBgScene(simulation);
|
||||
@ -127,7 +123,7 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
SWITCH_SINGLE_UNBLOCK_BG_SCENE("道岔单解背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Switch iSwitch = (Switch) mapElement;
|
||||
iSwitch.setSingleLock(true);
|
||||
return getBgScene(simulation);
|
||||
@ -135,7 +131,7 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
SWITCH_FAULT_UNLOCK_BG_SCENE("道岔故障解锁背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Switch iSwitch = (Switch) mapElement;
|
||||
iSwitch.setRouteLock(true);
|
||||
iSwitch.getAllSections().forEach(section -> section.setRouteLock(true));
|
||||
@ -144,7 +140,7 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
SWITCH_AXLE_FAULT_PRE_RESET_BG_SCENE("道岔计轴预复位背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Switch iSwitch = (Switch) mapElement;
|
||||
Switch.SwitchFault.AXLE_FAULT.apply(iSwitch);
|
||||
return getBgScene(simulation);
|
||||
@ -152,14 +148,14 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
SWITCH_SECTION_ACTIVE_BG_SCENE("道岔区段激活背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Switch iSwitch = (Switch) mapElement;
|
||||
return SECTION_ACTIVE_BG_SCENE.doHandle(simulation, iSwitch.getA());
|
||||
return SECTION_ACTIVE_BG_SCENE.doHandle(simulation, iSwitch.getA(), client);
|
||||
}
|
||||
},
|
||||
SWITCH_SECTION_LIMIT_SPEED("道岔区段速度限制背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Switch iSwitch = (Switch) mapElement;
|
||||
iSwitch.getAllSections().forEach(section -> section.setSpeedUpLimit(5));
|
||||
return getBgScene(simulation);
|
||||
@ -167,9 +163,9 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
SWITCH_ACTIVE_BG_SCENE("道岔区段激活背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Switch iSwitch = (Switch) mapElement;
|
||||
return BgSceneStatusRule.SECTION_ACTIVE_BG_SCENE.doHandle(simulation,iSwitch.getA());
|
||||
return BgSceneStatusRule.SECTION_ACTIVE_BG_SCENE.doHandle(simulation,iSwitch.getA(), client);
|
||||
}
|
||||
},
|
||||
/**
|
||||
@ -177,7 +173,7 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SIGNAL_TURN_ON_BG_SCENE("信号机点灯背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
signal.setAspect(SignalAspect.No);
|
||||
VirtualRealitySignal vrSignal = signal.getVirtualSignal();
|
||||
@ -190,7 +186,7 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SIGNAL_TURN_OFF_BG_SCENE("信号机灭灯背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
VirtualRealitySignal vrSignal = signal.getVirtualSignal();
|
||||
signal.setAspect(vrSignal.getModel().getDefaultAspect());
|
||||
@ -203,7 +199,7 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SIGNAL_REOPEN_BG_SCENE("信号机重开背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
Route route = signal.getRouteList().get(0);
|
||||
openRouteDirect(simulation, route);
|
||||
@ -219,7 +215,7 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SIGNAL_CLOSE_BG_SCENE("信号机关灯背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
Route route = signal.getRouteList().stream()
|
||||
// .filter(r -> r.getSwitchList().stream().allMatch(switchElement -> switchElement.isNormal()))
|
||||
@ -236,7 +232,7 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SIGNAL_GUIDE_BG_SCENE("信号机引导背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
// 开放进路
|
||||
Route route = signal.getRouteList().get(0);
|
||||
@ -259,7 +255,7 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SIGNAL_ROUTE_AUTO_SET_BG_SCENE("进路交自动控背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
Route route = signal.getRouteList().get(0);
|
||||
route.setAtsControl(false);
|
||||
@ -268,7 +264,7 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
SIGNAL_ROUTE_CANCEL_AUTO_SET_BG_SCENE("取消联锁自动触发背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
Route route = signal.getRouteList().get(0);
|
||||
route.setCiControl(true);
|
||||
@ -277,7 +273,7 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
SIGNAL_SET_CI_AUTO_BG_SCENE("联锁自动进路背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
List<Route> fltRouteList = signal.getRouteList().stream().filter(Route::isFlt).collect(Collectors.toList());
|
||||
boolean isSetFlt = simulation.getRepository().getConfig().isSetRouteBeforeSetFlt();
|
||||
@ -291,7 +287,7 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
SIGNAL_CANCEL_SET_CI_AUTO_BG_SCENE("取消联锁自动进路背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
Route route = signal.getRouteList().get(0);
|
||||
openRouteDirect(simulation, route);
|
||||
@ -301,7 +297,7 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
SIGNAL_UN_BLOCK_BG_SCENE("信号机解封锁背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
signal.setBlockade(true);
|
||||
return getBgScene(simulation);
|
||||
@ -309,7 +305,7 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
SIGNAL_HUMAN_RELEASE_BG_SCENE("信号机总人解背景"){
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
Route route = signal.getRouteList().get(0);
|
||||
openRouteDirect(simulation, route);
|
||||
@ -324,7 +320,7 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
SIGNAL_HUMAN_RELEASE_NB_BG_SCENE("宁波信号机总人解背景"){
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Signal signal = (Signal) mapElement;
|
||||
Route route = signal.getRouteList().get(0);
|
||||
openRouteDirect(simulation, route);
|
||||
@ -338,7 +334,7 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SECTION_FAULT_LOCK_BG_SCENE("区段区故解背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Section section = (Section) mapElement;
|
||||
Section.AxleFault.FAULT_LOCK.apply(section);
|
||||
return getBgScene(simulation);
|
||||
@ -349,7 +345,7 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SECTION_FAULT_UNLOCK_BG_SCENE("区段故障解锁背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Section section = (Section) mapElement;
|
||||
section.setRouteLock(true);
|
||||
if (section.isCross()) {
|
||||
@ -362,7 +358,7 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
SECTION_UNLOCK_BG_SCENE("区段解封背景"){
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Section section = (Section) mapElement;
|
||||
section.setBlockade(true);
|
||||
if (!CollectionUtils.isEmpty(section.getLogicList())) {
|
||||
@ -378,7 +374,7 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SECTION_ACTIVE_BG_SCENE("区段激活背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Section section = (Section) mapElement;
|
||||
Section axleSection = section;
|
||||
if (Objects.nonNull(section.getParent())) {
|
||||
@ -396,7 +392,7 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
SECTION_CANCEL_LIMIT_SPEED_BG_SCENE("区段取消限速背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Section section = (Section) mapElement;
|
||||
section.setSpeedUpLimit(5);
|
||||
return getBgScene(simulation);
|
||||
@ -404,7 +400,7 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
SECTION_CONFIRM_AXIS_VALID_BG_SCENE("设置计轴生效背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Section section = (Section) mapElement;
|
||||
if (Objects.nonNull(section.getParent())) {
|
||||
section.getParent().judgeAsNctOccupied(simulation);
|
||||
@ -416,7 +412,7 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
SECTION_AXIS_PRE_RESET_BG_SCENE("计轴预复位背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Section section = (Section) mapElement;
|
||||
if(!section.isAxleCounter() && !section.isCross()){
|
||||
throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error);
|
||||
@ -431,7 +427,7 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
SECTION_TURN_BACK_REENTRY_STRATEGY("区段折返策略修改背景"){
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Section section = (Section) mapElement;
|
||||
Stand stand = section.getStandList().get(0);
|
||||
stand.setTypeStrategy(Stand.TurnBackType.AUTO);
|
||||
@ -444,7 +440,7 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
SECTION_CLOSE_BG_SCENE("轨道开放背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Section section = (Section) mapElement;
|
||||
section.setCloseInit(false);
|
||||
section.setClosed(true);
|
||||
@ -456,7 +452,7 @@ public enum BgSceneStatusRule {
|
||||
*/
|
||||
STATION_POWER_ON_UNLOCK("车站上电解锁背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Station station = MapElementRule.queryStation(mapElement);
|
||||
restartInterlock(simulation, station);
|
||||
return getBgScene(simulation);
|
||||
@ -464,7 +460,7 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
STATION_OPEN_AUTO_SETTING_BG_SCENE("全站进路交ATS自动控背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Station station = MapElementRule.queryStation(mapElement);
|
||||
if(!station.isInterlock()) {
|
||||
throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error);
|
||||
@ -489,7 +485,7 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
STATION_CLOSE_AUTO_SETTING_BG_SCENE("全站进路交人工控背景"){
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Station station = (Station) mapElement;
|
||||
if(!station.isInterlock()) {
|
||||
throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error);
|
||||
@ -514,7 +510,7 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
STATION_CENTER_CONTROL_BG_SCENE ("车站设置中控背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Station station = MapElementRule.queryStation(mapElement);
|
||||
station.setControlMode(Station.ControlMode.Local);
|
||||
return getBgScene(simulation);
|
||||
@ -522,7 +518,7 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
STATION_STATION_CONTROL_BG_SCENE("车站转为站控背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Station station = MapElementRule.queryStation(mapElement);
|
||||
station.setControlMode(Station.ControlMode.Center);
|
||||
return getBgScene(simulation);
|
||||
@ -530,7 +526,7 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
STAND_EARLY_DEPART_BG_SCENE("提前发车背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Stand stand = (Stand) mapElement;
|
||||
Section section = stand.getSection();
|
||||
Route route = stand.getSection().getSignalToRight().getRouteList().stream().filter(r ->
|
||||
@ -549,9 +545,9 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
STAND_CANCEL_HOLD_TRAIN_BG_SCENE("站台取消扣车背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Stand stand = (Stand) mapElement;
|
||||
if (MapPrdTypeEnum.LOCAL.equals(simulation.getBuildParams().getProdType())) {
|
||||
if ("localWork".equals(client)) {
|
||||
// 现地,设置背景为现地扣车
|
||||
stand.setStationHoldTrain(true);
|
||||
} else {
|
||||
@ -563,7 +559,7 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
STAND_FORCE_CANCEL_HOLD_TRAIN_BG_SCENE("强制取消扣车背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Stand stand = (Stand) mapElement;
|
||||
stand.setCenterHoldTrain(true);
|
||||
return getBgScene(simulation);
|
||||
@ -571,7 +567,7 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
STAND_CANCEL_JUMP_STOP_BG_SCENE("站台取消设置跳停背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Stand stand = (Stand) mapElement;
|
||||
stand.setAllSkip(true);
|
||||
return getBgScene(simulation);
|
||||
@ -579,7 +575,7 @@ public enum BgSceneStatusRule {
|
||||
},
|
||||
STAND_STRATEGY_BG_SCENE("人工折返策略设置背景") {
|
||||
@Override
|
||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||
public String doHandle(Simulation simulation, MapElement mapElement, String client) {
|
||||
Stand stand = (Stand) mapElement;
|
||||
stand.setTypeStrategy(Stand.TurnBackType.AUTO);
|
||||
return getBgScene(simulation);
|
||||
@ -599,7 +595,7 @@ public enum BgSceneStatusRule {
|
||||
/**
|
||||
* 操作
|
||||
*/
|
||||
public abstract String doHandle(Simulation simulation, MapElement mapElement);
|
||||
public abstract String doHandle(Simulation simulation, MapElement mapElement, String client);
|
||||
|
||||
/**
|
||||
* 直接开放进路
|
||||
|
@ -668,7 +668,7 @@ public enum MapDeviceRule {
|
||||
|
||||
private String description;
|
||||
|
||||
private static final int NUMBER = 1;
|
||||
private static final int NUMBER = 5;
|
||||
|
||||
MapDeviceRule(String description) {
|
||||
this.description = description;
|
||||
|
@ -128,7 +128,7 @@ public class Training2Rule {
|
||||
}
|
||||
// 背景设置
|
||||
if (sceneRule != null) {
|
||||
copyTraining2.setBgSceneJson(sceneRule.doHandle(simulation, mapElement));
|
||||
copyTraining2.setBgSceneJson(sceneRule.doHandle(simulation, mapElement, this.client));
|
||||
}
|
||||
// 步骤
|
||||
if (!CollectionUtils.isEmpty(steps)) {
|
||||
|
@ -582,29 +582,29 @@
|
||||
<select id="selectTrainingByRuleId" resultType="map">
|
||||
SELECT t.id as id, t.map_id as mapId
|
||||
FROM (
|
||||
SELECT line_code,REGEXP_REPLACE(`name`,'【.*】','【】') as replaceName
|
||||
SELECT line_code,REGEXP_REPLACE(`name`,'【.*】','【】') as replaceName,client
|
||||
FROM rts_training2_rule
|
||||
WHERE id IN (<foreach collection="ruleIdList" item="ruleId" separator=",">#{ruleId}</foreach>)
|
||||
) r
|
||||
INNER JOIN map_info m ON m.line_code = r.line_code
|
||||
LEFT JOIN (
|
||||
SELECT id,map_id,name,REGEXP_REPLACE(name,'【.*】','【】') as replaceName
|
||||
SELECT id,map_id,name,REGEXP_REPLACE(name,'【.*】','【】') as replaceName,client
|
||||
FROM rts_published_training2
|
||||
WHERE map_id IN (<foreach collection="mapIdList" item="mapId" separator=",">#{mapId}</foreach>)
|
||||
) t
|
||||
ON t.map_id = m.id AND t.replaceName = r.replaceName
|
||||
ON t.map_id = m.id AND t.replaceName = r.replaceName AND r.client = t.client
|
||||
WHERE t.id is not NULL
|
||||
</select>
|
||||
|
||||
<select id="selectTrainingIdByRuleNameAndMapId" resultType="long">
|
||||
SELECT t.id as id
|
||||
FROM (
|
||||
SELECT id,map_id,name,REGEXP_REPLACE(name,'【.*】','【】') as replaceName
|
||||
SELECT id,map_id,name,REGEXP_REPLACE(name,'【.*】','【】') as replaceName,client
|
||||
FROM rts_published_training2 WHERE map_id = #{mapId}
|
||||
) t
|
||||
WHERE t.replaceName in (
|
||||
<foreach collection="ruleNameList" item="ruleName" separator=" union all">
|
||||
SELECT REGEXP_REPLACE(#{ruleName},'【.*】','【】') as replaceName
|
||||
WHERE (t.replaceName,t.client) in (
|
||||
<foreach collection="ruleNameList" item="rule" separator=" union all">
|
||||
SELECT REGEXP_REPLACE(#{rule.ruleName},'【.*】','【】') as replaceName, #{rule.client} as client
|
||||
</foreach>
|
||||
)
|
||||
</select>
|
||||
|
Loading…
Reference in New Issue
Block a user