Compare commits

...

21 Commits

Author SHA1 Message Date
thesai f14e377565 [新增]以终端反向信号机命名的信号机同样也用此信号机作为办理进路的按钮
CI / Docker-Build (push) Successful in 2m13s Details
2024-09-29 09:31:21 +08:00
thesai b302bb360b [新增]开启自动进路的信号机不能开放引导信号 2024-09-26 15:20:55 +08:00
thesai 1e2ed4d305 [新增]获取用户信息的接口中增加更新时间
CI / Docker-Build (push) Successful in 2m12s Details
2024-09-25 13:27:39 +08:00
thesai 436a07bcf4 [新增]获取所有用户信息的接口
CI / Docker-Build (push) Successful in 2m9s Details
2024-09-25 10:51:31 +08:00
thesai 235f4dce5b [新增]按id数组查询用户信息的接口
CI / Docker-Build (push) Successful in 2m14s Details
2024-09-24 16:43:07 +08:00
thesai ac87b0dbe9 [bug]实训中,有多个评分规则时,仅有一个评分规则被使用
CI / Docker-Build (push) Successful in 2m12s Details
2024-09-18 10:37:33 +08:00
thesai 3536ff75ad [修改]后备模式下,办理引导进路不再检查区段占用
CI / Docker-Build (push) Successful in 2m11s Details
2024-09-11 19:07:55 +08:00
thesai f57952b755 [修改]实训结束后的评分删除多余的memberId字段;查询实训按id逆序排列
CI / Docker-Build (push) Successful in 2m13s Details
2024-09-11 14:02:16 +08:00
thesai 9c9e7c60e3 [修改]场景实训结束后的评分展示中增加非用户角色的步骤(并增加每个步骤对应的角色id,非用户角色步骤没有分数)
CI / Docker-Build (push) Successful in 6m56s Details
2024-09-10 17:55:50 +08:00
thesai 98abf0691a Merge remote-tracking branch 'origin/develop' into develop 2024-09-10 17:01:45 +08:00
thesai 16e8dc191f [bug]对道岔区段的区故解仅解锁指定的区段,而非整个道岔计轴区段 2024-09-10 17:01:24 +08:00
tiger_zhou 4f151fae4a 修改 仿真销毁的时候发送cgy时间,有个可能是空的
CI / Docker-Build (push) Successful in 2m33s Details
2024-08-19 09:42:14 +08:00
tiger_zhou e93171e958 调整列车区段没有值得问题
CI / Docker-Build (push) Successful in 5m14s Details
2024-08-16 18:59:18 +08:00
thesai 4cd80bbec5 [bug]成都工业实体信号机黄灯、绿灯控制逻辑不对 2024-07-29 13:43:06 +08:00
thesai 8125e32d7e [bug]成都工业实体信号机黄灯、绿灯控制逻辑不对 2024-07-18 16:45:00 +08:00
thesai e23864fa72 [修改]探索如何设置maven镜像源
CI / Docker-Build (push) Successful in 5m3s Details
2024-06-11 20:40:34 +08:00
thesai 212773e679 [修改]gitea自动构建/发布脚本文件
CI / Docker-Build (push) Failing after 19m33s Details
2024-06-11 20:15:21 +08:00
thesai 495681db5d [修改]语音识别校验接口要求匹配率提高到70%
CI / Docker-Build (push) Failing after 1m49s Details
2024-06-07 18:10:20 +08:00
thesai dbe197eba6 [bug]成都工业区段联动服务没写 2024-05-24 11:40:13 +08:00
thesai cee9eda430 [修改]校验语音识别接口增加立体声转单声道逻辑
CI / Docker-Build (push) Successful in 2m36s Details
2024-05-17 17:38:22 +08:00
thesai 0d10203613 [修改]发布配置文件
CI / Docker-Build (push) Successful in 2m29s Details
公网服务发布 / Docker-Build-Push (push) Successful in 10s Details
2024-05-16 16:59:41 +08:00
21 changed files with 3443 additions and 3109 deletions

View File

@ -56,6 +56,6 @@ jobs:
docker rm -f rt-sim-training-service || echo "rt-sim-training-service not exist"
docker pull gitea.joylink.club/joylink/rt-sim-training-service:local-test
docker run --name rt-sim-training-service --restart=always --network net --ip 192.168.53.3 -d -e APP_ENV=local-test -p 9000:9000 -p 19000:19000 -v /usr/local/joylink/logs/rtss:/usr/local/joylink/logs/rtss gitea.joylink.club/joylink/rt-sim-training-service:local-test
- name: 清理tag为none的镜像
run: |
docker rmi $(docker images --filter "dangling=true" -q)
# - name: 清理tag为none的镜像
# run: |
# docker rmi $(docker images --filter "dangling=true" -q --no-trunc) 2>/dev/null || echo "No dangling images to remove"

View File

@ -2,7 +2,7 @@ name: 版本发布docker构建并上传
run-name: ${{ gitea.actor }} is testing out Gitea Actions
on:
release:
types: [published]
types: [ published ]
jobs:
Docker-Build-Push:
@ -45,9 +45,9 @@ jobs:
tags: |
gitea.joylink.club/joylink/rt-sim-training-service:${{ github.event.release.tag_name }}
gitea.joylink.club/joylink/rt-sim-training-service:latest
- name: 清理tag为none的镜像
run: |
docker rmi $(docker images --filter "dangling=true" -q)
# - name: 清理tag为none的镜像
# run: |
# docker rmi $(docker images --filter "dangling=true" -q --no-trunc) 2>/dev/null || echo "No dangling images to remove"
# - name: 发布到本地测试环境
# uses: https://gitea.joylink.club/appleboy/ssh-action@v1.0.3
# with:

23
pom.xml
View File

@ -227,5 +227,26 @@
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>aliyun-central</id>
<url>https://maven.aliyun.com/repository/central</url>
</repository>
<repository>
<id>aliyun-snapshots</id>
<url>https://maven.aliyun.com/repository/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>aliyun-central</id>
<url>https://maven.aliyun.com/repository/central</url>
</pluginRepository>
</pluginRepositories>
</project>

View File

@ -27,6 +27,6 @@ public class CgyStatsBO {
private AtomicLong visitor;
//实训人数
private final Set<Long> userSet = new HashSet<>();
//实训时长
//实训时长/s
private AtomicLong duration;
}

View File

