Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
walker-sheng 2021-04-29 15:30:11 +08:00
commit e17503d902
13 changed files with 61 additions and 26 deletions

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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);
}
}
// 保存登陆信息

View File

@ -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

View File

@ -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);

View File

@ -14,5 +14,5 @@ public interface ProjectSimulationService {
* @param project
* @return
*/
Simulation createCenterSimulation(LoginUserInfoVO loginUserInfo, Project project);
String createCenterSimulation(LoginUserInfoVO loginUserInfo, Project project);
}

View File

@ -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();
}
}

View File

@ -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("(保税局)", "保税区"));

View File

@ -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());
}

View File

@ -183,4 +183,6 @@ public class CilRepository extends SimulationRepository {
}
return list;
}
}

View File

@ -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,9 +122,13 @@ public class CilSignal extends CilDevice {
this.fl = false;
}
public void initDelayTime() {
public void initDelayTime(CommonSignal commonSignal) {
if (commonSignal.isShunting()) {
this.delayTime = SHUNTING_DELAY_TIME;
} else {
this.delayTime = DEFAULT_DELAY_TIME;
}
}
public void updateDelayTime() {
this.delayTime = Math.max(this.delayTime - CilLogicService.CilMainLogicRate, 0);

View File

@ -20,11 +20,12 @@ public class RtSimulation extends Simulation<RtSimulationUser, RtSimulationMembe
SimulationIdGenerator idGenerator;
public RtSimulation(String id, RtSimulationUser creator) {
public RtSimulation(String id, RtSimulationUser creator, MapPrdTypeEnum prdTypeEnum) {
super(id);
this.idGenerator = new SimulationIdGenerator();
this.creator = creator;
this.addSimulationUser(creator);
this.prdType = prdTypeEnum;
}
public LocalDateTime convertToSystemTime(LocalDateTime dateTime) {

View File

@ -38,7 +38,7 @@ public class RtSimulationService {
Objects.requireNonNull(mapId);
MapVO mapVO = this.mapService.getMapDetail(mapId);
RtSimulationUser creator = new RtSimulationUser(userVO.getId().toString());
RtSimulation rtSimulation = new RtSimulation(SimulationIdGenerator.buildId(), creator);
RtSimulation rtSimulation = new RtSimulation(SimulationIdGenerator.buildId(), creator, prdTypeEnum);
this.simulationManager.save(rtSimulation);
try {
rtSimulation.mapVO = mapVO;