From 3f45fc1c8f373613dc8027361c96a95575aa7c49 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Thu, 29 Apr 2021 13:30:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=AD=E9=9F=B3=E8=AE=AD=E7=BB=83=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=B7=BB=E5=8A=A0=E7=BB=93=E6=9E=9C=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=EF=BC=9B=E5=A4=A7=E9=93=81=E4=BB=BF=E7=9C=9Fbug=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=EF=BC=9B=E6=B7=BB=E5=8A=A0=E5=A4=A7=E9=93=81=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/club/joylink/rtss/constants/Project.java | 6 +++++- .../rtss/controller/voice/VoiceController.java | 9 ++++++++- .../rtss/services/auth/AuthenticateService.java | 4 ++-- .../completition/CompetitionPracticalService.java | 6 +++--- .../draftData/DraftMapRouteServiceImpl.java | 2 +- .../simulation/ProjectSimulationService.java | 2 +- .../simulation/ProjectSimulationServiceImpl.java | 11 +++++++++-- .../cbtc/conversation/SimulationVoiceHandler.java | 15 ++++++++------- .../simulation/rt/CIL/CilRouteLogicService.java | 15 +++++++++++---- .../rtss/simulation/rt/CIL/bo/CilRepository.java | 2 ++ .../rtss/simulation/rt/CIL/bo/CilSignal.java | 10 ++++++++-- .../joylink/rtss/simulation/rt/RtSimulation.java | 3 ++- .../rtss/simulation/rt/RtSimulationService.java | 2 +- 13 files changed, 61 insertions(+), 26 deletions(-) diff --git a/src/main/java/club/joylink/rtss/constants/Project.java b/src/main/java/club/joylink/rtss/constants/Project.java index a03cbda4b..b598e1636 100644 --- a/src/main/java/club/joylink/rtss/constants/Project.java +++ b/src/main/java/club/joylink/rtss/constants/Project.java @@ -1,5 +1,7 @@ package club.joylink.rtss.constants; +import com.huawei.sis.bean.request.GetTokenRequest; + /** * 项目 */ @@ -28,6 +30,8 @@ public enum Project { BJD, /** 成都工业职业技术学院 */ CGY, + /** 微机联锁 */ + WJLS, ; public static boolean isDefault(Project project) { @@ -35,6 +39,6 @@ public enum Project { } public static boolean isLoginWithCreateSimulation(Project project) { - return Project.DRTS.equals(project) || Project.BJD.equals(project); + return Project.DRTS.equals(project) || Project.BJD.equals(project) || Project.WJLS.equals(project); } } diff --git a/src/main/java/club/joylink/rtss/controller/voice/VoiceController.java b/src/main/java/club/joylink/rtss/controller/voice/VoiceController.java index 412649ba8..2472bdd05 100644 --- a/src/main/java/club/joylink/rtss/controller/voice/VoiceController.java +++ b/src/main/java/club/joylink/rtss/controller/voice/VoiceController.java @@ -1,6 +1,7 @@ package club.joylink.rtss.controller.voice; import club.joylink.rtss.services.IVoiceService; +import club.joylink.rtss.simulation.cbtc.conversation.SimulationVoiceHandler; import club.joylink.rtss.vo.client.VoiceRecognitionResult; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -21,10 +22,16 @@ public class VoiceController { @Qualifier("HuaWeiVoiceService") private IVoiceService iVoiceService; + @Autowired + private SimulationVoiceHandler simulationVoiceHandler; + @ApiOperation("语音识别") @PostMapping("recognition") public VoiceRecognitionResult voiceRecognition(MultipartFile file) { - return this.iVoiceService.voiceRecognition(file, ""); + VoiceRecognitionResult result = this.iVoiceService.voiceRecognition(file, ""); + result.setResult(simulationVoiceHandler.handle(result.getResult())); + return result; + } } diff --git a/src/main/java/club/joylink/rtss/services/auth/AuthenticateService.java b/src/main/java/club/joylink/rtss/services/auth/AuthenticateService.java index 58f14ebd7..afee500bf 100644 --- a/src/main/java/club/joylink/rtss/services/auth/AuthenticateService.java +++ b/src/main/java/club/joylink/rtss/services/auth/AuthenticateService.java @@ -239,9 +239,9 @@ public class AuthenticateService implements IAuthenticateService { } Project project = loginUserInfo.getProject(); if (Project.isLoginWithCreateSimulation(project)) { // 行调竞赛实训系统登录 - Simulation simulation = this.projectSimulationService + String group = this.projectSimulationService .createCenterSimulation(loginUserInfo, project); - loginUserInfo.setGroup(simulation.getGroup()); + loginUserInfo.setGroup(group); } } // 保存登陆信息 diff --git a/src/main/java/club/joylink/rtss/services/completition/CompetitionPracticalService.java b/src/main/java/club/joylink/rtss/services/completition/CompetitionPracticalService.java index d86c819a9..e8e2583f6 100644 --- a/src/main/java/club/joylink/rtss/services/completition/CompetitionPracticalService.java +++ b/src/main/java/club/joylink/rtss/services/completition/CompetitionPracticalService.java @@ -362,9 +362,9 @@ public class CompetitionPracticalService implements ICompetitionPracticalService @Override public String createSimulationAndLoadCompetition(Long id, LoginUserInfoVO userInfo) { - Simulation simulation = projectSimulationService.createCenterSimulation(userInfo, Project.DRTS); - loadCompetition(simulation.getGroup(), id, userInfo); - return simulation.getGroup(); + String group = projectSimulationService.createCenterSimulation(userInfo, Project.DRTS); + loadCompetition(group, id, userInfo); + return group; } @Override diff --git a/src/main/java/club/joylink/rtss/services/draftData/DraftMapRouteServiceImpl.java b/src/main/java/club/joylink/rtss/services/draftData/DraftMapRouteServiceImpl.java index e6b9c0d88..0720fcd5d 100644 --- a/src/main/java/club/joylink/rtss/services/draftData/DraftMapRouteServiceImpl.java +++ b/src/main/java/club/joylink/rtss/services/draftData/DraftMapRouteServiceImpl.java @@ -90,7 +90,7 @@ public class DraftMapRouteServiceImpl implements DraftMapRouteService { } } DraftMapRouteExample deleteExample = new DraftMapRouteExample(); - example.createCriteria() + deleteExample.createCriteria() .andMapIdEqualTo(id) .andCodeEqualTo(code); this.draftMapRouteDAO.deleteByExample(deleteExample); diff --git a/src/main/java/club/joylink/rtss/services/simulation/ProjectSimulationService.java b/src/main/java/club/joylink/rtss/services/simulation/ProjectSimulationService.java index d09a5cce5..43333893e 100644 --- a/src/main/java/club/joylink/rtss/services/simulation/ProjectSimulationService.java +++ b/src/main/java/club/joylink/rtss/services/simulation/ProjectSimulationService.java @@ -14,5 +14,5 @@ public interface ProjectSimulationService { * @param project * @return */ - Simulation createCenterSimulation(LoginUserInfoVO loginUserInfo, Project project); + String createCenterSimulation(LoginUserInfoVO loginUserInfo, Project project); } diff --git a/src/main/java/club/joylink/rtss/services/simulation/ProjectSimulationServiceImpl.java b/src/main/java/club/joylink/rtss/services/simulation/ProjectSimulationServiceImpl.java index 6accdf52e..1242108cf 100644 --- a/src/main/java/club/joylink/rtss/services/simulation/ProjectSimulationServiceImpl.java +++ b/src/main/java/club/joylink/rtss/services/simulation/ProjectSimulationServiceImpl.java @@ -7,6 +7,7 @@ import club.joylink.rtss.constants.Project; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.services.IMapService; import club.joylink.rtss.services.IUserPermissionService; +import club.joylink.rtss.simulation.rt.RtSimulationService; import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.client.map.MapVO; @@ -36,8 +37,11 @@ public class ProjectSimulationServiceImpl implements ProjectSimulationService { @Autowired private GroupSimulationService groupSimulationService; + @Autowired + private RtSimulationService rtSimulationService; + @Override - public Simulation createCenterSimulation(LoginUserInfoVO loginUserInfo, Project project) { + public String createCenterSimulation(LoginUserInfoVO loginUserInfo, Project project) { UserVO userVO = loginUserInfo.getUserVO(); // 查询用户综合演练配置 @@ -62,12 +66,15 @@ public class ProjectSimulationServiceImpl implements ProjectSimulationService { BusinessExceptionAssertEnum.SIMULATION_PERMISSION_NOT_AVAILABLE .assertNotTrue(CollectionUtils.isEmpty(collect), "用户仿真权限当前时间不可用"); } + if (Project.WJLS.equals(project)) { + return rtSimulationService.create(loginUserInfo.getUserVO(), mapId, MapPrdTypeEnum.LOCAL).getId(); + } // 构建仿真 Simulation simulation = this.groupSimulationService.create(loginUserInfo, mapId, MapPrdTypeEnum.CENTER, Simulation.FunctionalType.SIMULATION); RunAsPlanParam param = new RunAsPlanParam(LocalTime.now(), null); this.groupSimulationService.runAsPlan(simulation.getGroup(), param); - return simulation; + return simulation.getGroup(); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/conversation/SimulationVoiceHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/conversation/SimulationVoiceHandler.java index 278e2808b..4c5f440bf 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/conversation/SimulationVoiceHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/conversation/SimulationVoiceHandler.java @@ -36,11 +36,11 @@ public class SimulationVoiceHandler { // replacementList.add(new Replacement("(八)", "8")); // replacementList.add(new Replacement("(九)", "9")); //------------- 专业词汇 -------------- - replacementList.add(new Replacement("(行吊|情调|神雕|性交|心跳|香蕉|星标|平调)", "行调")); + replacementList.add(new Replacement("(行吊|情调|神雕|性交|心跳|香蕉|星标|平调|新调)", "行调")); replacementList.add(new Replacement("(茼蒿)", "通号")); replacementList.add(new Replacement("刺", "次")); replacementList.add(new Replacement("自动折法", "自动折返")); - replacementList.add(new Replacement("(倒插|刀叉|倒茶|倒叉|到插|倒闸|到察|到厂|道碴)", "道岔")); + replacementList.add(new Replacement("(倒插|刀叉|倒茶|倒叉|到插|倒闸|到察|到厂|道碴|到差)", "道岔")); replacementList.add(new Replacement("(师表|手表|时表)", "失表")); replacementList.add(new Replacement("攻作组", "工作组")); replacementList.add(new Replacement("军事表", "均失表")); @@ -51,7 +51,7 @@ public class SimulationVoiceHandler { replacementList.add(new Replacement("(客栈)", "各站")); replacementList.add(new Replacement("(正线队长发送)", "正线队长复诵")); replacementList.add(new Replacement("(电影)", "点名")); - replacementList.add(new Replacement("(代理|代练)", "待令")); + replacementList.add(new Replacement("(代理|代练|待定|待命)", "待令")); replacementList.add(new Replacement("(伤心)", "上行")); replacementList.add(new Replacement("(调制)", "调至")); replacementList.add(new Replacement("(时代丽|时代绿)", "首待令")); @@ -64,17 +64,17 @@ public class SimulationVoiceHandler { replacementList.add(new Replacement("(程序你)", "准许你")); replacementList.add(new Replacement("(车法)", "折返")); replacementList.add(new Replacement("(拉萍|拉婷)", "拉停")); - replacementList.add(new Replacement("(带领)", "待令")); replacementList.add(new Replacement("(站街)", "站级")); replacementList.add(new Replacement("(羡慕)", "线路")); replacementList.add(new Replacement("(功率标|功率表|公里表|公历表|公斤标|公立标)", "公里标")); replacementList.add(new Replacement("(赚钱折法|赚钱折返)", "站前折返")); replacementList.add(new Replacement("(权限各次)", "全线各次")); replacementList.add(new Replacement("(庭院)", "停运")); - replacementList.add(new Replacement("(请客|青稞|青客|轻客|轻课|青涩|听课|停课|听,可|听可)", "清客")); + replacementList.add(new Replacement("(请客|青稞|青客|轻客|轻课|青涩|听课|停课|听,可|听可|顷刻)", "清客")); replacementList.add(new Replacement("(会断|会短|回断)", "回段")); replacementList.add(new Replacement("(清朝|请朝|请钞)", "请抄")); - replacementList.add(new Replacement("(首领处所)", "受令处所")); + replacementList.add(new Replacement("(请超链|请超龄)", "请抄令")); + replacementList.add(new Replacement("(首领处所|手令处所)", "受令处所")); replacementList.add(new Replacement("安全保护", "安全防护")); replacementList.add(new Replacement("(手摇质|说杨智|受邀至)", "手摇至")); replacementList.add(new Replacement("(反胃|软位)", "反位")); @@ -85,9 +85,10 @@ public class SimulationVoiceHandler { replacementList.add(new Replacement("故障回复", "故障恢复")); replacementList.add(new Replacement("(出入断线|出路段线)", "出入段线")); replacementList.add(new Replacement("(控子权|控质权|放置权|矿质权|空置权)", "控制权")); - replacementList.add(new Replacement("(手机号)", "手信号")); + replacementList.add(new Replacement("(手机号|首信号)", "手信号")); replacementList.add(new Replacement("(鼓掌|部长)", "故障")); replacementList.add(new Replacement("(向凤)", "下放")); + replacementList.add(new Replacement("(占线|占先)", "站线")); //------------- 设备相关 -------------- replacementList.add(new Replacement("(宇花祭|玉花祭|雨化寨|氯化钙|绿化带|优化钙)", "鱼化寨")); replacementList.add(new Replacement("(保税局)", "保税区")); diff --git a/src/main/java/club/joylink/rtss/simulation/rt/CIL/CilRouteLogicService.java b/src/main/java/club/joylink/rtss/simulation/rt/CIL/CilRouteLogicService.java index e722bd394..82f76d43a 100644 --- a/src/main/java/club/joylink/rtss/simulation/rt/CIL/CilRouteLogicService.java +++ b/src/main/java/club/joylink/rtss/simulation/rt/CIL/CilRouteLogicService.java @@ -1,6 +1,8 @@ package club.joylink.rtss.simulation.rt.CIL; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; +import club.joylink.rtss.simulation.Simulation; +import club.joylink.rtss.simulation.cbtc.data.map.Signal; import club.joylink.rtss.simulation.rt.CIL.bo.*; import club.joylink.rtss.simulation.rt.RtSimulation; import club.joylink.rtss.simulation.rt.repo.*; @@ -159,7 +161,8 @@ public class CilRouteLogicService { //关闭信号 cilSignalLogicService.update2ForbiddenAspect(simulation, signalId); //设置延时解锁 - cilSignal.initDelayTime(); + CommonSignal commonSignal = cilRepository.getCommonRepository().getSignalById(signalId); + cilSignal.initDelayTime(commonSignal); cilRoute.setDelayUnlocking(true); } } @@ -213,11 +216,15 @@ public class CilRouteLogicService { cilSignal.setRouteId(cilRoute.getId()); } // 开始办理 - cilRoute.startSetting(rtSimulation.getSystemTime()); - cilRepository.addSupervisedRoute(cilRoute); + noCheckSetRoute(rtSimulation, cilRepository, cilRoute); return true; } + private void noCheckSetRoute(RtSimulation simulation, CilRepository cilRepository, CilRoute cilRoute) { + cilRoute.startSetting(simulation.getSystemTime()); + cilRepository.addSupervisedRoute(cilRoute); + } + /** * 为办理进路初始化相关状态 */ @@ -384,7 +391,7 @@ public class CilRouteLogicService { CilSignal cilSignal = cilRepository.getSignalById(subCommonRoute.getStart().getId()); if (cilSignal.getSignalAspect() != mra.getSignalAspect()) { if (!cilRepository.isSupervised(subCilRoute.getId())) { - setRoute(rtSimulation, subCilRoute.getId()); + noCheckSetRoute(rtSimulation, cilRepository, subCilRoute); if (i == 0) { cilRepository.removeSupervisedRoute(cilRoute.getId()); } diff --git a/src/main/java/club/joylink/rtss/simulation/rt/CIL/bo/CilRepository.java b/src/main/java/club/joylink/rtss/simulation/rt/CIL/bo/CilRepository.java index b50214351..9e94b5a80 100644 --- a/src/main/java/club/joylink/rtss/simulation/rt/CIL/bo/CilRepository.java +++ b/src/main/java/club/joylink/rtss/simulation/rt/CIL/bo/CilRepository.java @@ -183,4 +183,6 @@ public class CilRepository extends SimulationRepository { } return list; } + + } diff --git a/src/main/java/club/joylink/rtss/simulation/rt/CIL/bo/CilSignal.java b/src/main/java/club/joylink/rtss/simulation/rt/CIL/bo/CilSignal.java index a8348636e..39b6a38c2 100644 --- a/src/main/java/club/joylink/rtss/simulation/rt/CIL/bo/CilSignal.java +++ b/src/main/java/club/joylink/rtss/simulation/rt/CIL/bo/CilSignal.java @@ -2,12 +2,14 @@ package club.joylink.rtss.simulation.rt.CIL.bo; import club.joylink.rtss.simulation.rt.CIL.CilLogicService; import club.joylink.rtss.simulation.rt.SRD.bo.SrSignal; +import club.joylink.rtss.simulation.rt.repo.CommonSignal; import lombok.Getter; import lombok.Setter; @Getter public class CilSignal extends CilDevice { public static final int DEFAULT_DELAY_TIME = 180 * 1000; //进路延时解锁默认时长 + public static final int SHUNTING_DELAY_TIME = 30 * 1000; //调车信号机延时解锁时长 public static final int DEFAULT_GUIDE_TIME = 15 * 1000; //引导信号有效时长 int signalAspect = SrSignal.H; //当前显示的信号 @@ -120,8 +122,12 @@ public class CilSignal extends CilDevice { this.fl = false; } - public void initDelayTime() { - this.delayTime = DEFAULT_DELAY_TIME; + public void initDelayTime(CommonSignal commonSignal) { + if (commonSignal.isShunting()) { + this.delayTime = SHUNTING_DELAY_TIME; + } else { + this.delayTime = DEFAULT_DELAY_TIME; + } } public void updateDelayTime() { diff --git a/src/main/java/club/joylink/rtss/simulation/rt/RtSimulation.java b/src/main/java/club/joylink/rtss/simulation/rt/RtSimulation.java index 03f2cec1e..772a835f0 100644 --- a/src/main/java/club/joylink/rtss/simulation/rt/RtSimulation.java +++ b/src/main/java/club/joylink/rtss/simulation/rt/RtSimulation.java @@ -20,11 +20,12 @@ public class RtSimulation extends Simulation