diff --git a/src/main/java/club/joylink/rtss/constants/ProjectDeviceType.java b/src/main/java/club/joylink/rtss/constants/ProjectDeviceType.java index f23ac2f96..09d317d9f 100644 --- a/src/main/java/club/joylink/rtss/constants/ProjectDeviceType.java +++ b/src/main/java/club/joylink/rtss/constants/ProjectDeviceType.java @@ -67,6 +67,9 @@ public enum ProjectDeviceType { SANDBOX, /** 派班工作站 */ SCHEDULING, + + PIS_STAND, + PIS_TRAIN, /* -----------client device end---------- */ ; diff --git a/src/main/java/club/joylink/rtss/controller/audio/AudioResourcesController.java b/src/main/java/club/joylink/rtss/controller/audio/AudioResourcesController.java index 6155c0f5d..11439a47f 100644 --- a/src/main/java/club/joylink/rtss/controller/audio/AudioResourcesController.java +++ b/src/main/java/club/joylink/rtss/controller/audio/AudioResourcesController.java @@ -23,10 +23,18 @@ public class AudioResourcesController { * 创建 */ @PostMapping() - public void create(@RequestBody @Validated AudioResourcesVO vo) { + public void create(@RequestBody @Validated(value = AudioResourcesVO.Create.class) AudioResourcesVO vo) { audioResourcesService.create(vo); } + /** + * 生成资源 + */ + @PostMapping("/generate") + public void generate(@RequestBody @Validated(value = AudioResourcesVO.Generate.class) AudioResourcesVO vo) { + audioResourcesService.generate(vo); + } + /** * 查询所有 */ diff --git a/src/main/java/club/joylink/rtss/controller/iscs/IscsSystemResourcesController.java b/src/main/java/club/joylink/rtss/controller/iscs/IscsSystemResourcesController.java index a8056c895..245acd770 100644 --- a/src/main/java/club/joylink/rtss/controller/iscs/IscsSystemResourcesController.java +++ b/src/main/java/club/joylink/rtss/controller/iscs/IscsSystemResourcesController.java @@ -34,6 +34,11 @@ public class IscsSystemResourcesController { iscsSystemResourcesService.batchCreate(vos); } + @PostMapping("/generate/{mapId}/{type}") + public void generate(@PathVariable long mapId, @PathVariable int type) { + iscsSystemResourcesService.generate(mapId, type); + } + /** * 获取所有 */ diff --git a/src/main/java/club/joylink/rtss/controller/user/UserInfoController.java b/src/main/java/club/joylink/rtss/controller/user/UserInfoController.java index 12661af8b..4beb236b5 100644 --- a/src/main/java/club/joylink/rtss/controller/user/UserInfoController.java +++ b/src/main/java/club/joylink/rtss/controller/user/UserInfoController.java @@ -4,13 +4,8 @@ import club.joylink.rtss.services.ISysUserService; import club.joylink.rtss.vo.AccountVO; import club.joylink.rtss.vo.UserQueryVO; import club.joylink.rtss.vo.client.PageVO; -import club.joylink.rtss.vo.client.user.MobileInfoVO; -import club.joylink.rtss.vo.client.user.UpdateEmailVO; -import club.joylink.rtss.vo.client.user.UpdateMobileVO; -import club.joylink.rtss.vo.client.user.UpdatePasswordVO; +import club.joylink.rtss.vo.client.user.*; import club.joylink.rtss.vo.user.AccountCreateVO; -import club.joylink.rtss.vo.client.user.AccountRegisterQueryVO; -import club.joylink.rtss.vo.client.user.AccountRegisterStatisticsVO; import club.joylink.rtss.vo.user.UserRegisterCheck; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; @@ -146,4 +141,20 @@ public class UserInfoController { queryVO.setSource(source); return this.iSysUserService.queryPagedUser(queryVO); } + + /** + * 超管重置用户密码 + */ + @PutMapping("/{id}/reset/pwd") + public void resetPwd(@PathVariable long id) { + iSysUserService.resetPwd(id); + } + + /** + * 找回密码 + */ + @PutMapping("/retrieve/pwd") + public void retrievePwd(@RequestBody @Validated RetrievePwdVO vo) { + iSysUserService.retrievePwd(vo); + } } diff --git a/src/main/java/club/joylink/rtss/services/ISysUserService.java b/src/main/java/club/joylink/rtss/services/ISysUserService.java index c20c5e2b5..565af85d7 100644 --- a/src/main/java/club/joylink/rtss/services/ISysUserService.java +++ b/src/main/java/club/joylink/rtss/services/ISysUserService.java @@ -10,7 +10,6 @@ import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.org.CompanyVO; import club.joylink.rtss.vo.client.user.*; import club.joylink.rtss.vo.user.AccountCreateVO; -import club.joylink.rtss.vo.client.user.AccountRegisterStatisticsVO; import club.joylink.rtss.vo.wx.WmUserSession; import lombok.NonNull; @@ -325,4 +324,8 @@ public interface ISysUserService { boolean isThirdParentAccountExist(String parentAccount); List findEntitiesBySource(String source); + + void resetPwd(long id); + + void retrievePwd(RetrievePwdVO vo); } diff --git a/src/main/java/club/joylink/rtss/services/SysUserService.java b/src/main/java/club/joylink/rtss/services/SysUserService.java index 5198c5086..2c3c97218 100644 --- a/src/main/java/club/joylink/rtss/services/SysUserService.java +++ b/src/main/java/club/joylink/rtss/services/SysUserService.java @@ -738,7 +738,7 @@ public class SysUserService implements ISysUserService { @Override public String sendMobileValidCode(MobileInfoVO mobileInfoVO) { - BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(mobileInfoVO.validate()); + BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(mobileInfoVO.validate(), "发送验证码请求未通过"); String code = RandomGenerator.getByLen(4); long ts = System.currentTimeMillis(); List params = new ArrayList<>(); @@ -757,18 +757,44 @@ public class SysUserService implements ISysUserService { public void updatePassword(Long id, UpdatePasswordVO updatePasswordVO) { Objects.requireNonNull(id, "用户id不能为空"); SysAccount account = this.sysAccountDAO.selectByPrimaryKey(id); + updatePwdByMobileVdCode(updatePasswordVO, account); + } + + private void updatePwdByMobileVdCode(UpdatePasswordVO updatePasswordVO, SysAccount account) { if (Objects.nonNull(account)) { VdCode vdCode = (VdCode) this.iCacheService.get(account.getNationcode() + account.getMobile()); BusinessExceptionAssertEnum.INCORRECT_VERIFICATION_CODE.assertNotNull(vdCode); // 验证验证码 vdCode.isValidCode(updatePasswordVO.getVfCode()); // 验证码通过,修改密码 - account.setPassword(updatePasswordVO.getPassword()); - account.setUpdateTime(LocalDateTime.now()); - this.sysAccountDAO.updateByPrimaryKey(account); + updatePassword4Entity(account, updatePasswordVO.getPassword()); } } + /** + * 通过邮箱验证码更新密码 + * @param account 要更新密码的账号 + * @param userVfCode 用户填写的验证码 + * @param newPwd 新密码 + */ + private void updatePwdByEmailVdCode(SysAccount account, String userVfCode, String newPwd) { + if (Objects.nonNull(account)) { + VdCode vdCode = (VdCode) this.iCacheService.get(account.getEmail()); + BusinessExceptionAssertEnum.INCORRECT_VERIFICATION_CODE.assertNotNull(vdCode); + // 验证验证码 + vdCode.isValidCode(userVfCode); + // 验证码通过,修改密码 + updatePassword4Entity(account, newPwd); + } + } + + private void updatePassword4Entity(SysAccount account, String newPwd) { + BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(newPwd, "新密码不能为空"); + account.setPassword(newPwd); + account.setUpdateTime(LocalDateTime.now()); + this.sysAccountDAO.updateByPrimaryKey(account); + } + @Override public void updateUserPassword(Long id, String password) { Objects.requireNonNull(id, "用户id不能为空"); @@ -991,6 +1017,55 @@ public class SysUserService implements ISysUserService { return sysAccountDAO.selectByExample(example); } + @Override + public void resetPwd(long id) { + String pwd = EncryptUtil.md5("123456"); + SysAccount account = getEntity(id); + updatePassword4Entity(account, pwd); + } + + @Override + public void retrievePwd(RetrievePwdVO vo) { + if (StringUtils.hasText(vo.getMobile())) { + SysAccount account = getEntityByMobile(vo.getMobile()); + UpdatePasswordVO updatePasswordVO = new UpdatePasswordVO(vo.getVfCode(), vo.getNewPwd()); + updatePwdByMobileVdCode(updatePasswordVO, account); + } else if (StringUtils.hasText(vo.getEmail())) { + SysAccount account = getEntityByEmail(vo.getEmail()); + updatePwdByEmailVdCode(account, vo.getVfCode(), vo.getNewPwd()); + } else { + throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("手机号和邮箱不能都为空"); + } + } + + private SysAccount getEntityByMobile(String mobile) { + BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(mobile); + SysAccountExample example = new SysAccountExample(); + example.createCriteria().andMobileEqualTo(mobile); + List accounts = sysAccountDAO.selectByExample(example); + BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(accounts, + String.format("[手机号:%s]的账号不存在", mobile)); + if (accounts.size() != 1) { + log.error("[手机号:%s]的账号有多个"); + throw BusinessExceptionAssertEnum.DATA_ERROR.exception(); + } + return accounts.get(0); + } + + private SysAccount getEntityByEmail(String email) { + BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(email); + SysAccountExample example = new SysAccountExample(); + example.createCriteria().andEmailEqualTo(email); + List accounts = sysAccountDAO.selectByExample(example); + BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(accounts, + String.format("[邮箱:%s]的账号不存在", email)); + if (accounts.size() != 1) { + log.error(String.format("[邮箱:%s]的账号有多个", email)); + throw BusinessExceptionAssertEnum.DATA_ERROR.exception(); + } + return accounts.get(0); + } + private boolean isSameEmailExist(String email) { SysAccountExample example = new SysAccountExample(); example.createCriteria() diff --git a/src/main/java/club/joylink/rtss/services/audio/AudioResourcesService.java b/src/main/java/club/joylink/rtss/services/audio/AudioResourcesService.java index 8c774da6a..6da3625c2 100644 --- a/src/main/java/club/joylink/rtss/services/audio/AudioResourcesService.java +++ b/src/main/java/club/joylink/rtss/services/audio/AudioResourcesService.java @@ -20,4 +20,6 @@ public interface AudioResourcesService { PageVO pagedQuery(AudioResourcesQueryVO queryVO); AudioResourcesVO getById(long id); + + void generate(AudioResourcesVO vo); } diff --git a/src/main/java/club/joylink/rtss/services/audio/AudioResourcesServiceImpl.java b/src/main/java/club/joylink/rtss/services/audio/AudioResourcesServiceImpl.java index 9fca111c3..2fa5ba0fb 100644 --- a/src/main/java/club/joylink/rtss/services/audio/AudioResourcesServiceImpl.java +++ b/src/main/java/club/joylink/rtss/services/audio/AudioResourcesServiceImpl.java @@ -3,12 +3,14 @@ package club.joylink.rtss.services.audio; import club.joylink.rtss.dao.AudioResourcesDAO; import club.joylink.rtss.entity.AudioResources; import club.joylink.rtss.entity.AudioResourcesExample; +import club.joylink.rtss.services.voice.IVoiceService; import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.audio.AudioResourcesQueryVO; import club.joylink.rtss.vo.client.audio.AudioResourcesVO; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; @@ -21,6 +23,9 @@ import java.util.List; public class AudioResourcesServiceImpl implements AudioResourcesService { @Autowired private AudioResourcesDAO audioResourcesDAO; + @Autowired + @Qualifier("baiDuVoiceService") + private IVoiceService iVoiceService; @Override public void create(AudioResourcesVO vo) { @@ -82,6 +87,13 @@ public class AudioResourcesServiceImpl implements AudioResourcesService { return new AudioResourcesVO(getEntity(id)); } + @Override + public void generate(AudioResourcesVO vo) { + String filePath = iVoiceService.synthesis(vo.getDesc()); + vo.setUrl(filePath); + create(vo); + } + private AudioResources getEntity(long id) { return audioResourcesDAO.selectByPrimaryKey(id); } 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 d9c94d2ca..6d1c3ada4 100644 --- a/src/main/java/club/joylink/rtss/services/auth/AuthenticateService.java +++ b/src/main/java/club/joylink/rtss/services/auth/AuthenticateService.java @@ -468,6 +468,8 @@ public class AuthenticateService implements IAuthenticateService { case CCTV: case SANDBOX: case ILW: + case PIS_STAND: + case PIS_TRAIN: case VR_IBP: { RelationLoginConfigVO config = deviceVO.buildRelationLoginConfig(); if (Objects.nonNull(config) && Objects.nonNull(config.getDeviceCode())) { diff --git a/src/main/java/club/joylink/rtss/services/iscs/IscsSystemResourcesService.java b/src/main/java/club/joylink/rtss/services/iscs/IscsSystemResourcesService.java index 221dcbb7e..3cf196f0f 100644 --- a/src/main/java/club/joylink/rtss/services/iscs/IscsSystemResourcesService.java +++ b/src/main/java/club/joylink/rtss/services/iscs/IscsSystemResourcesService.java @@ -22,4 +22,10 @@ public interface IscsSystemResourcesService { List criteriaQuery(IscsSystemResourcesQueryVO queryVO); void batchCreate(List vos); + + /** + * 生成Iscs资源。 + * @param type 要生成的资源的类型,详见方法体内的注释 + */ + void generate(long mapId, int type); } diff --git a/src/main/java/club/joylink/rtss/services/iscs/IscsSystemResourcesServiceImpl.java b/src/main/java/club/joylink/rtss/services/iscs/IscsSystemResourcesServiceImpl.java index b706a218c..fee70bdef 100644 --- a/src/main/java/club/joylink/rtss/services/iscs/IscsSystemResourcesServiceImpl.java +++ b/src/main/java/club/joylink/rtss/services/iscs/IscsSystemResourcesServiceImpl.java @@ -4,11 +4,14 @@ import club.joylink.rtss.dao.IscsSystemResourcesDAO; import club.joylink.rtss.entity.IscsSystemResources; import club.joylink.rtss.entity.IscsSystemResourcesExample; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; +import club.joylink.rtss.services.IMapService; import club.joylink.rtss.services.audio.AudioResourcesService; import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.audio.AudioResourcesVO; import club.joylink.rtss.vo.client.iscs.systemRes.IscsSystemResourcesQueryVO; import club.joylink.rtss.vo.client.iscs.systemRes.IscsSystemResourcesVO; +import club.joylink.rtss.vo.map.MapVO; +import club.joylink.rtss.vo.map.graph.MapStationNewVO; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import org.springframework.beans.factory.annotation.Autowired; @@ -22,9 +25,10 @@ import java.util.List; public class IscsSystemResourcesServiceImpl implements IscsSystemResourcesService { @Autowired private IscsSystemResourcesDAO iscsSystemResourcesDAO; - @Autowired private AudioResourcesService audioResourcesService; + @Autowired + private IMapService iMapService; @Override public void create(IscsSystemResourcesVO vo) { @@ -106,6 +110,13 @@ public class IscsSystemResourcesServiceImpl implements IscsSystemResourcesServic } } + @Override + public void generate(long mapId, int type) { + MapVO mapDetail = iMapService.getMapDetail(mapId); + List stationList = mapDetail.getGraphDataNew().getStationList(); + + } + private IscsSystemResources findEntityById(long id) { return iscsSystemResourcesDAO.selectByPrimaryKey(id); } diff --git a/src/main/java/club/joylink/rtss/services/iscs/interactive/IscsInteractiveService.java b/src/main/java/club/joylink/rtss/services/iscs/interactive/IscsInteractiveService.java index f31d19a6e..6b787551c 100644 --- a/src/main/java/club/joylink/rtss/services/iscs/interactive/IscsInteractiveService.java +++ b/src/main/java/club/joylink/rtss/services/iscs/interactive/IscsInteractiveService.java @@ -5,7 +5,7 @@ import club.joylink.rtss.services.audio.AudioResourcesService; import club.joylink.rtss.services.voice.IVoiceService; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; -import club.joylink.rtss.simulation.cbtc.data.map.Audio; +import club.joylink.rtss.simulation.cbtc.data.iscs.Audio; import club.joylink.rtss.simulation.cbtc.data.map.MapElement; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityAudio; import club.joylink.rtss.simulation.cbtc.member.SimulationMember; @@ -18,6 +18,9 @@ import org.springframework.stereotype.Component; import java.util.List; +/** + * ISCS交互服务 + */ @Component public class IscsInteractiveService { @Autowired @@ -27,7 +30,7 @@ public class IscsInteractiveService { @Qualifier("baiDuVoiceService") private IVoiceService iVoiceService; - public void play(Simulation simulation, PlayParamVO param, SimulationMember member) { + public void paPlay(Simulation simulation, PlayParamVO param, SimulationMember member) { BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(member != null && (member.isDispatcher() || member.isStationSupervisor()), "仅行调和行值可操作"); BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(param.getResourceId(), "资源id不能为null"); @@ -47,6 +50,26 @@ public class IscsInteractiveService { } } + /** + * 信号系统自动通过PA系统播放 + */ + public void paPlayBySystem(Simulation simulation, List iscsDeviceCodes, + AudioResourcesVO audioResourcesVO, String state) { + SimulationDataRepository repository = simulation.getRepository(); + for (String code : iscsDeviceCodes) { + MapElement element = repository.getByCode(code); + if (element instanceof Audio) { + Audio audio = (Audio) element; + audio.updateResource(audioResourcesVO); + audio.updateState(state); + audio.updateRemain(Audio.DEFAULT_REMAIN); + VirtualRealityAudio vrAudio = audio.getVrAudio(); + vrAudio.updateUrl(audioResourcesVO.getUrl()); + vrAudio.control(VirtualRealityAudio.Command.PLAY); + } + } + } + public void paStopPlaying(Simulation simulation, List iscsDeviceCodes) { SimulationDataRepository repository = simulation.getRepository(); for (String code : iscsDeviceCodes) { diff --git a/src/main/java/club/joylink/rtss/simulation/Simulation.java b/src/main/java/club/joylink/rtss/simulation/Simulation.java index 13bceddac..9c1980b07 100644 --- a/src/main/java/club/joylink/rtss/simulation/Simulation.java +++ b/src/main/java/club/joylink/rtss/simulation/Simulation.java @@ -14,6 +14,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.util.StringUtils; import java.time.LocalDateTime; +import java.time.ZoneOffset; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicBoolean; @@ -190,6 +191,10 @@ public abstract class Simulation sessions = simulation.getSimulationUserIds(); - SocketMessageVO timeSyncMessage = SocketMessageFactory.buildSimulationTimeSyncMessage(simulation); + SocketMessageVO timeSyncMessage = SocketMessageFactory.buildSimulationTimeSyncMessage(simulation); stompMessageService.sendToUser(sessions, timeSyncMessage); } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/IscsOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/IscsOperateHandler.java index 45fb734e8..f946b13fe 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/IscsOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/IscsOperateHandler.java @@ -23,7 +23,7 @@ public class IscsOperateHandler { */ @OperateHandlerMapping(type = Operation.Type.ISCS_PA_Play) public void paPlay(Simulation simulation, PlayParamVO playParamVO, SimulationMember member) { - iscsInteractiveService.play(simulation, playParamVO, member); + iscsInteractiveService.paPlay(simulation, playParamVO, member); } /** @@ -46,7 +46,7 @@ public class IscsOperateHandler { * PIS系统停止播放 */ @OperateHandlerMapping(type = Operation.Type.ISCS_PIS_Stop_Playing) - public void pisPlay(Simulation simulation, List iscsDeviceCodes) { + public void pisStopPlaying(Simulation simulation, List iscsDeviceCodes) { iscsInteractiveService.pisStopPlaying(simulation, iscsDeviceCodes); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ISCS/IscsLogicLoop.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ISCS/IscsLogicLoop.java index 2ec02c318..ad7cf3089 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ISCS/IscsLogicLoop.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ISCS/IscsLogicLoop.java @@ -3,13 +3,17 @@ package club.joylink.rtss.simulation.cbtc.ISCS; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; -import club.joylink.rtss.simulation.cbtc.data.map.Audio; +import club.joylink.rtss.simulation.cbtc.data.iscs.Audio; import org.springframework.stereotype.Component; @Component public class IscsLogicLoop { - private void run(Simulation simulation) { + public static final String JOB_NAME = "ISCS_LOGIC_LOOP"; + public static final int RATE = 1000; + + public void run(Simulation simulation) { SimulationDataRepository repository = simulation.getRepository(); + // 广播播放结束逻辑 for (Audio audio : repository.getAudioList()) { if (audio.isInPa() && !audio.isNotUsed()) { int remain = audio.getRemainDuration(); @@ -24,6 +28,6 @@ public class IscsLogicLoop { } public void addJob(Simulation simulation) { - simulation.addJob(Simulation.JobName.iscsLogicLoop, () -> run(simulation), SimulationConstants.ATS_LOOP_RATE); + simulation.addJob(JOB_NAME, () -> run(simulation), RATE); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ISCS/IscsMessageCollectAndDispatcher.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ISCS/IscsMessageCollectAndDispatcher.java index 857f60d92..b36071f56 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ISCS/IscsMessageCollectAndDispatcher.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ISCS/IscsMessageCollectAndDispatcher.java @@ -4,7 +4,7 @@ import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; import club.joylink.rtss.simulation.cbtc.data.SimulationIscsDataRepository; -import club.joylink.rtss.simulation.cbtc.data.map.Audio; +import club.joylink.rtss.simulation.cbtc.data.iscs.Audio; import club.joylink.rtss.simulation.cbtc.data.vo.iscs.IscsAudioStatusVO; import club.joylink.rtss.simulation.cbtc.data.vo.iscs.IscsStatusVO; import club.joylink.rtss.simulation.rt.iscs.IscsStatusPublisher; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ProjectJointSimulationServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ProjectJointSimulationServiceImpl.java index 59fda98f5..c005adfdc 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ProjectJointSimulationServiceImpl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ProjectJointSimulationServiceImpl.java @@ -141,12 +141,14 @@ public class ProjectJointSimulationServiceImpl implements ProjectJointSimulation case PSC: return ((Heb1PscConfig) config).getConfig().getPsdCode(); } + break; } case XTY:{ switch (config.getDeviceType()) { case PSD: return ((XtyPsdConfig) config).getConfig().getPsdCode(); } + break; } case RICHOR_JOINT: { switch (config.getDeviceType()) { @@ -155,6 +157,7 @@ public class ProjectJointSimulationServiceImpl implements ProjectJointSimulation case PSL: return ((ZjdPslConfig) config).getConfigVO().getPslCode(); } + break; } case SR_SANDBOX: { switch (config.getDeviceType()) { @@ -167,6 +170,7 @@ public class ProjectJointSimulationServiceImpl implements ProjectJointSimulation case TRAIN: return ((SrTrainConfig) config).getConfigVO().getVrCode(); } + break; } case RICHOR_HHCJ: { switch (config.getDeviceType()) { @@ -175,6 +179,7 @@ public class ProjectJointSimulationServiceImpl implements ProjectJointSimulation case PSD: return ((HhcjPsdConfig) config).getConfigVO().getPsdCode(); } + break; } } return null; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/Simulation.java b/src/main/java/club/joylink/rtss/simulation/cbtc/Simulation.java index 99c887f90..b29b774a5 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/Simulation.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/Simulation.java @@ -39,6 +39,7 @@ import org.springframework.util.CollectionUtils; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; +import java.time.ZoneId; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; @@ -497,6 +498,13 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation voiceCommandBOList = iVoiceCommandService.getAll(); simulation.setVoiceCommandBOList(voiceCommandBOList); + // 添加消息发送器 + addMessagePublisher(simulation); // 添加任务 addJobs(simulation); applicationContext.publishEvent(new SimulationCreateSuccessEvent(this, simulation)); return simulation; } + private void addMessagePublisher(Simulation simulation) { + simulation.addMessagePublisher(new IscsStatusPublisher(simulation)); + simulation.addMessagePublisher(new PisStatusPublisher(simulation)); + } + private void addJobs(Simulation simulation) { if(simulation.getBuildParams().getProdType() == MapPrdTypeEnum.YJDDZH){ //非武汉大屏车辆定位 @@ -201,6 +211,7 @@ public class SimulationLifeCycleServiceImpl implements SimulationLifeCycleServic iVirtualRealityPslService.addJobs(simulation); iscsMessageCollectAndDispatcher.addJob(simulation); iscsLogicLoop.addJob(simulation); + pisLogicLoop.addJobs(simulation); } atpLogicLoop.addJobs(simulation); atsLogicLoop.addJobs(simulation); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/build/SimulationBuilder.java b/src/main/java/club/joylink/rtss/simulation/cbtc/build/SimulationBuilder.java index 864546fe3..463f7a5f6 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/build/SimulationBuilder.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/build/SimulationBuilder.java @@ -3,11 +3,11 @@ package club.joylink.rtss.simulation.cbtc.build; import club.joylink.rtss.entity.Ibp; import club.joylink.rtss.simulation.cbtc.CI.data.StationDirection; import club.joylink.rtss.simulation.cbtc.CTC.data.*; - import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.data.CalculateService; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; import club.joylink.rtss.simulation.cbtc.data.SimulationIscsDataRepository; +import club.joylink.rtss.simulation.cbtc.data.iscs.Audio; import club.joylink.rtss.simulation.cbtc.data.map.*; import club.joylink.rtss.simulation.cbtc.data.plan.TerminalDeparturePlan; import club.joylink.rtss.simulation.cbtc.data.plan.TripPlan; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/SimulationDataRepository.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/SimulationDataRepository.java index 2ba9cc73e..64e5943fc 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/SimulationDataRepository.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/SimulationDataRepository.java @@ -5,6 +5,7 @@ import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.simulation.cbtc.ATS.data.AtsAlarm; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.communication.vo.TrainHmiDisplay; +import club.joylink.rtss.simulation.cbtc.data.iscs.Audio; import club.joylink.rtss.simulation.cbtc.data.map.*; import club.joylink.rtss.simulation.cbtc.data.plan.RealRun; import club.joylink.rtss.simulation.cbtc.data.plan.SchedulingTrainPlan; @@ -852,6 +853,7 @@ public class SimulationDataRepository { /** * 此方法只能用于计划车次号唯一的线路(比如西门子风格的运行计划) + * * @param tripNumber * @return */ @@ -1242,6 +1244,18 @@ public class SimulationDataRepository { .collect(Collectors.toList()); } + public Stream