@ -124,8 +124,7 @@ public class TrainingV2PublishController {
*/
@PostMapping("/infos")
public List<PublishedTraining2InfoRspVo> findTrainingListInfos(
@RequestBody PublishedTrainingListRspVo vo
,
@RequestBody PublishedTrainingListRspVo vo,
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO) {
//只查询以上架
vo.setState(BusinessConsts.STATUS_USE_INT);

View File

@ -4,15 +4,25 @@ 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.*;
import club.joylink.rtss.vo.client.user.MobileInfoVO;
import club.joylink.rtss.vo.client.user.RetrievePwdVO;
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.user.AccountCreateVO;
import club.joylink.rtss.vo.user.AccountRegisterVO;
import club.joylink.rtss.vo.user.UserRegisterCheck;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 系统账户接口
@ -25,7 +35,8 @@ public class SysAccountController {
private ISysUserService iSysUserService;
@PostMapping("/register")
public void register(@RequestBody @Validated(value = UserRegisterCheck.class) AccountCreateVO accountCreateVO) {
public void register(
@RequestBody @Validated(value = UserRegisterCheck.class) AccountCreateVO accountCreateVO) {
this.iSysUserService.register(accountCreateVO);
}
@ -38,9 +49,9 @@ public class SysAccountController {
}
/**
*根据姓名或电话号查询用户
* 根据姓名或电话号查询用户
*/
@GetMapping(path="/nameOrMobile")
@GetMapping(path = "/nameOrMobile")
public List<AccountVO> queryUserByNameOrMobile(String query) {
List<AccountVO> list = this.iSysUserService.queryUserByNameOrMobile(query);
return list;
@ -63,7 +74,7 @@ public class SysAccountController {
}
/**
*根据用户id获取用户信息
* 根据用户id获取用户信息
*/
@GetMapping(path = "/{id}")
public AccountVO getUserBaseInfoById(@PathVariable Long id) {
@ -71,7 +82,7 @@ public class SysAccountController {
}
/**
*修改用户信息
* 修改用户信息
*/
@PutMapping(path = "/{id}")
public void modify(@PathVariable Long id, @RequestBody AccountVO userInfo, String vdcode) {
@ -79,7 +90,7 @@ public class SysAccountController {
}
/**
*微信关注事件
* 微信关注事件
*/
@GetMapping(path = "/wxsubscribe")
public void wxSubscribe(@RequestParam String wxId) {
@ -87,7 +98,7 @@ public class SysAccountController {
}
/**
*批量修改用户的openId为unionId
* 批量修改用户的openId为unionId
*/
@PutMapping(path = "/batchchange/unionid")
public void batchChangeOpenId2UnionId() {
@ -95,7 +106,7 @@ public class SysAccountController {
}
/**
*更新用户真实姓名
* 更新用户真实姓名
*/
@PutMapping(path = "/{id}/name")
public void updateName(@PathVariable Long id, String name) {
@ -103,7 +114,7 @@ public class SysAccountController {
}
/**
*更新用户昵称
* 更新用户昵称
*/
@PutMapping(path = "/{id}/nickname")
public void updateNickname(@PathVariable Long id, String nickname) {
@ -111,7 +122,7 @@ public class SysAccountController {
}
/**
*用户上传头像
* 用户上传头像
*/
@PostMapping(path = "/{id}/avatar")
public void uploadAvatar(@PathVariable Long id, @RequestBody AccountVO accountVO) {
@ -119,7 +130,7 @@ public class SysAccountController {
}
/**
*发送手机验证码
* 发送手机验证码
*/
@PostMapping(path = "/mobile/code")
public String sendMobileValidCode(@RequestBody MobileInfoVO mobileInfoVO) {
@ -127,7 +138,7 @@ public class SysAccountController {
}
/**
*发送邮箱验证码
* 发送邮箱验证码
*/
@PostMapping(path = "/email/code")
public String sendEmailValidCode(String email) {
@ -135,26 +146,29 @@ public class SysAccountController {
}
/**
*更新用户手机号
* 更新用户手机号
*/
@PutMapping(path = "/{id}/mobile")
public void updateMobile(@PathVariable Long id, @RequestBody @Validated UpdateMobileVO updateMobileVO) {
public void updateMobile(@PathVariable Long id,
@RequestBody @Validated UpdateMobileVO updateMobileVO) {
this.iSysUserService.updateMobile(id, updateMobileVO);
}
/**
*更新用户邮箱
* 更新用户邮箱
*/
@PutMapping(path = "/{id}/email")
public void updateEmail(@PathVariable Long id, @RequestBody @Validated UpdateEmailVO updateEmailVO) {
public void updateEmail(@PathVariable Long id,
@RequestBody @Validated UpdateEmailVO updateEmailVO) {
this.iSysUserService.updateEmail(id, updateEmailVO);
}
/**
*更新用户登陆密码
* 更新用户登陆密码
*/
@PutMapping(path = "/{id}/password")
public void updatePassword(@PathVariable Long id, @RequestBody @Validated UpdatePasswordVO updatePasswordVO) {
public void updatePassword(@PathVariable Long id,
@RequestBody @Validated UpdatePasswordVO updatePasswordVO) {
this.iSysUserService.updatePassword(id, updatePasswordVO);
}
@ -162,7 +176,8 @@ public class SysAccountController {
* 按条件分页查询指定来源的账号
*/
@GetMapping("/page/criteria/{source}")
public PageVO<AccountVO> queryPagedAccountOfTheSource(UserQueryVO queryVO, @PathVariable String source) {
public PageVO<AccountVO> queryPagedAccountOfTheSource(UserQueryVO queryVO,
@PathVariable String source) {
queryVO.setSource(source);
return this.iSysUserService.queryPagedUser(queryVO);
}
@ -182,4 +197,20 @@ public class SysAccountController {
public void retrievePwd(@RequestBody @Validated RetrievePwdVO vo) {
iSysUserService.retrievePwd(vo);
}
/**
* 根据用户id列表获取用户信息
*/
@PostMapping("/list/ids")
public List<AccountVO> listByIds(@RequestBody List<Long> ids) {
return iSysUserService.listByIds(ids);
}
/**
* 查询所有用户
*/
@GetMapping("/list/all")
public List<AccountVO> listAll() {
return iSysUserService.listAll();
}
}

View File

@ -363,4 +363,8 @@ public interface ISysUserService {
boolean isSameMobileExist(String mobile);
boolean isSameEmailExist(String email);
List<AccountVO> listByIds(List<Long> ids);
List<AccountVO> listAll();
}

View File

@ -1112,6 +1112,20 @@ public class SysUserService implements ISysUserService {
return sysAccountDAO.countByExample(example) > 0;
}
@Override
public List<AccountVO> listByIds(List<Long> ids) {
SysAccountExample example = new SysAccountExample();
example.createCriteria().andIdIn(ids);
List<SysAccount> sysAccounts = sysAccountDAO.selectByExample(example);
return AccountVO.convertFromDB(sysAccounts);
}
@Override
public List<AccountVO> listAll() {
List<SysAccount> sysAccounts = sysAccountDAO.selectByExample(null);
return AccountVO.convertFromDB(sysAccounts);
}
/**
* 查询包含组织信息的用户信息
*/

View File

@ -98,7 +98,7 @@ public class CgyStatsService {
+ "app_secret=" + statsBO.getAppSecret();
body.put("sign", EncryptUtil.md5(sb).toLowerCase());
//扩展字段
body.put("duration", statsBO.getDuration().get());
body.put("duration", statsBO.getDuration().get() / 60); //分钟
SimulationInfoQueryVO queryVO = new SimulationInfoQueryVO();
queryVO.setFunctionId(statsBO.getFunctionId());
List<SimulationInfoVO> sims = simulationService.listAllSimulation(queryVO);
@ -108,7 +108,7 @@ public class CgyStatsService {
httpHeaders.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<Map<String, Object>> httpEntity = new HttpEntity<>(body, httpHeaders);
Map<String, String> resBody = restTemplate.postForObject(
"https://common-dev.educloudxr.com/api/applicationCenter/openapi/summary", httpEntity,
"http://gdjtapp.cdivtc.edu.cn/api/applicationCenter/openapi/summary", httpEntity,
Map.class);
if (resBody != null && Objects.equals(resBody.get("code"), "100001")) {
log.error(String.format("成工院虚仿平台同步数据失败:[%s][%s]", resBody.get("msg"),
@ -122,11 +122,13 @@ public class CgyStatsService {
public void syncUserSimulationUsing(UserSimulationRecordEvent event) {
UserSimulationRecord record = event.getRecord();
CgyStatsBO cgyStatsBO = functionStatsMap.get(record.getFunctionId());
if (Objects.nonNull(cgyStatsBO)) {
cgyStatsBO.getVisitor().incrementAndGet();
cgyStatsBO.getUserSet().add(record.getUserId());
cgyStatsBO.getDuration().addAndGet(record.getDuration());
cgyStatsBO.getChange().set(true);
}
}
/**
* 更新此App的浏览量数据

View File

@ -5,7 +5,22 @@ import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
import club.joylink.rtss.simulation.cbtc.constant.SignalAspect;
import club.joylink.rtss.simulation.cbtc.constant.SignalModel;
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
import club.joylink.rtss.simulation.cbtc.data.map.*;
import club.joylink.rtss.simulation.cbtc.data.map.AutoSignal;
import club.joylink.rtss.simulation.cbtc.data.map.Cycle;
import club.joylink.rtss.simulation.cbtc.data.map.DestinationCodeDefinition;
import club.joylink.rtss.simulation.cbtc.data.map.ESP;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import club.joylink.rtss.simulation.cbtc.data.map.PSD;
import club.joylink.rtss.simulation.cbtc.data.map.Route;
import club.joylink.rtss.simulation.cbtc.data.map.RouteFls;
import club.joylink.rtss.simulation.cbtc.data.map.RouteOverlap;
import club.joylink.rtss.simulation.cbtc.data.map.Section;
import club.joylink.rtss.simulation.cbtc.data.map.SectionPath;
import club.joylink.rtss.simulation.cbtc.data.map.Signal;
import club.joylink.rtss.simulation.cbtc.data.map.Stand;
import club.joylink.rtss.simulation.cbtc.data.map.Station;
import club.joylink.rtss.simulation.cbtc.data.map.Switch;
import club.joylink.rtss.simulation.cbtc.data.map.SwitchElement;
import club.joylink.rtss.simulation.cbtc.data.support.RoutePath;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
@ -14,7 +29,28 @@ import club.joylink.rtss.vo.map.CiGenerateResultVO;
import club.joylink.rtss.vo.map.MapCiGenerateConfig;
import club.joylink.rtss.vo.map.MapRoutingSectionNewVO;
import club.joylink.rtss.vo.map.MapVO;
import club.joylink.rtss.vo.map.logic.*;
import club.joylink.rtss.vo.map.logic.MapAutoReentryVO;
import club.joylink.rtss.vo.map.logic.MapAutoSignalNewVO;
import club.joylink.rtss.vo.map.logic.MapDestinationCodeDefinitionVO;
import club.joylink.rtss.vo.map.logic.MapOverlapVO;
import club.joylink.rtss.vo.map.logic.MapRouteFlankProtectionNewVO;
import club.joylink.rtss.vo.map.logic.MapRouteNewVO;
import club.joylink.rtss.vo.map.logic.MapRoutingDataVO;
import club.joylink.rtss.vo.map.logic.MapSignalApproachSectionVO;
import club.joylink.rtss.vo.map.logic.MapStationRunLevelVO;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Stack;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.stream.Collectors;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -23,11 +59,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.stream.Collectors;
@Slf4j
@Service
public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
@ -46,9 +77,11 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
public CiGenerateResultVO generate(Long mapId) {
// 先校验地图基础数据
MapVO mapVO = this.draftMapService.getDraftMapData(mapId);
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildBasicMapData(mapVO);
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildBasicMapData(
mapVO);
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
String.format("地图基础数据有错误: %s", JsonUtils.writeValueAsString(buildResult.getErrMsgList())));
String.format("地图基础数据有错误: %s",
JsonUtils.writeValueAsString(buildResult.getErrMsgList())));
MapCiGenerateConfig generateConfig = mapVO.getGraphDataNew().getGenerateConfig();
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
// 联锁关系数据生成
@ -90,7 +123,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
autoReentryVOList.add(MapAutoReentryVO.fromBO(cycle));
}
// 目的地码
List<MapDestinationCodeDefinitionVO> destinationCodeDefinitionVOList = result.getDestinationCodeDefinitionList().stream()
List<MapDestinationCodeDefinitionVO> destinationCodeDefinitionVOList = result.getDestinationCodeDefinitionList()
.stream()
.map(MapDestinationCodeDefinitionVO::fromBO).collect(Collectors.toList());
// 删除旧联锁数据保存新联锁数据
@ -106,9 +140,11 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
public int generateDepot(Long mapId, String stationCode) {
// 先校验地图基础数据
MapVO mapVO = this.draftMapService.getDraftMapData(mapId);
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildBasicMapData(mapVO);
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildBasicMapData(
mapVO);
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
String.format("地图基础数据有错误: %s", JsonUtils.writeValueAsString(buildResult.getErrMsgList())));
String.format("地图基础数据有错误: %s",
JsonUtils.writeValueAsString(buildResult.getErrMsgList())));
MapCiGenerateConfig generateConfig = mapVO.getGraphDataNew().getGenerateConfig();
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
// 处理旧数据
@ -141,13 +177,17 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
// 列车兼调车信号机调车信号机
if (signal.getType().equals(Signal.SignalType.SHUNTING2)) {
signal.setType(Signal.SignalType.SHUNTING);
generatedRouteList.addAll(this.generateRouteDepot(signal, routeCodeGenerator, generateConfig, errorList));
generatedRouteList.addAll(
this.generateRouteDepot(signal, routeCodeGenerator, generateConfig, errorList));
signal.setType(Signal.SignalType.SHUNTING2);
generatedRouteList.addAll(this.generateRouteDepot(signal, routeCodeGenerator, generateConfig, errorList));
generatedRouteList.addAll(
this.generateRouteDepot(signal, routeCodeGenerator, generateConfig, errorList));
} else if (signal.getType().equals(Signal.SignalType.SHUNTING)) {
generatedRouteList.addAll(this.generateRouteDepot(signal, routeCodeGenerator, generateConfig, errorList));
generatedRouteList.addAll(
this.generateRouteDepot(signal, routeCodeGenerator, generateConfig, errorList));
} else if (signal.getType().equals(Signal.SignalType.INBOUND)) {
generatedRouteList.addAll(this.generateRouteDepot(signal, routeCodeGenerator, generateConfig, errorList));
generatedRouteList.addAll(
this.generateRouteDepot(signal, routeCodeGenerator, generateConfig, errorList));
}
}
log.info(String.format("生成一般进路[%s]条", generatedRouteList.size()));
@ -170,6 +210,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
* 唯一编码生成器
*/
public static class CodeGenerator {
public static final String Prefix_Route = "Route";
public static final String Prefix_Overlap = "Overlap";
public static final String Prefix_Fls = "Fls";
@ -221,6 +262,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
@Getter
private class CiGenerateResult {
private List<String> errMsgList;
private List<Signal> approachList;
@ -233,8 +275,10 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
List<MapRoutingDataVO> routingList;
public CiGenerateResult(List<String> errMsgList, List<Signal> approachList, List<AutoSignal> autoSignalList, List<Route> routeList,
List<RouteOverlap> overlapList, List<RouteFls> flsList, List<Cycle> generateCycleList, List<MapRoutingDataVO> routingList,
public CiGenerateResult(List<String> errMsgList, List<Signal> approachList,
List<AutoSignal> autoSignalList, List<Route> routeList,
List<RouteOverlap> overlapList, List<RouteFls> flsList, List<Cycle> generateCycleList,
List<MapRoutingDataVO> routingList,
List<DestinationCodeDefinition> destinationCodeDefinitionList) {
this.errMsgList = errMsgList;
this.approachList = approachList;
@ -269,7 +313,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
private CiGenerateResult generate(Long mapId, Map<String, MapElement> deviceMap, MapCiGenerateConfig config) {
private CiGenerateResult generate(Long mapId, Map<String, MapElement> deviceMap,
MapCiGenerateConfig config) {
List<String> errorList = new ArrayList<>();
List<AutoSignal> autoSignalList = new ArrayList<>();
List<Route> generatedRouteList = new ArrayList<>();
@ -321,7 +366,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
} else if (signal.isProtectionSignal()) {
// 防护信号机生成进路
if (config.isLikeHa1()) {
generatedRouteList.addAll(this.generateRouteLikeHa1(signal, routeCodeGenerator, overlapMap,
generatedRouteList.addAll(
this.generateRouteLikeHa1(signal, routeCodeGenerator, overlapMap,
overlapCodeGenerator, config, errorList));
} else {
generatedRouteList.addAll(this.generateRoute(signal,
@ -376,7 +422,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
// 根据配置生成折返进路
if (config.isGenerateTbRoute()) {
List<Route> tbRouteList = this.generateTurnBackRoute(generatedRouteList, routeCodeGenerator, config);
List<Route> tbRouteList = this.generateTurnBackRoute(generatedRouteList, routeCodeGenerator,
config);
generatedRouteList.addAll(tbRouteList);
}
// 清除不需要的基本进路
@ -411,7 +458,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
// 生成交路数据
List<MapRoutingDataVO> generateRoutingList = this.routingGenerator.generateAllRouting(deviceMap, errorList);
List<MapRoutingDataVO> generateRoutingList = this.routingGenerator.generateAllRouting(deviceMap,
errorList);
//目的地码生成
List<DestinationCodeDefinition> destinationCodeDefinitionList
@ -422,7 +470,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
generateCycleList, generateRoutingList, destinationCodeDefinitionList);
}
private List<DestinationCodeDefinition> generateDestinationCodeDefinition(MapCiGenerateConfig config, List<Section> sectionList, List<Station> stationList) {
private List<DestinationCodeDefinition> generateDestinationCodeDefinition(
MapCiGenerateConfig config, List<Section> sectionList, List<Station> stationList) {
List<DestinationCodeDefinition> destinationCodeDefinitionList = new ArrayList<>();
if (config.isGenerateDestination()) {
String code = null;
@ -442,9 +491,12 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
for (int i = 0; i < stationList.size(); i++) {
leftStation = stationList.get(i);
if (CollectionUtils.isEmpty(leftStation.getTurnBackList())) //没有折返轨的略过
{
continue;
if (i == stationList.size() - 1)
}
if (i == stationList.size() - 1) {
break;
}
List<Section> leftTbSections = queryAfterTurnBackList(leftStation, false);
leftTbSections.addAll(queryFrontTurnBackList(stationList, leftStation, false));
@ -464,8 +516,10 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
leftFrontTurnBack = startTbSection.isNormalStandTrack();
rightFrontTurnBack = endTbSection.isNormalStandTrack();
destinationCodeDefinitionList.add(
new DestinationCodeDefinition(code, type, description, null, null, right, necessarySections,
leftStation, leftFrontTurnBack, rightStation, rightFrontTurnBack, null, null, null)
new DestinationCodeDefinition(code, type, description, null, null, right,
necessarySections,
leftStation, leftFrontTurnBack, rightStation, rightFrontTurnBack, null, null,
null)
);
}
}
@ -478,7 +532,9 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if (!StringUtils.hasText(destinationCode)) {
continue;
}
destinationCodeDefinitionList.add(new DestinationCodeDefinition(destinationCode, DestinationCodeDefinition.Type.OTHER, section));
destinationCodeDefinitionList.add(
new DestinationCodeDefinition(destinationCode, DestinationCodeDefinition.Type.OTHER,
section));
}
}
}
@ -491,9 +547,11 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
* @param stations 所有车站
* @param right 是否是右端车站
*/
private List<Section> queryFrontTurnBackList(List<Station> stations, Station station, boolean right) {
private List<Section> queryFrontTurnBackList(List<Station> stations, Station station,
boolean right) {
List<Section> turnBackList = station.getTurnBackList();
if (CollectionUtils.isEmpty(turnBackList) || CollectionUtils.isEmpty(station.getAllNormalStands())) {
if (CollectionUtils.isEmpty(turnBackList) || CollectionUtils.isEmpty(
station.getAllNormalStands())) {
return new ArrayList<>();
}
int sn;
@ -513,20 +571,28 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
List<Section> tbSections = new ArrayList<>();
if (right) {
if (rightStandTrack.isTurnBackTrack()
&& !CollectionUtils.isEmpty(CalculateService.queryRoutePathsOnDirection(rightStandTrack, adjacentLeftStandTrack, false, 10))) {
&& !CollectionUtils.isEmpty(
CalculateService.queryRoutePathsOnDirection(rightStandTrack, adjacentLeftStandTrack,
false, 10))) {
tbSections.add(rightStandTrack);
}
if (leftStandTrack.isTurnBackTrack()
&& !CollectionUtils.isEmpty(CalculateService.queryRoutePathsOnDirection(adjacentRightStandTrack, leftStandTrack, true, 10))) {
&& !CollectionUtils.isEmpty(
CalculateService.queryRoutePathsOnDirection(adjacentRightStandTrack, leftStandTrack, true,
10))) {
tbSections.add(leftStandTrack);
}
} else {
if (rightStandTrack.isTurnBackTrack()
&& !CollectionUtils.isEmpty(CalculateService.queryRoutePathsOnDirection(adjacentLeftStandTrack, rightStandTrack, false, 10))) {
&& !CollectionUtils.isEmpty(
CalculateService.queryRoutePathsOnDirection(adjacentLeftStandTrack, rightStandTrack,
false, 10))) {
tbSections.add(rightStandTrack);
}
if (leftStandTrack.isTurnBackTrack()
&& !CollectionUtils.isEmpty(CalculateService.queryRoutePathsOnDirection(leftStandTrack, adjacentRightStandTrack, true, 10))) {
&& !CollectionUtils.isEmpty(
CalculateService.queryRoutePathsOnDirection(leftStandTrack, adjacentRightStandTrack, true,
10))) {
tbSections.add(leftStandTrack);
}
}
@ -545,17 +611,20 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
Section standTrack = station.getNormalStand(right).get(0).getSection();
return turnBackList.stream().filter(section -> !section.isNormalStandTrack())
.filter(section -> !CollectionUtils.isEmpty(CalculateService.queryRoutePathsOnDirection(standTrack, section, right, 10)))
.filter(section -> !CollectionUtils.isEmpty(
CalculateService.queryRoutePathsOnDirection(standTrack, section, right, 10)))
.collect(Collectors.toList());
}
private Collection<? extends Route> generateRouteLikeHa1(Signal signal, CodeGenerator routeCodeGenerator,
private Collection<? extends Route> generateRouteLikeHa1(Signal signal,
CodeGenerator routeCodeGenerator,
Map<String, List<RouteOverlap>> overlapMap,
CodeGenerator overlapCodeGenerator,
MapCiGenerateConfig config, List<String> errorList) {
// 生成ATP信号
List<Route> routeList = new ArrayList<>();
List<Route> atpRouteList = this.generateRoute(signal, routeCodeGenerator, overlapMap, overlapCodeGenerator, config, errorList);
List<Route> atpRouteList = this.generateRoute(signal, routeCodeGenerator, overlapMap,
overlapCodeGenerator, config, errorList);
if (!CollectionUtils.isEmpty(atpRouteList)) {
for (Route route : atpRouteList) {
route.setAtp(true);
@ -567,7 +636,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
}
// 生成地面信号
List<Route> groundRouteList = this.generateGroundRoute(signal, routeCodeGenerator, overlapMap, overlapCodeGenerator, config, errorList);
List<Route> groundRouteList = this.generateGroundRoute(signal, routeCodeGenerator, overlapMap,
overlapCodeGenerator, config, errorList);
if (!CollectionUtils.isEmpty(groundRouteList)) {
for (Route ground : groundRouteList) {
ground.setGround(true);
@ -578,14 +648,16 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
// 生成引导信号
if (!CollectionUtils.isEmpty(groundRouteList)) {
for (Route route : groundRouteList) {
Route guide = this.buildGuideRouteFromGroundRoute(route, routeCodeGenerator, config.isRouteInterlockDoNotIncludeStandHoldTrain());
Route guide = this.buildGuideRouteFromGroundRoute(route, routeCodeGenerator,
config.isRouteInterlockDoNotIncludeStandHoldTrain());
routeList.add(guide);
}
}
return routeList;
}
private Route buildGuideRouteFromGroundRoute(Route route, CodeGenerator routeCodeGenerator, boolean noStandHold) {
private Route buildGuideRouteFromGroundRoute(Route route, CodeGenerator routeCodeGenerator,
boolean noStandHold) {
Route clone = new Route(routeCodeGenerator.next(), route.getName());
clone.setArs(false);
clone.setGuide(true);
@ -616,7 +688,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
List<SectionPath> routePathList = new ArrayList<>();
getRoutePathOf(signal, startSection, true,
new SectionPath(right), routePathList, config, errorList);
List<Route> routeList = this.buildRouteFromPath(signal, routeCodeGenerator, routePathList, overlapMap,
List<Route> routeList = this.buildRouteFromPath(signal, routeCodeGenerator, routePathList,
overlapMap,
overlapCodeGenerator, config, errorList);
return routeList;
}
@ -645,7 +718,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
return routeList;
}
private List<Route> buildRouteFromPath(Signal start, CodeGenerator routeCodeGenerator, List<SectionPath> routePathList,
private List<Route> buildRouteFromPath(Signal start, CodeGenerator routeCodeGenerator,
List<SectionPath> routePathList,
Map<String, List<RouteOverlap>> overlapMap,
CodeGenerator overlapCodeGenerator,
MapCiGenerateConfig config, List<String> errorList) {
@ -690,8 +764,10 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
for (RouteOverlap routeOverlap : overlapList) {
String code = routeCodeGenerator.next();
String name = String.format("%s-%s_%s", start.getName(), endName, index);
Route route = this.buildRoute(code, name, start, end, clickEnd, sectionPath, routeOverlap,
config.isRouteSignalAlwaysGreen(), config.isRouteInterlockDoNotIncludeStandHoldTrain(), singleTrain);
Route route = this.buildRoute(code, name, start, end, clickEnd, sectionPath,
routeOverlap,
config.isRouteSignalAlwaysGreen(),
config.isRouteInterlockDoNotIncludeStandHoldTrain(), singleTrain);
routeList.add(route);
++index;
}
@ -699,7 +775,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
String code = routeCodeGenerator.next();
String name = String.format("%s-%s", start.getName(), endName);
Route route = this.buildRoute(code, name, start, end, clickEnd, sectionPath, null,
config.isRouteSignalAlwaysGreen(), config.isRouteInterlockDoNotIncludeStandHoldTrain(), singleTrain);
config.isRouteSignalAlwaysGreen(),
config.isRouteInterlockDoNotIncludeStandHoldTrain(), singleTrain);
routeList.add(route);
} else {
String code = routeCodeGenerator.next();
@ -709,12 +786,14 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
overlap = overlapList.get(0);
}
Route route = this.buildRoute(code, name, start, end, clickEnd, sectionPath, overlap,
config.isRouteSignalAlwaysGreen(), config.isRouteInterlockDoNotIncludeStandHoldTrain(), singleTrain);
config.isRouteSignalAlwaysGreen(),
config.isRouteInterlockDoNotIncludeStandHoldTrain(), singleTrain);
routeList.add(route);
}
}
} else {
errorList.add(String.format("以[%s(%s)]为始端信号的进路未搜索到", start.getName(), start.getCode()));
errorList.add(
String.format("以[%s(%s)]为始端信号的进路未搜索到", start.getName(), start.getCode()));
}
return routeList;
}
@ -724,11 +803,13 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
boolean right = start.isRight();
Section startSection = start.getSection().getSectionOf(right);
List<SectionPath> routePathList = new ArrayList<>();
getRoutePathOfDepot(start, startSection, new SectionPath(right), routePathList, config, errorList);
getRoutePathOfDepot(start, startSection, new SectionPath(right), routePathList, config,
errorList);
return buildRouteFromPathDepot(start, routeCodeGenerator, routePathList, config, errorList);
}
private List<Route> buildRouteFromPathDepot(Signal startSignal, CodeGenerator routeCodeGenerator, List<SectionPath> routePathList,
private List<Route> buildRouteFromPathDepot(Signal startSignal, CodeGenerator routeCodeGenerator,
List<SectionPath> routePathList,
MapCiGenerateConfig config, List<String> errorList) {
boolean right = startSignal.isRight();
List<Route> routeList = new ArrayList<>();
@ -741,16 +822,20 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
Signal.SignalType endSignalType = Objects.nonNull(endSignal) ? endSignal.getType() : null;
// 反向信号机
Signal endOpSignal = lastSection.getSignalOf(!right);
Signal.SignalType endOpSignalType = Objects.nonNull(endOpSignal) ? endOpSignal.getType() : null;
Signal.SignalType endOpSignalType =
Objects.nonNull(endOpSignal) ? endOpSignal.getType() : null;
Section nextSection = lastSection.getSectionOf(right);
// 下个区段反向信号机
Signal nextOpSignal = Objects.nonNull(nextSection) ? nextSection.getSignalOf(!right) : null;
Signal clickEnd;
SignalAspect signalAspect;
if ((Signal.SignalType.SHUNTING2.equals(endSignalType) && Signal.SignalType.SHUNTING2.equals(startSignalType))
|| (Signal.SignalType.SHUNTING2.equals(endSignalType) && Signal.SignalType.INBOUND.equals(startSignalType))
|| (Signal.SignalType.OUTBOUND.equals(endSignalType) && Signal.SignalType.SHUNTING2.equals(startSignalType))) {
if ((Signal.SignalType.SHUNTING2.equals(endSignalType)
&& Signal.SignalType.SHUNTING2.equals(startSignalType))
|| (Signal.SignalType.SHUNTING2.equals(endSignalType)
&& Signal.SignalType.INBOUND.equals(startSignalType))
|| (Signal.SignalType.OUTBOUND.equals(endSignalType)
&& Signal.SignalType.SHUNTING2.equals(startSignalType))) {
// 列车进路
signalAspect = SignalAspect.Y;
if (Objects.nonNull(endOpSignal) && (Signal.SignalType.SHUNTING2.equals(endOpSignalType)
@ -774,15 +859,18 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
}
String endName = Objects.nonNull(endSignal) ? endSignal.getShowName() : lastSection.getName();
String endName =
Objects.nonNull(endSignal) ? endSignal.getShowName() : lastSection.getName();
// 构建进路
String code = routeCodeGenerator.next();
String name = String.format("%s-%s", startSignal.getShowName(), endName);
Route route = this.buildRouteDepot(code, name, startSignal, endSignal, clickEnd, sectionPath, signalAspect);
Route route = this.buildRouteDepot(code, name, startSignal, endSignal, clickEnd,
sectionPath, signalAspect);
routeList.add(route);
}
} else {
errorList.add(String.format("以[%s(%s)]为始端信号(%s)的进路未搜索到", startSignal.getShowName(),
errorList.add(
String.format("以[%s(%s)]为始端信号(%s)的进路未搜索到", startSignal.getShowName(),
startSignal.getCode(), startSignal.getType()));
}
return routeList;
@ -824,7 +912,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
* @param generatedRouteList
*/
private void deleteBaseRoute(List<Signal> signalList, List<Route> generatedRouteList) {
Map<String, Signal> signalMap = signalList.stream().collect(Collectors.toMap(Signal::getCode, Function.identity()));
Map<String, Signal> signalMap = signalList.stream()
.collect(Collectors.toMap(Signal::getCode, Function.identity()));
List<Route> removeList = new ArrayList<>();
for (Route route : generatedRouteList) {
if (route.isTurnBack()) { // 折返进路不处理
@ -874,7 +963,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
Switch linkedSwitch = aSwitch.queryLinkedSwitch();
if (Objects.nonNull(linkedSwitch)) {
// 联动道岔存在联动道岔定位即为一级侧防
RouteFls.FlsElement flsElement = new RouteFls.FlsElement(new SwitchElement(linkedSwitch, true));
RouteFls.FlsElement flsElement = new RouteFls.FlsElement(
new SwitchElement(linkedSwitch, true));
fls.addLevel1(flsElement);
} else {
// 无联动道岔则从道岔C区段向外查询第一个反向信号机和经过的路径道岔位置构成一级侧防
@ -883,8 +973,10 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
// 尽头区段不需构成侧防
return null;
}
BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue(c.getLeftSection() != null && c.getRightSection() != null,
String.format("道岔区段[%s]关联区段关系异常,只能最多一边关联,实际两边都关联了区段", c.debugStr()));
BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue(
c.getLeftSection() != null && c.getRightSection() != null,
String.format("道岔区段[%s]关联区段关系异常,只能最多一边关联,实际两边都关联了区段",
c.debugStr()));
boolean right = true;
Section startSection = c.getRightSection();
if (c.getLeftSection() != null) { // 左向区段存在方向向左
@ -910,7 +1002,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
relSwitch.isC(firstSection) && relSwitch.isA(pre))) {
normal = false;
}
flsElement = new RouteFls.FlsElement(oppositeSignal, new SwitchElement(relSwitch, normal));
flsElement = new RouteFls.FlsElement(oppositeSignal,
new SwitchElement(relSwitch, normal));
} else {
flsElement = new RouteFls.FlsElement(oppositeSignal);
}
@ -921,7 +1014,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if (next != null) {
if (next.isSwitchTrack() && next.getRelSwitch().isC(next)) {
// C区段一级侧防为此道岔定位
RouteFls.FlsElement flsElement = new RouteFls.FlsElement(new SwitchElement(next.getRelSwitch(), true));
RouteFls.FlsElement flsElement = new RouteFls.FlsElement(
new SwitchElement(next.getRelSwitch(), true));
fls.addLevel1(flsElement);
pre = null;
} else {
@ -966,8 +1060,10 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
// 尽头区段不需构成侧防
return null;
}
BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue(b.getLeftSection() != null && b.getRightSection() != null,
String.format("道岔区段[%s]关联区段关系异常,只能最多一边关联,实际两边都关联了区段", b.debugStr()));
BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue(
b.getLeftSection() != null && b.getRightSection() != null,
String.format("道岔区段[%s]关联区段关系异常,只能最多一边关联,实际两边都关联了区段",
b.debugStr()));
boolean right = true;
Section startSection = b.getRightSection();
if (b.getLeftSection() != null) { // 左向区段存在方向向左
@ -990,9 +1086,11 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
!Objects.equals(aSwitch.queryAxleRelatedOtherSwitch(), relSwitch)) {
Switch remoteSwitch = relSwitch.queryAxleRelatedOtherSwitch();
if (Objects.nonNull(remoteSwitch)) {
flsElement = new RouteFls.FlsElement(oppositeSignal, new SwitchElement(remoteSwitch, true));
flsElement = new RouteFls.FlsElement(oppositeSignal,
new SwitchElement(remoteSwitch, true));
} else {
flsElement = new RouteFls.FlsElement(oppositeSignal, new SwitchElement(relSwitch, true));
flsElement = new RouteFls.FlsElement(oppositeSignal,
new SwitchElement(relSwitch, true));
}
} else {
flsElement = new RouteFls.FlsElement(oppositeSignal);
@ -1003,7 +1101,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if (next != null) {
if (next.isSwitchTrack() && next.getRelSwitch().isC(next)) {
// C区段一级侧防为此道岔定位
RouteFls.FlsElement flsElement = new RouteFls.FlsElement(new SwitchElement(next.getRelSwitch(), true));
RouteFls.FlsElement flsElement = new RouteFls.FlsElement(
new SwitchElement(next.getRelSwitch(), true));
fls.addLevel1(flsElement);
} else {
sectionStack.push(next);
@ -1063,13 +1162,18 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if (station.getSn() > min && station.getSn() < max) {
BusinessExceptionAssertEnum.CI_GENERATE_ERROR
.assertTrue(station.isDepot() || station.isNoDepotAndNoNormalStand(),
String.format("交路[%s]下的站间运行等级[%s]数据间隔车站大于1且间隔中的车站[%s]是正常可停靠车站",
String.format(
"交路[%s]下的站间运行等级[%s]数据间隔车站大于1且间隔中的车站[%s]是正常可停靠车站",
String.format("%s(%s)->%s(%s)",
routingStartSection.getStation().getName(), routingStartSection.getName(),
routingEndSection.getStation().getName(), routingEndSection.getName()),
routingStartSection.getStation().getName(),
routingStartSection.getName(),
routingEndSection.getStation().getName(),
routingEndSection.getName()),
String.format("%s(%s(%s))->%s(%s(%s))",
startSection.getStation().getName(), startSection.getName(), startSection.getCode(),
endSection.getStation().getName(), endSection.getName(), endSection.getCode()),
startSection.getStation().getName(), startSection.getName(),
startSection.getCode(),
endSection.getStation().getName(), endSection.getName(),
endSection.getCode()),
station.getName()));
}
}
@ -1081,14 +1185,17 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
runLevelVO.setEndSectionCode(endSection.getCode());
runLevelVO.setEndStationCode(endSection.getStation().getCode());
runLevelVO.setRight(right);
List<RoutePath> routePaths = CalculateService.queryRoutePathsOnDirection(startSection, endSection, right, 10);
List<RoutePath> routePaths = CalculateService.queryRoutePathsOnDirection(startSection,
endSection, right, 10);
if (CollectionUtils.isEmpty(routePaths)) {
// 未找到反方向再找
routePaths = CalculateService.queryRoutePathsOnDirection(startSection, endSection, !right, 10);
routePaths = CalculateService.queryRoutePathsOnDirection(startSection, endSection, !right,
10);
if (!CollectionUtils.isEmpty(routePaths)) {
log.info(String.format("站间运行等级[%s]与交路[%s]方向相反,实际为[%s]",
String.format("%s(%s(%s))->%s(%s(%s))",
startSection.getStation().getName(), startSection.getName(), startSection.getCode(),
startSection.getStation().getName(), startSection.getName(),
startSection.getCode(),
endSection.getStation().getName(), endSection.getName(), endSection.getCode()),
String.format("%s(%s)->%s(%s)",
routingStartSection.getStation().getName(), routingStartSection.getName(),
@ -1098,8 +1205,10 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
}
if (CollectionUtils.isEmpty(routePaths)) {
log.warn(String.format("站间运行等级数据生成失败:没有找到[%s(%s) ——> %s(%s)]对应方向[%s]的站间",
startSection.getStation().getName(), startSection.getName(), endSection.getStation().getName(), endSection.getName(), right ? "右向" : "左向"));
log.warn(String.format(
"站间运行等级数据生成失败:没有找到[%s(%s) ——> %s(%s)]对应方向[%s]的站间",
startSection.getStation().getName(), startSection.getName(),
endSection.getStation().getName(), endSection.getName(), right ? "右向" : "左向"));
// errorList.add(String.format("站间运行等级数据生成失败:没有找到[%s(%s) ——> %s(%s)]对应方向[%s]的站间",
// startSection.getStation().getName(), startSection.getName(), endSection.getStation().getName(), endSection.getName(), right ? "右向" : "左向"));
continue;
@ -1117,7 +1226,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
}
private void buildAutoSignalRouteConflict(List<AutoSignal> autoSignalList, List<Route> generatedRouteList) {
private void buildAutoSignalRouteConflict(List<AutoSignal> autoSignalList,
List<Route> generatedRouteList) {
if (CollectionUtils.isEmpty(autoSignalList)) {
// 自动信号为空返回
return;
@ -1195,7 +1305,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
}
if (Objects.isNull(basicRoute)) {
errorList.add(String.format("自动折返数据生成失败:折返进路[%s(%s)]的反向基本进路不存在",
errorList.add(
String.format("自动折返数据生成失败:折返进路[%s(%s)]的反向基本进路不存在",
tbRoute.getName(), tbRoute.getCode()));
continue;
}
@ -1310,8 +1421,12 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
String code = routeCodeGenerator.next();
Route tbRoute = new Route(code, name);
// 拷贝进路其他属性
this.copyToTurnBackRoute(route, tbRoute, config.isRouteInterlockDoNotIncludeStandHoldTrain());
this.copyToTurnBackRoute(route, tbRoute,
config.isRouteInterlockDoNotIncludeStandHoldTrain());
tbRoute.setTurnBack(true);
if (config.isTbRouteNameUseEndOppositeSignalName()) {
tbRoute.setDestinationButtonSignal(endOppositeSignal);
}
// 如果生成进路按钮折返进路按钮默认为终端信号机
if (config.isRouteButton()) {
tbRoute.setDestinationButtonSignal(route.getDestination());
@ -1424,7 +1539,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
*/
private Route buildRoute(String code, String name,
Signal start, Signal end, Signal endButton,
SectionPath sectionPath, RouteOverlap routeOverlap, boolean alwaysGreen, boolean noStandHold, boolean singleTrain) {
SectionPath sectionPath, RouteOverlap routeOverlap, boolean alwaysGreen, boolean noStandHold,
boolean singleTrain) {
Route route = new Route(code, name);
route.setInterlockStation(start.getInterlockStation());
route.setStart(start);
@ -1436,7 +1552,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
route.setSingleTrain(singleTrain);
SignalModel signalModel = start.getSignalModel();
switch (signalModel) {
case RGY:{
case RGY: {
route.setAspect(SignalAspect.G);
if (!alwaysGreen && sectionPath.containRpSwitch()) {
route.setAspect(SignalAspect.Y);
@ -1447,7 +1563,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
route.setAspect(SignalAspect.W);
break;
default:
throw BusinessExceptionAssertEnum.DATA_ERROR.exception(String.format("信号机[%s]型号[%s]不正确",
throw BusinessExceptionAssertEnum.DATA_ERROR.exception(
String.format("信号机[%s]型号[%s]不正确",
start.debugStr(), start.getSignalModel()));
}
route.setTurnBack(false);
@ -1641,7 +1758,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
List<SectionPath> triggerPathList = new ArrayList<>();
Section section = signalSection;
// 反方向找触发区段
this.getOverlapTriggerPathOf(end, section, !right, new SectionPath(!right), triggerPathList);
this.getOverlapTriggerPathOf(end, section, !right, new SectionPath(!right),
triggerPathList);
routeOverlap.setTriggerPathList(triggerPathList);
}
overlapList.add(routeOverlap);
@ -1714,7 +1832,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
getOverlapTriggerPathOf(end, relSwitch.getA().getSectionOf(right), right,
tempPath, triggerPathList);
} else {
log.error(String.format("地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段",
log.error(String.format(
"地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段",
section.getName(), section.getCode(),
relSwitch.getName(), relSwitch.getCode()));
return;
@ -1753,7 +1872,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
} else if (Objects.isNull(section)) { // 如果区段不存在就没有延续保护区段
return;
} else if (config.isOverlapOnlySwitch() && !section.isSwitchTrack()) { // 如果只构建道岔延续保护不是道岔区段不构建返回
} else if (config.isOverlapOnlySwitch()
&& !section.isSwitchTrack()) { // 如果只构建道岔延续保护不是道岔区段不构建返回
return;
}
tempPath.addSection(section);
@ -1785,7 +1905,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
// if (config.isCoupleSwitch()) {
// 如果是同一道岔计轴添加另一道岔定位
Switch otherSwitch = relSwitch.queryAxleRelatedOtherSwitch();
if (!config.isGenerateFls() && Objects.nonNull(otherSwitch) && relSwitch.isBConnectTo(otherSwitch)) {
if (!config.isGenerateFls() && Objects.nonNull(otherSwitch) && relSwitch.isBConnectTo(
otherSwitch)) {
rpPath.addSwitchElement(new SwitchElement(otherSwitch, true));
}
// }
@ -1815,13 +1936,15 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
getOverlapPathOf(relSwitch.getA().getSectionOf(right), right,
tempPath, overlapPathList, config, errorList);
} else {
errorList.add(String.format("地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段",
errorList.add(String.format(
"地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段",
section.getName(), section.getCode(),
relSwitch.getName(), relSwitch.getCode()));
return;
}
} else {
getOverlapPathOf(section.getSectionOf(right), right, tempPath, overlapPathList, config, errorList);
getOverlapPathOf(section.getSectionOf(right), right, tempPath, overlapPathList, config,
errorList);
}
}
@ -1883,7 +2006,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if (!config.isGenerateFls() && Objects.nonNull(linkedSwitch)) {
npPath.addSwitchElement(new SwitchElement(linkedSwitch, true));
}
getRoutePathOf(startSignal, relSwitch.getB().getSectionOf(right), ground, npPath, routePathList, config, errorList);
getRoutePathOf(startSignal, relSwitch.getB().getSectionOf(right), ground, npPath,
routePathList, config, errorList);
SectionPath rpPath = tempPath.cloneNew();// 反位路径
rpPath.addSection(relSwitch.getC());
rpPath.addSwitchElement(new SwitchElement(relSwitch, false));
@ -1892,7 +2016,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
// }
// 如果是同一道岔计轴添加另一道岔定位
Switch otherSwitch = relSwitch.queryAxleRelatedOtherSwitch();
if (!config.isGenerateFls() && Objects.nonNull(otherSwitch) && relSwitch.isBConnectTo(otherSwitch)) {
if (!config.isGenerateFls() && Objects.nonNull(otherSwitch) && relSwitch.isBConnectTo(
otherSwitch)) {
rpPath.addSwitchElement(new SwitchElement(otherSwitch, true));
// 另一道岔联动道岔也需要
Switch otherLinkSwitch = otherSwitch.queryLinkedSwitch();
@ -1900,7 +2025,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
rpPath.addSwitchElement(new SwitchElement(otherLinkSwitch, true));
}
}
getRoutePathOf(startSignal, relSwitch.getC().getSectionOf(right), ground, rpPath, routePathList, config, errorList);
getRoutePathOf(startSignal, relSwitch.getC().getSectionOf(right), ground, rpPath,
routePathList, config, errorList);
} else if (relSwitch.isB(section)) {
// 只有一条路径从B->A道岔定位
tempPath.addSection(relSwitch.getA());
@ -1909,7 +2035,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if (!config.isGenerateFls() && Objects.nonNull(linkedSwitch)) {
tempPath.addSwitchElement(new SwitchElement(linkedSwitch, true));
}
getRoutePathOf(startSignal, relSwitch.getA().getSectionOf(right), ground, tempPath, routePathList, config, errorList);
getRoutePathOf(startSignal, relSwitch.getA().getSectionOf(right), ground, tempPath,
routePathList, config, errorList);
} else if (relSwitch.isC(section)) {
// 只有一条路径从C->A道岔反位
tempPath.addSection(relSwitch.getA());
@ -1927,9 +2054,11 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
tempPath.addSwitchElement(new SwitchElement(otherLinkSwitch, true));
}
}
getRoutePathOf(startSignal, relSwitch.getA().getSectionOf(right), ground, tempPath, routePathList, config, errorList);
getRoutePathOf(startSignal, relSwitch.getA().getSectionOf(right), ground, tempPath,
routePathList, config, errorList);
} else {
errorList.add(String.format("地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段",
errorList.add(String.format(
"地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段",
section.getName(), section.getCode(),
relSwitch.getName(), relSwitch.getCode()));
return;
@ -1957,7 +2086,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
if (Objects.isNull(section)) {
Signal lastSignal = tempPath.getLastSection().getSignalOf(!right);
if (Objects.nonNull(lastSignal) && lastSignal.getType().equals(Signal.SignalType.SHUNTING2)) {
if (Objects.nonNull(lastSignal) && lastSignal.getType()
.equals(Signal.SignalType.SHUNTING2)) {
routePathList.add(tempPath);
}
return;
@ -1997,7 +2127,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if (Objects.nonNull(linkedSwitch)) {
npPath.addSwitchElement(new SwitchElement(linkedSwitch, true));
}
getRoutePathOfDepot(startSignal, relSwitch.getB().getSectionOf(right), npPath, routePathList, config, errorList);
getRoutePathOfDepot(startSignal, relSwitch.getB().getSectionOf(right), npPath,
routePathList, config, errorList);
SectionPath rpPath = tempPath.cloneNew();// 反位路径
rpPath.addSection(relSwitch.getC());
rpPath.addSwitchElement(new SwitchElement(relSwitch, false));
@ -2011,7 +2142,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
rpPath.addSwitchElement(new SwitchElement(otherLinkSwitch, true));
}
}
getRoutePathOfDepot(startSignal, relSwitch.getC().getSectionOf(right), rpPath, routePathList, config, errorList);
getRoutePathOfDepot(startSignal, relSwitch.getC().getSectionOf(right), rpPath,
routePathList, config, errorList);
} else if (relSwitch.isB(section)) {
// 只有一条路径从B->A道岔定位
tempPath.addSection(relSwitch.getA());
@ -2020,7 +2152,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if (Objects.nonNull(linkedSwitch)) {
tempPath.addSwitchElement(new SwitchElement(linkedSwitch, true));
}
getRoutePathOfDepot(startSignal, relSwitch.getA().getSectionOf(right), tempPath, routePathList, config, errorList);
getRoutePathOfDepot(startSignal, relSwitch.getA().getSectionOf(right), tempPath,
routePathList, config, errorList);
} else if (relSwitch.isC(section)) {
// 只有一条路径从C->A道岔反位
tempPath.addSection(relSwitch.getA());
@ -2035,9 +2168,11 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
tempPath.addSwitchElement(new SwitchElement(otherLinkSwitch, true));
}
}
getRoutePathOfDepot(startSignal, relSwitch.getA().getSectionOf(right), tempPath, routePathList, config, errorList);
getRoutePathOfDepot(startSignal, relSwitch.getA().getSectionOf(right), tempPath,
routePathList, config, errorList);
} else {
errorList.add(String.format("地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段",
errorList.add(String.format(
"地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段",
section.getName(), section.getCode(),
relSwitch.getName(), relSwitch.getCode()));
return;
@ -2070,7 +2205,9 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
List<Section> logicApproachList = new ArrayList<>();
List<Section> sectionList = sectionPath.getSectionList();
for (Section phySection : sectionList) {
if (len >= 600) break;
if (len >= 600) {
break;
}
if (phySection.isSwitchTrack()) {
len += phySection.getLen();
logicApproachList.add(phySection);
@ -2089,7 +2226,9 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
for (Section logic : sortedList) {
logicApproachList.add(logic);
len += logic.getLen();
if (len >= 600) break;
if (len >= 600) {
break;
}
}
}
sectionPath.setLogicList(logicApproachList);
@ -2098,7 +2237,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
signal.setRouteReleaseTime(config.getRouteReleaseTime());
}
public void getApproachPathOf(Section section, boolean right, Float distance, SectionPath tempPath, MapCiGenerateConfig config, List<SectionPath> results) {
public void getApproachPathOf(Section section, boolean right, Float distance,
SectionPath tempPath, MapCiGenerateConfig config, List<SectionPath> results) {
if (!CollectionUtils.isEmpty(tempPath.getSectionList())) {
// 已经有区段了
if (Objects.isNull(section)) {
@ -2110,7 +2250,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
return;
}
}
if (config.isSignalApproachNotPassPreSignal() && Objects.nonNull(section.getSignalOf(!right))) {
if (config.isSignalApproachNotPassPreSignal() && Objects.nonNull(
section.getSignalOf(!right))) {
results.add(tempPath);
return;
}
@ -2131,33 +2272,39 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
SectionPath npPath = tempPath.cloneNew();// 定位路径
npPath.addSection(relSwitch.getB());
npPath.addSwitchElement(new SwitchElement(relSwitch, true));
getApproachPathOf(relSwitch.getB().getSectionOf(right), right, distance, npPath, config, results);
getApproachPathOf(relSwitch.getB().getSectionOf(right), right, distance, npPath, config,
results);
if (!config.isSignalApproachOnlyNpSwitch()) {
SectionPath rpPath = tempPath.cloneNew();// 反位路径
rpPath.addSection(relSwitch.getC());
rpPath.addSwitchElement(new SwitchElement(relSwitch, false));
getApproachPathOf(relSwitch.getC().getSectionOf(right), right, distance, rpPath, config, results);
getApproachPathOf(relSwitch.getC().getSectionOf(right), right, distance, rpPath, config,
results);
}
} else if (relSwitch.isB(section)) {
// 只有一条路径从B->A道岔定位
tempPath.addSection(section);
tempPath.addSection(relSwitch.getA());
tempPath.addSwitchElement(new SwitchElement(relSwitch, true));
getApproachPathOf(relSwitch.getA().getSectionOf(right), right, distance, tempPath, config, results);
getApproachPathOf(relSwitch.getA().getSectionOf(right), right, distance, tempPath, config,
results);
} else if (relSwitch.isC(section)) {
if (!config.isSignalApproachOnlyNpSwitch() || CollectionUtils.isEmpty(tempPath.getSectionList())) {
if (!config.isSignalApproachOnlyNpSwitch() || CollectionUtils.isEmpty(
tempPath.getSectionList())) {
// 只有一条路径从C->A道岔反位
tempPath.addSection(section);
tempPath.addSection(relSwitch.getA());
tempPath.addSwitchElement(new SwitchElement(relSwitch, false));
getApproachPathOf(relSwitch.getA().getSectionOf(right), right, distance, tempPath, config, results);
getApproachPathOf(relSwitch.getA().getSectionOf(right), right, distance, tempPath, config,
results);
} else {
results.add(tempPath);
return;
}
} else {
throw BusinessExceptionAssertEnum.DATA_ERROR.exception(
String.format("地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段",
String.format(
"地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段",
section.getName(), section.getCode(),
relSwitch.getName(), relSwitch.getCode()));
}
@ -2175,7 +2322,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
* @param autoSignalGenerator
* @param errorList
*/
private AutoSignal generateAutoSignal(Signal signal, CodeGenerator autoSignalGenerator, List<String> errorList) {
private AutoSignal generateAutoSignal(Signal signal, CodeGenerator autoSignalGenerator,
List<String> errorList) {
AutoSignal autoSignal = new AutoSignal(autoSignalGenerator.next());
autoSignal.setSignal(signal);
List<Section> sectionList = new ArrayList<>();
@ -2203,10 +2351,12 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
sectionList.add(nextSwitchSection);
Section next2 = nextSwitchSection.getSectionOf(right);
if (Objects.nonNull(next2) && Objects.equals(next2.getParent(), nextSwitchSection.getParent())) {
if (Objects.nonNull(next2) && Objects.equals(next2.getParent(),
nextSwitchSection.getParent())) {
// 是同一计轴区段添加下一个道岔区段
sectionList.add(next2);
sectionList.add(next2.getRelSwitch().getNextSectionOnBaseSectionAndPosition(next2, true));
sectionList.add(
next2.getRelSwitch().getNextSectionOnBaseSectionAndPosition(next2, true));
}
}
break;

View File

@ -380,9 +380,7 @@ public class Training2PublishService {
if (reqVO.getType() != null) {
or.andTypeEqualTo(reqVO.getType().value());
}
// if(reqVO.getOrgId() !=null){
// or.andOrgIdNotEqualTo(reqVO.getOrgId());
// }
example.setOrderByClause("id desc");
List<PublishedTraining2> list = this.publishedDao.selectByExample(example);
if (CollectionUtils.isEmpty(list)) {
return List.of();

View File

@ -16,8 +16,6 @@ import club.joylink.rtss.simulation.cbtc.GroupSimulationService;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.SimulationLifeCycleService;
import club.joylink.rtss.simulation.cbtc.SimulationService;
import club.joylink.rtss.simulation.cbtc.conversation.ConversationGroup;
import club.joylink.rtss.simulation.cbtc.conversation.ConversationMember;
import club.joylink.rtss.simulation.cbtc.data.map.Switch;
import club.joylink.rtss.simulation.cbtc.data.vo.ConversationMessageVO;
import club.joylink.rtss.simulation.cbtc.data.vo.Training2MessageVO;
@ -317,9 +315,12 @@ public class Training2Service {
Map<Long, Float> scoreMap = new HashMap<>();
if (!CollectionUtils.isEmpty(training2.getScoringRules())) {
training2.getScoringRules().stream()
.filter(score -> Objects.equals(score.getMember().getId(), member.getId()))
.findFirst().ifPresent(scoringRule2 -> scoringRule2.getDetails()
.forEach(d -> scoreMap.put(d.getStep().getId(), d.getScore())));
.flatMap(sr -> sr.getDetails().stream())
.forEach(d -> scoreMap.put(d.getStep().getId(), d.getScore()));
// training2.getScoringRules().stream()
//// .filter(score -> Objects.equals(score.getMember().getId(), member.getId()))
// .findFirst().ifPresent(scoringRule2 -> scoringRule2.getDetails()
// .forEach(d -> scoreMap.put(d.getStep().getId(), d.getScore())));
}
// 前端传回的步骤信息
Map<Long, PaperTrainAnswerDetail> answerDetailMap = new HashMap<>();
@ -327,20 +328,23 @@ public class Training2Service {
scoreDetailList.forEach(d -> answerDetailMap.put(d.getStepId(), d));
}
return training2.getSteps().stream()
.filter(s -> Objects.equals(s.getSimulationMember().getId(), member.getId()))
// .filter(s -> Objects.equals(s.getSimulationMember().getId(), member.getId()))
.map(step -> {
PaperTrainAnswerDetail detail = new PaperTrainAnswerDetail();
detail.setStepId(step.getId());
detail.setHaveRule(scoreMap.containsKey(step.getId()));
detail.setRuleScore(scoreMap.get(step.getId()));
if (!Objects.equals(step.getSimulationMember().getId(), member.getId())) {
detail.setSuccess(true);
detail.setScore(detail.getRuleScore());
} else {
if (answerDetailMap.containsKey(step.getId())) {
detail.setSuccess(answerDetailMap.get(step.getId()).isSuccess());
detail.setScore(
detail.isHaveRule() && detail.isSuccess() ? scoreMap.get(step.getId()) : 0F);
detail.setClientOperations(answerDetailMap.get(step.getId()).getClientOperations());
detail.setNotExistAppend(true);
}
if (detail.isHaveRule()) {
detail.setRuleScore(scoreMap.get(step.getId()));
detail.setScore(
detail.isHaveRule() && detail.isSuccess() ? scoreMap.get(step.getId()) : 0F);
}
return detail;
}).collect(Collectors.toList());

View File

@ -2,6 +2,7 @@ package club.joylink.rtss.services.voice;
import club.joylink.rtss.dao.CompetitionErrorSetDAO;
import club.joylink.rtss.entity.CompetitionErrorSet;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.conversation.SimulationVoiceHandler;
import club.joylink.rtss.util.StrUtils;
import club.joylink.rtss.vo.client.PageQueryVO;
@ -12,8 +13,16 @@ import club.joylink.rtss.vo.client.voice.VoiceRecognitionVO;
import club.joylink.rtss.vo.voice.VoiceVerifyResultVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;
import javax.sound.sampled.AudioFileFormat;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.UnsupportedAudioFileException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
@ -58,9 +67,10 @@ public class VoiceTrainingService implements IVoiceTrainingService {
@Override
public VoiceVerifyResultVO verifyVoice(String contentType, byte[] fileData, String text) {
byte[] monoData = convertToMonoChannel(fileData);
VoiceRecognitionResult voiceRecognitionResult = voiceRecognition(
new VoiceRecognitionVO(fileData, contentType));
boolean match = StrUtils.isMatch(text, voiceRecognitionResult.getResult(), 20);
new VoiceRecognitionVO(monoData, contentType));
boolean match = StrUtils.isMatch(text, voiceRecognitionResult.getResult(), 70);
return new VoiceVerifyResultVO(voiceRecognitionResult.getResult(), match);
}
@ -70,4 +80,40 @@ public class VoiceTrainingService implements IVoiceTrainingService {
result.setResult(simulationVoiceHandler.handle(result.getResult()));
return result;
}
private byte[] convertToMonoChannel(byte[] audioData) {
try {
// 假设输入和输出音频都存储在字节数组中
byte[] outputAudioBytes;
// 将输入音频字节数组转换为音频输入流
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(audioData);
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(byteArrayInputStream);
AudioFormat format = audioInputStream.getFormat();
// 确保输入音频是立体声
if (format.getChannels() != 2) {
System.out.println("Input audio is not stereo.");
return audioData;
}
// 创建单声道格式
AudioFormat monoFormat = new AudioFormat(format.getEncoding(), format.getSampleRate(),
format.getSampleSizeInBits(), 1, format.getFrameSize() / 2, format.getFrameRate(), false);
// 从立体声转换为单声道
AudioInputStream monoInputStream = AudioSystem.getAudioInputStream(monoFormat,
audioInputStream);
// 将单声道音频写入字节数组输出流
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
AudioSystem.write(monoInputStream, AudioFileFormat.Type.WAVE, byteArrayOutputStream);
// 获取输出音频的字节数组
return byteArrayOutputStream.toByteArray();
} catch (UnsupportedAudioFileException | IOException e) {
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception(
String.format("音频转单声道失败:%s", e));
}
}
}

View File

@ -21,6 +21,7 @@ import club.joylink.rtss.vo.client.WebSocketMessageType;
import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
import club.joylink.rtss.websocket.StompMessageService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
@ -102,9 +103,9 @@ public class ATSMessageCollectAndDispatcher {
TrainStatus trainStatus = repository.findStatusByCode(train.getGroupNumber(), TrainStatus.class);
if (Objects.isNull(trainStatus)) {
// if(simulation.getBuildParams().getProdType() == MapPrdTypeEnum.YJDDZH){
if(Objects.equals(simulation.getProject(),MapPrdTypeEnum.YJDDZH.name())){
if (Objects.equals(simulation.getProject(), MapPrdTypeEnum.YJDDZH.name())) {
trainStatus = new YJDDZHTrainStatus(train);
}else{
} else {
trainStatus = new TrainStatus(train);
}
repository.addDeviceInfo(trainStatus);
@ -112,10 +113,11 @@ public class ATSMessageCollectAndDispatcher {
} else {
DeviceStatusVO statusVO;
// if(simulation.getBuildParams().getProdType() == MapPrdTypeEnum.YJDDZH){
if(Objects.equals(simulation.getProject(),MapPrdTypeEnum.YJDDZH.name())){
if (Objects.equals(simulation.getProject(), MapPrdTypeEnum.YJDDZH.name())) {
statusVO = new YJDDZHTrainStatusVO(train);
}else{
statusVO = new TrainStatusVO(train);
} else {
// statusVO = new TrainStatusVO(train);
statusVO = new TrainStatusVO(trainStatus);
}
if (trainStatus.compareAndChange(train, statusVO)) {
totalList.add(statusVO);

View File

@ -413,6 +413,10 @@ public class CiApiServiceImpl2 implements CiApiService {
throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception(
"signalCode和routeCode不能都为空");
}
//开启联锁自动进路的信号机不能办理引导进路需先解除自动进路成都三操作文档
if (signal.getRouteList().stream().anyMatch(Route::isFleetMode)) {
throw BusinessExceptionAssertEnum.OPERATION_FAIL.exception("需先解除自动进路状态");
}
if (route == null && signal.getRouteList().stream().anyMatch(Route::isAnySwitchMasterLock)) {
openGuideAspect4GuideMasterLock(simulation, signal);

View File

@ -113,7 +113,7 @@ public class CiRouteService {
// return new Route.CheckFailMessage(Route.CheckFailReason.SectionFaultOccupied, section);
// }
}
if (!start.isCbtcMode()) {
if (!start.isCbtcMode() && !guide) {
// 后备办理检查
// 区段占用
for (Section section : sectionList) {
@ -584,11 +584,15 @@ public class CiRouteService {
route.setLock(false);
}
}
if (section.isSwitchTrack()) {
switchFaultUnlock(simulation, section.getRelSwitch(), route);
} else {
section.faultUnlock();
if (section.isShowLogic()) {
section.getLogicList().forEach(Section::faultUnlock);
}
}
}
/**
* 列车逐段解锁进路

View File

@ -0,0 +1,43 @@
package club.joylink.rtss.simulation.cbtc.device.real.modbustcp.cgy;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySectionAxleCounter;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.RealDeviceService;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.common.PlcGateway;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.common.RealDeviceConfig;
import club.joylink.rtss.vo.client.project.cgy.CgySectionConfigVO;
import io.netty.buffer.ByteBuf;
import org.springframework.stereotype.Service;
@Service
public class CgySectionServiceImpl implements RealDeviceService {
@Override
public boolean canHandle(RealDeviceConfig deviceConfig) {
return deviceConfig instanceof CgySectionConfig;
}
@Override
public void init(Simulation simulation, RealDeviceConfig deviceConfig) {
}
@Override
public void handle(Simulation simulation, RealDeviceConfig deviceConfig, ByteBuf byteBuf) {
PlcGateway plcGateway = simulation.queryPlcGatewayDevice();
if (plcGateway == null) {
return;
}
CgySectionConfig config = (CgySectionConfig) deviceConfig;
VirtualRealitySectionAxleCounter vrAxleCounter = (VirtualRealitySectionAxleCounter) config.getMapElement();
if (vrAxleCounter == null) {
return;
}
CgySectionConfigVO configVO = config.getConfigVO();
ByteBuf deviceStatus = RealDeviceConfig.getDeviceCoilStatus(byteBuf, configVO.getAddr(),
configVO.getQuantity());
boolean r_occupied = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_occupied());
vrAxleCounter.setOccupy(r_occupied);
}
}

View File

@ -64,7 +64,7 @@ public class CgySignalServiceImpl implements RealDeviceService {
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_zxj(), true, channel);
break;
case Y:
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_ddj(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_ddj(), true, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_lxj(), true, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yxj(), false, channel);
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_zxj(), false, channel);
@ -139,7 +139,8 @@ public class CgySignalServiceImpl implements RealDeviceService {
break;
case G:
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_ddj(), w_ddj,
false, channel);
false,
channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_lxj(), w_lxj, true,
channel);
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yxj(), w_yxj,

View File

@ -7,18 +7,17 @@ import club.joylink.rtss.vo.client.org.OrgVO;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.validation.constraints.NotBlank;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
/**
* 账户对象
@ -28,6 +27,7 @@ import java.util.List;
@Setter
@EqualsAndHashCode
public class AccountVO implements Serializable {
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@ -129,6 +129,11 @@ public class AccountVO implements Serializable {
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
//单位信息
private Long companyId;
@ -163,6 +168,7 @@ public class AccountVO implements Serializable {
this.email = account.getEmail();
this.status = account.getStatus();
this.createTime = account.getCreateTime();
this.updateTime = account.getUpdateTime();
}
public static AccountVO system() {
@ -219,7 +225,8 @@ public class AccountVO implements Serializable {
@Override
public String toString() {
return "UserVO [id=" + id + ", name=" + name + ", nickname=" + nickname + ", mobile=" + mobile + ", email=" + email + ", nationcode="
return "UserVO [id=" + id + ", name=" + name + ", nickname=" + nickname + ", mobile=" + mobile
+ ", email=" + email + ", nationcode="
+ nationcode + ", wxId=" + wxId + "]";
}
@ -269,7 +276,8 @@ public class AccountVO implements Serializable {
@JsonIgnore
public boolean isAdmin() {
return !CollectionUtils.isEmpty(this.roles)
&& (this.roles.contains(BusinessConsts.ROLE_04) || this.roles.contains(BusinessConsts.ROLE_05));
&& (this.roles.contains(BusinessConsts.ROLE_04) || this.roles.contains(
BusinessConsts.ROLE_05));
}
/**

View File

@ -1,10 +1,9 @@
package club.joylink.rtss.vo.map;
import lombok.Getter;
import lombok.Setter;
import java.util.HashSet;
import java.util.Set;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@ -12,57 +11,57 @@ public class MapCiGenerateConfig {
//--------------------联锁数据生成配置start-------------------
/**
*是否类似哈尔滨一号线联锁分为ATP信号地面信号引导信号
* 是否类似哈尔滨一号线联锁分为ATP信号地面信号引导信号
*/
private boolean likeHa1;
/**
*是否生成侧防true-生成侧防不要联动道岔false-不生成侧防用联动道岔
* 是否生成侧防true-生成侧防不要联动道岔false-不生成侧防用联动道岔
*/
private boolean generateFls;
/**
*信号机接近区段只取最近的一个
* 信号机接近区段只取最近的一个
*/
private boolean signalApproachOnlyOne;
/**
*信号机接近区段仅考虑定位道岔
* 信号机接近区段仅考虑定位道岔
*/
private boolean signalApproachOnlyNpSwitch;
/**
*信号机接近区段不跨过前方同向信号机
* 信号机接近区段不跨过前方同向信号机
*/
private boolean signalApproachNotPassPreSignal = true;
/**
*进路名称使用终端信号机同区段反向信号机名称命名true-使用反向如果存在的话false-使用终端信号机命名
* 进路名称使用终端信号机同区段反向信号机名称命名true-使用反向如果存在的话false-使用终端信号机命名
*/
private boolean routeNameUseEndOppositeSignalName;
/**
*是否生成折返进路
* 是否生成折返进路
*/
private boolean generateTbRoute;
/**
*折返进路名称使用终端信号机反向信号机名称
* 折返进路名称使用终端信号机反向信号机名称并且终端按钮亦使用反向信号机-成都三联锁
*/
private boolean tbRouteNameUseEndOppositeSignalName;
/**
*进路始端防护信号机是否总是绿灯true-总是开绿灯false-根据进路中有无反位道岔生成绿灯或黄灯
* 进路始端防护信号机是否总是绿灯true-总是开绿灯false-根据进路中有无反位道岔生成绿灯或黄灯
*/
private boolean routeSignalAlwaysGreen;
/**
*多个延续保护路径生成多条进路:true-生成多条进路false-生成一条进路
* 多个延续保护路径生成多条进路:true-生成多条进路false-生成一条进路
*/
private boolean routeApartByOverlap;
/**
*延续保护是否只构建道岔
* 延续保护是否只构建道岔
*/
private boolean overlapOnlySwitch;
//
@ -74,60 +73,66 @@ public class MapCiGenerateConfig {
private float overlapMinLen = 55;
/**
*延续保护道岔是否只构建定位道岔
* 延续保护道岔是否只构建定位道岔
*/
private boolean overlapSwitchNpOnly;
/**
*延续保护道岔在防护信号机与所属区段方向相反时只构建定位道岔
* 延续保护道岔在防护信号机与所属区段方向相反时只构建定位道岔
*/
private boolean overlapSignalOppositeSwitchNpOnly;
/**
*延续保护的建立方式true-通过触发建立false-随进路建立
* 延续保护的建立方式true-通过触发建立false-随进路建立
*/
private boolean overlapSettingByTrigger;
/**
*默认延续保护解锁时间
* 默认延续保护解锁时间
*/
private int overlapReleaseTime = 60;
/**
*默认进路解锁时间
* 默认进路解锁时间
*/
private int routeReleaseTime = 45;
/**
*是否生成自动折返
* 是否生成自动折返
*/
private boolean generateCycle;
/**
*是否生成进路信号按钮
* 是否生成进路信号按钮
*/
private boolean routeButton;
/**
*若生成进路信号按钮进路信号按钮是否取最近的一个信号机
* 若生成进路信号按钮进路信号按钮是否取最近的一个信号机
*/
private boolean getNearlySignal;
/**
*是否生成目的地码定义泰雷兹式
* 是否生成目的地码定义泰雷兹式
*/
private boolean generateDestination;
/** 上下行站台共享紧急关闭效果的车站 */
/**
* 上下行站台共享紧急关闭效果的车站
*/
private Set<String> sharingECStations = new HashSet<>();
/** 进路联锁不包含站台扣车 */
/**
* 进路联锁不包含站台扣车
*/
private boolean routeInterlockDoNotIncludeStandHoldTrain;
// @ApiModelProperty(value = "是否分开生成ATP联锁和地面信号联锁")
// private boolean apartGroundAndAtp;
/** 是否处理停车场/车辆段逻辑 */
/**
* 是否处理停车场/车辆段逻辑
*/
private boolean handleDepot;
/**

View File

@ -1,11 +1,10 @@
package club.joylink.rtss.vo.paper;
import club.joylink.rtss.vo.client.training2.Operation2VO;
import java.util.List;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@NoArgsConstructor
public class PaperTrainAnswerDetail {
@ -41,8 +40,7 @@ public class PaperTrainAnswerDetail {
*/
private List<TrainOperations> clientOperations;
public static class TrainOperations extends Operation2VO.ClientOperation2VO{
public static class TrainOperations extends Operation2VO.ClientOperation2VO {
}
}