Compare commits
38 Commits
Author | SHA1 | Date | |
---|---|---|---|
508b8fa086 | |||
|
3c9aeb82f6 | ||
81074bbb2a | |||
82682452a1 | |||
f14e377565 | |||
b302bb360b | |||
1e2ed4d305 | |||
436a07bcf4 | |||
235f4dce5b | |||
ac87b0dbe9 | |||
3536ff75ad | |||
f57952b755 | |||
9c9e7c60e3 | |||
98abf0691a | |||
16e8dc191f | |||
|
4f151fae4a | ||
|
e93171e958 | ||
4cd80bbec5 | |||
8125e32d7e | |||
e23864fa72 | |||
212773e679 | |||
495681db5d | |||
dbe197eba6 | |||
cee9eda430 | |||
0d10203613 | |||
99a772a050 | |||
ba1e057bce | |||
6187e6d667 | |||
bef6dda6b2 | |||
5d15ba3240 | |||
aae729b637 | |||
2416d21a4f | |||
346a265164 | |||
9921aea15a | |||
3e19150a48 | |||
202037ec55 | |||
5045f6152a | |||
2a47dc5979 |
32
.gitea/workflows/CD_pub_deploy.yaml
Normal file
32
.gitea/workflows/CD_pub_deploy.yaml
Normal file
@ -0,0 +1,32 @@
|
||||
name: 公网服务发布
|
||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 3 * * 1' # 每周一的凌晨3:30
|
||||
|
||||
jobs:
|
||||
Docker-Build-Push:
|
||||
runs-on: joylink-local233
|
||||
steps:
|
||||
- name: 发布到正式环境1
|
||||
uses: https://gitea.joylink.club/appleboy/ssh-action@v1.0.3
|
||||
with:
|
||||
host: ${{ secrets.PUB1_DOMAIN_SSH_HOST }}
|
||||
port: ${{ secrets.PUB1_DOMAIN_SSH_PORT }}
|
||||
username: ${{ secrets.PUB1_DOMAIN_SSH_USER }}
|
||||
password: ${{ secrets.PUB1_DOMAIN_SSH_PASSWORD }}
|
||||
script: |
|
||||
docker rm -f rt-sim-training-service || echo "rt-sim-training-service not exist"
|
||||
docker pull gitea.joylink.club/joylink/rt-sim-training-service:latest
|
||||
docker run --name rt-sim-training-service -it -u root --restart=always -d -e APP_ENV=prd -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:latest
|
||||
- name: 发布到正式环境2
|
||||
uses: https://gitea.joylink.club/appleboy/ssh-action@v1.0.3
|
||||
with:
|
||||
host: ${{ secrets.PUB2_DOMAIN_SSH_HOST }}
|
||||
port: ${{ secrets.PUB2_DOMAIN_SSH_PORT }}
|
||||
username: ${{ secrets.PUB2_DOMAIN_SSH_USER }}
|
||||
password: ${{ secrets.PUB2_DOMAIN_SSH_PASSWORD }}
|
||||
script: |
|
||||
docker rm -f rt-sim-training-service || echo "rt-sim-training-service not exist"
|
||||
docker pull gitea.joylink.club/joylink/rt-sim-training-service:latest
|
||||
docker run --name rt-sim-training-service -it -u root --restart=always -d -e APP_ENV=prd -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:latest
|
@ -56,3 +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 --no-trunc) 2>/dev/null || echo "No dangling images to remove"
|
@ -1,8 +1,8 @@
|
||||
name: CI-master
|
||||
name: 版本发布docker构建并上传
|
||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
types: [ published ]
|
||||
|
||||
jobs:
|
||||
Docker-Build-Push:
|
||||
@ -45,6 +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 --no-trunc) 2>/dev/null || echo "No dangling images to remove"
|
||||
# - name: 发布到本地测试环境
|
||||
# uses: https://gitea.joylink.club/appleboy/ssh-action@v1.0.3
|
||||
# with:
|
7
README.md
Normal file
7
README.md
Normal file
@ -0,0 +1,7 @@
|
||||
# CI、CD说明
|
||||
- 分支主要为develop,local-test,master
|
||||
- 本地233服务器部署方式为push到local-test分支即可触发
|
||||
- 公网服务器发布方式:
|
||||
1. push到master(虽然可以用别的分支,但不建议)
|
||||
2. 在版本发布处发布新版本,触发构建docker镜像
|
||||
3. 待docker镜像构建完成后,点击Actions中CD_pub_deploy.yaml,进入第一个任务,点击重新运行所有任务,进行服务发布
|
23
pom.xml
23
pom.xml
@ -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>
|
||||
|
41
src/main/java/club/joylink/rtss/aop/CgyViewAspect.java
Normal file
41
src/main/java/club/joylink/rtss/aop/CgyViewAspect.java
Normal file
@ -0,0 +1,41 @@
|
||||
package club.joylink.rtss.aop;
|
||||
|
||||
import club.joylink.rtss.services.cgy.CgyStatsService;
|
||||
import club.joylink.rtss.simulation.cbtc.SimulationService;
|
||||
import club.joylink.rtss.vo.client.cgy.CgyThirdPartyLoginInfoVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.AfterReturning;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@Aspect
|
||||
@Slf4j
|
||||
@Component
|
||||
public class CgyViewAspect {
|
||||
|
||||
private CgyStatsService cgyStatsService;
|
||||
private RestTemplate restTemplate;
|
||||
private SimulationService simulationService;
|
||||
|
||||
|
||||
@Autowired
|
||||
public CgyViewAspect(CgyStatsService cgyStatsService, RestTemplate restTemplate,
|
||||
SimulationService simulationService) {
|
||||
this.cgyStatsService = cgyStatsService;
|
||||
this.restTemplate = restTemplate;
|
||||
this.simulationService = simulationService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 成工院第三方登录接口被调用后,加一个浏览量,并同步给虚仿平台
|
||||
*/
|
||||
@AfterReturning(value = "execution(public * club.joylink.rtss.controller.LoginController.cgyThirdPartyLogin(..))")
|
||||
public void addViewCount(JoinPoint joinPoint) {
|
||||
Object arg = joinPoint.getArgs()[0];
|
||||
CgyThirdPartyLoginInfoVO loginInfoVO = (CgyThirdPartyLoginInfoVO) arg;
|
||||
cgyStatsService.updateView(loginInfoVO.getAppId());
|
||||
}
|
||||
}
|
32
src/main/java/club/joylink/rtss/bo/cgy/CgyStatsBO.java
Normal file
32
src/main/java/club/joylink/rtss/bo/cgy/CgyStatsBO.java
Normal file
@ -0,0 +1,32 @@
|
||||
package club.joylink.rtss.bo.cgy;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 成工院虚仿平台对接统计数据
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@RequiredArgsConstructor
|
||||
public class CgyStatsBO {
|
||||
|
||||
private final String appId;
|
||||
private final String appSecret;
|
||||
private final Long FunctionId;
|
||||
//统计数据是否发生变化
|
||||
private AtomicBoolean change;
|
||||
//浏览量
|
||||
private AtomicLong view;
|
||||
//实训人次
|
||||
private AtomicLong visitor;
|
||||
//实训人数
|
||||
private final Set<Long> userSet = new HashSet<>();
|
||||
//实训时长/s
|
||||
private AtomicLong duration;
|
||||
}
|
@ -70,6 +70,8 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
whiteList.add("/api/v2/paper/composition/oldData/handle");
|
||||
whiteList.add("/api/user/sync");
|
||||
whiteList.add("/dataHandle");
|
||||
//modbus测试
|
||||
whiteList.add("/api/test/modbus/writeCoil");
|
||||
|
||||
registry.addInterceptor(authenticateInterceptor).excludePathPatterns(whiteList);
|
||||
}
|
||||
|
@ -6,5 +6,6 @@ public interface ProjectCode {
|
||||
String SR_SANDBOX = "SR_SANDBOX";
|
||||
String NGY_SAND_TABLE = "NGY_SAND_TABLE";
|
||||
String CDGXY = "CDGXY";
|
||||
String CGY = "CGY";
|
||||
|
||||
}
|
||||
|
@ -7,13 +7,19 @@ import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.client.LoginStatusVO;
|
||||
import club.joylink.rtss.vo.client.LoginUserVO;
|
||||
import club.joylink.rtss.vo.client.cgy.CgyThirdPartyLoginInfoVO;
|
||||
import club.joylink.rtss.vo.client.validGroup.LoginInfoCheck;
|
||||
import club.joylink.rtss.vo.client.validGroup.ThirdLoginInfoCheck;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
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.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/login")
|
||||
@ -22,8 +28,14 @@ public class LoginController {
|
||||
@Autowired
|
||||
private IAuthenticateService iAuthenticateService;
|
||||
|
||||
@PostMapping("/cgy/third")
|
||||
public String cgyThirdPartyLogin(@RequestBody @Validated CgyThirdPartyLoginInfoVO loginInfo) {
|
||||
return this.iAuthenticateService.cgyThirdPartyLogin(loginInfo);
|
||||
}
|
||||
|
||||
@PostMapping(path = "/third")
|
||||
public String thirdPartyLogin(@RequestBody @Validated(ThirdLoginInfoCheck.class) LoginUserVO loginInfo) {
|
||||
public String thirdPartyLogin(
|
||||
@RequestBody @Validated(ThirdLoginInfoCheck.class) LoginUserVO loginInfo) {
|
||||
return this.iAuthenticateService.thirdPartyLogin(loginInfo);
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ import club.joylink.rtss.vo.paper.CreatePaperCompositionRspVo;
|
||||
import club.joylink.rtss.vo.paper.FindPaperCompositionByAccountReqVo;
|
||||
import club.joylink.rtss.vo.paper.FindPaperCompositionPageReqVo;
|
||||
import club.joylink.rtss.vo.paper.PaperCompositionWithRuleVo;
|
||||
import club.joylink.rtss.vo.paper.PaperCompositionWithRuleVo.CreatorBasic;
|
||||
import java.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -109,6 +110,14 @@ public class PaperCompositionController {
|
||||
return this.compositionService.findPaperCompositionByPage(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询试卷的创建者的信息
|
||||
*/
|
||||
@PostMapping("/list/creatorInfo")
|
||||
public List<CreatorBasic> queryCreatorList(@RequestBody FindPaperCompositionPageReqVo req) {
|
||||
return compositionService.queryCreatorList(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据mapId查询蓝图的基本信息
|
||||
*
|
||||
|
@ -47,12 +47,10 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -591,16 +589,7 @@ public class SimulationV1Controller {
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public List<SimulationInfoVO> queryInfo(SimulationInfoQueryVO queryVO) {
|
||||
List<Simulation> simulationList = this.simulationManager.getSimulationList();
|
||||
Stream<Simulation> stream = simulationList.stream();
|
||||
if (StringUtils.hasText(queryVO.getGroup())) {
|
||||
stream = stream.filter(simulation -> simulation.getId().contains(queryVO.getGroup()));
|
||||
}
|
||||
if (StringUtils.hasText(queryVO.getUserName())) {
|
||||
stream = stream.filter(simulation -> simulation.getSimulationUsers().stream()
|
||||
.anyMatch(user -> user.getName().contains(queryVO.getUserName())));
|
||||
}
|
||||
return stream.map(Simulation::convertToVO).collect(Collectors.toList());
|
||||
return simulationService.listAllSimulation(queryVO);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -4,11 +4,14 @@ import club.joylink.rtss.services.voice.IVoiceTrainingService;
|
||||
import club.joylink.rtss.services.voice.baidu.TokenHolder;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult;
|
||||
import club.joylink.rtss.vo.client.competition.VoiceErrorVO;
|
||||
import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult;
|
||||
import club.joylink.rtss.vo.voice.VoiceVerifyResultVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@ -25,6 +28,7 @@ public class VoiceController {
|
||||
|
||||
/**
|
||||
* 语音识别
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@ -35,6 +39,7 @@ public class VoiceController {
|
||||
|
||||
/**
|
||||
* 查询语音识别错误集
|
||||
*
|
||||
* @param queryVO
|
||||
* @return
|
||||
*/
|
||||
@ -50,4 +55,14 @@ public class VoiceController {
|
||||
public String getBaiduToken() {
|
||||
return TokenHolder.getInstance().getToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验语音识别结果
|
||||
*/
|
||||
@PostMapping("/verify")
|
||||
public VoiceVerifyResultVO verifyVoice(HttpServletRequest request, @RequestBody byte[] fileData,
|
||||
String text) {
|
||||
String contentType = request.getHeader("Content-Type");
|
||||
return iVoiceTrainingService.verifyVoice(contentType, fileData, text);
|
||||
}
|
||||
}
|
||||
|
@ -2,21 +2,22 @@ package club.joylink.rtss.controller.voice;
|
||||
|
||||
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
|
||||
import club.joylink.rtss.services.voice.IVoiceDataConfigService;
|
||||
import club.joylink.rtss.services.voice.IVoiceTrainingService;
|
||||
import club.joylink.rtss.services.voice.baidu.TokenHolder;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.competition.VoiceErrorVO;
|
||||
import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult;
|
||||
import club.joylink.rtss.vo.voice.VoiceDiscriminateConfigVO;
|
||||
import club.joylink.rtss.vo.voice.VoiceQueryVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 语音AI接口
|
||||
* 语音管理接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/voice/manage")
|
||||
@ -27,8 +28,9 @@ public class VoiceManageController {
|
||||
|
||||
|
||||
@PostMapping("saveOrUpdate")
|
||||
public void saveOrUpdate(@RequestBody VoiceDiscriminateConfigVO configVO, @RequestAttribute(name= AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
this.configService.saveOrUpdate(configVO,userInfoVO);
|
||||
public void saveOrUpdate(@RequestBody VoiceDiscriminateConfigVO configVO,
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
this.configService.saveOrUpdate(configVO, userInfoVO);
|
||||
}
|
||||
|
||||
|
||||
@ -38,7 +40,7 @@ public class VoiceManageController {
|
||||
}
|
||||
|
||||
@GetMapping("query")
|
||||
public PageVO<VoiceDiscriminateConfigVO> query(@ModelAttribute VoiceQueryVO queryVO){
|
||||
public PageVO<VoiceDiscriminateConfigVO> query(@ModelAttribute VoiceQueryVO queryVO) {
|
||||
return this.configService.query(queryVO);
|
||||
}
|
||||
|
||||
@ -46,7 +48,9 @@ public class VoiceManageController {
|
||||
* 获取百度语音识别token
|
||||
*/
|
||||
@GetMapping("{id}/{status}")
|
||||
public void changeStatus(@PathVariable(value = "id") Long id,@PathVariable(value = "status")Integer status,@RequestAttribute(name= AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
this.configService.changeStatus(id,status,userInfoVO);
|
||||
public void changeStatus(@PathVariable(value = "id") Long id,
|
||||
@PathVariable(value = "status") Integer status,
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
this.configService.changeStatus(id, status, userInfoVO);
|
||||
}
|
||||
}
|
||||
|
12
src/main/java/club/joylink/rtss/dao/CgyViewDAO.java
Normal file
12
src/main/java/club/joylink/rtss/dao/CgyViewDAO.java
Normal file
@ -0,0 +1,12 @@
|
||||
package club.joylink.rtss.dao;
|
||||
|
||||
import club.joylink.rtss.entity.CgyView;
|
||||
import club.joylink.rtss.entity.CgyViewExample;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* CgyViewDAO继承基类
|
||||
*/
|
||||
@Repository
|
||||
public interface CgyViewDAO extends MyBatisBaseDao<CgyView, String, CgyViewExample> {
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
//package club.joylink.rtss.dao;
|
||||
//
|
||||
//import club.joylink.rtss.entity.Company;
|
||||
//import club.joylink.rtss.entity.CompanyExample;
|
||||
//import org.springframework.stereotype.Repository;
|
||||
//
|
||||
///**
|
||||
// * CompanyDAO继承基类
|
||||
// */
|
||||
////@Repository
|
||||
////public interface CompanyDAO extends MyBatisBaseDao<Company, Integer, CompanyExample> {
|
||||
////}
|
107
src/main/java/club/joylink/rtss/entity/CgyView.java
Normal file
107
src/main/java/club/joylink/rtss/entity/CgyView.java
Normal file
@ -0,0 +1,107 @@
|
||||
package club.joylink.rtss.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* cgy_view
|
||||
* @author
|
||||
*/
|
||||
public class CgyView implements Serializable {
|
||||
/**
|
||||
* 接入虚仿平台后获取
|
||||
*/
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* 接入虚仿平台后获取
|
||||
*/
|
||||
private String appSecret;
|
||||
|
||||
/**
|
||||
* 地图功能id
|
||||
*/
|
||||
private Long functionId;
|
||||
|
||||
/**
|
||||
* 浏览量
|
||||
*/
|
||||
private Long viewCount;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getAppSecret() {
|
||||
return appSecret;
|
||||
}
|
||||
|
||||
public void setAppSecret(String appSecret) {
|
||||
this.appSecret = appSecret;
|
||||
}
|
||||
|
||||
public Long getFunctionId() {
|
||||
return functionId;
|
||||
}
|
||||
|
||||
public void setFunctionId(Long functionId) {
|
||||
this.functionId = functionId;
|
||||
}
|
||||
|
||||
public Long getViewCount() {
|
||||
return viewCount;
|
||||
}
|
||||
|
||||
public void setViewCount(Long viewCount) {
|
||||
this.viewCount = viewCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (that == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != that.getClass()) {
|
||||
return false;
|
||||
}
|
||||
CgyView other = (CgyView) that;
|
||||
return (this.getAppId() == null ? other.getAppId() == null : this.getAppId().equals(other.getAppId()))
|
||||
&& (this.getAppSecret() == null ? other.getAppSecret() == null : this.getAppSecret().equals(other.getAppSecret()))
|
||||
&& (this.getFunctionId() == null ? other.getFunctionId() == null : this.getFunctionId().equals(other.getFunctionId()))
|
||||
&& (this.getViewCount() == null ? other.getViewCount() == null : this.getViewCount().equals(other.getViewCount()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getAppId() == null) ? 0 : getAppId().hashCode());
|
||||
result = prime * result + ((getAppSecret() == null) ? 0 : getAppSecret().hashCode());
|
||||
result = prime * result + ((getFunctionId() == null) ? 0 : getFunctionId().hashCode());
|
||||
result = prime * result + ((getViewCount() == null) ? 0 : getViewCount().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", appId=").append(appId);
|
||||
sb.append(", appSecret=").append(appSecret);
|
||||
sb.append(", functionId=").append(functionId);
|
||||
sb.append(", viewCount=").append(viewCount);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
482
src/main/java/club/joylink/rtss/entity/CgyViewExample.java
Normal file
482
src/main/java/club/joylink/rtss/entity/CgyViewExample.java
Normal file
@ -0,0 +1,482 @@
|
||||
package club.joylink.rtss.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CgyViewExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
private Integer limit;
|
||||
|
||||
private Long offset;
|
||||
|
||||
public CgyViewExample() {
|
||||
oredCriteria = new ArrayList<Criteria>();
|
||||
}
|
||||
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
public void setLimit(Integer limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
public Integer getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setOffset(Long offset) {
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
public Long getOffset() {
|
||||
return offset;
|
||||
}
|
||||
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<Criterion>();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return criteria.size() > 0;
|
||||
}
|
||||
|
||||
public List<Criterion> getAllCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public List<Criterion> getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition) {
|
||||
if (condition == null) {
|
||||
throw new RuntimeException("Value for condition cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value, String property) {
|
||||
if (value == null) {
|
||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||
if (value1 == null || value2 == null) {
|
||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value1, value2));
|
||||
}
|
||||
|
||||
public Criteria andAppIdIsNull() {
|
||||
addCriterion("app_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdIsNotNull() {
|
||||
addCriterion("app_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdEqualTo(String value) {
|
||||
addCriterion("app_id =", value, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdNotEqualTo(String value) {
|
||||
addCriterion("app_id <>", value, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdGreaterThan(String value) {
|
||||
addCriterion("app_id >", value, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("app_id >=", value, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdLessThan(String value) {
|
||||
addCriterion("app_id <", value, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("app_id <=", value, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdLike(String value) {
|
||||
addCriterion("app_id like", value, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdNotLike(String value) {
|
||||
addCriterion("app_id not like", value, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdIn(List<String> values) {
|
||||
addCriterion("app_id in", values, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdNotIn(List<String> values) {
|
||||
addCriterion("app_id not in", values, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdBetween(String value1, String value2) {
|
||||
addCriterion("app_id between", value1, value2, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdNotBetween(String value1, String value2) {
|
||||
addCriterion("app_id not between", value1, value2, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretIsNull() {
|
||||
addCriterion("app_secret is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretIsNotNull() {
|
||||
addCriterion("app_secret is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretEqualTo(String value) {
|
||||
addCriterion("app_secret =", value, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretNotEqualTo(String value) {
|
||||
addCriterion("app_secret <>", value, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretGreaterThan(String value) {
|
||||
addCriterion("app_secret >", value, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("app_secret >=", value, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretLessThan(String value) {
|
||||
addCriterion("app_secret <", value, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretLessThanOrEqualTo(String value) {
|
||||
addCriterion("app_secret <=", value, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretLike(String value) {
|
||||
addCriterion("app_secret like", value, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretNotLike(String value) {
|
||||
addCriterion("app_secret not like", value, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretIn(List<String> values) {
|
||||
addCriterion("app_secret in", values, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretNotIn(List<String> values) {
|
||||
addCriterion("app_secret not in", values, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretBetween(String value1, String value2) {
|
||||
addCriterion("app_secret between", value1, value2, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretNotBetween(String value1, String value2) {
|
||||
addCriterion("app_secret not between", value1, value2, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdIsNull() {
|
||||
addCriterion("function_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdIsNotNull() {
|
||||
addCriterion("function_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdEqualTo(Long value) {
|
||||
addCriterion("function_id =", value, "functionId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdNotEqualTo(Long value) {
|
||||
addCriterion("function_id <>", value, "functionId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdGreaterThan(Long value) {
|
||||
addCriterion("function_id >", value, "functionId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("function_id >=", value, "functionId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdLessThan(Long value) {
|
||||
addCriterion("function_id <", value, "functionId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdLessThanOrEqualTo(Long value) {
|
||||
addCriterion("function_id <=", value, "functionId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdIn(List<Long> values) {
|
||||
addCriterion("function_id in", values, "functionId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdNotIn(List<Long> values) {
|
||||
addCriterion("function_id not in", values, "functionId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdBetween(Long value1, Long value2) {
|
||||
addCriterion("function_id between", value1, value2, "functionId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdNotBetween(Long value1, Long value2) {
|
||||
addCriterion("function_id not between", value1, value2, "functionId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountIsNull() {
|
||||
addCriterion("view_count is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountIsNotNull() {
|
||||
addCriterion("view_count is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountEqualTo(Long value) {
|
||||
addCriterion("view_count =", value, "viewCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountNotEqualTo(Long value) {
|
||||
addCriterion("view_count <>", value, "viewCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountGreaterThan(Long value) {
|
||||
addCriterion("view_count >", value, "viewCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("view_count >=", value, "viewCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountLessThan(Long value) {
|
||||
addCriterion("view_count <", value, "viewCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountLessThanOrEqualTo(Long value) {
|
||||
addCriterion("view_count <=", value, "viewCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountIn(List<Long> values) {
|
||||
addCriterion("view_count in", values, "viewCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountNotIn(List<Long> values) {
|
||||
addCriterion("view_count not in", values, "viewCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountBetween(Long value1, Long value2) {
|
||||
addCriterion("view_count between", value1, value2, "viewCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountNotBetween(Long value1, Long value2) {
|
||||
addCriterion("view_count not between", value1, value2, "viewCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
||||
protected Criteria() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criterion {
|
||||
private String condition;
|
||||
|
||||
private Object value;
|
||||
|
||||
private Object secondValue;
|
||||
|
||||
private boolean noValue;
|
||||
|
||||
private boolean singleValue;
|
||||
|
||||
private boolean betweenValue;
|
||||
|
||||
private boolean listValue;
|
||||
|
||||
private String typeHandler;
|
||||
|
||||
public String getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Object getSecondValue() {
|
||||
return secondValue;
|
||||
}
|
||||
|
||||
public boolean isNoValue() {
|
||||
return noValue;
|
||||
}
|
||||
|
||||
public boolean isSingleValue() {
|
||||
return singleValue;
|
||||
}
|
||||
|
||||
public boolean isBetweenValue() {
|
||||
return betweenValue;
|
||||
}
|
||||
|
||||
public boolean isListValue() {
|
||||
return listValue;
|
||||
}
|
||||
|
||||
public String getTypeHandler() {
|
||||
return typeHandler;
|
||||
}
|
||||
|
||||
protected Criterion(String condition) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.typeHandler = null;
|
||||
this.noValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.typeHandler = typeHandler;
|
||||
if (value instanceof List<?>) {
|
||||
this.listValue = true;
|
||||
} else {
|
||||
this.singleValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value) {
|
||||
this(condition, value, null);
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.secondValue = secondValue;
|
||||
this.typeHandler = typeHandler;
|
||||
this.betweenValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue) {
|
||||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
@ -6,14 +6,19 @@ import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.UserQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.org.OrgVO;
|
||||
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.client.user.WeChatBindStatusVO;
|
||||
import club.joylink.rtss.vo.user.AccountCreateVO;
|
||||
import club.joylink.rtss.vo.user.AccountRegisterVO;
|
||||
import club.joylink.rtss.vo.wx.WmUserSession;
|
||||
import java.util.Map;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import lombok.NonNull;
|
||||
|
||||
public interface ISysUserService {
|
||||
|
||||
@ -337,7 +342,7 @@ public interface ISysUserService {
|
||||
*/
|
||||
List<AccountVO> queryAdminsAndSuperAdmins();
|
||||
|
||||
AccountVO queryOrCreateThirdAccount(String parentAccount, String account);
|
||||
AccountVO queryOrCreateThirdAccount(String parentAccount, String account, @NotEmpty String name);
|
||||
|
||||
AccountVO getThirdAccount(String account);
|
||||
|
||||
@ -358,4 +363,8 @@ public interface ISysUserService {
|
||||
boolean isSameMobileExist(String mobile);
|
||||
|
||||
boolean isSameEmailExist(String email);
|
||||
|
||||
List<AccountVO> listByIds(List<Long> ids);
|
||||
|
||||
List<AccountVO> listAll();
|
||||
}
|
||||
|
@ -6,14 +6,25 @@ import club.joylink.rtss.constants.SystemEnv;
|
||||
import club.joylink.rtss.dao.LearnCommentDAO;
|
||||
import club.joylink.rtss.dao.LearnMessageDAO;
|
||||
import club.joylink.rtss.dao.LearnPostDAO;
|
||||
import club.joylink.rtss.entity.*;
|
||||
import club.joylink.rtss.entity.LearnComment;
|
||||
import club.joylink.rtss.entity.LearnCommentExample;
|
||||
import club.joylink.rtss.entity.LearnMessage;
|
||||
import club.joylink.rtss.entity.LearnMessageExample;
|
||||
import club.joylink.rtss.entity.LearnPost;
|
||||
import club.joylink.rtss.entity.LearnPostExample;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.learn.*;
|
||||
import club.joylink.rtss.vo.client.learn.LearnCommentUpdateVO;
|
||||
import club.joylink.rtss.vo.client.learn.LearnCommentVO;
|
||||
import club.joylink.rtss.vo.client.learn.LearnCreateVO;
|
||||
import club.joylink.rtss.vo.client.learn.LearnMessageUpdateVO;
|
||||
import club.joylink.rtss.vo.client.learn.LearnPostCreateVO;
|
||||
import club.joylink.rtss.vo.client.learn.LearnPostUpdateVO;
|
||||
import club.joylink.rtss.vo.client.learn.LearnPostVO;
|
||||
import club.joylink.rtss.vo.client.post.LearnMessageCreateVO;
|
||||
import club.joylink.rtss.vo.client.post.LearnMessagePagedQueryVO;
|
||||
import club.joylink.rtss.vo.client.post.LearnMessageVO;
|
||||
@ -22,18 +33,23 @@ import club.joylink.rtss.wechat.MiniProgramService;
|
||||
import club.joylink.rtss.wechat.vo.WxError;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@ -48,9 +64,6 @@ public class LearnService implements ILearnService {
|
||||
@Autowired
|
||||
private ISysUserService iSysUserService;
|
||||
|
||||
@Autowired
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
@Autowired
|
||||
private WeChatConfig weChatConfig;
|
||||
|
||||
@ -71,7 +84,8 @@ public class LearnService implements ILearnService {
|
||||
example.createCriteria().andProjectEqualTo(queryVO.getProject());
|
||||
}
|
||||
Page<LearnPost> page = (Page<LearnPost>) learnPostDAO.selectByExample(example);
|
||||
List<LearnPostVO> vos = page.getResult().stream().map(LearnPostVO::new).collect(Collectors.toList());
|
||||
List<LearnPostVO> vos = page.getResult().stream().map(LearnPostVO::new)
|
||||
.collect(Collectors.toList());
|
||||
return PageVO.convert(page, vos);
|
||||
}
|
||||
|
||||
@ -161,11 +175,13 @@ public class LearnService implements ILearnService {
|
||||
}
|
||||
// 回复的用户的昵称
|
||||
if (comment.getParentId() != null) {
|
||||
commentVO.setReplyUserNickName(iSysUserService.findUserById(comment.getParentId()).getNickname());
|
||||
commentVO.setReplyUserNickName(
|
||||
iSysUserService.findUserById(comment.getParentId()).getNickname());
|
||||
}
|
||||
// 回复数
|
||||
LearnCommentExample learnCommentExample = new LearnCommentExample();
|
||||
learnCommentExample.createCriteria().andMessageIdEqualTo(comment.getMessageId()).andRootIdEqualTo(comment.getId());
|
||||
learnCommentExample.createCriteria().andMessageIdEqualTo(comment.getMessageId())
|
||||
.andRootIdEqualTo(comment.getId());
|
||||
commentVO.setCommentCount(learnCommentDAO.countByExample(learnCommentExample));
|
||||
return commentVO;
|
||||
}
|
||||
@ -185,7 +201,8 @@ public class LearnService implements ILearnService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addComment(Long messageId, Long commentId, LearnCreateVO postCreateVO, AccountVO accountVO) {
|
||||
public void addComment(Long messageId, Long commentId, LearnCreateVO postCreateVO,
|
||||
AccountVO accountVO) {
|
||||
checkMessageExist(messageId);
|
||||
if (SystemEnv.isPrdEnv(otherConfig.getEnv())) {
|
||||
this.checkContent(postCreateVO.getContent());
|
||||
@ -241,7 +258,8 @@ public class LearnService implements ILearnService {
|
||||
//删除留言
|
||||
LearnMessageExample messageExample = new LearnMessageExample();
|
||||
messageExample.createCriteria().andPostIdEqualTo(postId);
|
||||
List<Long> messageIds = learnMessageDAO.selectByExample(messageExample).stream().map(LearnMessage::getId).collect(Collectors.toList());
|
||||
List<Long> messageIds = learnMessageDAO.selectByExample(messageExample).stream()
|
||||
.map(LearnMessage::getId).collect(Collectors.toList());
|
||||
learnMessageDAO.deleteByExample(messageExample);
|
||||
//删除评论
|
||||
LearnCommentExample commentExample = new LearnCommentExample();
|
||||
@ -268,7 +286,8 @@ public class LearnService implements ILearnService {
|
||||
|
||||
@Override
|
||||
public long createMessage(LearnMessageCreateVO messageCreateVO, AccountVO user) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(StringUtils.hasText(messageCreateVO.getContent()),
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
|
||||
StringUtils.hasText(messageCreateVO.getContent()),
|
||||
"内容不能空白");
|
||||
if (SystemEnv.isPrdEnv(otherConfig.getEnv())) {
|
||||
this.checkContent(messageCreateVO.getContent());
|
||||
@ -281,7 +300,8 @@ public class LearnService implements ILearnService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageVO<LearnMessageVO> pagedQueryMessageByPostId(Long postId, LearnMessagePagedQueryVO queryVO) {
|
||||
public PageVO<LearnMessageVO> pagedQueryMessageByPostId(Long postId,
|
||||
LearnMessagePagedQueryVO queryVO) {
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
Page<LearnMessageVO> page = (Page<LearnMessageVO>) learnMessageDAO.select(postId, queryVO);
|
||||
for (LearnMessageVO vo : page.getResult()) {
|
||||
@ -318,7 +338,8 @@ public class LearnService implements ILearnService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageVO<LearnMessageVO> pagedQueryMessageByProject(String project, LearnMessagePagedQueryVO queryVO) {
|
||||
public PageVO<LearnMessageVO> pagedQueryMessageByProject(String project,
|
||||
LearnMessagePagedQueryVO queryVO) {
|
||||
LearnPostVO post = queryPost(project);
|
||||
if (post == null) {
|
||||
log.error(String.format("项目[%s]的留言板不存在", project));
|
||||
@ -331,15 +352,17 @@ public class LearnService implements ILearnService {
|
||||
public void updatePost(Long postId, LearnPostUpdateVO updateVO, AccountVO user) {
|
||||
iSysUserService.confirmAdmin(user);
|
||||
LearnPost entity = getPostEntity(postId);
|
||||
if (Objects.equals(updateVO.getTitle(), entity.getTitle()))
|
||||
if (Objects.equals(updateVO.getTitle(), entity.getTitle())) {
|
||||
return;
|
||||
}
|
||||
entity.setTitle(updateVO.getTitle());
|
||||
learnPostDAO.updateByPrimaryKey(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long cgyCreateMessage(LearnMessageCreateVO messageCreateVO) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(StringUtils.hasText(messageCreateVO.getContent()),
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
|
||||
StringUtils.hasText(messageCreateVO.getContent()),
|
||||
"内容不能空白");
|
||||
LearnMessage message = messageCreateVO.convert2DB(1L);
|
||||
message.setCreatorId(null);
|
||||
@ -407,10 +430,13 @@ public class LearnService implements ILearnService {
|
||||
example.createCriteria().andPostIdEqualTo(27L);
|
||||
List<LearnMessage> allMessage = learnMessageDAO.selectByExample(example);
|
||||
//删重复数据
|
||||
List<LearnMessage> list = allMessage.stream().collect(Collectors.toMap(LearnMessage::getContent, Function.identity(), (old, newValue) -> old))
|
||||
.values().stream().sorted(Comparator.comparingLong(LearnMessage::getId)).collect(Collectors.toList());
|
||||
List<LearnMessage> list = allMessage.stream().collect(
|
||||
Collectors.toMap(LearnMessage::getContent, Function.identity(), (old, newValue) -> old))
|
||||
.values().stream().sorted(Comparator.comparingLong(LearnMessage::getId))
|
||||
.collect(Collectors.toList());
|
||||
HashSet<LearnMessage> distinctSet = new HashSet<>(list);
|
||||
List<Long> deleteIds = allMessage.stream().filter(message -> !distinctSet.contains(message)).map(LearnMessage::getId).collect(Collectors.toList());
|
||||
List<Long> deleteIds = allMessage.stream().filter(message -> !distinctSet.contains(message))
|
||||
.map(LearnMessage::getId).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(deleteIds)) {
|
||||
example.clear();
|
||||
example.createCriteria().andIdIn(deleteIds);
|
||||
@ -424,7 +450,8 @@ public class LearnService implements ILearnService {
|
||||
dayOffsetList.add(random.nextInt(day));
|
||||
}
|
||||
dayOffsetList.sort((i1, i2) -> i2 - i1);
|
||||
Map<Integer, Long> dayCountMap = dayOffsetList.stream().collect(Collectors.groupingBy(Function.identity(), LinkedHashMap::new, Collectors.counting()));
|
||||
Map<Integer, Long> dayCountMap = dayOffsetList.stream().collect(
|
||||
Collectors.groupingBy(Function.identity(), LinkedHashMap::new, Collectors.counting()));
|
||||
int startIndex = 0;
|
||||
LocalDateTime now = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0);
|
||||
for (Integer dayOffset : dayCountMap.keySet()) {
|
||||
@ -436,7 +463,8 @@ public class LearnService implements ILearnService {
|
||||
}
|
||||
for (int i = startIndex; i < startIndex + dayCount; i++) {
|
||||
LearnMessage message = list.get(i);
|
||||
message.setCreateTime(now.minusDays(dayOffset).plusSeconds(secondsOffsetList.get(i - startIndex)));
|
||||
message.setCreateTime(
|
||||
now.minusDays(dayOffset).plusSeconds(secondsOffsetList.get(i - startIndex)));
|
||||
learnMessageDAO.updateByPrimaryKey(message);
|
||||
}
|
||||
startIndex += dayCount;
|
||||
@ -519,7 +547,8 @@ public class LearnService implements ILearnService {
|
||||
|
||||
private LearnMessage getMessageEntity(Long messageId) {
|
||||
LearnMessage message = findMessageEntity(messageId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(message, String.format("id为[%s]的留言不存在", messageId));
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(message,
|
||||
String.format("id为[%s]的留言不存在", messageId));
|
||||
return message;
|
||||
}
|
||||
|
||||
@ -539,7 +568,8 @@ public class LearnService implements ILearnService {
|
||||
private void confirmPostIsNotExist(String project) {
|
||||
LearnPostExample example = new LearnPostExample();
|
||||
example.createCriteria().andProjectEqualTo(project);
|
||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertTrue(learnPostDAO.countByExample(example) == 0,
|
||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertTrue(
|
||||
learnPostDAO.countByExample(example) == 0,
|
||||
String.format("项目[%s]下留言板已存在", project));
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,12 @@ import club.joylink.rtss.constants.StatusEnum;
|
||||
import club.joylink.rtss.dao.OrgDAO;
|
||||
import club.joylink.rtss.dao.SysAccountDAO;
|
||||
import club.joylink.rtss.dao.UserSubscribeMapper;
|
||||
import club.joylink.rtss.entity.*;
|
||||
import club.joylink.rtss.entity.Org;
|
||||
import club.joylink.rtss.entity.OrgUser;
|
||||
import club.joylink.rtss.entity.SysAccount;
|
||||
import club.joylink.rtss.entity.SysAccountExample;
|
||||
import club.joylink.rtss.entity.UserSubscribe;
|
||||
import club.joylink.rtss.entity.UserSubscribeExample;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.cache.ICacheService;
|
||||
import club.joylink.rtss.services.org.IOrgProjectService;
|
||||
@ -14,10 +19,19 @@ import club.joylink.rtss.services.org.IOrgService;
|
||||
import club.joylink.rtss.services.org.IOrgUserService;
|
||||
import club.joylink.rtss.util.EncryptUtil;
|
||||
import club.joylink.rtss.util.RandomGenerator;
|
||||
import club.joylink.rtss.vo.*;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.SmsResponse;
|
||||
import club.joylink.rtss.vo.UserQueryVO;
|
||||
import club.joylink.rtss.vo.VdCode;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.org.OrgVO;
|
||||
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.client.user.WeChatBindStatusVO;
|
||||
import club.joylink.rtss.vo.map.MapVO;
|
||||
import club.joylink.rtss.vo.user.AccountCreateVO;
|
||||
import club.joylink.rtss.vo.user.AccountRegisterVO;
|
||||
@ -25,6 +39,18 @@ import club.joylink.rtss.vo.wx.WmUserSession;
|
||||
import club.joylink.rtss.vo.wx.WxUserGet;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.NonNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -34,13 +60,6 @@ import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class SysUserService implements ISysUserService {
|
||||
@ -360,7 +379,8 @@ public class SysUserService implements ISysUserService {
|
||||
BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotHasText(account.getWmOpenId(),
|
||||
String.format("用户[%s]已经绑定微信小程序", account.getNickname()));
|
||||
// 如果之前已经存在绑定,解除之前的绑定
|
||||
WmUserSession userSession = this.iWxApiService.getWmUserSession(WxApiService.MiniApp.JoyLink, code);
|
||||
WmUserSession userSession = this.iWxApiService.getWmUserSession(WxApiService.MiniApp.JoyLink,
|
||||
code);
|
||||
String openid = userSession.getOpenid();
|
||||
SysAccountExample example = new SysAccountExample();
|
||||
example.createCriteria()
|
||||
@ -392,7 +412,8 @@ public class SysUserService implements ISysUserService {
|
||||
@Transactional
|
||||
public OrgVO userScanCodeBindCompanyManager(Long userId, Long companyId) {
|
||||
SysAccount sysAccount = sysAccountDAO.selectByPrimaryKey(userId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(sysAccount, String.format("id为[%s]的用户不存在", userId));
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(sysAccount,
|
||||
String.format("id为[%s]的用户不存在", userId));
|
||||
AccountVO accountVO = new AccountVO(sysAccount);
|
||||
OrgVO orgVO = iOrgUserService.userBindCompanyManager(accountVO, companyId);
|
||||
this.loginSessionManager.updateLoginUser(accountVO);
|
||||
@ -655,7 +676,8 @@ public class SysUserService implements ISysUserService {
|
||||
@Override
|
||||
public void updateMobile(Long id, UpdateMobileVO updateMobileVO) {
|
||||
Objects.requireNonNull(id, "用户id不能为空");
|
||||
validateMobileVerificationCode(updateMobileVO.getNationCode(), updateMobileVO.getMobile(), updateMobileVO.getValidCode());
|
||||
validateMobileVerificationCode(updateMobileVO.getNationCode(), updateMobileVO.getMobile(),
|
||||
updateMobileVO.getValidCode());
|
||||
SysAccount account = this.sysAccountDAO.selectByPrimaryKey(id);
|
||||
if (Objects.nonNull(account)) {
|
||||
account.setNationcode(updateMobileVO.getNationCode());
|
||||
@ -666,7 +688,8 @@ public class SysUserService implements ISysUserService {
|
||||
}
|
||||
}
|
||||
|
||||
private void validateMobileVerificationCode(String nationCode, String mobile, String verificationCode) {
|
||||
private void validateMobileVerificationCode(String nationCode, String mobile,
|
||||
String verificationCode) {
|
||||
VdCode vdCode = (VdCode) this.iCacheService.get(nationCode + mobile);
|
||||
// 验证验证码
|
||||
BusinessExceptionAssertEnum.INCORRECT_VERIFICATION_CODE.assertNotNull(vdCode);
|
||||
@ -705,16 +728,20 @@ 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<String> params = new ArrayList<>();
|
||||
params.add(code);
|
||||
params.add(VdCode.CODE_TIMEOUT + "");
|
||||
SmsResponse resp = this.iSmsService.sendValidateCode(mobileInfoVO.getMobile(), mobileInfoVO.getNationCode(), params, ts);
|
||||
SmsResponse resp = this.iSmsService.sendValidateCode(mobileInfoVO.getMobile(),
|
||||
mobileInfoVO.getNationCode(), params, ts);
|
||||
BusinessExceptionAssertEnum.THIRD_SERVICE_CALL_EXCEPTION.assertTrue(resp.getResult() == 0,
|
||||
String.format("短信发送服务调用异常:[result: %s, errmsg: %s]", resp.getResult(), resp.getErrmsg()));
|
||||
iCacheService.putExpired(mobileInfoVO.buildUp(), new VdCode(code, ts), VdCode.CODE_TIMEOUT, TimeUnit.MINUTES);
|
||||
String.format("短信发送服务调用异常:[result: %s, errmsg: %s]", resp.getResult(),
|
||||
resp.getErrmsg()));
|
||||
iCacheService.putExpired(mobileInfoVO.buildUp(), new VdCode(code, ts), VdCode.CODE_TIMEOUT,
|
||||
TimeUnit.MINUTES);
|
||||
log.debug(String.format("短息发送手机%s验证码:[%s]", mobileInfoVO.buildUp(), code));
|
||||
return EncryptUtil.md5(code);
|
||||
}
|
||||
@ -729,7 +756,8 @@ public class SysUserService implements ISysUserService {
|
||||
|
||||
private void updatePwdByMobileVdCode(UpdatePasswordVO updatePasswordVO, SysAccount account) {
|
||||
if (Objects.nonNull(account)) {
|
||||
VdCode vdCode = (VdCode) this.iCacheService.get(account.getNationcode() + account.getMobile());
|
||||
VdCode vdCode = (VdCode) this.iCacheService.get(
|
||||
account.getNationcode() + account.getMobile());
|
||||
BusinessExceptionAssertEnum.INCORRECT_VERIFICATION_CODE.assertNotNull(vdCode);
|
||||
// 验证验证码
|
||||
vdCode.isValidCode(updatePasswordVO.getVfCode());
|
||||
@ -787,7 +815,8 @@ public class SysUserService implements ISysUserService {
|
||||
SysAccountExample example = new SysAccountExample();
|
||||
example.createCriteria().andNameLike(String.format("%%%s%%", name));
|
||||
List<SysAccount> users = sysAccountDAO.selectByExample(example);
|
||||
List<AccountVO> voList = users.stream().map(account -> new AccountVO(account)).collect(Collectors.toList());
|
||||
List<AccountVO> voList = users.stream().map(account -> new AccountVO(account))
|
||||
.collect(Collectors.toList());
|
||||
return voList;
|
||||
}
|
||||
|
||||
@ -800,7 +829,8 @@ public class SysUserService implements ISysUserService {
|
||||
@Override
|
||||
public List<AccountVO> getUsersWithEmail() {
|
||||
SysAccountExample example = new SysAccountExample();
|
||||
example.createCriteria().andMobileIsNotNull().andNationcodeIsNotNull().andStatusEqualTo(BusinessConsts.STATUS_USE);
|
||||
example.createCriteria().andMobileIsNotNull().andNationcodeIsNotNull()
|
||||
.andStatusEqualTo(BusinessConsts.STATUS_USE);
|
||||
List<SysAccount> sysUsers = sysAccountDAO.selectByExample(example);
|
||||
List<AccountVO> users = sysUsers.stream().map(AccountVO::new).collect(Collectors.toList());
|
||||
return users;
|
||||
@ -882,7 +912,8 @@ public class SysUserService implements ISysUserService {
|
||||
|
||||
private SysAccount getEntity(Long id) {
|
||||
SysAccount account = sysAccountDAO.selectByPrimaryKey(id);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(account, String.format("id为[%s]的用户不存在", id));
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(account,
|
||||
String.format("id为[%s]的用户不存在", id));
|
||||
return account;
|
||||
}
|
||||
|
||||
@ -893,7 +924,8 @@ public class SysUserService implements ISysUserService {
|
||||
|
||||
@Override
|
||||
public void register(AccountCreateVO accountCreateVO) {
|
||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(this.isSameEmailExist(accountCreateVO.getEmail()));
|
||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(
|
||||
this.isSameEmailExist(accountCreateVO.getEmail()));
|
||||
SysAccount account = accountCreateVO.toDB();
|
||||
account.setRoles(BusinessConsts.ROLE_01);
|
||||
account.setCreateTime(LocalDateTime.now());
|
||||
@ -918,7 +950,7 @@ public class SysUserService implements ISysUserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountVO queryOrCreateThirdAccount(String parentAccount, String account) {
|
||||
public AccountVO queryOrCreateThirdAccount(String parentAccount, String account, String name) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(parentAccount);
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(account);
|
||||
String key = parentAccount + account;
|
||||
@ -939,9 +971,14 @@ public class SysUserService implements ISysUserService {
|
||||
SysAccount sysAccount = new SysAccount();
|
||||
sysAccount.setAccount(account);
|
||||
sysAccount.setParentAccount(parentAccount);
|
||||
if (StringUtils.hasText(name)) {
|
||||
sysAccount.setName(name);
|
||||
sysAccount.setNickname(name);
|
||||
} else {
|
||||
sysAccount.setNickname(String.format("第三方账户%s", account));
|
||||
}
|
||||
sysAccount.setType(AccountVO.Type_3);
|
||||
String initPassword = EncryptUtil.md5("123456");
|
||||
String initPassword = EncryptUtil.md5(BusinessConsts.DEFAULT_PASSWORD);
|
||||
sysAccount.setPassword(initPassword);
|
||||
sysAccount.setStatus(BusinessConsts.STATUS_USE);
|
||||
sysAccount.setRoles(BusinessConsts.ROLE_01);
|
||||
@ -1017,10 +1054,13 @@ public class SysUserService implements ISysUserService {
|
||||
@Override
|
||||
public void register2(AccountRegisterVO registerVO) {
|
||||
if (StringUtils.hasText(registerVO.getMobile())) {
|
||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(isSameMobileExist(registerVO.getMobile()));
|
||||
validateMobileVerificationCode(registerVO.getNationCode(), registerVO.getMobile(), registerVO.getVerificationCode());
|
||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(
|
||||
isSameMobileExist(registerVO.getMobile()));
|
||||
validateMobileVerificationCode(registerVO.getNationCode(), registerVO.getMobile(),
|
||||
registerVO.getVerificationCode());
|
||||
} else if (StringUtils.hasText(registerVO.getEmail())) {
|
||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(isSameEmailExist(registerVO.getEmail()));
|
||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(
|
||||
isSameEmailExist(registerVO.getEmail()));
|
||||
validateEmailVerificationCode(registerVO.getEmail(), registerVO.getVerificationCode());
|
||||
}
|
||||
SysAccount sysAccount = registerVO.toDB();
|
||||
@ -1072,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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询包含组织信息的用户信息
|
||||
*/
|
||||
@ -1097,7 +1151,8 @@ public class SysUserService implements ISysUserService {
|
||||
* @param account
|
||||
*/
|
||||
private void updateLoginUserInfoWithOrgInfo(SysAccount account) {
|
||||
List<LoginUserInfoVO> loginUserInfoVOS = loginSessionManager.queryLoginInfoByUserId(account.getId());
|
||||
List<LoginUserInfoVO> loginUserInfoVOS = loginSessionManager.queryLoginInfoByUserId(
|
||||
account.getId());
|
||||
if (!CollectionUtils.isEmpty(loginUserInfoVOS)) {
|
||||
for (LoginUserInfoVO loginInfo : loginUserInfoVOS) {
|
||||
AccountVO oldAccountVO = loginInfo.getAccountVO();
|
||||
|
@ -3,6 +3,7 @@ package club.joylink.rtss.services.auth;
|
||||
import club.joylink.rtss.configuration.configProp.OtherConfig;
|
||||
import club.joylink.rtss.configuration.configProp.WeChatConfig;
|
||||
import club.joylink.rtss.constants.Client;
|
||||
import club.joylink.rtss.constants.ProjectCode;
|
||||
import club.joylink.rtss.dao.SysAccountLoginDAO;
|
||||
import club.joylink.rtss.entity.SysAccountLogin;
|
||||
import club.joylink.rtss.entity.project.Project;
|
||||
@ -22,6 +23,7 @@ import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.client.LoginStatusVO;
|
||||
import club.joylink.rtss.vo.client.LoginUserVO;
|
||||
import club.joylink.rtss.vo.client.SocketMessageVO;
|
||||
import club.joylink.rtss.vo.client.cgy.CgyThirdPartyLoginInfoVO;
|
||||
import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
|
||||
import club.joylink.rtss.vo.client.project.ProjectDeviceVO;
|
||||
import club.joylink.rtss.vo.client.project.RelationLoginConfigVO;
|
||||
@ -239,6 +241,24 @@ public class AuthenticateService implements IAuthenticateService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String cgyThirdPartyLogin(CgyThirdPartyLoginInfoVO loginInfo) {
|
||||
BusinessExceptionAssertEnum.INVALID_OPERATION
|
||||
.assertTrue(this.iSysUserService.isThirdParentAccountExist(loginInfo.getParentAccount()),
|
||||
String.format("成工院父账号不存在: %s", loginInfo.getParentAccount()));
|
||||
AccountVO accountVO = this.iSysUserService.queryOrCreateThirdAccount(
|
||||
loginInfo.getParentAccount(),
|
||||
loginInfo.getAccount(),
|
||||
loginInfo.getName());
|
||||
ProjectVO projectVO = projectService.queryLoginProjectByCode(ProjectCode.CGY);
|
||||
// 构造登陆用户信息
|
||||
LoginUserInfoVO loginUserInfo = new LoginUserInfoVO(accountVO, Client.Joylink, projectVO, null);
|
||||
loginUserInfo.setThirdLogin(true);
|
||||
// 执行登录
|
||||
login(loginUserInfo, true);
|
||||
return loginUserInfo.getToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* @update 20221019 去除设置组织信息
|
||||
*/
|
||||
@ -384,8 +404,7 @@ public class AuthenticateService implements IAuthenticateService {
|
||||
.assertTrue(this.iSysUserService.isThirdParentAccountExist(loginInfo.getParentAccount()),
|
||||
String.format("第三方企业账号不存在: %s", loginInfo.getParentAccount()));
|
||||
AccountVO accountVO = this.iSysUserService.queryOrCreateThirdAccount(
|
||||
loginInfo.getParentAccount(),
|
||||
loginInfo.getAccount());
|
||||
loginInfo.getParentAccount(), loginInfo.getAccount(), null);
|
||||
Client client = Client.getByIdAndSecret(loginInfo.getClientId(), loginInfo.getSecret());
|
||||
ProjectVO projectVO = projectService.queryLoginProjectByCode(loginInfo.getProject());
|
||||
// 构造登陆用户信息
|
||||
|
@ -5,6 +5,7 @@ import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.client.LoginStatusVO;
|
||||
import club.joylink.rtss.vo.client.LoginUserVO;
|
||||
import club.joylink.rtss.vo.client.cgy.CgyThirdPartyLoginInfoVO;
|
||||
|
||||
public interface IAuthenticateService {
|
||||
|
||||
@ -64,7 +65,8 @@ public interface IAuthenticateService {
|
||||
* <p>
|
||||
* 测试文档后删除相关注释
|
||||
*/
|
||||
LoginStatusVO getWmLoginUrl(String clientId, String secret, String projectCode, String deviceCode);
|
||||
LoginStatusVO getWmLoginUrl(String clientId, String secret, String projectCode,
|
||||
String deviceCode);
|
||||
|
||||
/**
|
||||
* 微信小程序确认登陆
|
||||
@ -121,4 +123,9 @@ public interface IAuthenticateService {
|
||||
* @param token
|
||||
*/
|
||||
void preLogout(String token);
|
||||
|
||||
/**
|
||||
* 成工业虚仿平台跳转登录接口
|
||||
*/
|
||||
String cgyThirdPartyLogin(CgyThirdPartyLoginInfoVO loginInfo);
|
||||
}
|
||||
|
@ -0,0 +1,171 @@
|
||||
package club.joylink.rtss.services.cgy;
|
||||
|
||||
import club.joylink.rtss.bo.cgy.CgyStatsBO;
|
||||
import club.joylink.rtss.dao.CgyViewDAO;
|
||||
import club.joylink.rtss.entity.CgyView;
|
||||
import club.joylink.rtss.entity.CgyViewExample;
|
||||
import club.joylink.rtss.entity.UserSimulationRecord;
|
||||
import club.joylink.rtss.event.UserSimulationRecordEvent;
|
||||
import club.joylink.rtss.services.user.UserSimulationRecordService;
|
||||
import club.joylink.rtss.simulation.cbtc.SimulationService;
|
||||
import club.joylink.rtss.simulation.vo.SimulationInfoVO;
|
||||
import club.joylink.rtss.util.EncryptUtil;
|
||||
import club.joylink.rtss.vo.client.simulationUsage.SimulationUsageRecordQueryVO;
|
||||
import club.joylink.rtss.vo.client.simulationv1.SimulationInfoQueryVO;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import javax.annotation.PostConstruct;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
/**
|
||||
* 成工院虚仿平台对接统计服务
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class CgyStatsService {
|
||||
|
||||
private CgyViewDAO cgyViewDAO;
|
||||
private UserSimulationRecordService userSimulationRecordService;
|
||||
private SimulationService simulationService;
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
@Autowired
|
||||
public CgyStatsService(CgyViewDAO cgyViewDAO,
|
||||
UserSimulationRecordService userSimulationRecordService,
|
||||
SimulationService simulationService, RestTemplate restTemplate) {
|
||||
this.cgyViewDAO = cgyViewDAO;
|
||||
this.userSimulationRecordService = userSimulationRecordService;
|
||||
this.simulationService = simulationService;
|
||||
this.restTemplate = restTemplate;
|
||||
}
|
||||
|
||||
private final ConcurrentHashMap<String, CgyStatsBO> appStatsMap = new ConcurrentHashMap<>();
|
||||
private final ConcurrentHashMap<Long, CgyStatsBO> functionStatsMap = new ConcurrentHashMap<>();
|
||||
|
||||
@PostConstruct
|
||||
public void makeCache() {
|
||||
List<CgyView> cgyViews = cgyViewDAO.selectByExample(new CgyViewExample());
|
||||
if (CollectionUtils.isEmpty(cgyViews)) {
|
||||
return;
|
||||
}
|
||||
cgyViews.forEach(cgyView -> {
|
||||
CgyStatsBO bo = new CgyStatsBO(cgyView.getAppId(), cgyView.getAppSecret(),
|
||||
cgyView.getFunctionId());
|
||||
bo.setChange(new AtomicBoolean(true));
|
||||
bo.setView(new AtomicLong(cgyView.getViewCount()));
|
||||
makeCache(bo);
|
||||
appStatsMap.put(cgyView.getAppId(), bo);
|
||||
functionStatsMap.put(cgyView.getFunctionId(), bo);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 向虚仿平台同步数据
|
||||
*/
|
||||
@Scheduled(fixedRate = 2000)
|
||||
public void syncData() {
|
||||
appStatsMap.forEach((appId, statsBO) -> {
|
||||
if (!statsBO.getChange().getAndSet(false)) {
|
||||
return;
|
||||
}
|
||||
//同步汇总数据
|
||||
Map<String, Object> body = new HashMap<>();
|
||||
body.put("app_id", appId);
|
||||
body.put("timestamp", System.currentTimeMillis());
|
||||
body.put("view", statsBO.getView().get());
|
||||
body.put("visitor", statsBO.getVisitor().get());
|
||||
body.put("user", statsBO.getUserSet().size());
|
||||
String sb = "app_id=" + body.get("app_id") + "&"
|
||||
+ "timestamp=" + body.get("timestamp") + "&"
|
||||
+ "user=" + body.get("user") + "&"
|
||||
+ "view=" + body.get("view") + "&"
|
||||
+ "visitor=" + body.get("visitor") + "&"
|
||||
+ "app_secret=" + statsBO.getAppSecret();
|
||||
body.put("sign", EncryptUtil.md5(sb).toLowerCase());
|
||||
//扩展字段
|
||||
body.put("duration", statsBO.getDuration().get() / 60); //分钟
|
||||
SimulationInfoQueryVO queryVO = new SimulationInfoQueryVO();
|
||||
queryVO.setFunctionId(statsBO.getFunctionId());
|
||||
List<SimulationInfoVO> sims = simulationService.listAllSimulation(queryVO);
|
||||
body.put("onlineUser", sims.size());
|
||||
|
||||
HttpHeaders httpHeaders = new HttpHeaders();
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_JSON);
|
||||
HttpEntity<Map<String, Object>> httpEntity = new HttpEntity<>(body, httpHeaders);
|
||||
Map<String, String> resBody = restTemplate.postForObject(
|
||||
"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"),
|
||||
resBody.get("data")));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Async("thirdAccountDataSyncExecutor")
|
||||
@EventListener
|
||||
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的浏览量数据
|
||||
*/
|
||||
public void updateView(String appId) {
|
||||
CgyStatsBO cgyStatsBO = appStatsMap.get(appId);
|
||||
if (cgyStatsBO == null) {
|
||||
log.warn(String.format("成工院虚仿平台未知的appId:%s", appId));
|
||||
return;
|
||||
}
|
||||
long count = cgyStatsBO.getView().incrementAndGet();
|
||||
CgyView record = new CgyView();
|
||||
record.setAppId(appId);
|
||||
record.setViewCount(count);
|
||||
CgyViewExample example = new CgyViewExample();
|
||||
example.createCriteria().andAppIdEqualTo(appId).andViewCountLessThan(count);
|
||||
cgyViewDAO.updateByExampleSelective(record, example);
|
||||
cgyStatsBO.getChange().set(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 实训人数、实训人次、实训时长缓存
|
||||
*/
|
||||
private void makeCache(CgyStatsBO bo) {
|
||||
long visitor = 0;
|
||||
long duration = 0;
|
||||
//实训人数、人次、时长
|
||||
List<UserSimulationRecord> records = userSimulationRecordService.listSimulationUsageRecords(
|
||||
new SimulationUsageRecordQueryVO(null, bo.getFunctionId()));
|
||||
if (!CollectionUtils.isEmpty(records)) {
|
||||
visitor = records.size();
|
||||
for (UserSimulationRecord record : records) {
|
||||
bo.getUserSet().add(record.getUserId()); //实训人数
|
||||
duration += record.getDuration();
|
||||
}
|
||||
}
|
||||
bo.setVisitor(new AtomicLong(visitor)); //实训人次
|
||||
bo.setDuration(new AtomicLong(duration)); //实训时长
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
@ -15,6 +15,7 @@ import club.joylink.rtss.exception.PaperExceptionAssert;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.paper.*;
|
||||
import club.joylink.rtss.vo.paper.PaperCompositionWithRuleVo.CreatorBasic;
|
||||
import club.joylink.rtss.vo.paper.convertor.PaperCompositionConvertor;
|
||||
import club.joylink.rtss.vo.paper.convertor.PaperRuleConvertor;
|
||||
import com.github.pagehelper.Page;
|
||||
@ -37,6 +38,7 @@ import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PaperCompositionService {
|
||||
|
||||
@Autowired
|
||||
private PaperCompositionDAO compositionDAO;
|
||||
@Autowired
|
||||
@ -48,15 +50,22 @@ public class PaperCompositionService {
|
||||
* 创建试卷蓝图包括规则定义
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CreatePaperCompositionRspVo createPaperCompositionWithRule(PaperCompositionWithRuleVo req, AccountVO user) {
|
||||
public CreatePaperCompositionRspVo createPaperCompositionWithRule(PaperCompositionWithRuleVo req,
|
||||
AccountVO user) {
|
||||
//根据项目和名称来查,如果存在则结束
|
||||
PaperExceptionAssert.PcNotExisted.assertTrue(Objects.nonNull(req.getMapId()), "请选择对应的线路");
|
||||
List<PaperComposition> pcList = this.findCompositionByCompanyIdAndName(req.getOrgId(), req.getName());
|
||||
PaperExceptionAssert.PcNotExisted.assertTrue(CollectionUtils.isEmpty(pcList), "试卷定义已经存在:orgId=" + req.getOrgId() + " name=" + req.getName());
|
||||
Optional<PaperCompositionWithRuleVo.PaperRuleVo> optionalRule = req.getRuleList().stream().filter(d->d.getSubtype() == PaperQType.SubType.Single
|
||||
&& (Objects.isNull(d.getSubTypeParam()) || Objects.isNull(d.getSubTypeParam().getClient()))).findAny();
|
||||
PaperExceptionAssert.PcNotExisted.assertTrue(Objects.nonNull(req.getMapId()),
|
||||
"请选择对应的线路");
|
||||
List<PaperComposition> pcList = this.findCompositionByCompanyIdAndName(req.getOrgId(),
|
||||
req.getName());
|
||||
PaperExceptionAssert.PcNotExisted.assertTrue(CollectionUtils.isEmpty(pcList),
|
||||
"试卷定义已经存在:orgId=" + req.getOrgId() + " name=" + req.getName());
|
||||
Optional<PaperCompositionWithRuleVo.PaperRuleVo> optionalRule = req.getRuleList().stream()
|
||||
.filter(d -> d.getSubtype() == PaperQType.SubType.Single
|
||||
&& (Objects.isNull(d.getSubTypeParam()) || Objects.isNull(
|
||||
d.getSubTypeParam().getClient()))).findAny();
|
||||
|
||||
PaperExceptionAssert.PcNotHavePr.assertTrue(optionalRule.isEmpty(), "试卷规则-单操缺少客户端的定义");
|
||||
PaperExceptionAssert.PcNotHavePr.assertTrue(optionalRule.isEmpty(),
|
||||
"试卷规则-单操缺少客户端的定义");
|
||||
PaperComposition newPc = PaperCompositionConvertor.convertToBean(req);
|
||||
|
||||
newPc.setCreateTime(LocalDateTime.now());
|
||||
@ -79,24 +88,35 @@ public class PaperCompositionService {
|
||||
return rsp;
|
||||
}
|
||||
|
||||
private String ruleMapKey(PaperCompositionWithRuleVo.PaperRuleVo vo){
|
||||
String key = String.format("%s-%s-%s",vo.getType(),vo.getSubtype(), CollectionUtils.isEmpty(vo.getTags())? "" : Joiner.on(",").join(vo.getTags()));
|
||||
private String ruleMapKey(PaperCompositionWithRuleVo.PaperRuleVo vo) {
|
||||
String key = String.format("%s-%s-%s", vo.getType(), vo.getSubtype(),
|
||||
CollectionUtils.isEmpty(vo.getTags()) ? "" : Joiner.on(",").join(vo.getTags()));
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* 试卷蓝图添加规则
|
||||
*/
|
||||
private void createPaperCompositionRule(Long pcId, List<PaperCompositionWithRuleVo.PaperRuleVo> reqList) {
|
||||
Map<String,List<PaperCompositionWithRuleVo.PaperRuleVo>> tmpList = reqList.stream().collect(Collectors.groupingBy(this::ruleMapKey));
|
||||
private void createPaperCompositionRule(Long pcId,
|
||||
List<PaperCompositionWithRuleVo.PaperRuleVo> reqList) {
|
||||
Map<String, List<PaperCompositionWithRuleVo.PaperRuleVo>> tmpList = reqList.stream()
|
||||
.collect(Collectors.groupingBy(this::ruleMapKey));
|
||||
|
||||
for (PaperCompositionWithRuleVo.PaperRuleVo req : reqList) {
|
||||
req.setPcId(pcId);
|
||||
PaperQType.assertPaperSubTypeMatchGroupType(req.getSubtype(), req.getType());
|
||||
String key = this.ruleMapKey(req);
|
||||
List<PaperCompositionWithRuleVo.PaperRuleVo> voList = tmpList.get(key);
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(!CollectionUtils.isEmpty(voList) && voList.size() <= 1 ,String.format("试题规则类型[%s],规则类型[%s] 规则只能有一个", PaperQType.GroupType.getTypeName(req.getType()), PaperQType.SubType.getItemName(req.getSubtype())));
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(!CollectionUtils.isEmpty(req.getTags()) && req.getTags().size() <= 1 ,String.format("试题规则类型[%s],规则类型[%s],分类%s最多只能有一个", PaperQType.GroupType.getTypeName(req.getType()), PaperQType.SubType.getItemName(req.getSubtype()),req.getTags()));
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
|
||||
!CollectionUtils.isEmpty(voList) && voList.size() <= 1,
|
||||
String.format("试题规则类型[%s],规则类型[%s] 规则只能有一个",
|
||||
PaperQType.GroupType.getTypeName(req.getType()),
|
||||
PaperQType.SubType.getItemName(req.getSubtype())));
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
|
||||
!CollectionUtils.isEmpty(req.getTags()) && req.getTags().size() <= 1,
|
||||
String.format("试题规则类型[%s],规则类型[%s],分类%s最多只能有一个",
|
||||
PaperQType.GroupType.getTypeName(req.getType()),
|
||||
PaperQType.SubType.getItemName(req.getSubtype()), req.getTags()));
|
||||
PaperRule rule = PaperRuleConvertor.convert(req);
|
||||
ruleDAO.insertSelective(rule);
|
||||
}
|
||||
@ -107,18 +127,24 @@ public class PaperCompositionService {
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updatePaperCompositionWithRule(PaperCompositionWithRuleVo req, AccountVO user) {
|
||||
PaperExceptionAssert.PcNotExisted.assertTrue(Objects.nonNull(req.getMapId()), "请选择对应的线路");
|
||||
Optional<PaperCompositionWithRuleVo.PaperRuleVo> optionalRule = req.getRuleList().stream().filter(d->d.getSubtype() == PaperQType.SubType.Single
|
||||
&& (Objects.isNull(d.getSubTypeParam()) || Objects.isNull(d.getSubTypeParam().getClient()))).findAny();
|
||||
PaperExceptionAssert.PcNotHavePr.assertTrue(optionalRule.isEmpty(), "试卷规则-单操缺少客户端的定义");
|
||||
PaperExceptionAssert.PcNotExisted.assertTrue(Objects.nonNull(req.getMapId()),
|
||||
"请选择对应的线路");
|
||||
Optional<PaperCompositionWithRuleVo.PaperRuleVo> optionalRule = req.getRuleList().stream()
|
||||
.filter(d -> d.getSubtype() == PaperQType.SubType.Single
|
||||
&& (Objects.isNull(d.getSubTypeParam()) || Objects.isNull(
|
||||
d.getSubTypeParam().getClient()))).findAny();
|
||||
PaperExceptionAssert.PcNotHavePr.assertTrue(optionalRule.isEmpty(),
|
||||
"试卷规则-单操缺少客户端的定义");
|
||||
|
||||
PaperComposition curPc = compositionDAO.selectByPrimaryKey(req.getId());
|
||||
assertPaperCompositionCanModify(curPc);
|
||||
//
|
||||
List<PaperComposition> pcList = this.findCompositionByCompanyIdAndName(req.getOrgId(), req.getName());
|
||||
List<PaperComposition> pcList = this.findCompositionByCompanyIdAndName(req.getOrgId(),
|
||||
req.getName());
|
||||
if (!CollectionUtils.isEmpty(pcList)) {
|
||||
boolean exist = pcList.stream().anyMatch(c ->c.getId().compareTo(curPc.getId()) != 0);
|
||||
PaperExceptionAssert.PcExisted.assertNotTrue(exist, "试卷定义已经存在:orgId=" + req.getOrgId() + " name=" + req.getName());
|
||||
boolean exist = pcList.stream().anyMatch(c -> c.getId().compareTo(curPc.getId()) != 0);
|
||||
PaperExceptionAssert.PcExisted.assertNotTrue(exist,
|
||||
"试卷定义已经存在:orgId=" + req.getOrgId() + " name=" + req.getName());
|
||||
}
|
||||
PaperComposition newPc = PaperCompositionConvertor.convertToBean(req);
|
||||
newPc.setId(curPc.getId());
|
||||
@ -129,11 +155,12 @@ public class PaperCompositionService {
|
||||
this.updateCompositionRule(req.getRuleList(), req.getId());
|
||||
}
|
||||
|
||||
private void updateCompositionRule(List<PaperCompositionWithRuleVo.PaperRuleVo> updateRuleList, Long pcId) {
|
||||
private void updateCompositionRule(List<PaperCompositionWithRuleVo.PaperRuleVo> updateRuleList,
|
||||
Long pcId) {
|
||||
PaperRuleExample ruleExample = new PaperRuleExample();
|
||||
ruleExample.createCriteria().andPcIdEqualTo(pcId);
|
||||
this.ruleDAO.deleteByExample(ruleExample);
|
||||
this.createPaperCompositionRule(pcId,updateRuleList);
|
||||
this.createPaperCompositionRule(pcId, updateRuleList);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -142,8 +169,11 @@ public class PaperCompositionService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void lockPaperComposition(Long pcId, AccountVO user) {
|
||||
PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId);
|
||||
PaperExceptionAssert.PcCanModify.assertTrue(null != curPc && PaperCompositionState.Editing.equals(PaperCompositionState.getItem(curPc.getState())), "试卷定义不存在或非编辑中");
|
||||
PaperExceptionAssert.PcScore.assertTrue(this.checkRulesScoreEqualFull(curPc.getId()), "规则总分值不等于试卷总分值");
|
||||
PaperExceptionAssert.PcCanModify.assertTrue(
|
||||
null != curPc && PaperCompositionState.Editing.equals(
|
||||
PaperCompositionState.getItem(curPc.getState())), "试卷定义不存在或非编辑中");
|
||||
PaperExceptionAssert.PcScore.assertTrue(this.checkRulesScoreEqualFull(curPc.getId()),
|
||||
"规则总分值不等于试卷总分值");
|
||||
//
|
||||
PaperComposition nPc = new PaperComposition();
|
||||
nPc.setId(curPc.getId());
|
||||
@ -158,7 +188,9 @@ public class PaperCompositionService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void unlockPaperComposition(Long pcId, AccountVO user) {
|
||||
PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId);
|
||||
PaperExceptionAssert.PcCanModify.assertTrue(null != curPc && PaperCompositionState.Locked.equals(PaperCompositionState.getItem(curPc.getState())), "试卷定义不存在或非封存中");
|
||||
PaperExceptionAssert.PcCanModify.assertTrue(
|
||||
null != curPc && PaperCompositionState.Locked.equals(
|
||||
PaperCompositionState.getItem(curPc.getState())), "试卷定义不存在或非封存中");
|
||||
//
|
||||
PaperComposition nPc = new PaperComposition();
|
||||
nPc.setId(curPc.getId());
|
||||
@ -213,12 +245,17 @@ public class PaperCompositionService {
|
||||
* 断言试卷蓝图可以修改
|
||||
*/
|
||||
public void assertPaperCompositionCanModify(PaperComposition curPc) {
|
||||
PaperExceptionAssert.PcCanModify.assertTrue(null != curPc && PaperCompositionState.Editing.equals(PaperCompositionState.getItem(curPc.getState())), "试卷定义不存在或状态非编辑中,不能修改,pcId = " + curPc.getId());
|
||||
PaperExceptionAssert.PcCanModify.assertTrue(
|
||||
null != curPc && PaperCompositionState.Editing.equals(
|
||||
PaperCompositionState.getItem(curPc.getState())),
|
||||
"试卷定义不存在或状态非编辑中,不能修改,pcId = " + curPc.getId());
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public PageVO<PaperCompositionWithRuleVo> findPaperCompositionByPageForAccount(FindPaperCompositionByAccountReqVo req) {
|
||||
PaperExceptionAssert.PpValid.assertTrue(null != req.getAccount() || null != req.getUserId(), "账号和用户id不能同时为空");
|
||||
public PageVO<PaperCompositionWithRuleVo> findPaperCompositionByPageForAccount(
|
||||
FindPaperCompositionByAccountReqVo req) {
|
||||
PaperExceptionAssert.PpValid.assertTrue(null != req.getAccount() || null != req.getUserId(),
|
||||
"账号和用户id不能同时为空");
|
||||
Long userId = req.getUserId();
|
||||
if (null == userId) {
|
||||
SysAccountExample accountExample = new SysAccountExample();
|
||||
@ -242,7 +279,8 @@ public class PaperCompositionService {
|
||||
}
|
||||
//
|
||||
List<SysAccount> users = this.sysAccountDAO.selectByExample(accountExample);
|
||||
PaperExceptionAssert.PdValid.assertTrue(null != users && users.size() == 1, "用户不存在或根据账户信息匹配了多个");
|
||||
PaperExceptionAssert.PdValid.assertTrue(null != users && users.size() == 1,
|
||||
"用户不存在或根据账户信息匹配了多个");
|
||||
userId = users.get(0).getId();
|
||||
}
|
||||
//
|
||||
@ -267,21 +305,21 @@ public class PaperCompositionService {
|
||||
orderBy = "name";
|
||||
break;
|
||||
}
|
||||
orderBy+=(req.getDesc()?" desc":"");
|
||||
orderBy += (req.getDesc() ? " desc" : "");
|
||||
//
|
||||
PageHelper.clearPage();
|
||||
PageHelper.startPage(req.getPageNum(),req.getPageSize(),orderBy);
|
||||
PageHelper.startPage(req.getPageNum(), req.getPageSize(), orderBy);
|
||||
Page<PaperComposition> sqlPage = (Page<PaperComposition>) compositionDAO.selectByExample(pcEx);
|
||||
//
|
||||
final List<PaperCompositionWithRuleVo> rtList = new ArrayList<>();
|
||||
if(!CollectionUtils.isEmpty(sqlPage.getResult())){
|
||||
sqlPage.getResult().forEach(pc->{
|
||||
if (!CollectionUtils.isEmpty(sqlPage.getResult())) {
|
||||
sqlPage.getResult().forEach(pc -> {
|
||||
List<PaperRule> prList = this.findRuleByPcId(pc.getId());
|
||||
rtList.add(PaperCompositionConvertor.convert(pc, prList));
|
||||
});
|
||||
}
|
||||
//
|
||||
PageVO<PaperCompositionWithRuleVo> page = PageVO.convert(sqlPage,rtList);
|
||||
PageVO<PaperCompositionWithRuleVo> page = PageVO.convert(sqlPage, rtList);
|
||||
//
|
||||
if (!CollectionUtils.isEmpty(page.getList())) {
|
||||
page.getList().forEach(pc -> {
|
||||
@ -296,25 +334,26 @@ public class PaperCompositionService {
|
||||
/**
|
||||
* 返回蓝图的列表基本信息
|
||||
*/
|
||||
public List<PaperCompositionWithRuleVo> findPaperCompositionList(FindPaperCompositionPageReqVo req){
|
||||
public List<PaperCompositionWithRuleVo> findPaperCompositionList(
|
||||
FindPaperCompositionPageReqVo req) {
|
||||
PaperCompositionExample pcEx = this.queryExample(req);
|
||||
pcEx.setOrderByClause(" create_time desc ");
|
||||
List<PaperComposition> sqlPage = compositionDAO.selectByExample(pcEx);
|
||||
//
|
||||
final List<PaperCompositionWithRuleVo> rtList = new ArrayList<>();
|
||||
for (PaperComposition pc : sqlPage) {
|
||||
rtList.add(PaperCompositionConvertor.convert(pc,null));
|
||||
rtList.add(PaperCompositionConvertor.convert(pc, null));
|
||||
}
|
||||
return rtList;
|
||||
}
|
||||
|
||||
private PaperCompositionExample queryExample(FindPaperCompositionPageReqVo req){
|
||||
private PaperCompositionExample queryExample(FindPaperCompositionPageReqVo req) {
|
||||
PaperCompositionExample pcEx = new PaperCompositionExample();
|
||||
PaperCompositionExample.Criteria pcExCriteria = pcEx.createCriteria();
|
||||
if (Objects.nonNull(req.getOrgId())) {
|
||||
pcExCriteria.andOrgIdEqualTo(req.getOrgId());
|
||||
}
|
||||
if(Objects.nonNull(req.getMapId())){
|
||||
if (Objects.nonNull(req.getMapId())) {
|
||||
pcExCriteria.andMapIdEqualTo(req.getMapId());
|
||||
}
|
||||
if (StringUtils.hasText(req.getName())) {
|
||||
@ -331,17 +370,22 @@ public class PaperCompositionService {
|
||||
pcExCriteria.andProfileEqualTo(req.getProfile());
|
||||
}
|
||||
}
|
||||
if (req.getCreatorId() != null) {
|
||||
pcExCriteria.andCreatorIdEqualTo(req.getCreatorId());
|
||||
}
|
||||
List<PaperCompositionState> findStates = req.stateList();
|
||||
pcExCriteria.andStateIn(findStates.stream().map(pcState -> {
|
||||
return pcState.getValue();
|
||||
}).collect(Collectors.toList()));
|
||||
return pcEx;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查找试卷蓝图
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public PageVO<PaperCompositionWithRuleVo> findPaperCompositionByPage(FindPaperCompositionPageReqVo req) {
|
||||
public PageVO<PaperCompositionWithRuleVo> findPaperCompositionByPage(
|
||||
FindPaperCompositionPageReqVo req) {
|
||||
PaperCompositionExample pcEx = this.queryExample(req);
|
||||
//
|
||||
//1--创建时间 2--更新时间 3--名称;默认值为1;
|
||||
@ -357,21 +401,21 @@ public class PaperCompositionService {
|
||||
orderBy = "name";
|
||||
break;
|
||||
}
|
||||
orderBy+=(req.getDesc()?" desc":"");
|
||||
orderBy += (req.getDesc() ? " desc" : "");
|
||||
//
|
||||
PageHelper.clearPage();
|
||||
PageHelper.startPage(req.getPageNum(),req.getPageSize(),orderBy);
|
||||
PageHelper.startPage(req.getPageNum(), req.getPageSize(), orderBy);
|
||||
Page<PaperComposition> sqlPage = (Page<PaperComposition>) compositionDAO.selectByExample(pcEx);
|
||||
//
|
||||
final List<PaperCompositionWithRuleVo> rtList = new ArrayList<>();
|
||||
if(!CollectionUtils.isEmpty(sqlPage.getResult())){
|
||||
if (!CollectionUtils.isEmpty(sqlPage.getResult())) {
|
||||
for (PaperComposition pc : sqlPage.getResult()) {
|
||||
List<PaperRule> prList = this.findRuleByPcId(pc.getId());
|
||||
rtList.add(PaperCompositionConvertor.convert(pc, prList));
|
||||
}
|
||||
}
|
||||
//
|
||||
PageVO<PaperCompositionWithRuleVo> page = PageVO.convert(sqlPage,rtList);
|
||||
PageVO<PaperCompositionWithRuleVo> page = PageVO.convert(sqlPage, rtList);
|
||||
//
|
||||
if (!CollectionUtils.isEmpty(page.getList())) {
|
||||
page.getList().forEach(pc -> {
|
||||
@ -387,7 +431,11 @@ public class PaperCompositionService {
|
||||
if (null != sa) {
|
||||
PaperCompositionWithRuleVo.CreatorBasic rt = new PaperCompositionWithRuleVo.CreatorBasic();
|
||||
rt.setId(sa.getId());
|
||||
if (StringUtils.hasText(sa.getName())) {
|
||||
rt.setName(sa.getName());
|
||||
} else {
|
||||
rt.setName("昵称:" + sa.getNickname());
|
||||
}
|
||||
rt.setAccount(sa.getAccount());
|
||||
rt.setMobile(sa.getMobile());
|
||||
rt.setEmail(sa.getEmail());
|
||||
@ -435,20 +483,13 @@ public class PaperCompositionService {
|
||||
return ruleDAO.selectByExample(example);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验规则当前规定的总分值是否小于等于试卷蓝图中的满分
|
||||
*/
|
||||
private boolean checkRulesScoreLessOrEqualFull(Long pcId) {
|
||||
PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId);
|
||||
PaperExceptionAssert.PcExisted.assertTrue(null != curPc, String.format("试卷定义[id = %s]不存在", pcId));
|
||||
List<PaperRule> ruleList = findRuleByPcId(pcId);
|
||||
int ruleScore = 0;
|
||||
if (!CollectionUtils.isEmpty(ruleList)) {
|
||||
ruleScore = ruleList.stream().mapToInt(rule -> {
|
||||
return rule.getScore() * rule.getAmount();
|
||||
}).sum();
|
||||
}
|
||||
return ruleScore <= curPc.getFullScore();
|
||||
public List<CreatorBasic> queryCreatorList(FindPaperCompositionPageReqVo req) {
|
||||
List<CreatorBasic> creators = new ArrayList<>();
|
||||
List<PaperCompositionWithRuleVo> rules = findPaperCompositionList(req);
|
||||
rules.stream().map(PaperCompositionWithRuleVo::getCreatorId)
|
||||
.distinct()
|
||||
.forEach(creatorId -> creators.add(this.findCreatorInfo(creatorId)));
|
||||
return creators;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -456,7 +497,8 @@ public class PaperCompositionService {
|
||||
*/
|
||||
private boolean checkRulesScoreEqualFull(Long pcId) {
|
||||
PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId);
|
||||
PaperExceptionAssert.PcExisted.assertTrue(null != curPc, String.format("试卷定义[id = %s]不存在", pcId));
|
||||
PaperExceptionAssert.PcExisted.assertTrue(null != curPc,
|
||||
String.format("试卷定义[id = %s]不存在", pcId));
|
||||
List<PaperRule> ruleList = findRuleByPcId(pcId);
|
||||
int ruleScore = 0;
|
||||
if (!CollectionUtils.isEmpty(ruleList)) {
|
||||
|
@ -34,6 +34,8 @@ import club.joylink.rtss.vo.client.project.UDPClientConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.UDPLowConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.VrIbpConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.VrpsdConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.cgy.CgyPslConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.cgy.CgySectionConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.cgy.CgySignalConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.cgy.CgySwitchConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.gzb.GzbSignalConfigVO;
|
||||
@ -579,7 +581,7 @@ public class DeviceServiceImpl implements DeviceService {
|
||||
plcGateway.setType(ProjectDeviceType.PLC_GATEWAY.name());
|
||||
plcGateway.setCreator(accountVO.getId());
|
||||
plcGateway.setCreateTime(now);
|
||||
PlcGatewayConfigVO plcGatewayConfigVO = new PlcGatewayConfigVO(0, 16);
|
||||
PlcGatewayConfigVO plcGatewayConfigVO = new PlcGatewayConfigVO(0, 64);
|
||||
plcGateway.setConfig(plcGatewayConfigVO.toJson());
|
||||
list.add(plcGateway);
|
||||
//SIGNAL
|
||||
@ -589,7 +591,7 @@ public class DeviceServiceImpl implements DeviceService {
|
||||
signal1.setType(ProjectDeviceType.SIGNAL.name());
|
||||
signal1.setCreator(accountVO.getId());
|
||||
signal1.setCreateTime(now);
|
||||
signal1.setConfig(new CgySignalConfigVO(null, 2, 3, 4, 11, 12, 13).toJson());
|
||||
signal1.setConfig(new CgySignalConfigVO("S13289", 0, 1, 2, 3, 4, 5, 16, 17, 18, 19).toJson());
|
||||
list.add(signal1);
|
||||
ProjectDevice signal2 = new ProjectDevice();
|
||||
signal2.setProjectCode(projectCode);
|
||||
@ -597,7 +599,7 @@ public class DeviceServiceImpl implements DeviceService {
|
||||
signal2.setType(ProjectDeviceType.SIGNAL.name());
|
||||
signal2.setCreator(accountVO.getId());
|
||||
signal2.setCreateTime(now);
|
||||
signal2.setConfig(new CgySignalConfigVO(null, 5, 6, 7, 14, 15, 16).toJson());
|
||||
signal2.setConfig(new CgySignalConfigVO("X44854", 6, 7, 8, 9, 10, 11, 20, 21, 22, 23).toJson());
|
||||
list.add(signal2);
|
||||
//SWITCH
|
||||
ProjectDevice aSwitch = new ProjectDevice();
|
||||
@ -606,17 +608,50 @@ public class DeviceServiceImpl implements DeviceService {
|
||||
aSwitch.setType(ProjectDeviceType.SWITCH.name());
|
||||
aSwitch.setCreator(accountVO.getId());
|
||||
aSwitch.setCreateTime(now);
|
||||
aSwitch.setConfig(new CgySwitchConfigVO().toJson());
|
||||
aSwitch.setConfig(new CgySwitchConfigVO("W37779").toJson());
|
||||
list.add(aSwitch);
|
||||
// //SECTION
|
||||
// ProjectDevice section = new ProjectDevice();
|
||||
// section.setProjectCode(projectCode);
|
||||
// section.setCode(prefix + "section");
|
||||
// section.setType(ProjectDeviceType.SECTION.name());
|
||||
// section.setCreator(accountVO.getId());
|
||||
// section.setCreateTime(now);
|
||||
// section.setConfig(new CgySectionConfigVO().toJson());
|
||||
// list.add(section);
|
||||
//PSL
|
||||
ProjectDevice psl = new ProjectDevice();
|
||||
psl.setProjectCode(projectCode);
|
||||
psl.setCode(prefix + "psl");
|
||||
psl.setType(ProjectDeviceType.PSL.name());
|
||||
psl.setCreator(accountVO.getId());
|
||||
psl.setCreateTime(now);
|
||||
psl.setConfig(new CgyPslConfigVO("PF59020_PSL").toJson());
|
||||
list.add(psl);
|
||||
//SECTION
|
||||
ProjectDevice section106 = new ProjectDevice();
|
||||
section106.setProjectCode(projectCode);
|
||||
section106.setCode(prefix + "section106");
|
||||
section106.setType(ProjectDeviceType.SECTION.name());
|
||||
section106.setCreator(accountVO.getId());
|
||||
section106.setCreateTime(now);
|
||||
section106.setConfig(new CgySectionConfigVO(null, 35).toJson());
|
||||
list.add(section106);
|
||||
ProjectDevice section104 = new ProjectDevice();
|
||||
section104.setProjectCode(projectCode);
|
||||
section104.setCode(prefix + "section104");
|
||||
section104.setType(ProjectDeviceType.SECTION.name());
|
||||
section104.setCreator(accountVO.getId());
|
||||
section104.setCreateTime(now);
|
||||
section104.setConfig(new CgySectionConfigVO(null, 36).toJson());
|
||||
list.add(section104);
|
||||
ProjectDevice section101 = new ProjectDevice();
|
||||
section101.setProjectCode(projectCode);
|
||||
section101.setCode(prefix + "section101");
|
||||
section101.setType(ProjectDeviceType.SECTION.name());
|
||||
section101.setCreator(accountVO.getId());
|
||||
section101.setCreateTime(now);
|
||||
section101.setConfig(new CgySectionConfigVO(null, 37).toJson());
|
||||
list.add(section101);
|
||||
ProjectDevice section102 = new ProjectDevice();
|
||||
section102.setProjectCode(projectCode);
|
||||
section102.setCode(prefix + "section102");
|
||||
section102.setType(ProjectDeviceType.SECTION.name());
|
||||
section102.setCreator(accountVO.getId());
|
||||
section102.setCreateTime(now);
|
||||
section102.setConfig(new CgySectionConfigVO(null, 38).toJson());
|
||||
list.add(section102);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
@ -12,14 +12,13 @@ import club.joylink.rtss.simulation.cbtc.data.map.Stand;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl;
|
||||
import club.joylink.rtss.simulation.cbtc.event.SimulationPslStatusEvent;
|
||||
import club.joylink.rtss.vo.client.psl.PslStatus;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class VirtualRealityPslService implements IVirtualRealityPslService {
|
||||
|
||||
@ -51,13 +50,15 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pressTheButton(Simulation simulation, String standCode, VirtualRealityPsl.Button button) {
|
||||
public void pressTheButton(Simulation simulation, String standCode,
|
||||
VirtualRealityPsl.Button button) {
|
||||
Stand stand = simulation.getRepository().getByCode(standCode, Stand.class);
|
||||
VirtualRealityPsl vrPsl = collectStatus(stand);
|
||||
theButtonIsPressed(simulation, vrPsl, button);
|
||||
}
|
||||
|
||||
private void theButtonIsPressed(Simulation simulation, VirtualRealityPsl vrPsl, VirtualRealityPsl.Button button) {
|
||||
private void theButtonIsPressed(Simulation simulation, VirtualRealityPsl vrPsl,
|
||||
VirtualRealityPsl.Button button) {
|
||||
Stand stand = vrPsl.getStand();
|
||||
switch (button) {
|
||||
case YXJZ:
|
||||
@ -68,10 +69,12 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
|
||||
ciApiService.setOrCancelInterlockRelease(simulation, stand, vrPsl.isHsjcKey());
|
||||
break;
|
||||
case KM:
|
||||
ciApiService.openScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
|
||||
ciApiService.openScreenDoor(simulation, stand.getCode(),
|
||||
CiStandService.PsdCommandSource.PSL);
|
||||
break;
|
||||
case GM:
|
||||
ciApiService.closeScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
|
||||
ciApiService.closeScreenDoor(simulation, stand.getCode(),
|
||||
CiStandService.PsdCommandSource.PSL);
|
||||
break;
|
||||
case SD:
|
||||
vrPsl.setSdButton(!vrPsl.isSdButton());
|
||||
@ -80,7 +83,8 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(Simulation simulation, VirtualRealityPsl vrPsl, VirtualRealityPsl.Button button, boolean on) {
|
||||
public void updateStatus(Simulation simulation, VirtualRealityPsl vrPsl,
|
||||
VirtualRealityPsl.Button button, boolean on) {
|
||||
switch (button) {
|
||||
case YXJZ:
|
||||
vrPsl.setYxjzKey(on);
|
||||
@ -89,7 +93,10 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
|
||||
vrPsl.setHsjcKey(on);
|
||||
break;
|
||||
case KM:
|
||||
vrPsl.setKmButton(on);
|
||||
break;
|
||||
case GM:
|
||||
vrPsl.setGmButton(on);
|
||||
break;
|
||||
case SD:
|
||||
vrPsl.setSdButton(on);
|
||||
@ -98,7 +105,8 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
|
||||
effective(simulation, vrPsl.getStand(), button, on);
|
||||
}
|
||||
|
||||
private void effective(Simulation simulation, Stand stand, VirtualRealityPsl.Button button, boolean on) {
|
||||
private void effective(Simulation simulation, Stand stand, VirtualRealityPsl.Button button,
|
||||
boolean on) {
|
||||
switch (button) {
|
||||
case YXJZ:
|
||||
break;
|
||||
@ -106,12 +114,16 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
|
||||
ciApiService.setOrCancelInterlockRelease(simulation, stand, on);
|
||||
break;
|
||||
case KM:
|
||||
if (on)
|
||||
ciApiService.openScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
|
||||
if (on) {
|
||||
ciApiService.openScreenDoor(simulation, stand.getCode(),
|
||||
CiStandService.PsdCommandSource.PSL);
|
||||
}
|
||||
break;
|
||||
case GM:
|
||||
if (on)
|
||||
ciApiService.closeScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
|
||||
if (on) {
|
||||
ciApiService.closeScreenDoor(simulation, stand.getCode(),
|
||||
CiStandService.PsdCommandSource.PSL);
|
||||
}
|
||||
break;
|
||||
case SD:
|
||||
break;
|
||||
@ -129,8 +141,9 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
|
||||
Map<String, PslStatus> ibpStatusMap = repository.getPslStatusMap();
|
||||
Map<String, PslStatus> collectionMap = new HashMap<>();
|
||||
for (Stand stand : repository.getStandList()) {
|
||||
if (stand.getVrPsl() == null)
|
||||
if (stand.getVrPsl() == null) {
|
||||
continue;
|
||||
}
|
||||
VirtualRealityPsl vrPsl = this.collectStatus(stand);
|
||||
PslStatus pslStatus = ibpStatusMap.get(stand.getCode());
|
||||
if (pslStatus == null) {
|
||||
@ -145,7 +158,8 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(collectionMap)) {
|
||||
applicationContext.publishEvent(new SimulationPslStatusEvent(this, simulation, collectionMap));
|
||||
applicationContext.publishEvent(
|
||||
new SimulationPslStatusEvent(this, simulation, collectionMap));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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());
|
||||
|
@ -5,6 +5,7 @@ import club.joylink.rtss.entity.RtsMapFunction;
|
||||
import club.joylink.rtss.entity.SysAccount;
|
||||
import club.joylink.rtss.entity.UserSimulationRecord;
|
||||
import club.joylink.rtss.entity.UserSimulationRecordExample;
|
||||
import club.joylink.rtss.entity.UserSimulationRecordExample.Criteria;
|
||||
import club.joylink.rtss.event.UserSimulationRecordEvent;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.IMapService;
|
||||
@ -13,6 +14,7 @@ import club.joylink.rtss.services.mapFunction.RtsMapFunctionService;
|
||||
import club.joylink.rtss.simulation.cbtc.message.UserSimulationRecordManager;
|
||||
import club.joylink.rtss.util.TimeUnit;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.simulationUsage.SimulationUsageRecordQueryVO;
|
||||
import club.joylink.rtss.vo.client.simulationUsage.UserSimulationQueryVO;
|
||||
import club.joylink.rtss.vo.client.simulationUsage.UserSimulationRecordVO;
|
||||
import club.joylink.rtss.vo.client.simulationUsage.UserSimulationStatsVO;
|
||||
@ -66,7 +68,8 @@ public class UserSimulationRecordService {
|
||||
}
|
||||
|
||||
public List<UserSimulationRecord> queryByMapAndUserIds(Long mapId, List<Long> userIds) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(userIds, "用户列表不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(userIds,
|
||||
"用户列表不能为空");
|
||||
UserSimulationRecordExample example = new UserSimulationRecordExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId).andUserIdIn(userIds);
|
||||
return userSimulationRecordDAO.selectByExample(example);
|
||||
@ -165,6 +168,22 @@ public class UserSimulationRecordService {
|
||||
return statistic(startTime, endTime, timeUnit, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询仿真使用记录
|
||||
*/
|
||||
public List<UserSimulationRecord> listSimulationUsageRecords(
|
||||
SimulationUsageRecordQueryVO queryVO) {
|
||||
UserSimulationRecordExample example = new UserSimulationRecordExample();
|
||||
Criteria criteria = example.createCriteria();
|
||||
if (queryVO.getUid() != null) {
|
||||
criteria.andUserIdEqualTo(queryVO.getUid());
|
||||
}
|
||||
if (queryVO.getFunctionId() != null) {
|
||||
criteria.andFunctionIdEqualTo(queryVO.getFunctionId());
|
||||
}
|
||||
return userSimulationRecordDAO.selectByExample(example);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对使用记录按照时间单位、开始、结束时间分段统计
|
||||
*/
|
||||
@ -223,9 +242,12 @@ public class UserSimulationRecordService {
|
||||
}
|
||||
|
||||
private void checkParam(UserSimulationQueryVO queryVO) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getTimeUnit(), "缺少时间单位");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getStartTime(), "缺少开始时间");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getEndTime(), "缺少结束时间");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getTimeUnit(),
|
||||
"缺少时间单位");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getStartTime(),
|
||||
"缺少开始时间");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getEndTime(),
|
||||
"缺少结束时间");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
|
||||
!queryVO.getStartTime().isAfter(queryVO.getEndTime()), "开始时间不能晚于结束时间");
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.competition.VoiceErrorVO;
|
||||
import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult;
|
||||
import club.joylink.rtss.vo.voice.VoiceVerifyResultVO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
@ -16,4 +17,14 @@ public interface IVoiceTrainingService {
|
||||
VoiceRecognitionResult voiceRecognition(MultipartFile file);
|
||||
|
||||
VoiceRecognitionResult voiceRecognition(byte[] bytes, String filePath);
|
||||
|
||||
/**
|
||||
* 校验语音识别结果
|
||||
*
|
||||
* @param contentType
|
||||
* @param file 需要校验的语音
|
||||
* @param text 正确的文本
|
||||
* @return 校验结果
|
||||
*/
|
||||
VoiceVerifyResultVO verifyVoice(String contentType, byte[] file, String text);
|
||||
}
|
||||
|
@ -2,21 +2,30 @@ 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;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.competition.VoiceErrorVO;
|
||||
import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult;
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
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;
|
||||
|
||||
@Service
|
||||
public class VoiceTrainingService implements IVoiceTrainingService {
|
||||
@ -47,18 +56,64 @@ public class VoiceTrainingService implements IVoiceTrainingService {
|
||||
@Override
|
||||
public VoiceRecognitionResult voiceRecognition(MultipartFile file) {
|
||||
VoiceRecognitionVO vo = VoiceRecognitionVO.load(file);
|
||||
return voiceRecognition(vo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoiceRecognitionResult voiceRecognition(byte[] bytes, String filePath) {
|
||||
VoiceRecognitionVO vo = new VoiceRecognitionVO(bytes);
|
||||
return voiceRecognition(vo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoiceVerifyResultVO verifyVoice(String contentType, byte[] fileData, String text) {
|
||||
byte[] monoData = convertToMonoChannel(fileData);
|
||||
VoiceRecognitionResult voiceRecognitionResult = voiceRecognition(
|
||||
new VoiceRecognitionVO(monoData, contentType));
|
||||
boolean match = StrUtils.isMatch(text, voiceRecognitionResult.getResult(), 70);
|
||||
return new VoiceVerifyResultVO(voiceRecognitionResult.getResult(), match);
|
||||
}
|
||||
|
||||
private VoiceRecognitionResult voiceRecognition(VoiceRecognitionVO vo) {
|
||||
VoiceRecognitionResult result = this.iVoiceService.voiceRecognition(vo);
|
||||
// VoiceRecognitionResult result = this.iVoiceService.voiceRecognition(file, "");
|
||||
result.setResult(simulationVoiceHandler.handle(result.getResult()));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoiceRecognitionResult voiceRecognition(byte[] bytes, String filePath) {
|
||||
VoiceRecognitionVO vo = new VoiceRecognitionVO(bytes);
|
||||
VoiceRecognitionResult result = this.iVoiceService.voiceRecognition(vo);
|
||||
// VoiceRecognitionResult result = this.iVoiceService.voiceRecognition(bytes, filePath);
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,78 +0,0 @@
|
||||
/*
|
||||
package club.joylink.rtss.services.voice.huawei;
|
||||
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.voice.IVoiceService;
|
||||
import club.joylink.rtss.util.VoiceFileUtils;
|
||||
import club.joylink.rtss.vo.client.VoiceRecognitionResult;
|
||||
import com.huawei.sis.bean.AuthInfo;
|
||||
import com.huawei.sis.bean.SisConfig;
|
||||
import com.huawei.sis.bean.request.AsrCustomShortRequest;
|
||||
import com.huawei.sis.bean.response.AsrCustomShortResponse;
|
||||
import com.huawei.sis.client.AsrCustomizationClient;
|
||||
import com.huawei.sis.exception.SisException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Base64;
|
||||
|
||||
@Slf4j
|
||||
@Service("HuaWeiVoiceService")
|
||||
public class HuaweiVoiceServiceImpl implements IVoiceService {
|
||||
|
||||
|
||||
@Override
|
||||
public String synthesis(String message, String per) {
|
||||
throw BusinessExceptionAssertEnum.THIRD_SERVICE_CALL_EXCEPTION.exception("功能暂未实现");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String synthesis(String message) {
|
||||
return this.synthesis(message, "0");
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* 华为语音识别配置
|
||||
*//*
|
||||
|
||||
private final String ak = "YDUXTXRYGAHGPHAIXZCU";
|
||||
private final String sk = "Kcbm3sTDCYEou8kGeAhKxfBkgWybIn6IjJyGBX3p";
|
||||
private final String region = "cn-north-4";
|
||||
private final String projectId = "0aada8176180f28c2f34c0196f5394e8";
|
||||
|
||||
@Override
|
||||
public VoiceRecognitionResult voiceRecognition(MultipartFile file, String lang) {
|
||||
String filePath = VoiceFileUtils.saveFile(file);
|
||||
try {
|
||||
return voiceRecognition(file.getBytes(), filePath);
|
||||
} catch (IOException e) {
|
||||
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("第三方服务调用异常");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoiceRecognitionResult voiceRecognition(byte[] bytes, String filePath) {
|
||||
AuthInfo authInfo = new AuthInfo(ak, sk, region, projectId);
|
||||
SisConfig sisConfig = new SisConfig();
|
||||
AsrCustomizationClient client = new AsrCustomizationClient(authInfo, sisConfig);
|
||||
String data = Base64.getEncoder().encodeToString(bytes);
|
||||
try {
|
||||
AsrCustomShortRequest request = new AsrCustomShortRequest(data, "pcm16k16bit", "chinese_16k_common");
|
||||
AsrCustomShortResponse response = client.getAsrShortResponse(request);
|
||||
return new VoiceRecognitionResult(filePath, response.getResult().getText());
|
||||
} catch (SisException e) {
|
||||
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("语音识别失败", e);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public VoiceRecognitionResult voiceRecognition(String fileBase64) {
|
||||
String base64 = fileBase64.substring(fileBase64.indexOf("base64,") + "base64,".length());
|
||||
byte[] bytes = Base64.getDecoder().decode(base64.trim());
|
||||
String filePath = VoiceFileUtils.saveFile(bytes);
|
||||
return voiceRecognition(bytes, filePath);
|
||||
}
|
||||
}
|
||||
*/
|
@ -1,154 +0,0 @@
|
||||
//package club.joylink.rtss.simulation;
|
||||
//
|
||||
//import club.joylink.rtss.simulation.operation.SimulationOperationDispatcher;
|
||||
//import club.joylink.rtss.simulation.vo.SimulationFaultVO;
|
||||
//import club.joylink.rtss.simulation.vo.SimulationInfoVO;
|
||||
//import club.joylink.rtss.simulation.vo.SimulationMemberVO;
|
||||
//import club.joylink.rtss.simulation.vo.SimulationUserVO;
|
||||
//import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
//import club.joylink.rtss.vo.client.simulationv1.SimulationInfoQueryVO;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.util.StringUtils;
|
||||
//import org.springframework.web.bind.annotation.*;
|
||||
//
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//import java.util.Objects;
|
||||
//import java.util.stream.Collectors;
|
||||
//import java.util.stream.Stream;
|
||||
//
|
||||
//import static club.joylink.rtss.controller.advice.AuthenticateInterceptor.LOGIN_INFO_KEY;
|
||||
//
|
||||
///**
|
||||
// * 仿真通用接口
|
||||
// */
|
||||
//@Slf4j
|
||||
//@RestController
|
||||
//@RequestMapping("/common/simulation")
|
||||
//public class SimulationCommonController {
|
||||
// @Autowired
|
||||
// private SimulationManager simulationManager;
|
||||
// @Autowired
|
||||
// private SimulationOperationDispatcher simulationOperationDispatcher;
|
||||
//
|
||||
// /**
|
||||
// * 监管仿真
|
||||
// * @param loginUserInfoVO
|
||||
// * @param queryVO
|
||||
// * @return
|
||||
// */
|
||||
// @GetMapping("/supervise")
|
||||
// public List<SimulationInfoVO> superviseSimulation(@RequestAttribute(name=LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO, SimulationInfoQueryVO queryVO) {
|
||||
// List<Simulation> simulationList = this.simulationManager.getSimulationList();
|
||||
// Stream<Simulation> stream = simulationList.stream();
|
||||
//
|
||||
// stream = stream.filter(simulation -> simulation instanceof club.joylink.rtss.simulation.cbtc.Simulation
|
||||
// && Objects.equals(loginUserInfoVO.getTopOrgId(),((club.joylink.rtss.simulation.cbtc.Simulation)simulation).getBuildParams().getLoginUserInfo().getTopOrgId()));
|
||||
//
|
||||
// if (StringUtils.hasText(queryVO.getGroup())) {
|
||||
// stream = stream.filter(simulation -> simulation.getId().contains(queryVO.getGroup()));
|
||||
// }
|
||||
// if (StringUtils.hasText(queryVO.getUserName())) {
|
||||
// stream = stream.filter(simulation -> simulation.getSimulationUsers().stream().anyMatch(user -> ((SimulationUser) user).getName().contains(queryVO.getUserName())));
|
||||
// }
|
||||
// if (StringUtils.hasText(queryVO.getPrdType())) {
|
||||
// stream = stream.filter(simulation -> simulation instanceof club.joylink.rtss.simulation.cbtc.Simulation
|
||||
// && queryVO.getPrdType().equals(((club.joylink.rtss.simulation.cbtc.Simulation) simulation).getBuildParams().getProdType().getCode()));
|
||||
// }
|
||||
// return stream.map(Simulation::convertToVO).collect(Collectors.toList());
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/list")
|
||||
// public List<SimulationInfoVO> queryInfo(SimulationInfoQueryVO queryVO) {
|
||||
// List<Simulation> simulationList = this.simulationManager.getSimulationList();
|
||||
// Stream<Simulation> stream = simulationList.stream();
|
||||
// if (StringUtils.hasText(queryVO.getGroup())) {
|
||||
// stream = stream.filter(simulation -> simulation.getId().contains(queryVO.getGroup()));
|
||||
// }
|
||||
// if (StringUtils.hasText(queryVO.getUserName())) {
|
||||
// stream = stream.filter(simulation -> simulation.getSimulationUsers().stream().anyMatch(user -> ((SimulationUser) user).getName().contains(queryVO.getUserName())));
|
||||
// }
|
||||
// if (StringUtils.hasText(queryVO.getPrdType())) {
|
||||
// stream = stream.filter(simulation -> simulation instanceof club.joylink.rtss.simulation.cbtc.Simulation
|
||||
// && queryVO.getPrdType().equals(((club.joylink.rtss.simulation.cbtc.Simulation) simulation).getBuildParams().getProdType().getCode()));
|
||||
// }
|
||||
// return stream.map(Simulation::convertToVO).collect(Collectors.toList());
|
||||
// }
|
||||
//
|
||||
// @PutMapping("/{id}/pause")
|
||||
// public void pause(@PathVariable String id) {
|
||||
// this.simulationManager.pause(id);
|
||||
// }
|
||||
//
|
||||
// @PutMapping("/{id}/start")
|
||||
// public void start(@PathVariable String id) {
|
||||
// this.simulationManager.start(id);
|
||||
// }
|
||||
//
|
||||
// @PutMapping("/{id}/init")
|
||||
// public void init(@PathVariable String id) {
|
||||
// this.simulationManager.init(id);
|
||||
// }
|
||||
//
|
||||
// @PutMapping("/{id}/updateSpeed/{speed}")
|
||||
// public void updateSpeed(@PathVariable String id, @PathVariable int speed) {
|
||||
// this.simulationManager.updateSpeed(id, speed);
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/{id}")
|
||||
// public SimulationInfoVO getSimulationInfo(@PathVariable String id) {
|
||||
// return this.simulationManager.getById(id).convertToVO();
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/{id}/users")
|
||||
// public List<SimulationUserVO> getSimulationUsers(@PathVariable String id) {
|
||||
// return this.simulationManager.getSimulationUsers(id).stream()
|
||||
// .map(SimulationUser::convertToVO)
|
||||
// .collect(Collectors.toList());
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/{id}/members")
|
||||
// public List<SimulationMemberVO> getSimulationMembers(@PathVariable String id, @RequestParam(required = false) String role) {
|
||||
// return this.simulationManager.getSimulationMembers(id).stream()
|
||||
// .map(SimulationMember::convertToVO)
|
||||
// .filter(member -> StringUtils.hasText(role) ? member.getRole().toString().equals(role) : true)
|
||||
// .collect(Collectors.toList());
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/{id}/member/playedBy/{userId}")
|
||||
// public SimulationMemberVO queryUserPlayedMember(@PathVariable String id, @PathVariable String userId) {
|
||||
// return this.simulationManager.getById(id)
|
||||
// .getSimulationMemberByUserId(userId).convertToVO();
|
||||
// }
|
||||
//
|
||||
// @PostMapping("/{id}/member/{memberId}/operate/{type}")
|
||||
// public Object operate(@PathVariable String id, @PathVariable String memberId,
|
||||
// @PathVariable String type, @RequestBody Map<String, Object> params) {
|
||||
// return this.simulationOperationDispatcher.doDispatch(id, memberId, type, params);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 故障注入
|
||||
// */
|
||||
// @PostMapping("/{id}/fault")
|
||||
// public void injectFault(@PathVariable String id, @RequestBody SimulationFaultVO faultVO) {
|
||||
// this.simulationManager.injectFault(id, faultVO);
|
||||
// }
|
||||
//
|
||||
// @DeleteMapping("/{id}/device/{deviceId}/fault/{fault}")
|
||||
// public void removeFault(@PathVariable String id, @PathVariable String deviceId, @PathVariable String fault) {
|
||||
// this.simulationManager.removeFault(id, deviceId, fault);
|
||||
// }
|
||||
//
|
||||
// @PutMapping("/{id}/member/{memberId}/playby/{userId}")
|
||||
// public void memberPlay(@PathVariable String id, @PathVariable String memberId, @PathVariable String userId) {
|
||||
// this.simulationManager.memberPlayedByUser(id, memberId, userId);
|
||||
// }
|
||||
//
|
||||
// @DeleteMapping("/{id}/destroy")
|
||||
// public void destroy(@PathVariable String id) {
|
||||
// this.simulationManager.destroy(id);
|
||||
// log.info(String.format("仿真通用接口销毁仿真[%s]", id));
|
||||
// }
|
||||
//}
|
@ -1,687 +0,0 @@
|
||||
//package club.joylink.rtss.simulation.cbtc.ATP.ground;
|
||||
//
|
||||
//import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
//import club.joylink.rtss.simulation.cbtc.ATS.AtsApiService;
|
||||
//import club.joylink.rtss.simulation.cbtc.CI.service.RouteService;
|
||||
//import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
//import club.joylink.rtss.simulation.cbtc.constant.RunLevel;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.CalculateService;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.support.MovementAuthority;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||
//import club.joylink.rtss.simulation.cbtc.onboard.ATP.ATPService;
|
||||
//import club.joylink.rtss.simulation.cbtc.onboard.ATP.OnboardAtpApiService;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//import org.springframework.util.CollectionUtils;
|
||||
//
|
||||
//import java.util.*;
|
||||
//import java.util.stream.Collectors;
|
||||
//
|
||||
///**
|
||||
// * ZC逻辑循环
|
||||
// */
|
||||
//@Slf4j
|
||||
//@Component
|
||||
//public class ZCLogicLoop {
|
||||
//
|
||||
// @Autowired
|
||||
// private OnboardAtpApiService onboardAtpApiService;
|
||||
//
|
||||
// @Autowired
|
||||
// private ATPService ATPService;
|
||||
//
|
||||
// @Autowired
|
||||
// private AtsApiService atsApiService;
|
||||
//
|
||||
// @Autowired
|
||||
// private MaService maService;
|
||||
//
|
||||
// @Autowired
|
||||
// private RouteService routeService;
|
||||
//
|
||||
// public void run(Simulation simulation) {
|
||||
// List<VirtualRealityTrain> trainList = simulation.getRepository().getOnlineTrainList();
|
||||
// trainList.forEach(train -> {
|
||||
// SectionPosition headPosition = train.getHeadPosition();
|
||||
// Station deviceStation = headPosition.getSection().getDeviceStation();
|
||||
// RunLevel defaultRunLevel = simulation.getRepository().getConfig().getRunMode();
|
||||
// if (RunLevel.ITC.equals(defaultRunLevel)) { //如果线路最高运行级别为ITC级别
|
||||
// if (!Station.Fault.INTERLOCK_MACHINE_FAULT.equals(deviceStation.getFault())) {
|
||||
// this.calculateMAOfITC(simulation, train);
|
||||
// }
|
||||
// } else if (RunLevel.CBTC.equals(defaultRunLevel)) {
|
||||
// //更新ITC ma
|
||||
// if (!simulation.getRepository().hasResponder()) {
|
||||
// if (!Station.Fault.INTERLOCK_MACHINE_FAULT.equals(deviceStation.getFault())) {
|
||||
// Float distance2NextSignal = train.calculateDistance2NextNormalOpenSignal();
|
||||
// if (distance2NextSignal != null && distance2NextSignal <= 5) {
|
||||
// train.setPositioned(true);
|
||||
// this.calculateMAOfITC(simulation, train);
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// simulation.getRepository().getSectionRespondersMap().forEach((section, responders) ->
|
||||
// responders.stream()
|
||||
// .filter(Responder::isVB)
|
||||
// .forEach(responder -> {
|
||||
// if (responder.getSignal().isNormalOpen()) {
|
||||
// responder.setMa(this.calculateMAOfITC(simulation, responder));
|
||||
// }
|
||||
// }));
|
||||
// }
|
||||
// //更新CBTC ma
|
||||
// if (train.isCommunicable()) {
|
||||
// this.calculateMAOfCBTC(simulation, train, trainList);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// private void calculateMAOfCBTC(Simulation simulation, VirtualRealityTrain train,
|
||||
// List<VirtualRealityTrain> trainList) {
|
||||
// // 查找移动授权终端列表
|
||||
// List<MovementAuthority.End> endList = this.findMaEnd(simulation, train, trainList);
|
||||
// // 根据查找到的授权终端,比较并构建最终的移动授权数据
|
||||
// MovementAuthority ma = this.compareAndBuildMa(train, endList);
|
||||
// // 通知车载ATP
|
||||
// this.onboardAtpApiService.updateMA4CBTC(train, ma);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 计算移动授权终端
|
||||
// *
|
||||
// * @param simulation
|
||||
// * @param train
|
||||
// * @param trainList
|
||||
// * @return
|
||||
// */
|
||||
// private List<MovementAuthority.End> findMaEnd(Simulation simulation, VirtualRealityTrain train, List<VirtualRealityTrain> trainList) {
|
||||
// // 从车尾开始找(车尾主要查看是否在站台轨上,且站台轨屏蔽门开放)
|
||||
// boolean right = train.isRight();
|
||||
// SectionPosition headPosition = train.getHeadPosition();
|
||||
// SectionPosition tailPosition = train.calculateTailPosition();
|
||||
// Section tailSection = tailPosition.getSection();
|
||||
// MovementAuthority.End openPsdEnd = checkPsdOpenOrClose(tailSection);
|
||||
// List<MovementAuthority.End> endList = new ArrayList<>();
|
||||
// if (openPsdEnd != null)
|
||||
// endList.add(openPsdEnd);
|
||||
// MovementAuthority.End ecStandEnd = checkEC(simulation.getRepository().getConfig(), tailSection);
|
||||
// if (ecStandEnd != null)
|
||||
// endList.add(ecStandEnd);
|
||||
// MovementAuthority.End closedSection = checkClosedSection(tailSection);
|
||||
// if (closedSection != null)
|
||||
// return List.of(closedSection);
|
||||
// // 如果车尾正常,从车头开始往前查找
|
||||
// Section section = headPosition.getSection();
|
||||
// MovementAuthority.End switchEnd = checkSwitch(tailSection, section, right);
|
||||
// if (switchEnd != null)
|
||||
// return List.of(switchEnd);
|
||||
// // 检查列车当前所在进路是否锁闭
|
||||
//// MovementAuthority.End end1 = this.checkRouteLock(simulation, section, tailSection, right, train);
|
||||
//// if (Objects.nonNull(end1)) {
|
||||
//// endList.add(end1);
|
||||
//// return endList;
|
||||
//// }
|
||||
//// // 检查车头区段是否故障
|
||||
//// if (headPosition.getSection().isFault()) {
|
||||
//// endList.add(new MovementAuthority.End(headPosition.getSection(), MovementAuthority.EndType.FAULT_SECTION));
|
||||
//// }
|
||||
// //非通信车占用区段
|
||||
// if (section.hasNctOccupy() && !section.isInvalid()) {
|
||||
// endList.add(new MovementAuthority.End(section, MovementAuthority.EndType.NCT_OCCUPIED_SECTION));
|
||||
// return endList;
|
||||
// }
|
||||
// //通信车占用区段
|
||||
// List<Section> occupiedLogicSectionList = simulation.getRepository().queryTrainOccupyAtpSectionList(train.getGroupNumber());
|
||||
// Set<Section> occupiedLogicSectionSet;
|
||||
// if (!CollectionUtils.isEmpty(occupiedLogicSectionList)) {
|
||||
// occupiedLogicSectionSet = new HashSet<>(occupiedLogicSectionList);
|
||||
// } else {
|
||||
// occupiedLogicSectionSet = new HashSet<>();
|
||||
// }
|
||||
// List<Section> logicList = section.getLogicList();
|
||||
// if (!CollectionUtils.isEmpty(logicList)) {
|
||||
// Section logicSection = headPosition.getLogicSection();
|
||||
// int index = logicList.indexOf(logicSection);
|
||||
// if (right) {
|
||||
// for (int i = index + 1; i < logicList.size(); i++) {
|
||||
// MovementAuthority.End end = checkSectionOccupied(logicList.get(i), right, occupiedLogicSectionSet);
|
||||
// if (end != null)
|
||||
// endList.add(end);
|
||||
// }
|
||||
// } else {
|
||||
// for (int i = index - 1; i >= 0; i--) {
|
||||
// MovementAuthority.End end = checkSectionOccupied(logicList.get(i), right, occupiedLogicSectionSet);
|
||||
// if (end != null)
|
||||
// endList.add(end);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// int count = 0;
|
||||
// while (count < 50) {
|
||||
// ++count;
|
||||
//// // 区段未进路锁闭或延时解锁中(转换轨除外,因为出库列车加载到转换轨没有进路)
|
||||
//// if (!section.isTransferTrack()) {
|
||||
//// if (section.isDelayUnlock()) {
|
||||
//// deviceEnd = new MovementAuthority.End(section, MovementAuthority.EndType.UNLOCK_SECTION);
|
||||
//// break;
|
||||
//// }
|
||||
//// if (!section.isRouteLock()) {
|
||||
//// deviceEnd = new MovementAuthority.End(section, MovementAuthority.EndType.UNLOCK_SECTION);
|
||||
//// break;
|
||||
//// }
|
||||
//// }
|
||||
// // 站台屏蔽门
|
||||
// MovementAuthority.End psdEnd = checkPsdOpenOrClose(section);
|
||||
// if (psdEnd != null)
|
||||
// endList.add(psdEnd);
|
||||
// // 紧急关闭的站台
|
||||
// MovementAuthority.End standEnd = checkEC(simulation.getRepository().getConfig(), section);
|
||||
// if (standEnd != null)
|
||||
// endList.add(standEnd);
|
||||
// // 信号机
|
||||
// MovementAuthority.End signalEnd = checkSignal(section, right);
|
||||
// if (Objects.nonNull(signalEnd)) {
|
||||
// endList.add(signalEnd);
|
||||
// MovementAuthority.End unlockedOverlapEnd = this.checkUnlockedOverlap(simulation, section, right);
|
||||
// if (Objects.nonNull(unlockedOverlapEnd)) {
|
||||
// endList.add(unlockedOverlapEnd);
|
||||
// }
|
||||
// }
|
||||
// // 道岔
|
||||
// MovementAuthority.End end = checkSwitch(section, right);
|
||||
// if (end != null)
|
||||
// endList.add(end);
|
||||
// // 轨道尽头/问题道岔
|
||||
// Section temp = section.getNextRunningSectionOf(right);
|
||||
// if (Objects.isNull(temp)) { // 到尽头
|
||||
// if (!section.isSwitchTrack()) { // 问题道岔
|
||||
// endList.add(new MovementAuthority.End(section, MovementAuthority.EndType.END_TRACK));
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// //通信车占用区段
|
||||
// MovementAuthority.End trainEnd = checkSectionOccupied(temp, right, occupiedLogicSectionSet);
|
||||
// if (trainEnd != null)
|
||||
// endList.add(trainEnd);
|
||||
// //非通信车占用区段
|
||||
// if (temp.hasNctOccupy() && !temp.isInvalid()) {
|
||||
// endList.add(new MovementAuthority.End(temp, MovementAuthority.EndType.NCT_OCCUPIED_SECTION));
|
||||
// }
|
||||
// //检查关闭的区段
|
||||
// MovementAuthority.End cs = checkClosedSection(section);
|
||||
// if (cs != null)
|
||||
// endList.add(cs);
|
||||
//
|
||||
// if (endList.stream().anyMatch(end2 -> !MovementAuthority.EndType.CLOSED_SIGNAL.equals(end2.getType()))) {
|
||||
// break;
|
||||
// }
|
||||
// section = temp;
|
||||
// }
|
||||
//// // 前方列车
|
||||
//// VirtualRealityTrain frontTrain = this.queryFrontTrain(train, trainList);
|
||||
//// if (Objects.nonNull(frontTrain)) {
|
||||
//// Section baseSection;
|
||||
//// if (Objects.equals(frontTrain.isRight(), train.isRight())) {
|
||||
//// baseSection = frontTrain.calculateTailPosition().getSection();
|
||||
//// } else {
|
||||
//// baseSection = frontTrain.getHeadPosition().getSection();
|
||||
//// }
|
||||
//// endList.add(new MovementAuthority.End(frontTrain,
|
||||
//// MovementAuthority.EndType.FRONT_TRAIN,
|
||||
//// baseSection));
|
||||
//// }
|
||||
// return endList;
|
||||
// }
|
||||
//
|
||||
// private MovementAuthority.End checkSectionOccupied(Section section, boolean right, Set<Section> occupiedLogicSectionSet) {
|
||||
// List<Section> logicList = section.getLogicList();
|
||||
// if (!CollectionUtils.isEmpty(logicList)) {
|
||||
// if (right) {
|
||||
// for (Section logic : logicList) {
|
||||
// if (logic.isCtOccupied() && !occupiedLogicSectionSet.contains(logic)) {
|
||||
// return new MovementAuthority.End(logic, MovementAuthority.EndType.FRONT_TRAIN, null);
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// for (int i = logicList.size() - 1; i >= 0; i--) {
|
||||
// Section logic = logicList.get(i);
|
||||
// if (logic.isCtOccupied() && !occupiedLogicSectionSet.contains(logic)) {
|
||||
// return new MovementAuthority.End(logic, MovementAuthority.EndType.FRONT_TRAIN, null);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// if (section.isCtOccupied() && !occupiedLogicSectionSet.contains(section)) {
|
||||
// return new MovementAuthority.End(section, MovementAuthority.EndType.FRONT_TRAIN, null);
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// private MovementAuthority.End checkSwitch(Section tailSection, Section headSection, boolean right) {
|
||||
// Section section = tailSection;
|
||||
// for (int i = 0; i < 10; i++) {
|
||||
// if (section == null || section.equals(headSection))
|
||||
// break;
|
||||
// MovementAuthority.End end = checkSwitch(section, right);
|
||||
// if (end != null)
|
||||
// return end;
|
||||
// section = section.getNextRunningSectionOf(right);
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// private MovementAuthority.End checkSwitch(Section section, boolean right) {
|
||||
// Switch relSwitch = section.getRelSwitch();
|
||||
// Section nextSection = section.getNextRunningSectionOf(right);
|
||||
// if (relSwitch != null) { //是道岔区段
|
||||
// Route route = relSwitch.getRoute();
|
||||
// Section previousSection = section.getNextRunningSectionOf(!right);
|
||||
// if (previousSection == null)
|
||||
// return null;
|
||||
// if (route != null) { //道岔进路锁闭
|
||||
// if (relSwitch.isLoss()) { //失表且下个区段
|
||||
// return new MovementAuthority.End(relSwitch, MovementAuthority.EndType.FAULT_SWITCH, previousSection);
|
||||
// } else {
|
||||
// List<RouteFls> flsList = route.getFlsList();
|
||||
// if (!CollectionUtils.isEmpty(flsList)) {
|
||||
// List<RouteFls> fls = flsList.stream()
|
||||
// .filter(routeFls -> routeFls.getBase().getASwitch().equals(relSwitch))
|
||||
// .collect(Collectors.toList());
|
||||
// if (!routeService.isFlsCheckPass(fls)) {
|
||||
// return new MovementAuthority.End(relSwitch, MovementAuthority.EndType.FAULT_SWITCH, previousSection);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// private MovementAuthority.End checkClosedSection(Section section) {
|
||||
// if (section.isClosed()) {
|
||||
// return new MovementAuthority.End(section, MovementAuthority.EndType.CLOSED_SECTION);
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// private MovementAuthority.End checkEC(MapConfig config, Section section) {
|
||||
// if (section.isNormalStandTrack()) {
|
||||
// Station station = section.getStation();
|
||||
// if (config.isSharingECStation(station.getCode())) {
|
||||
// for (Stand stand : station.getAllStandList()) {
|
||||
// if (stand.isEmergencyClosed()) {
|
||||
// return new MovementAuthority.End(stand, MovementAuthority.EndType.EC_STAND, section);
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// List<Stand> standList = section.getStandList();
|
||||
// for (Stand stand : standList) {
|
||||
// if (stand.isEmergencyClosed()) {
|
||||
// return new MovementAuthority.End(stand, MovementAuthority.EndType.EC_STAND, section);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// private MovementAuthority.End checkUnlockedOverlap(Simulation simulation, Section section, boolean right) {
|
||||
// SimulationDataRepository repository = simulation.getRepository();
|
||||
// // 判断是否已经办理进路的区段
|
||||
// Route route = null;
|
||||
// if (section.isRouteLock()) {
|
||||
// List<Route> settingRoutes = repository.getSettingRoutes();
|
||||
// for (Route settingRoute : settingRoutes) {
|
||||
// if (settingRoute.isLastRouteSection(section)) {
|
||||
// route = settingRoute;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (Objects.nonNull(route) && repository.isOverlapNeedSetting(route)) { // 进路需要办理延续保护
|
||||
// RouteOverlap overlap = route.getOverlap();
|
||||
// if (!overlap.isLock()) { // 延续保护未锁闭
|
||||
// return new MovementAuthority.End(overlap,
|
||||
// MovementAuthority.EndType.UNLOCKED_OVERLAP, overlap.getSection());
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public void calculateMAOfITC(Simulation simulation, VirtualRealityTrain train) {
|
||||
// // 查找移动授权终端列表
|
||||
// List<MovementAuthority.End> endList = this.findItcMaEnd(train.getHeadPosition(), train.isRight());
|
||||
// if (CollectionUtils.isEmpty(endList)) { // 未找到授权终点
|
||||
// return;
|
||||
// }
|
||||
// // 根据查找到的授权终端,比较并构建最终的移动授权数据
|
||||
// MovementAuthority ma = this.compareAndBuildMa(train, endList);
|
||||
// // 通知车载ATP
|
||||
// this.onboardAtpApiService.updateMA4ITC(train, ma);
|
||||
// }
|
||||
//
|
||||
// public MovementAuthority calculateMAOfITC(Simulation simulation, Responder responder) {
|
||||
// // 查找移动授权终端列表
|
||||
// List<MovementAuthority.End> endList = this.findItcMaEnd(responder.getPosition(), responder.getSignal().isRight());
|
||||
// if (CollectionUtils.isEmpty(endList)) { // 未找到授权终点
|
||||
// return null;
|
||||
// }
|
||||
// // 根据查找到的授权终端,比较并构建最终的移动授权数据
|
||||
// MovementAuthority ma = this.compareAndBuildMa(responder.getSignal().isRight(), endList);
|
||||
// // 通知车载ATP
|
||||
// return ma;
|
||||
// }
|
||||
//
|
||||
// private List<MovementAuthority.End> findItcMaEnd(SectionPosition position, boolean right) {
|
||||
// List<MovementAuthority.End> endList = new ArrayList<>();
|
||||
// MovementAuthority.End deviceEnd = null;
|
||||
// Section section = position.getSection();
|
||||
// int count = 0;
|
||||
// while (Objects.nonNull(section) && count < 20) {
|
||||
// if (count > 1 && !CollectionUtils.isEmpty(endList))
|
||||
// break;
|
||||
// ++count;
|
||||
// // 信号机
|
||||
// MovementAuthority.End signalEnd = checkGroundSignal(section, right);
|
||||
// if (Objects.nonNull(signalEnd)) {
|
||||
// endList.add(signalEnd);
|
||||
//// deviceEnd = signalEnd;
|
||||
// break;
|
||||
// }
|
||||
// // 轨道尽头/问题道岔
|
||||
// Section temp = section.getNextRunningSectionOf(right);
|
||||
// if (Objects.isNull(temp)) { // 到尽头
|
||||
// if (!section.isSwitchTrack()) { // 问题道岔
|
||||
// endList.add(new MovementAuthority.End(section,
|
||||
// MovementAuthority.EndType.END_TRACK));
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (Objects.nonNull(deviceEnd)) {
|
||||
// endList.add(deviceEnd);
|
||||
// }
|
||||
// return endList;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 比较并构建移动授权数据
|
||||
// *
|
||||
// * @param train
|
||||
// * @param endList
|
||||
// * @return
|
||||
// */
|
||||
// private MovementAuthority compareAndBuildMa(VirtualRealityTrain train, List<MovementAuthority.End> endList) {
|
||||
// return compareAndBuildMa(train.isRight(), endList);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 比较并构建移动授权数据
|
||||
// *
|
||||
// * @param endList
|
||||
// * @return
|
||||
// */
|
||||
// private MovementAuthority compareAndBuildMa(boolean right, List<MovementAuthority.End> endList) {
|
||||
// MovementAuthority.End end = null;
|
||||
// if (endList.size() == 1) { // 只有一个,直接构建移动授权
|
||||
// end = endList.get(0);
|
||||
// } else {
|
||||
// for (MovementAuthority.End temp : endList) {
|
||||
// if (Objects.isNull(end)) {
|
||||
// end = temp;
|
||||
// } else {
|
||||
// if (end.isAheadOf(temp, right)) {
|
||||
// end = temp;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(end);
|
||||
// end.confirmEndPosition(right);
|
||||
// return new MovementAuthority(end);
|
||||
// }
|
||||
//
|
||||
// private VirtualRealityTrain queryFrontTrain(VirtualRealityTrain train, List<VirtualRealityTrain> trainList) {
|
||||
// boolean right = train.isRight();
|
||||
// SectionPosition headPosition = train.getHeadPosition();
|
||||
// VirtualRealityTrain front = null;
|
||||
// Float distance = null;
|
||||
// for (VirtualRealityTrain other : trainList) {
|
||||
// if (Objects.equals(other, train)) {
|
||||
// continue;
|
||||
// }
|
||||
// SectionPosition otherTrainPosition;
|
||||
// if (Objects.equals(right, other.isRight())) {
|
||||
// // 同向列车,取车尾
|
||||
// otherTrainPosition = other.calculateTailPosition();
|
||||
//
|
||||
// } else {
|
||||
// // 反向列车,取车头
|
||||
// otherTrainPosition = other.getHeadPosition();
|
||||
// }
|
||||
// Float tempDistance = CalculateService.calculateDistance(headPosition, otherTrainPosition, right);
|
||||
// if (Objects.isNull(tempDistance) || tempDistance < 0) {
|
||||
// // 未找到
|
||||
// continue;
|
||||
// } else {
|
||||
// if (Objects.isNull(front) || tempDistance < distance) {
|
||||
// front = other;
|
||||
// distance = tempDistance;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//// if (Objects.nonNull(front)) {
|
||||
//// log.debug(String.format("列车[%s-%s|%s|%s]前方列车为[%s-%s|%s|%s]",
|
||||
//// train.getGroupNumber(), train.getServiceNumber(),
|
||||
//// train.getTripNumber(), train.getDestinationCode(),
|
||||
//// front.getGroupNumber(), front.getServiceNumber(),
|
||||
//// front.getTripNumber(), front.getDestinationCode()));
|
||||
//// }
|
||||
// return front;
|
||||
// }
|
||||
//
|
||||
// private MovementAuthority.End checkRouteLock(Simulation simulation, Section section, Section tailSection, boolean right, VirtualRealityTrain train) {
|
||||
// if (section.isTransferTrack())
|
||||
// return null;
|
||||
// SimulationDataRepository repository = simulation.getRepository();
|
||||
// // 判断前方是否有信号机(如果存在信号机,则不判断进路锁闭,以兼容现在列车加载到转换轨没有进路情况)
|
||||
//// Signal aheadSignal = section.getSignalOf(right);
|
||||
//// if (Objects.nonNull(aheadSignal)) {
|
||||
//// return null;
|
||||
//// }
|
||||
// // 先查询是否是已排列的锁闭进路
|
||||
// List<Route> settingRoutes = repository.getSettingRoutes();
|
||||
// boolean lock = false;
|
||||
// if (!CollectionUtils.isEmpty(settingRoutes)) {
|
||||
// for (Route route : settingRoutes) {
|
||||
// if (route.isRouteSection(section)
|
||||
//// && !route.isSetting()
|
||||
// ) {
|
||||
// Signal signal = section.getSignalOf(right);
|
||||
// if (route.isRight() == right || (signal == null || signal.isNormalOpen())) {
|
||||
// lock = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (!lock) { // 未找到锁闭进路,判断是否自动信号
|
||||
// Section base = section;
|
||||
// int count = 0;
|
||||
// while (Objects.nonNull(base) && count < 20) {
|
||||
// ++count;
|
||||
// // 向反方向查找,找信号机,判断是否自动信号
|
||||
// Section pre = base.getNextRunningSectionOf(!right);
|
||||
// if (Objects.nonNull(pre)) {
|
||||
// Signal signal = pre.getSignalOf(right);
|
||||
// if (Objects.nonNull(signal)) {
|
||||
// if (signal.isAutoSignal()) {
|
||||
// lock = true; // 如果是自动信号,也相当于锁闭
|
||||
// }
|
||||
// break; // 找到信号机,结束
|
||||
// }
|
||||
// }
|
||||
// base = pre;
|
||||
// }
|
||||
// }
|
||||
// if (!lock) {
|
||||
// // 未锁闭进路中,设置移动授权终点
|
||||
// return new MovementAuthority.End(section, MovementAuthority.EndType.UNLOCK_SECTION);
|
||||
// }
|
||||
// return null;
|
||||
//
|
||||
//
|
||||
//// SimulationDataRepository repository = simulation.getRepository();
|
||||
//// // 判断前方是否有信号机(如果存在信号机,则不判断进路锁闭,以兼容现在列车加载到转换轨没有进路情况)
|
||||
//// if (section.isTransferTrack()) {
|
||||
//// return null;
|
||||
//// }
|
||||
////// Signal aheadSignal = section.getSignalOf(right);
|
||||
////// if (Objects.nonNull(aheadSignal)) {
|
||||
////// return null;
|
||||
////// }
|
||||
//// // 先查询是否是已排列的锁闭进路
|
||||
//// List<Route> settingRoutes = repository.getSettingRoutes();
|
||||
//// boolean lock = false;
|
||||
//// if (!CollectionUtils.isEmpty(settingRoutes)) {
|
||||
//// boolean headRoute = false;
|
||||
//// boolean tailRoute = false;
|
||||
//// for (Route route : settingRoutes) {
|
||||
//// if (route.isRight() == right && (route.isRouteSection(section) || route.isRouteSection(tailSection))) {
|
||||
//// if (route.isRouteSection(section))
|
||||
//// headRoute = true;
|
||||
//// if (route.isRouteSection(tailSection))
|
||||
//// tailRoute = true;
|
||||
//// lock = true;
|
||||
//// List<Switch> switches = screenSwitchesInFront(route, tailSection);
|
||||
//// if (!this.checkRouteSwitchPosition(route, switches) || !this.isFlsCheckPass(route.getFlsList(), switches)) {
|
||||
//// return new MovementAuthority.End(section, MovementAuthority.EndType.ROUTE_INTERLOCK_NOT_MET);
|
||||
//// }
|
||||
//// if (headRoute && tailRoute)
|
||||
//// break;
|
||||
//// }
|
||||
//// }
|
||||
//// }
|
||||
//// if (!lock) { // 未找到锁闭进路,判断是否自动信号
|
||||
//// Section base = section;
|
||||
//// int count = 0;
|
||||
//// while (Objects.nonNull(base) && count < 20) {
|
||||
//// ++count;
|
||||
//// // 向反方向查找,找信号机,判断是否自动信号
|
||||
//// Section pre = base.getNextRunningSectionOf(!right);
|
||||
//// if (Objects.nonNull(pre)) {
|
||||
//// Signal signal = pre.getSignalOf(right);
|
||||
//// if (Objects.nonNull(signal)) {
|
||||
//// if (signal.isAutoSignal()) {
|
||||
//// lock = true; // 如果是自动信号,也相当于锁闭
|
||||
//// }
|
||||
//// break; // 找到信号机,结束
|
||||
//// }
|
||||
//// }
|
||||
//// base = pre;
|
||||
//// }
|
||||
//// }
|
||||
//// if (!lock && section.getSignalOf(right) == null) {
|
||||
//// // 未锁闭进路中,设置移动授权终点
|
||||
//// return new MovementAuthority.End(section, MovementAuthority.EndType.UNLOCK_SECTION);
|
||||
//// }
|
||||
//// return null;
|
||||
// }
|
||||
//
|
||||
// private boolean checkRouteSwitchPosition(Route route, List<Switch> switches) {
|
||||
// List<SwitchElement> collect = route.getSwitchList().stream()
|
||||
// .filter(element -> switches.contains(element.getASwitch()))
|
||||
// .collect(Collectors.toList());
|
||||
// return routeService.checkRouteSwitchPosition(collect);
|
||||
// }
|
||||
//
|
||||
// private boolean isFlsCheckPass(List<RouteFls> flsList, List<Switch> switches) {
|
||||
// if (!CollectionUtils.isEmpty(flsList) && !CollectionUtils.isEmpty(switches)) {
|
||||
// List<RouteFls> collect = flsList.stream().filter(fls -> switches.contains(fls.getBase().getASwitch())).collect(Collectors.toList());
|
||||
// return routeService.isFlsCheckPass(collect);
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 筛选前方的道岔
|
||||
// */
|
||||
// private List<Switch> screenSwitchesInFront(Route route, Section section) {
|
||||
// boolean right = route.isRight();
|
||||
// List<Section> sectionList = route.getSectionList();
|
||||
// List<Switch> sectionRelSwitches = new ArrayList<>();
|
||||
// for (int i = 0; i < 10; i++) {
|
||||
// if (sectionList.contains(section))
|
||||
// break;
|
||||
// else
|
||||
// section = section.getNextRunningSectionOf(right);
|
||||
// }
|
||||
// while (sectionList.contains(section)) {
|
||||
// if (section.getRelSwitch() != null)
|
||||
// sectionRelSwitches.add(section.getRelSwitch());
|
||||
// section = section.getNextRunningSectionOf(right);
|
||||
// }
|
||||
// return sectionRelSwitches;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 检查地面真实信号机是否未开放/故障信号机
|
||||
// *
|
||||
// * @param section
|
||||
// * @param right
|
||||
// * @return
|
||||
// */
|
||||
// private MovementAuthority.End checkGroundSignal(Section section, boolean right) {
|
||||
// Signal signal = section.getSignalOf(right);
|
||||
// if (Objects.nonNull(signal) && !signal.isVirtual() && !signal.isNormalOpen()) {
|
||||
// return new MovementAuthority.End(signal,
|
||||
// MovementAuthority.EndType.CLOSED_SIGNAL);
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 检查是否未开放/故障信号机
|
||||
// *
|
||||
// * @param section
|
||||
// * @param right
|
||||
// * @return
|
||||
// */
|
||||
// private MovementAuthority.End checkSignal(Section section, boolean right) {
|
||||
// Signal signal = section.getSignalOf(right);
|
||||
// if (Objects.nonNull(signal) && !signal.isNormalOpen()) {
|
||||
// return new MovementAuthority.End(signal,
|
||||
// MovementAuthority.EndType.CLOSED_SIGNAL);
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 检查是否站台屏蔽门开门
|
||||
// */
|
||||
// private MovementAuthority.End checkPsdOpenOrClose(Section section) {
|
||||
// if (section.isStandTrack()) {
|
||||
// List<Stand> standList = section.getStandList();
|
||||
// for (Stand stand : standList) {
|
||||
// if (!stand.isPsdSafe()) {
|
||||
// return new MovementAuthority.End(stand, MovementAuthority.EndType.OPENED_PSD, section);
|
||||
// }
|
||||
// if (stand.isClosed()) {
|
||||
// return new MovementAuthority.End(stand, MovementAuthority.EndType.CLOSED_STAND, section);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
//// public void addJobs(Simulation simulation) {
|
||||
////// simulation.addJob(SimulationModule.ZC.name(), () -> this.run(simulation), SimulationConstants.ZC_LOOP_RATE);
|
||||
//// simulation.addJob("MaCal", () -> this.maService.calculateMaOfCtcTrains(simulation), 1000);
|
||||
//// }
|
||||
//}
|
@ -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);
|
||||
|
@ -46,7 +46,14 @@ public class SortDiagramStation {
|
||||
|
||||
|
||||
private Station findNotDepotStation(boolean isRight, int index) {
|
||||
Station station = stationList.get(index);
|
||||
Station station = null;
|
||||
if (index >= stationList.size()) {
|
||||
station = stationList.get(stationList.size() - 1);
|
||||
} else if (index <= 0) {
|
||||
station = stationList.get(0);
|
||||
} else {
|
||||
station = stationList.get(index);
|
||||
}
|
||||
while (station.isDepot()) {
|
||||
index += isRight ? -1 : 1;
|
||||
station = stationList.get(index);
|
||||
|
@ -32,6 +32,7 @@ public abstract class AtsRouteSelectService {
|
||||
* 查询需要触发的进路
|
||||
*
|
||||
* @param simulation
|
||||
* @param targetList 运行计划中的计划区段(包含站后折返轨)
|
||||
* @param turnBackSection 站后折返的折返轨
|
||||
* @return
|
||||
*/
|
||||
@ -63,13 +64,18 @@ public abstract class AtsRouteSelectService {
|
||||
MapConfig config = repository.getConfig();
|
||||
if (!config.isSignalOpenAfterParking() || (headSection.equals(planSection)
|
||||
&& trainInfo.isParking())) { //不需要停站就可以开放信号机或者已经在计划区段停站(可以继续向前办理进路)
|
||||
if (nextPlanSection != null) { //计划区段路径未跑完
|
||||
//根据车站折返策略处理
|
||||
Station station = planSection.getStation();
|
||||
if (station.getTbStrategyId() != null && Objects.equals(turnBackSection,
|
||||
nextPlanSection)) { //有折返策略时按折返策略
|
||||
return queryTriggerRoutes4TurnBack(simulation, planSection, turnBackSection, trainInfo);
|
||||
} else if (nextPlanSection != null) { //无折返策略按计划
|
||||
routePaths = repository.queryRoutePaths(planSection, nextPlanSection);
|
||||
if (!CollectionUtils.isEmpty(routePaths)) {
|
||||
return this.queryTriggerRoutesOfRoutePath(repository, trainInfo, routePaths,
|
||||
nextPlanSection).getRoute();
|
||||
}
|
||||
} else if (turnBackSection != null) { //站后折返
|
||||
} else if (turnBackSection != null) {
|
||||
return queryTriggerRoutes4TurnBack(simulation, planSection, turnBackSection, trainInfo);
|
||||
}
|
||||
}
|
||||
|
@ -5,23 +5,26 @@ import club.joylink.rtss.simulation.cbtc.ATS.service.AtsStandService;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.service.AtsTrainService;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.MapConfig;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Route;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
||||
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.plan.StationPlan;
|
||||
import club.joylink.rtss.simulation.cbtc.data.plan.TripPlan;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.RoutePath;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATP.OnboardAtpApiService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* 计划车阶段处理服务
|
||||
@ -29,6 +32,7 @@ import java.util.Objects;
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AtsPlanTrainStageService implements AtsStageService {
|
||||
|
||||
@Autowired
|
||||
private AtsRealRunRecordService realRunRecordService;
|
||||
@Autowired
|
||||
@ -39,9 +43,11 @@ public class AtsPlanTrainStageService implements AtsStageService {
|
||||
private AtsTrainService atsTrainService;
|
||||
|
||||
@Override
|
||||
public void handleTransferTrackParking(Simulation simulation, TrainInfo trainInfo, Section parkSection) {
|
||||
public void handleTransferTrackParking(Simulation simulation, TrainInfo trainInfo,
|
||||
Section parkSection) {
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(), trainInfo.getTripNumber());
|
||||
TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(),
|
||||
trainInfo.getTripNumber());
|
||||
// List<RoutePath> routePathList = repository.queryRoutePathsByEnd(parkSection);
|
||||
// if (routePathList.get(0).isRight() == trainInfo.getRight()) { //准备回库
|
||||
// if (!parkSection.isTurnBackTrack()) { //针对上饶沙盘
|
||||
@ -82,15 +88,18 @@ public class AtsPlanTrainStageService implements AtsStageService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleNormalStandParking(Simulation simulation, TrainInfo trainInfo, Section parkSection) {
|
||||
public void handleNormalStandParking(Simulation simulation, TrainInfo trainInfo,
|
||||
Section parkSection) {
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
MapConfig config = repository.getConfig();
|
||||
List<Stand> standList = parkSection.getStandList();
|
||||
TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(), trainInfo.getTripNumber());
|
||||
TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(),
|
||||
trainInfo.getTripNumber());
|
||||
TripPlan nextTripPlan = null;
|
||||
StationPlan stationPlan = tripPlan.queryStationPlan(parkSection);
|
||||
if (config.isStandTbStrategyIsInvalid()) {
|
||||
if (stationPlan != null && tripPlan.isLastPlan(stationPlan) && tripPlan.isFrontTurnBack()) { // 到达终点站了,判断站前折返还是站后折返
|
||||
if (stationPlan != null && tripPlan.isLastPlan(stationPlan)
|
||||
&& tripPlan.isFrontTurnBack()) { // 到达终点站了,判断站前折返还是站后折返
|
||||
// 站前折返,查询下一车次计划
|
||||
nextTripPlan = repository.queryNextTripPlanOf(tripPlan);
|
||||
} else if (stationPlan == null && tripPlan.isLastPlanStation(parkSection.getStation())) {
|
||||
@ -101,9 +110,12 @@ public class AtsPlanTrainStageService implements AtsStageService {
|
||||
}
|
||||
if (nextTripPlan != null) { // 站前折返,更新计划
|
||||
this.updateTripPlan(simulation, trainInfo, nextTripPlan);
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertEquals(nextTripPlan.getFirstStationPlan().getSection(), parkSection,
|
||||
String.format("下一车次计划[%s]第一站台轨和停靠站台轨不相同:[%s]", nextTripPlan.getStNumber(), parkSection.getName()));
|
||||
this.updateNextPlan(simulation, trainInfo, nextTripPlan, nextTripPlan.getFirstStationPlan());
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertEquals(
|
||||
nextTripPlan.getFirstStationPlan().getSection(), parkSection,
|
||||
String.format("下一车次计划[%s]第一站台轨和停靠站台轨不相同:[%s]",
|
||||
nextTripPlan.getStNumber(), parkSection.getName()));
|
||||
this.updateNextPlan(simulation, trainInfo, nextTripPlan,
|
||||
nextTripPlan.getFirstStationPlan());
|
||||
}
|
||||
} else {
|
||||
if (!CollectionUtils.isEmpty(standList)) {
|
||||
@ -114,20 +126,24 @@ public class AtsPlanTrainStageService implements AtsStageService {
|
||||
case AUTO:
|
||||
if (stationPlan != null && tripPlan.isLastPlan(stationPlan)) { // 当前计划终点站
|
||||
if (Objects.equals(stand.isRight(), trainInfo.getRight())) {
|
||||
onboardAtpApiService.startTurnBack(simulation, trainInfo.getGroupNumber(), parkSection.getCode());
|
||||
onboardAtpApiService.startTurnBack(simulation, trainInfo.getGroupNumber(),
|
||||
parkSection.getCode());
|
||||
nextTripPlan = repository.queryNextTripPlanOf(tripPlan);
|
||||
if (nextTripPlan != null) { // 站前折返,更新计划
|
||||
this.updateTripPlan(simulation, trainInfo, nextTripPlan);
|
||||
this.updateNextPlan(simulation, trainInfo, nextTripPlan, nextTripPlan.getSecondStationPlan());
|
||||
this.updateNextPlan(simulation, trainInfo, nextTripPlan,
|
||||
nextTripPlan.getSecondStationPlan());
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (stationPlan != null && tripPlan.isLastPlan(stationPlan) && tripPlan.isFrontTurnBack()) { // 到达终点站了,判断站前折返还是站后折返
|
||||
if (stationPlan != null && tripPlan.isLastPlan(stationPlan)
|
||||
&& tripPlan.isFrontTurnBack()) { // 到达终点站了,判断站前折返还是站后折返
|
||||
// 站前折返,查询下一车次计划
|
||||
nextTripPlan = repository.queryNextTripPlanOf(tripPlan);
|
||||
} else if (stationPlan == null && tripPlan.isLastPlanStation(parkSection.getStation())) {
|
||||
} else if (stationPlan == null && tripPlan.isLastPlanStation(
|
||||
parkSection.getStation())) {
|
||||
if (config.isAtsAutoHandleManualFrontTurnBack()) {
|
||||
// 人工站前折返
|
||||
nextTripPlan = repository.queryNextTripPlanOf(tripPlan);
|
||||
@ -135,9 +151,12 @@ public class AtsPlanTrainStageService implements AtsStageService {
|
||||
}
|
||||
if (nextTripPlan != null) { // 站前折返,更新计划
|
||||
this.updateTripPlan(simulation, trainInfo, nextTripPlan);
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertEquals(nextTripPlan.getFirstStationPlan().getSection(), parkSection,
|
||||
String.format("下一车次计划[%s]第一站台轨和停靠站台轨不相同:[%s]", nextTripPlan.getStNumber(), parkSection.getName()));
|
||||
this.updateNextPlan(simulation, trainInfo, nextTripPlan, nextTripPlan.getFirstStationPlan());
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertEquals(
|
||||
nextTripPlan.getFirstStationPlan().getSection(), parkSection,
|
||||
String.format("下一车次计划[%s]第一站台轨和停靠站台轨不相同:[%s]",
|
||||
nextTripPlan.getStNumber(), parkSection.getName()));
|
||||
this.updateNextPlan(simulation, trainInfo, nextTripPlan,
|
||||
nextTripPlan.getFirstStationPlan());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -146,9 +165,11 @@ public class AtsPlanTrainStageService implements AtsStageService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ready2DepartFromNormalStand(Simulation simulation, TrainInfo trainInfo, Section parkSection) {
|
||||
public void ready2DepartFromNormalStand(Simulation simulation, TrainInfo trainInfo,
|
||||
Section parkSection) {
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(), trainInfo.getTripNumber());
|
||||
TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(),
|
||||
trainInfo.getTripNumber());
|
||||
StationPlan stationPlan = tripPlan.queryStationPlan(parkSection);
|
||||
if (stationPlan == null) {
|
||||
// 非计划中的停靠站台轨,暂不处理
|
||||
@ -168,7 +189,8 @@ public class AtsPlanTrainStageService implements AtsStageService {
|
||||
}
|
||||
// 到达终点站,准备折返
|
||||
log.debug(String.format("列车[%s]折返初始化", trainInfo.getGroupNumber()));
|
||||
List<RoutePath> routePaths = repository.getRoutePaths(parkSection, tripPlan.getEndSection());
|
||||
List<RoutePath> routePaths = repository.getRoutePaths(parkSection,
|
||||
tripPlan.getEndSection());
|
||||
Signal signal = parkSection.getSignalOf(routePaths.get(0).isRight());
|
||||
if (signal.isMainAspect() || signal.isGuideAspect()) {
|
||||
Route lockedRoute = signal.getLockedRoute();
|
||||
@ -190,7 +212,8 @@ public class AtsPlanTrainStageService implements AtsStageService {
|
||||
this.onboardAtpApiService.updateTripPlan(simulation, trainInfo.getGroupNumber(), nextTripPlan);
|
||||
}
|
||||
|
||||
public void updateNextPlan(Simulation simulation, TrainInfo trainInfo, TripPlan tripPlan, StationPlan nextStationPlan) {
|
||||
public void updateNextPlan(Simulation simulation, TrainInfo trainInfo, TripPlan tripPlan,
|
||||
StationPlan nextStationPlan) {
|
||||
if (nextStationPlan == null) {
|
||||
log.warn(String.format("列车[%s]下一计划到站为null", trainInfo.debugStr()));
|
||||
return;
|
||||
@ -239,7 +262,8 @@ public class AtsPlanTrainStageService implements AtsStageService {
|
||||
}
|
||||
int planRunTime = (int) ChronoUnit.SECONDS.between(startTime, endTime);
|
||||
int adjustRunTime = planRunTime;
|
||||
if (!turnBack && !outbound && config.isAdjustOperationAutomatically() && trainInfo.isAtsAutoAdjust()) {
|
||||
if (!turnBack && !outbound && config.isAdjustOperationAutomatically()
|
||||
&& trainInfo.isAtsAutoAdjust()) {
|
||||
startTime = systemTime.toLocalTime();
|
||||
adjustRunTime = (int) ChronoUnit.SECONDS.between(startTime, endTime);
|
||||
}
|
||||
@ -253,12 +277,17 @@ public class AtsPlanTrainStageService implements AtsStageService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleTurnBackTrackParking(Simulation simulation, TrainInfo trainInfo, Section parkSection) {
|
||||
public void handleTurnBackTrackParking(Simulation simulation, TrainInfo trainInfo,
|
||||
Section parkSection) {
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
LocalDateTime systemTime = simulation.getSystemTime();
|
||||
TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(), trainInfo.getTripNumber());
|
||||
if (tripPlan.getEndSection().equals(parkSection)
|
||||
/*|| tripPlan.getEndSection().getStation().equals(parkSection.getStation())*/) {
|
||||
TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(),
|
||||
trainInfo.getTripNumber());
|
||||
|
||||
// 车次计划中的车站计划全部完成,并且当前折返轨与计划折返轨属于同一站,则认为车次计划完成
|
||||
boolean completed = tripPlan.getPlanList().stream().allMatch(StationPlan::isFinished)
|
||||
&& tripPlan.getEndSection().getStation().equals(parkSection.getStation());
|
||||
if (completed) {
|
||||
// 计划终端折返轨或和计划终端折返轨同站的折返轨,根据车次类型处理
|
||||
TripPlan nextTripPlan = repository.queryNextTripPlanOf(tripPlan);
|
||||
if (nextTripPlan == null) {
|
||||
@ -268,15 +297,19 @@ public class AtsPlanTrainStageService implements AtsStageService {
|
||||
// 备用车
|
||||
if (systemTime.toLocalTime().plusMinutes(5).isAfter(nextTripPlan.getStartTime())) {
|
||||
this.updateTripPlan(simulation, trainInfo, nextTripPlan);
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertNotEquals(parkSection, nextTripPlan.getFirstStationPlan().getSection());
|
||||
this.updateNextPlan(simulation, trainInfo, nextTripPlan, nextTripPlan.getFirstStationPlan());
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertNotEquals(parkSection,
|
||||
nextTripPlan.getFirstStationPlan().getSection());
|
||||
this.updateNextPlan(simulation, trainInfo, nextTripPlan,
|
||||
nextTripPlan.getFirstStationPlan());
|
||||
return;
|
||||
}
|
||||
} else if (tripPlan.isTurnBack()) {
|
||||
// 折返计划
|
||||
this.updateTripPlan(simulation, trainInfo, nextTripPlan);
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertNotEquals(parkSection, nextTripPlan.getFirstStationPlan().getSection());
|
||||
this.updateNextPlan(simulation, trainInfo, nextTripPlan, nextTripPlan.getFirstStationPlan());
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertNotEquals(parkSection,
|
||||
nextTripPlan.getFirstStationPlan().getSection());
|
||||
this.updateNextPlan(simulation, trainInfo, nextTripPlan,
|
||||
nextTripPlan.getFirstStationPlan());
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@ -317,7 +350,8 @@ public class AtsPlanTrainStageService implements AtsStageService {
|
||||
return;
|
||||
}
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(), trainInfo.getTripNumber());
|
||||
TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(),
|
||||
trainInfo.getTripNumber());
|
||||
StationPlan stationPlan = tripPlan.queryStationPlan(planStandTrack);
|
||||
Section section = repository.getByCode(planStandTrack, Section.class);
|
||||
//更新离站信息
|
||||
|
@ -246,12 +246,12 @@ public class CiApiServiceImpl2 implements CiApiService {
|
||||
@Override
|
||||
public void humanCancel(Simulation simulation, String routeCode) {
|
||||
Route route = simulation.getRepository().getByCode(routeCode, Route.class);
|
||||
// if (simulation.getRepository().getConfig().isRailway()) {
|
||||
// BusinessExceptionAssertEnum.OPERATION_FAIL.assertTrue(route.isApproachLock(),
|
||||
// "进路未接近锁闭,不能人解");
|
||||
// }
|
||||
if (route.getStart().isGuideAspect()) { // 根据成都三引导解锁逻辑修改
|
||||
signalService.closeRoute(simulation, route.getStart());
|
||||
} else {
|
||||
this.routeService.delayUnlockStart(simulation, route, route.getStart());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sectionFaultUnlock(Simulation simulation, String sectionCode) {
|
||||
@ -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);
|
||||
@ -500,6 +504,10 @@ public class CiApiServiceImpl2 implements CiApiService {
|
||||
signal.guideDelayStart();
|
||||
}
|
||||
}
|
||||
if (repository.getConfig().isGuideDelayCloseWhenFirstSectionOccupied()
|
||||
&& signal.isGuideAspect()) {
|
||||
signal.guideDelayStart();
|
||||
}
|
||||
// if (signal.getGuideRemain() > 0) {
|
||||
// signal.setGuideRemain(0);
|
||||
// } else {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 列车逐段解锁进路
|
||||
|
@ -6,14 +6,14 @@ 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.vr.VirtualRealitySwitch;
|
||||
import club.joylink.rtss.simulation.cbtc.device.virtual.VirtualRealityDeviceService;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Component
|
||||
public class CiSwitchControlService {
|
||||
|
||||
@Autowired
|
||||
private VirtualRealityDeviceService virtualRealityDeviceService;
|
||||
|
||||
@ -99,7 +99,14 @@ public class CiSwitchControlService {
|
||||
*/
|
||||
public SwitchIndication turn(Simulation simulation, Switch aSwitch) {
|
||||
VirtualRealitySwitch vrSwitch = aSwitch.getVirtualSwitch();
|
||||
boolean lastTurnToN = vrSwitch.isLastTurnToN();
|
||||
boolean lastTurnToN; //最后转向的方向,主要是为了解决失表的情况下每次转动道岔要向不同方向转动
|
||||
if (vrSwitch.isPosN()) {
|
||||
lastTurnToN = true;
|
||||
} else if (vrSwitch.isPosR()) {
|
||||
lastTurnToN = false;
|
||||
} else {
|
||||
lastTurnToN = vrSwitch.isLastTurnToN();
|
||||
}
|
||||
if (simulation.getRepository().getConfig().isSwitchNRTurnChain()) {
|
||||
Switch linkedSwitch = aSwitch.queryLinkedSwitch();
|
||||
if (Objects.nonNull(linkedSwitch)) {
|
||||
@ -133,7 +140,8 @@ public class CiSwitchControlService {
|
||||
return false;
|
||||
}
|
||||
VirtualRealitySwitch vrSwitch = aSwitch.getVirtualSwitch();
|
||||
this.virtualRealityDeviceService.control(simulation, vrSwitch, VirtualRealitySwitch.Operation.NP);
|
||||
this.virtualRealityDeviceService.control(simulation, vrSwitch,
|
||||
VirtualRealitySwitch.Operation.NP);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -149,7 +157,8 @@ public class CiSwitchControlService {
|
||||
return false;
|
||||
}
|
||||
VirtualRealitySwitch vrSwitch = aSwitch.getVirtualSwitch();
|
||||
this.virtualRealityDeviceService.control(simulation, vrSwitch, VirtualRealitySwitch.Operation.RP);
|
||||
this.virtualRealityDeviceService.control(simulation, vrSwitch,
|
||||
VirtualRealitySwitch.Operation.RP);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -161,20 +170,23 @@ public class CiSwitchControlService {
|
||||
*/
|
||||
private boolean checkTurnCondition(Switch aSwitch) {
|
||||
// 道岔锁闭 或者 道岔占用且无强扳授权,则不能转动
|
||||
return !(aSwitch.isLocked() || (aSwitch.isSectionOccupied() && aSwitch.getForceTurnRemain() <= 0));
|
||||
return !(aSwitch.isLocked() || (aSwitch.isSectionOccupied()
|
||||
&& aSwitch.getForceTurnRemain() <= 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* 确保道岔位置正确
|
||||
*/
|
||||
public boolean ensureSwitchPosCurrent(Simulation simulation, List<SwitchElement> switchElements, boolean guideSetting) {
|
||||
public boolean ensureSwitchPosCurrent(Simulation simulation, List<SwitchElement> switchElements,
|
||||
boolean guideSetting) {
|
||||
boolean allOn = true;
|
||||
if (switchElements == null) {
|
||||
return true;
|
||||
}
|
||||
for (SwitchElement switchElement : switchElements) {
|
||||
boolean onPos = this.turnRouteSwitch(simulation, switchElement);
|
||||
if (!onPos && !(guideSetting && switchElement.getASwitch().isLoss() && switchElement.getASwitch().isGuideMasterLock())) { //不在正确位置并且不是办理引导进路中的引导总锁的失表道岔
|
||||
if (!onPos && !(guideSetting && switchElement.getASwitch().isLoss()
|
||||
&& switchElement.getASwitch().isGuideMasterLock())) { //不在正确位置并且不是办理引导进路中的引导总锁的失表道岔
|
||||
allOn = false;
|
||||
}
|
||||
}
|
||||
|
@ -1,59 +0,0 @@
|
||||
//package club.joylink.rtss.simulation.cbtc.CI.service;
|
||||
//
|
||||
//import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.map.AutoSignal;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.map.Signal;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
///**
|
||||
// * 自动信号服务
|
||||
// */
|
||||
//@Slf4j
|
||||
//@Component
|
||||
//public class AutoSignalService {
|
||||
//
|
||||
// @Autowired
|
||||
// private SignalService signalService;
|
||||
//
|
||||
// /**
|
||||
// * 根据连锁关系更新信号显示
|
||||
// * @param simulation
|
||||
// * @param autoSignal
|
||||
// */
|
||||
// public void updateSignalDisplay(Simulation simulation, AutoSignal autoSignal) {
|
||||
// Signal signal = autoSignal.getSignal();
|
||||
// if (!signal.isLogicLight()) {
|
||||
// List<Section> sectionList = autoSignal.getSectionList();
|
||||
// boolean clear = true; // 所有区段是否出清
|
||||
// for (Section section : sectionList) {
|
||||
// if (section.isOccupied()) {
|
||||
// clear = false;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (clear) { // 全部出清,开信号机
|
||||
// this.signalService.openGreenSignal(simulation, signal);
|
||||
// } else { // 关信号机
|
||||
// this.signalService.close(simulation, signal);
|
||||
// }
|
||||
// } else {
|
||||
// if (!signal.isMainAspect()) {
|
||||
// this.signalService.openGreenSignal(simulation, signal);
|
||||
// }
|
||||
// }
|
||||
//// if (!clear) { // 信号机物理点红灯
|
||||
//// if (signal.isLogicLight()) {
|
||||
//// signal.changeLightType(false);
|
||||
//// }
|
||||
//// this.signalService.close(simulation, signal);
|
||||
//// } else { // 信号机开灯
|
||||
//// this.signalService.openGreenSignal(simulation, signal);
|
||||
//// }
|
||||
// }
|
||||
//
|
||||
//}
|
File diff suppressed because it is too large
Load Diff
@ -1,120 +0,0 @@
|
||||
//package club.joylink.rtss.simulation.cbtc.CI.service;
|
||||
//
|
||||
//import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
//import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.map.Route;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.map.Signal;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//import org.springframework.util.CollectionUtils;
|
||||
//
|
||||
//import java.util.List;
|
||||
//import java.util.Objects;
|
||||
//
|
||||
///**
|
||||
// * 区段服务
|
||||
// */
|
||||
//@Component
|
||||
//@Slf4j
|
||||
//public class SectionService {
|
||||
//
|
||||
// @Autowired
|
||||
// private SignalService signalService;
|
||||
// @Autowired
|
||||
// private RouteService routeService;
|
||||
//
|
||||
// /**
|
||||
// * 封锁(封锁后,包含区段的进路不能排列)
|
||||
// */
|
||||
// public void blockade(Section section) {
|
||||
//// if(section.isRouteLock() || section.isOverlapLock()) {
|
||||
//// log.info(String.format("区段[%s(%s)]进路锁闭,不能封锁", section.getName(), section.getCode()));
|
||||
//// return;
|
||||
//// }
|
||||
// if (!section.isBlockade()) {
|
||||
// section.setBlockade(true);
|
||||
// if (!section.isCross() && !CollectionUtils.isEmpty(section.getLogicList())) {
|
||||
// section.getLogicList().forEach(logic -> logic.setBlockade(true));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 解封
|
||||
// */
|
||||
// public void unblock(Section section) {
|
||||
// if (section.isBlockade()) {
|
||||
// section.setBlockade(false);
|
||||
// if (!section.isCross() && !CollectionUtils.isEmpty(section.getLogicList())) {
|
||||
// section.getLogicList().forEach(logic -> logic.setBlockade(false));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 区故解
|
||||
// */
|
||||
// public void sectionFaultUnlock(Simulation simulation, Section section, Route route) {
|
||||
// if (route != null) {
|
||||
// if (route.isOpenMain()) {
|
||||
// signalService.close(simulation, route.getStart());
|
||||
// }
|
||||
// if (routeService.isApproachLock(simulation.getRepository(), route) || section.isOverlapLock()) {
|
||||
// // 区段延时解锁
|
||||
// int delayTime = route.getDelayReleaseTime() * 1000;
|
||||
// section.delayUnlock(delayTime);
|
||||
// if (section.isShowLogic()) {
|
||||
// section.getLogicList().forEach(ls -> ls.delayUnlock(delayTime));
|
||||
// }
|
||||
// return;
|
||||
// } else {
|
||||
// route.setLock(false);
|
||||
// Signal start = route.getStart();
|
||||
// if (start.getLockedRoute() == route) {
|
||||
// start.setLockedRoute(null);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// section.faultUnlock();
|
||||
// if (section.isShowLogic()) {
|
||||
// section.getLogicList().forEach(Section::faultUnlock);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 区段延时区故解
|
||||
// *
|
||||
// * @param simulation
|
||||
// * @param section
|
||||
// */
|
||||
// public void delayUnlock(Simulation simulation, Section section) {
|
||||
// int remainTime = section.getDelayTime();
|
||||
// if (remainTime > 0) {
|
||||
// remainTime -= SimulationConstants.CI_LOOP_RATE;
|
||||
// if (remainTime <= 0) {
|
||||
// List<Route> routeList = simulation.getRepository().queryAllLockedRoute();
|
||||
// Route lockedRoute = null;
|
||||
// for (Route route : routeList) {
|
||||
// if (route.containSection(section)) {
|
||||
// lockedRoute = route;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (Objects.nonNull(lockedRoute)) {
|
||||
// lockedRoute.setLock(false);
|
||||
// Signal start = lockedRoute.getStart();
|
||||
// this.signalService.close(simulation, start);
|
||||
// if (start.getLockedRoute() == lockedRoute) {
|
||||
// start.setLockedRoute(null);
|
||||
// }
|
||||
// }
|
||||
// section.faultUnlock();
|
||||
// section.setDelayTime(0);
|
||||
// } else {
|
||||
// section.setDelayTime(remainTime);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
@ -1,180 +0,0 @@
|
||||
//package club.joylink.rtss.simulation.cbtc.CI.service;
|
||||
//
|
||||
//import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.map.Route;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.map.Signal;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.support.SignalApproachMessage;
|
||||
//import club.joylink.rtss.simulation.cbtc.event.RouteModeChangeEvent;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.context.ApplicationContext;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//import org.springframework.util.CollectionUtils;
|
||||
//
|
||||
//import java.util.List;
|
||||
//import java.util.Objects;
|
||||
//
|
||||
///**
|
||||
// * 信号机服务
|
||||
// */
|
||||
//@Component
|
||||
//@Slf4j
|
||||
//public class SignalService {
|
||||
//
|
||||
// @Autowired
|
||||
// private VrSignalControlService vrSignalControlService;
|
||||
//
|
||||
// @Autowired
|
||||
// private ApplicationContext applicationContext;
|
||||
//
|
||||
// /**
|
||||
// * 封锁(封锁后,包含信号机的进路不能排列)
|
||||
// * @param signal
|
||||
// */
|
||||
// public void blockade(Simulation simulation, Signal signal) {
|
||||
// if(!signal.isBlockade()) {
|
||||
// signal.setBlockade(true);
|
||||
// this.close(simulation, signal);
|
||||
// if (signal.getLockedRoute() != null) {
|
||||
// signal.setReblockade(true);
|
||||
// log.debug(signal.debugStr() + "因信号机封锁且有锁闭的进路而重复封锁");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 解封
|
||||
// * @param signal
|
||||
// */
|
||||
// public void unblock(Signal signal) {
|
||||
// if (signal.isBlockade()) {
|
||||
// signal.setBlockade(false);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 信号关闭
|
||||
// * @param simulation
|
||||
// * @param signal
|
||||
// */
|
||||
// public void close(Simulation simulation, Signal signal) {
|
||||
// if (signal.isLogicLight()) {
|
||||
// signal.apply(false, false, true);
|
||||
// if (!signal.isVirtual()) {
|
||||
// this.vrSignalControlService.close(simulation, signal.getVirtualSignal());
|
||||
// }
|
||||
// } else {
|
||||
// if (!signal.isVirtual()) {
|
||||
// this.vrSignalControlService.openRedSignal(simulation, signal.getVirtualSignal());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 控制室外信号机点绿灯
|
||||
// * @param simulation
|
||||
// * @param signal
|
||||
// */
|
||||
// public void openGreenSignal(Simulation simulation, Signal signal) {
|
||||
// if (signal.isLogicLight()) {
|
||||
// signal.apply(true, false, false);
|
||||
// if (!signal.isVirtual()) {
|
||||
// this.vrSignalControlService.close(simulation, signal.getVirtualSignal());
|
||||
// }
|
||||
// } else {
|
||||
// if (!signal.isVirtual()) {
|
||||
// this.vrSignalControlService.openGreenSignal(simulation, signal.getVirtualSignal());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 控制室外信号机点黄灯
|
||||
// * @param simulation
|
||||
// * @param signal
|
||||
// */
|
||||
// public void openYellowSignal(Simulation simulation, Signal signal) {
|
||||
// if (signal.isLogicLight()) {
|
||||
// signal.apply(false, true, false);
|
||||
// if (!signal.isVirtual()) {
|
||||
// this.vrSignalControlService.close(simulation, signal.getVirtualSignal());
|
||||
// }
|
||||
// } else {
|
||||
// this.vrSignalControlService.openYellowSignal(simulation, signal.getVirtualSignal());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 控制室外信号机点黄红灯
|
||||
// * @param simulation
|
||||
// * @param signal
|
||||
// */
|
||||
// public void openGuideSignal(Simulation simulation, Signal signal) {
|
||||
// signal.changeLightType(false);
|
||||
// this.vrSignalControlService.openGuideSignal(simulation, signal.getVirtualSignal());
|
||||
// signal.apply(false, true, true);
|
||||
// int guideRemain = signal.getGuideRemain();
|
||||
// if (guideRemain > 0) {
|
||||
// signal.guideInfinite();
|
||||
// } else {
|
||||
// signal.guideStart();
|
||||
// }
|
||||
// signal.setInit(false);
|
||||
// if (signal.isReblockade()) {
|
||||
// signal.setReblockade(false);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 处理信号机接近消息
|
||||
// * @param simulation
|
||||
// * @param signal
|
||||
// * @param approachMessage
|
||||
// */
|
||||
// public void handleApproachMessage(Simulation simulation, Signal signal, SignalApproachMessage approachMessage) {
|
||||
// if (Objects.equals(signal.getApproachMsg(), approachMessage.getApproachMsg())) {
|
||||
// return;
|
||||
// }
|
||||
// signal.setApproachMsg(approachMessage.getApproachMsg());
|
||||
// if (signal.isNctApproach()) { // 接近区段非通信车占用
|
||||
// this.changeRoutesCBTCMode(simulation, signal, false);
|
||||
// if (signal.isLogicLight()) { // 非通信车占用,改为物理点灯
|
||||
// this.changeSignalLightType(simulation, signal, false);
|
||||
// }
|
||||
// } else if (signal.isCbtcApproach()) { // 接近区段通信车占用
|
||||
// this.changeRoutesCBTCMode(simulation, signal, true);
|
||||
// if (!signal.isLogicLight()) {
|
||||
// this.changeSignalLightType(simulation, signal, true);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void changeSignalLightType(Simulation simulation, Signal signal, boolean logic) {
|
||||
// if (!Objects.equals(signal.isLogicLight(), logic)) {
|
||||
// signal.changeLightType(logic);
|
||||
// if (!signal.isLogicLight()) {
|
||||
// if (!signal.isVirtual()) {
|
||||
// if (signal.isGreenOpen()) {
|
||||
// this.vrSignalControlService.openGreenSignal(simulation, signal.getVirtualSignal());
|
||||
// } else if (signal.isYellowOpen()) {
|
||||
// this.vrSignalControlService.openYellowSignal(simulation, signal.getVirtualSignal());
|
||||
// } else {
|
||||
// this.vrSignalControlService.openRedSignal(simulation, signal.getVirtualSignal());
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// if (!signal.isVirtual()) {
|
||||
// this.vrSignalControlService.close(simulation, signal.getVirtualSignal());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void changeRoutesCBTCMode(Simulation simulation, Signal signal, boolean cbtc) {
|
||||
// List<Route> routeList = signal.getRouteList();
|
||||
// if (!CollectionUtils.isEmpty(routeList)) {
|
||||
// routeList.forEach(route -> route.setCbtcMode(cbtc));
|
||||
// applicationContext.publishEvent(new RouteModeChangeEvent(this, simulation, routeList));
|
||||
// }
|
||||
// }
|
||||
//}
|
@ -1,185 +0,0 @@
|
||||
//package club.joylink.rtss.simulation.cbtc.CI.service;
|
||||
//
|
||||
//import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
//import club.joylink.rtss.simulation.cbtc.communication.vo.ControllableDevice;
|
||||
//import club.joylink.rtss.simulation.cbtc.communication.vo.PsdSwitch;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityScreenDoor;
|
||||
//import club.joylink.rtss.simulation.cbtc.event.SimulationDeviceControlEvent;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.context.ApplicationContext;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//import java.util.Objects;
|
||||
//
|
||||
///**
|
||||
// * 屏蔽门服务
|
||||
// */
|
||||
//@Component
|
||||
//@Slf4j
|
||||
//public class StandService {
|
||||
//
|
||||
// @Autowired
|
||||
// private ApplicationContext applicationContext;
|
||||
//
|
||||
// @Autowired
|
||||
// private SignalService signalService;
|
||||
//
|
||||
// @Autowired
|
||||
// private RouteService routeService;
|
||||
//
|
||||
// /**
|
||||
// * 控制室外屏蔽门开关
|
||||
// */
|
||||
// public void controlVrPSD(Simulation simulation, VirtualRealityScreenDoor vrPsd, boolean open) {
|
||||
// if ((open && (vrPsd.isSettingOpen() || vrPsd.isOpen2End())) ||
|
||||
// (!open && (vrPsd.isSettingClose() || vrPsd.isLockAndClose()))) {
|
||||
//// log.debug(String.format("屏蔽门[%s(%s)]已经在对应状态,不需要再控制", vrPsd.getName(), vrPsd.getCode()));
|
||||
// return;
|
||||
// }
|
||||
// vrPsd.startSetting(open);
|
||||
// ControllableDevice ctrlMsg = new PsdSwitch(vrPsd, open);
|
||||
// SimulationDeviceControlEvent event = new SimulationDeviceControlEvent(this, simulation, ctrlMsg);
|
||||
// this.applicationContext.publishEvent(event);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 打开屏蔽门
|
||||
// *
|
||||
// * @param simulation
|
||||
// * @param psd
|
||||
// */
|
||||
// public void openScreenDoor(Simulation simulation, PSD psd) {
|
||||
// VirtualRealityScreenDoor vrPsd = psd.getVirtualScreenDoor();
|
||||
// if (vrPsd.isPslControl()) {
|
||||
// return;
|
||||
// }
|
||||
// this.controlVrPSD(simulation, vrPsd, true);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 关闭屏蔽门
|
||||
// *
|
||||
// * @param simulation
|
||||
// * @param psd
|
||||
// */
|
||||
// public void closeScreenDoor(Simulation simulation, PSD psd) {
|
||||
// VirtualRealityScreenDoor vrPsd = psd.getVirtualScreenDoor();
|
||||
// if (vrPsd.isPslControl()) {
|
||||
// return;
|
||||
// }
|
||||
// this.controlVrPSD(simulation, vrPsd, false);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 设置扣车
|
||||
// *
|
||||
// * @param simulation
|
||||
// * @param stand
|
||||
// * @param center
|
||||
// */
|
||||
// public void holdTrain(Simulation simulation, Stand stand, boolean center) {
|
||||
// if (center) {
|
||||
// stand.setCenterHoldTrain(true);
|
||||
// } else {
|
||||
// stand.setStationHoldTrain(true);
|
||||
// }
|
||||
// // 关闭出站信号机
|
||||
// Signal signal = stand.getSection().getSignalOf(stand.isRight());
|
||||
// if (Objects.nonNull(signal)) {
|
||||
// MapConfig config = simulation.getRepository().getConfig();
|
||||
// if (config.isStandHoldCloseLogicLight()/* || !signal.isLogicLight()*/) {
|
||||
// this.signalService.close(simulation, signal);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**系统扣车*/
|
||||
// public void sysHoldTrain(Simulation simulation, Stand stand) {
|
||||
// stand.setSysHoldTrain(true);
|
||||
// // 关闭出站信号机
|
||||
// Signal signal = stand.getSection().getSignalOf(stand.isRight());
|
||||
// if (Objects.nonNull(signal)) {
|
||||
// MapConfig config = simulation.getRepository().getConfig();
|
||||
// if (config.isStandHoldCloseLogicLight() || !signal.isLogicLight()) {
|
||||
// this.signalService.close(simulation, signal);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void cancelSysHoldTrain(Simulation simulation, Stand stand) {
|
||||
// stand.setSysHoldTrain(false);
|
||||
// // 如果所有扣车都取消,开放出站信号机
|
||||
// if (!stand.isHoldTrain()) {
|
||||
// this.reopenSignal(simulation, stand);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void ibpHoldTrain(Simulation simulation, Stand stand) {
|
||||
// stand.setIbpHoldTrain(true);
|
||||
// // 关闭出站信号机
|
||||
// Signal signal = stand.getSection().getSignalOf(stand.isRight());
|
||||
// if (Objects.nonNull(signal)) {
|
||||
// MapConfig config = simulation.getRepository().getConfig();
|
||||
// if (config.isStandHoldCloseLogicLight() || !signal.isLogicLight()) {
|
||||
// this.signalService.close(simulation, signal);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void cancelIbpHoldTrain(Simulation simulation, Stand stand) {
|
||||
// stand.setIbpHoldTrain(false);
|
||||
// // 如果所有扣车都取消,开放出站信号机
|
||||
// if (!stand.isHoldTrain()) {
|
||||
// this.reopenSignal(simulation, stand);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 取消扣车
|
||||
// *
|
||||
// * @param simulation
|
||||
// * @param stand
|
||||
// * @param center
|
||||
// */
|
||||
// public void cancelHoldTrain(Simulation simulation, Stand stand, boolean center) {
|
||||
// if (center) {
|
||||
// stand.setCenterHoldTrain(false);
|
||||
// } else {
|
||||
// stand.setStationHoldTrain(false);
|
||||
// }
|
||||
// // 如果所有扣车都取消,开放出站信号机
|
||||
// if (!stand.isHoldTrain()) {
|
||||
// this.reopenSignal(simulation, stand);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void cancelAllHoldTrain(Simulation simulation, Stand stand) {
|
||||
// stand.setCenterHoldTrain(false);
|
||||
// stand.setStationHoldTrain(false);
|
||||
// this.reopenSignal(simulation, stand);
|
||||
// }
|
||||
//
|
||||
// private void reopenSignal(Simulation simulation, Stand stand) {
|
||||
// Signal signal = stand.getSection().getSignalOf(stand.isRight());
|
||||
// if (Objects.nonNull(signal) && !signal.isMainAspect()) {
|
||||
// Route lockedRoute = signal.getLockedRoute();
|
||||
// if (Objects.nonNull(lockedRoute) && this.routeService.isInterlocked(lockedRoute)) { // 锁闭进路存在,开信号机
|
||||
// this.routeService.routeOpen(simulation, lockedRoute);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 设置或取消互锁解除
|
||||
// * @param release 是否是设置
|
||||
// */
|
||||
// public void setOrCancelInterlockRelease(Simulation simulation, Stand stand, boolean release) {
|
||||
// stand.getPsd().getVirtualScreenDoor().updateIL(release);
|
||||
// stand.getPsd().setInterlockRelease(release);
|
||||
// if (release) {
|
||||
// this.reopenSignal(simulation, stand);
|
||||
// }
|
||||
// }
|
||||
//}
|
@ -1,263 +0,0 @@
|
||||
//package club.joylink.rtss.simulation.cbtc.CI.service;
|
||||
//
|
||||
//import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
//import club.joylink.rtss.simulation.cbtc.communication.vo.ControllableDevice;
|
||||
//import club.joylink.rtss.simulation.cbtc.communication.vo.SwitchTurn;
|
||||
//import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch;
|
||||
//import club.joylink.rtss.simulation.cbtc.event.RouteModeChangeEvent;
|
||||
//import club.joylink.rtss.simulation.cbtc.event.SimulationDeviceControlEvent;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.context.ApplicationContext;
|
||||
//import org.springframework.context.event.EventListener;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//import org.springframework.util.CollectionUtils;
|
||||
//
|
||||
//import java.util.List;
|
||||
//import java.util.Objects;
|
||||
//import java.util.Random;
|
||||
//import java.util.stream.Collectors;
|
||||
//
|
||||
///**
|
||||
// * 道岔服务
|
||||
// */
|
||||
//@Component
|
||||
//@Slf4j
|
||||
//public class SwitchService {
|
||||
//
|
||||
// @Autowired
|
||||
// private ApplicationContext applicationContext;
|
||||
//
|
||||
// @Autowired
|
||||
// private SignalService signalService;
|
||||
//
|
||||
// @Autowired
|
||||
// private RouteService routeService;
|
||||
//
|
||||
// @Autowired
|
||||
// private SectionService sectionService;
|
||||
//
|
||||
// /**
|
||||
// * 控制室外道岔转动(道岔转动指令下达)
|
||||
// * @param simulation
|
||||
// * @param aSwitch
|
||||
// * @param toNormal
|
||||
// */
|
||||
// public void controlSwitch(Simulation simulation, Switch aSwitch, boolean toNormal) {
|
||||
// if (simulation.getRepository().getConfig().isSwitchTurnOperationCanRecoverSplitFault()) {
|
||||
// if (new Random().nextInt(3) == 0) {
|
||||
// Switch.SwitchFault.SPLIT.fix(aSwitch);
|
||||
// Switch.SwitchFault.NORMAL_SPLIT.fix(aSwitch);
|
||||
// Switch.SwitchFault.REVERSE_SPLIT.fix(aSwitch);
|
||||
// }
|
||||
// }
|
||||
// VirtualRealitySwitch virtualSwitch = aSwitch.getVirtualSwitch();
|
||||
// if ((virtualSwitch.isNormal() && toNormal) ||
|
||||
// (virtualSwitch.isReverse() && !toNormal)) {
|
||||
// log.debug(String.format("道岔[%s]已经在指定位置[%s],无需转动", aSwitch.debugStr(), virtualSwitch.isNormal()?"N":"R"));
|
||||
// return;
|
||||
// }
|
||||
// if (virtualSwitch.isSettingTo(toNormal)) {
|
||||
// return;
|
||||
// }
|
||||
// // 向虚拟室外设备发送转换指令
|
||||
// virtualSwitch.startSetting(toNormal);
|
||||
// ControllableDevice ctrlMsg = new SwitchTurn(virtualSwitch, toNormal);
|
||||
// SimulationDeviceControlEvent event = new SimulationDeviceControlEvent(this, simulation, ctrlMsg);
|
||||
// this.applicationContext.publishEvent(event);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 道岔定操
|
||||
// * @param simulation
|
||||
// * @param aSwitch
|
||||
// */
|
||||
// public boolean turn2NormalPosition(Simulation simulation, Switch aSwitch) {
|
||||
// if(aSwitch.isLocked() || aSwitch.isSectionOccupied()) {
|
||||
// return false;
|
||||
// }
|
||||
// this.controlSwitch(simulation, aSwitch, true);
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 道岔反操
|
||||
// * @param simulation
|
||||
// * @param aSwitch
|
||||
// * @return
|
||||
// */
|
||||
// public boolean turn2ReversePosition(Simulation simulation, Switch aSwitch) {
|
||||
// if(aSwitch.isLocked() || aSwitch.isSectionOccupied()) {
|
||||
// return false;
|
||||
// }
|
||||
// this.controlSwitch(simulation, aSwitch, false);
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 道岔单锁
|
||||
// * @param aSwitch
|
||||
// */
|
||||
// public void singleLock(Switch aSwitch) {
|
||||
// if (!aSwitch.isSingleLock()) {
|
||||
// aSwitch.setSingleLock(true);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 道岔单解
|
||||
// * @param aSwitch
|
||||
// */
|
||||
// public void singleUnlock(Switch aSwitch) {
|
||||
// if (aSwitch.isSingleLock()) {
|
||||
// aSwitch.setSingleLock(false);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 封锁(封锁后,包含道岔的进路不能排列)
|
||||
// * @param aSwitch
|
||||
// */
|
||||
// public void blockade(Switch aSwitch) {
|
||||
// if(!aSwitch.isBlockade()) {
|
||||
// aSwitch.setBlockade(true);
|
||||
// aSwitch.getA().setBlockade(true);
|
||||
// aSwitch.getB().setBlockade(true);
|
||||
// aSwitch.getC().setBlockade(true);
|
||||
// }
|
||||
// aSwitch.setInit(false);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 解封
|
||||
// * @param aSwitch
|
||||
// */
|
||||
// public void unblock(Switch aSwitch) {
|
||||
// if(aSwitch.isBlockade()) {
|
||||
// aSwitch.setBlockade(false);
|
||||
// aSwitch.getA().setBlockade(false);
|
||||
// aSwitch.getB().setBlockade(false);
|
||||
// aSwitch.getC().setBlockade(false);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 道岔区段故障解锁
|
||||
// * @param simulation
|
||||
// * @param aSwitch
|
||||
// * @param route
|
||||
// */
|
||||
// public void switchFaultUnlock(Simulation simulation, Switch aSwitch, Route route) {
|
||||
// if (route != null) {
|
||||
// if (route.isOpenMain()) {
|
||||
// signalService.close(simulation, route.getStart());
|
||||
// }
|
||||
// if (routeService.isApproachLock(simulation.getRepository(), route) || aSwitch.isOverlapLock()) {
|
||||
// // 延时解锁
|
||||
// aSwitch.setDelayTime(route.getDelayReleaseTime() * 1000);
|
||||
// aSwitch.getAllSections().forEach(section -> {
|
||||
// if (section.isLocked())
|
||||
// sectionService.sectionFaultUnlock(simulation, section, route);
|
||||
// });
|
||||
// return;
|
||||
// } else {
|
||||
// route.setLock(false);
|
||||
// Signal start = route.getStart();
|
||||
// if (start.getLockedRoute() == route) {
|
||||
// start.setLockedRoute(null);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// this.faultUnlock(aSwitch, route);
|
||||
// }
|
||||
//
|
||||
// public void faultUnlock(Switch aSwitch, Route route) {
|
||||
// aSwitch.faultUnlock();
|
||||
// aSwitch.sectionFaultUnlock();
|
||||
// if (route != null) {
|
||||
// route.unlockRouteFlsOfSwitch(aSwitch); //进路中该道岔对应的侧防解除锁闭
|
||||
// RouteOverlap overlap = route.getOverlap();
|
||||
// if (overlap != null) {
|
||||
// for (SectionPath sectionPath : overlap.getPathList()) {
|
||||
// overlap.unlockFlsOfSwitch(sectionPath.getFlsList(), aSwitch); //延续保护中该道岔的侧防解除锁闭
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void delayUnlock(Simulation simulation, Switch aSwitch) {
|
||||
// int remainTime = aSwitch.getDelayTime();
|
||||
// if (remainTime > 0) {
|
||||
// remainTime -= SimulationConstants.CI_LOOP_RATE;
|
||||
// if (remainTime <= 0) {
|
||||
// List<Route> routeList = simulation.getRepository().queryAllLockedRoute();
|
||||
// Route lockedRoute = null;
|
||||
// if (aSwitch.isRouteLock()) {
|
||||
// lockedRoute = aSwitch.getRoute();
|
||||
// } else {
|
||||
// for (Route route : routeList) {
|
||||
// if (route.overlapContainSwitch(aSwitch)) {
|
||||
// lockedRoute = route;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (Objects.nonNull(lockedRoute)) {
|
||||
// lockedRoute.setLock(false);
|
||||
// Signal start = lockedRoute.getStart();
|
||||
// if (start.getLockedRoute() == lockedRoute) {
|
||||
// start.setLockedRoute(null);
|
||||
// }
|
||||
// }
|
||||
// this.faultUnlock(aSwitch, lockedRoute);
|
||||
// aSwitch.setDelayTime(0);
|
||||
// } else {
|
||||
// aSwitch.setDelayTime(remainTime);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @EventListener
|
||||
// public void handle(RouteModeChangeEvent event) {
|
||||
// this.switchStatusUpdate(event.getSimulation(), event.getRoutes());
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 道岔的封锁失效状态更新
|
||||
// */
|
||||
// private void switchStatusUpdate(Simulation simulation, List<Route> routes) {
|
||||
// if (!simulation.getRepository().getConfig().isBlockadeCommandOnlyValidInStandbyMode()) {
|
||||
// return;
|
||||
// }
|
||||
// if (!CollectionUtils.isEmpty(routes)) {
|
||||
// if (!routes.get(0).isCbtcMode()) { //进路的状态被设为非cbtc
|
||||
// routes.forEach(route -> {
|
||||
// route.getSwitchList().forEach(switchElement -> {
|
||||
// Switch aSwitch = switchElement.getASwitch();
|
||||
// if (aSwitch.isBlockade()) {
|
||||
// aSwitch.setBlockadeInvalid(false);
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
// } else {
|
||||
// List<Switch> switches = routes.stream()
|
||||
// .flatMap(route -> route.getSwitchList()
|
||||
// .stream()
|
||||
// .map(SwitchElement::getASwitch)
|
||||
// .filter(aSwitch -> aSwitch.isBlockade() && !aSwitch.isBlockadeInvalid()))
|
||||
// .collect(Collectors.toList()); //进路下所有处于封锁且封锁有效状态的道岔
|
||||
// for (Route route : simulation.getRepository().getRouteList()) {
|
||||
// if (!route.isCbtcMode()) {
|
||||
// switches.removeIf(route::isRouteSwitch);
|
||||
// if (switches.isEmpty()) {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// switches.forEach(aSwitch -> aSwitch.setBlockadeInvalid(true));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
@ -1,100 +0,0 @@
|
||||
//package club.joylink.rtss.simulation.cbtc.CI.service;
|
||||
//
|
||||
//import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
//import club.joylink.rtss.simulation.cbtc.communication.vo.ControllableDevice;
|
||||
//import club.joylink.rtss.simulation.cbtc.communication.vo.SignalLight;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.map.Signal;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySignal;
|
||||
//import club.joylink.rtss.simulation.cbtc.event.SimulationDeviceControlEvent;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.context.ApplicationContext;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//import java.util.Objects;
|
||||
//
|
||||
///**
|
||||
// * 信号机服务
|
||||
// */
|
||||
//@Component
|
||||
//@Slf4j
|
||||
//public class VrSignalControlService {
|
||||
//
|
||||
// @Autowired
|
||||
// private ApplicationContext applicationContext;
|
||||
//
|
||||
// /**
|
||||
// * 控制室外信号机灭灯
|
||||
// * @param simulation
|
||||
// * @param vrSignal
|
||||
// */
|
||||
// public void close(Simulation simulation, VirtualRealitySignal vrSignal) {
|
||||
// if (!vrSignal.isBlack()) {
|
||||
// this.controlRealSignal(simulation, vrSignal, false, false, false);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 控制室外信号机点绿灯
|
||||
// * @param simulation
|
||||
// * @param vrSignal
|
||||
// */
|
||||
// public void openGreenSignal(Simulation simulation, VirtualRealitySignal vrSignal) {
|
||||
// controlRealSignal(simulation, vrSignal, true, false, false);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 控制室外信号机点黄灯
|
||||
// * @param simulation
|
||||
// * @param vrSignal
|
||||
// */
|
||||
// public void openYellowSignal(Simulation simulation, VirtualRealitySignal vrSignal) {
|
||||
// controlRealSignal(simulation, vrSignal, false, true, false);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 控制室外信号机点红灯
|
||||
// * @param simulation
|
||||
// * @param vrSignal
|
||||
// */
|
||||
// public void openRedSignal(Simulation simulation, VirtualRealitySignal vrSignal) {
|
||||
// controlRealSignal(simulation, vrSignal, false, false, true);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 控制室外信号机点黄红灯
|
||||
// * @param simulation
|
||||
// * @param vrSignal
|
||||
// */
|
||||
// public void openGuideSignal(Simulation simulation, VirtualRealitySignal vrSignal) {
|
||||
// this.controlRealSignal(simulation, vrSignal, false, true, true);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 控制室外信号灯显示
|
||||
// * @param simulation
|
||||
// * @param vrSignal
|
||||
// * @param greenOpen
|
||||
// * @param yellowOpen
|
||||
// * @param redOpen
|
||||
// */
|
||||
// private void controlRealSignal(Simulation simulation, VirtualRealitySignal vrSignal,
|
||||
// boolean greenOpen, boolean yellowOpen, boolean redOpen) {
|
||||
// // 根据点灯类型,和要开放信号,下达信号机控制指令
|
||||
// if(Objects.isNull(vrSignal)){
|
||||
// return;
|
||||
// }
|
||||
// if (!vrSignal.isSame(greenOpen, yellowOpen, redOpen)) {
|
||||
// Signal signal = simulation.getRepository().getByCode(vrSignal.getCode(), Signal.class);
|
||||
// if (signal.isFault()) {
|
||||
// vrSignal.apply(false, false, true);
|
||||
// } else {
|
||||
// vrSignal.apply(greenOpen, yellowOpen, redOpen);
|
||||
// }
|
||||
// ControllableDevice ctrlMsg = new SignalLight(vrSignal);
|
||||
// SimulationDeviceControlEvent event = new SimulationDeviceControlEvent(this, simulation, ctrlMsg);
|
||||
// this.applicationContext.publishEvent(event);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
@ -189,8 +189,8 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
||||
Simulation.FunctionalType functionalType) {
|
||||
Objects.requireNonNull(mapId, "地图id不能为空");
|
||||
Objects.requireNonNull(functionalType, "仿真功能类型不能为空");
|
||||
SimulationBuildParams params = this.prepareSimulationParams(loginUserInfoVO, mapId,
|
||||
prdType, functionalType);
|
||||
SimulationBuildParams params = this.prepareSimulationParams(loginUserInfoVO, mapId, prdType,
|
||||
functionalType);
|
||||
String group = SimulationIdGenerator.generateGroup(loginUserInfoVO.getAccountVO().getId(),
|
||||
mapId);
|
||||
Simulation simulation = this.simulationLifeCycleService.create(params, group);
|
||||
@ -212,17 +212,13 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
||||
List<RunPlanParkingTimeVO> parkTimeList = this.prepareParkTimeData(mapVO, loginUserInfoVO,
|
||||
mapId);
|
||||
// 获取操作定义数据
|
||||
List<CommandDefinitionVO> operationDefinitionList = this.iCommandService
|
||||
.queryDefinitionsByLineCode(mapVO.getLineCode());
|
||||
List<CommandDefinitionVO> operationDefinitionList = this.iCommandService.queryDefinitionsByLineCode(
|
||||
mapVO.getLineCode());
|
||||
SimulationBuildParams.SimulationBuildParamsBuilder builder = SimulationBuildParams.builder();
|
||||
// 都有的属性构造
|
||||
builder.loginUserInfo(loginUserInfoVO)
|
||||
.createTime(LocalDateTime.now())
|
||||
.map(mapVO)
|
||||
.userRunLevelList(runLevelList)
|
||||
.userParkTimeList(parkTimeList)
|
||||
.operationDefinitionList(operationDefinitionList)
|
||||
.prodType(prdType)
|
||||
builder.loginUserInfo(loginUserInfoVO).createTime(LocalDateTime.now()).map(mapVO)
|
||||
.userRunLevelList(runLevelList).userParkTimeList(parkTimeList)
|
||||
.operationDefinitionList(operationDefinitionList).prodType(prdType)
|
||||
.functionalType(functionalType);
|
||||
//运行图选择性构造
|
||||
LocalDate runPlanDate = SimulationConstants.getRunPlanDate();
|
||||
@ -236,9 +232,8 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
||||
schedulingPlanNewVO = this.schedulingService.queryCommonSchedulingPlanOfDay(mapId,
|
||||
runPlanDate);
|
||||
} else {
|
||||
schedulingPlanNewVO = this.schedulingService
|
||||
.querySchedulingPlanUserFirst(loginUserInfoVO.getAccountVO().getId(), runPlanVO.getId(),
|
||||
runPlanDate);
|
||||
schedulingPlanNewVO = this.schedulingService.querySchedulingPlanUserFirst(
|
||||
loginUserInfoVO.getAccountVO().getId(), runPlanVO.getId(), runPlanDate);
|
||||
}
|
||||
builder.schedulingPlan(schedulingPlanNewVO);
|
||||
}
|
||||
@ -294,15 +289,12 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
||||
// 获取地图数据
|
||||
MapVO mapVO = this.iMapService.getMapDetail(mapId);
|
||||
// 获取操作定义数据
|
||||
List<CommandDefinitionVO> operationDefinitionList = this.iCommandService
|
||||
.queryDefinitionsByLineCode(mapVO.getLineCode());
|
||||
List<CommandDefinitionVO> operationDefinitionList = this.iCommandService.queryDefinitionsByLineCode(
|
||||
mapVO.getLineCode());
|
||||
SimulationBuildParams.SimulationBuildParamsBuilder builder = SimulationBuildParams.builder();
|
||||
// 都有的属性构造
|
||||
builder.loginUserInfo(loginUserInfoVO)
|
||||
.createTime(LocalDateTime.now())
|
||||
.map(mapVO)
|
||||
.operationDefinitionList(operationDefinitionList)
|
||||
.prodType(prdType)
|
||||
builder.loginUserInfo(loginUserInfoVO).createTime(LocalDateTime.now()).map(mapVO)
|
||||
.operationDefinitionList(operationDefinitionList).prodType(prdType)
|
||||
.functionalType(functionalType);
|
||||
//运行图选择性构造
|
||||
LocalDate runPlanDate = SimulationConstants.getRunPlanDate();
|
||||
@ -314,9 +306,8 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
||||
schedulingPlanNewVO = this.schedulingService.queryCommonSchedulingPlanOfDay(mapId,
|
||||
runPlanDate);
|
||||
} else {
|
||||
schedulingPlanNewVO = this.schedulingService
|
||||
.querySchedulingPlanUserFirst(loginUserInfoVO.getAccountVO().getId(), runPlanVO.getId(),
|
||||
runPlanDate);
|
||||
schedulingPlanNewVO = this.schedulingService.querySchedulingPlanUserFirst(
|
||||
loginUserInfoVO.getAccountVO().getId(), runPlanVO.getId(), runPlanDate);
|
||||
}
|
||||
builder.schedulingPlan(schedulingPlanNewVO);
|
||||
}
|
||||
@ -368,8 +359,7 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
||||
confirmHasPermission(loginUserInfoVO.getAccountVO(), mapId, prodCode);
|
||||
|
||||
MapPrdTypeEnum prdType = MapPrdTypeEnum.getMapPrdTypeEnumByCode(prodCode);
|
||||
Simulation simulation = this.create(loginUserInfoVO, mapId,
|
||||
prdType,
|
||||
Simulation simulation = this.create(loginUserInfoVO, mapId, prdType,
|
||||
Simulation.FunctionalType.SIMULATION);
|
||||
|
||||
if (Objects.equals(MapPrdTypeEnum.BIG_SCREEN, prdType)) {
|
||||
@ -573,8 +563,7 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
||||
Simulation simulation = this.groupSimulationCache.getSimulationByGroup(group);
|
||||
this.simulationLifeCycleService.checkErrorThrow(simulation);
|
||||
List<TripPlan> tripPlanList = simulation.getRepository().getAllTripPlanList();
|
||||
List<String> tripNumberList = tripPlanList.stream()
|
||||
.map(TripPlan::getTripNumber)
|
||||
List<String> tripNumberList = tripPlanList.stream().map(TripPlan::getTripNumber)
|
||||
.collect(Collectors.toList());
|
||||
return tripNumberList;
|
||||
}
|
||||
@ -652,8 +641,8 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
||||
RunPlanVO runPlan = this.iRunPlanTemplateService.getRunPlan(templateId);
|
||||
// 重新加载运行计划匹配的派班计划
|
||||
Long userId = simulation.getBuildParams().getUser().getId();
|
||||
SchedulingPlanNewVO schedulingPlan = this.schedulingService
|
||||
.querySchedulingPlanUserFirst(userId, templateId, SimulationConstants.getRunPlanDate());
|
||||
SchedulingPlanNewVO schedulingPlan = this.schedulingService.querySchedulingPlanUserFirst(userId,
|
||||
templateId, SimulationConstants.getRunPlanDate());
|
||||
this.simulationLifeCycleService.reloadRunPlan(simulation, runPlan, schedulingPlan);
|
||||
simulation.getRepository().clearChangeTrips(); //清除掉之前的车次计划变化信息
|
||||
}
|
||||
@ -673,8 +662,7 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
||||
ScriptBO scriptBO = iScriptService.getScriptBOById(scriptId, simulation);
|
||||
iScriptSimulationService.scriptCoverSimulation(simulation, scriptBO);
|
||||
SocketMessageVO<Boolean> message = SocketMessageFactory.build(
|
||||
WebSocketMessageType.Simulation_Script_Loaded,
|
||||
simulation.getId(), true);
|
||||
WebSocketMessageType.Simulation_Script_Loaded, simulation.getId(), true);
|
||||
Set<String> userIds = simulation.getSimulationUserIds();
|
||||
stompMessageService.sendToUser(userIds, message);
|
||||
}
|
||||
@ -851,11 +839,9 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
||||
@Override
|
||||
public List<SimulationVO> queryJointSimulationByUser(LoginUserInfoVO loginUserInfoVO) {
|
||||
List<Simulation> jointSimulationList = this.groupSimulationCache.queryAllJointSimulation();
|
||||
List<Simulation> userJointSimulationList = jointSimulationList.stream()
|
||||
.filter(simulation ->
|
||||
simulation.isSame(loginUserInfoVO.getProject()) &&
|
||||
simulation.containsUser(loginUserInfoVO.getAccountVO().getId()))
|
||||
.collect(Collectors.toList());
|
||||
List<Simulation> userJointSimulationList = jointSimulationList.stream().filter(
|
||||
simulation -> simulation.isSame(loginUserInfoVO.getProject()) && simulation.containsUser(
|
||||
loginUserInfoVO.getAccountVO().getId())).collect(Collectors.toList());
|
||||
|
||||
List<SimulationVO> simulationVOList = SimulationVO.convert2VOList(userJointSimulationList);
|
||||
return simulationVOList;
|
||||
@ -864,13 +850,11 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
||||
@Override
|
||||
public void kickOut(String group, Long userId, AccountVO user) {
|
||||
Simulation simulation = this.getSimulationByGroup(group);
|
||||
BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS
|
||||
.assertTrue(simulation.isAdmin(user));
|
||||
BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS.assertTrue(simulation.isAdmin(user));
|
||||
SimulationUser simulationUser = simulation.querySimulationUserById(userId);
|
||||
if (Objects.nonNull(simulationUser)) {
|
||||
ProjectDeviceVO projectDevice = simulationUser.getProjectDevice();
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED
|
||||
.assertNull(projectDevice);
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNull(projectDevice);
|
||||
this.kickOut(simulation, simulationUser);
|
||||
}
|
||||
}
|
||||
@ -903,12 +887,12 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
||||
Simulation simulation = this.getSimulationByGroup(group);
|
||||
List<RealDeviceConfig> realDeviceList = simulation.getRealDeviceList();
|
||||
if (!CollectionUtils.isEmpty(realDeviceList)) {
|
||||
Set<ProjectDeviceType> displayDeviceTypes =
|
||||
new HashSet<>(
|
||||
Set<ProjectDeviceType> displayDeviceTypes = new HashSet<>(
|
||||
List.of(ProjectDeviceType.PSD, ProjectDeviceType.SWITCH, ProjectDeviceType.SIGNAL,
|
||||
ProjectDeviceType.PLC_GATEWAY, ProjectDeviceType.IBP, ProjectDeviceType.SECTION));
|
||||
realDeviceList = realDeviceList
|
||||
.stream().filter(device -> displayDeviceTypes.contains(device.getDeviceType()))
|
||||
ProjectDeviceType.PLC_GATEWAY, ProjectDeviceType.IBP, ProjectDeviceType.SECTION,
|
||||
ProjectDeviceType.PSL));
|
||||
realDeviceList = realDeviceList.stream()
|
||||
.filter(device -> displayDeviceTypes.contains(device.getDeviceType()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
// List<RealDevice> showList = null;
|
||||
@ -953,8 +937,8 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
||||
//校验目标成员类型
|
||||
SimulationMember targetMember = simulation.getSimulationMemberById(
|
||||
initiateVO.getTargetMemberId());
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION
|
||||
.assertEquals(targetMember.getType(), commandType.getMemberType(), "目标成员不正确");
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertEquals(targetMember.getType(),
|
||||
commandType.getMemberType(), "目标成员不正确");
|
||||
|
||||
ScriptBO script = simulation.getScript();
|
||||
if (script != null && script.isBgSet()) { //剧本背景已经保存
|
||||
@ -1008,15 +992,13 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
||||
public void alarmConfirm(String group, List<String> codes, AccountVO accountVO) {
|
||||
Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
|
||||
simulation.getRepository().getAlarmList().stream()
|
||||
.filter(atsAlarm -> codes.contains(atsAlarm.getCode()))
|
||||
.filter(atsAlarm -> {
|
||||
.filter(atsAlarm -> codes.contains(atsAlarm.getCode())).filter(atsAlarm -> {
|
||||
if (atsAlarm.isConfirmed()) {
|
||||
codes.remove(atsAlarm.getCode());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.forEach(atsAlarm -> atsAlarm.confirm(accountVO, simulation.getCorrectSystemTime()));
|
||||
}).forEach(atsAlarm -> atsAlarm.confirm(accountVO, simulation.getCorrectSystemTime()));
|
||||
this.applicationContext.publishEvent(new SimulationAlarmConfirmEvent(this, simulation, codes));
|
||||
}
|
||||
|
||||
@ -1057,20 +1039,15 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
||||
int end = pageNum * queryVO.getPageSize();
|
||||
start = Math.min(start, logs.size() - 1);
|
||||
end = Math.min(end, logs.size());
|
||||
logs = logs.stream()
|
||||
.filter(log -> {
|
||||
if (queryVO.getStartTime() != null && log.getTime()
|
||||
.isBefore(queryVO.getStartTime())) {
|
||||
logs = logs.stream().filter(log -> {
|
||||
if (queryVO.getStartTime() != null && log.getTime().isBefore(queryVO.getStartTime())) {
|
||||
return false;
|
||||
}
|
||||
if (queryVO.getEndTime() != null && log.getTime().isAfter(queryVO.getEndTime())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.skip(start)
|
||||
.limit(end - start)
|
||||
.collect(Collectors.toList());
|
||||
}).skip(start).limit(end - start).collect(Collectors.toList());
|
||||
pageVO.setList(logs);
|
||||
} else {
|
||||
pageVO.setPageNum(1);
|
||||
@ -1173,23 +1150,21 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
||||
Long mapId, String prdType) {
|
||||
if (accountVO.isThirdChildAccount()) {
|
||||
List<LoginUserInfoVO> loginInfos = this.loginSessionManager.getAllLoginUserInfos();
|
||||
Set<LoginUserInfoVO> thirdLoginList = loginInfos.stream()
|
||||
.filter(loginUserInfoVO -> loginUserInfoVO.getAccountVO().isThirdChildAccount()
|
||||
Set<LoginUserInfoVO> thirdLoginList = loginInfos.stream().filter(
|
||||
loginUserInfoVO -> loginUserInfoVO.getAccountVO().isThirdChildAccount()
|
||||
&& loginUserInfoVO.getAccountVO().getParentAccount()
|
||||
.equals(accountVO.getParentAccount()))
|
||||
.collect(Collectors.toSet());
|
||||
.equals(accountVO.getParentAccount())).collect(Collectors.toSet());
|
||||
Set<String> thirdLoginAccountIdList = thirdLoginList.stream()
|
||||
.map(loginUserInfoVO -> loginUserInfoVO.getAccountVO().getId().toString())
|
||||
.collect(Collectors.toSet());
|
||||
long count = this.simulationManager.getSimulationList().stream()
|
||||
.filter(simulation -> simulation instanceof Simulation)
|
||||
.map(simulation -> ((Simulation) simulation))
|
||||
.filter(simulation -> {
|
||||
.map(simulation -> ((Simulation) simulation)).filter(simulation -> {
|
||||
if (simulation.getBuildParams().getMap().getId().equals(mapId)) {
|
||||
if (!((MapPrdTypeEnum.JOINT.getCode().equals(prdType) &&
|
||||
MapPrdTypeEnum.JOINT.equals(simulation.getBuildParams().getProdType())) ||
|
||||
(!MapPrdTypeEnum.JOINT.getCode().equals(prdType) &&
|
||||
!MapPrdTypeEnum.JOINT.equals(simulation.getBuildParams().getProdType())))) {
|
||||
if (!((MapPrdTypeEnum.JOINT.getCode().equals(prdType) && MapPrdTypeEnum.JOINT.equals(
|
||||
simulation.getBuildParams().getProdType())) || (
|
||||
!MapPrdTypeEnum.JOINT.getCode().equals(prdType) && !MapPrdTypeEnum.JOINT.equals(
|
||||
simulation.getBuildParams().getProdType())))) {
|
||||
return false;
|
||||
}
|
||||
for (String accountId : simulation.getSimulationUserIds()) {
|
||||
@ -1199,11 +1174,8 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.count();
|
||||
int sum = ups.stream()
|
||||
.mapToInt(userPermissionVO -> userPermissionVO.getRemains())
|
||||
.sum();
|
||||
}).count();
|
||||
int sum = ups.stream().mapToInt(userPermissionVO -> userPermissionVO.getRemains()).sum();
|
||||
if (sum <= count) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -1,39 +0,0 @@
|
||||
//package club.joylink.rtss.simulation.cbtc.ISCS;
|
||||
//
|
||||
//import club.joylink.rtss.services.voice.VoiceService;
|
||||
//import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||
//import club.joylink.rtss.vo.client.iscs.Ats2PisMsg;
|
||||
//import club.joylink.rtss.vo.client.voice.BaseVoiceSynthesisVO;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
///**
|
||||
// * PIS系统逻辑服务
|
||||
// */
|
||||
//@Component
|
||||
//public class OnBoardPisService {
|
||||
// /*@Autowired
|
||||
// @Qualifier("baiDuVoiceService")
|
||||
// private IVoiceService iVoiceService;*/
|
||||
//
|
||||
// @Autowired
|
||||
//// @Qualifier("baiDuVoiceService2")
|
||||
// private VoiceService iVoiceService;
|
||||
// public void play(Simulation simulation, Ats2PisMsg msg) {
|
||||
// String content;
|
||||
// if (msg.isArrivalMsg()) {
|
||||
// String direction = msg.getStand().isInside() ? "左" : "右";
|
||||
// content = msg.getStation().getName() + "站到了,下车的乘客请从列车运行方向的" + direction + "侧车门下车";
|
||||
// } else {
|
||||
// content = "本次列车开往" + msg.getTerminalStation().getName() + "方向,下一站" + msg.getStation().getName();
|
||||
// }
|
||||
// BaseVoiceSynthesisVO vo = new BaseVoiceSynthesisVO(content);
|
||||
// String path = iVoiceService.synthesis(vo).getFilePath();
|
||||
//// String path = iVoiceService.synthesis(content);
|
||||
// SimulationDataRepository repository = simulation.getRepository();
|
||||
// VirtualRealityTrain train = repository.getOnlineTrainBy(msg.getGroupNumber());
|
||||
// train.getVrAudio().updateUrl(path);
|
||||
// }
|
||||
//}
|
@ -8,16 +8,17 @@ import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.simulationv1.RunAsPlanParam;
|
||||
import club.joylink.rtss.vo.client.simulationv1.SimulationInfoQueryVO;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.NonNull;
|
||||
|
||||
public interface SimulationService {
|
||||
|
||||
/**
|
||||
* 创建仿真
|
||||
*/
|
||||
String createSimulation(long mapId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO);
|
||||
String createSimulation(long mapId, SimulationWorkParamVO workParamVO,
|
||||
@NonNull LoginUserInfoVO loginUserInfoVO);
|
||||
|
||||
/**
|
||||
* 给仿真添加功能
|
||||
@ -27,7 +28,8 @@ public interface SimulationService {
|
||||
/**
|
||||
* 从仿真中移除功能
|
||||
*/
|
||||
void removeItems(String simulationId, List<SimulationWorkParamVO.Item> items, LoginUserInfoVO loginInfo);
|
||||
void removeItems(String simulationId, List<SimulationWorkParamVO.Item> items,
|
||||
LoginUserInfoVO loginInfo);
|
||||
|
||||
/**
|
||||
* 按计划行车
|
||||
@ -82,4 +84,6 @@ public interface SimulationService {
|
||||
PageVO<SimulationInfoVO> pagedSimulationByOrg(Long topOrgId, SimulationInfoQueryVO queryVO);
|
||||
|
||||
void sendUnreceivedMessages(String simulationId, String memberId);
|
||||
|
||||
List<SimulationInfoVO> listAllSimulation(SimulationInfoQueryVO queryVO);
|
||||
}
|
||||
|
@ -34,6 +34,15 @@ import club.joylink.rtss.vo.permission.subject.PermissionSubjectVO;
|
||||
import club.joylink.rtss.websocket.StompMessageService;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import lombok.NonNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -42,14 +51,10 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class SimulationServiceImpl implements SimulationService {
|
||||
|
||||
@Autowired
|
||||
private SimulationManager simulationManager;
|
||||
@Autowired
|
||||
@ -80,17 +85,21 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
|
||||
|
||||
@Override
|
||||
public String createSimulation(long mapId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(workParamVO.containsRealDeviceItem(), "此途径创建的仿真不能连接真实设备");
|
||||
public String createSimulation(long mapId, SimulationWorkParamVO workParamVO,
|
||||
@NonNull LoginUserInfoVO loginUserInfoVO) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(workParamVO.containsRealDeviceItem(),
|
||||
"此途径创建的仿真不能连接真实设备");
|
||||
return createSimulation(mapId, null, workParamVO, loginUserInfoVO, null).getId();
|
||||
}
|
||||
|
||||
//只获取所有与该功能相关的权限信息
|
||||
private List<PermissionSubjectVO> filterUserPermission(List<PermissionSubjectVO> subjectVOList, MapFunctionVO functionVO, LoginUserInfoVO loginUserInfoVO) {
|
||||
private List<PermissionSubjectVO> filterUserPermission(List<PermissionSubjectVO> subjectVOList,
|
||||
MapFunctionVO functionVO, LoginUserInfoVO loginUserInfoVO) {
|
||||
List<PermissionSubjectVO> newVoList = Lists.newArrayList();
|
||||
for (PermissionSubjectVO subjectVO : subjectVOList) {
|
||||
if (subjectVO.getStartTime().isAfter(LocalDateTime.now())) {
|
||||
log.info("权限主体id:[{}] 用户id:[{}] 开始时间:[{}]未到时间", subjectVO.getId(), subjectVO.getSubjectId(), subjectVO.getStartTime());
|
||||
log.info("权限主体id:[{}] 用户id:[{}] 开始时间:[{}]未到时间", subjectVO.getId(),
|
||||
subjectVO.getSubjectId(), subjectVO.getStartTime());
|
||||
continue;
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(subjectVO.getSystemAbilityList())) {
|
||||
@ -112,7 +121,8 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
}
|
||||
// }
|
||||
} else {
|
||||
log.error("权限主体对应的功能是空 主体id:[{}],subjectId:[{}],subjectType:[{}]", subjectVO.getId(), subjectVO.getSubjectId(), subjectVO.getSubjectType());
|
||||
log.error("权限主体对应的功能是空 主体id:[{}],subjectId:[{}],subjectType:[{}]",
|
||||
subjectVO.getId(), subjectVO.getSubjectId(), subjectVO.getSubjectType());
|
||||
}
|
||||
}
|
||||
return newVoList;
|
||||
@ -124,36 +134,45 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
* @param functionVO
|
||||
* @param loginInfo
|
||||
*/
|
||||
private Map<String, Boolean> checkUserPermission(MapFunctionVO functionVO, LoginUserInfoVO loginInfo) {
|
||||
private Map<String, Boolean> checkUserPermission(MapFunctionVO functionVO,
|
||||
LoginUserInfoVO loginInfo) {
|
||||
if (loginInfo.getAccountVO().isAdmin()) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
LoginUserInfoVO newLoginUser = loginInfo;
|
||||
if (loginInfo.getAccountVO().isThirdChildAccount()) {
|
||||
AccountVO user = this.iSysUserService.queryUserByAccountForMaster(loginInfo.getAccountVO().getParentAccount());
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(user), "未找到主账号相关权限");
|
||||
AccountVO user = this.iSysUserService.queryUserByAccountForMaster(
|
||||
loginInfo.getAccountVO().getParentAccount());
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(user),
|
||||
"未找到主账号相关权限");
|
||||
newLoginUser = new LoginUserInfoVO();
|
||||
user.setCompanyId(loginInfo.getAccountVO().getCompanyId());
|
||||
newLoginUser.setAccountVO(user);
|
||||
newLoginUser.setProjectInfo(loginInfo.getProjectInfo());
|
||||
}
|
||||
|
||||
List<PermissionSubjectVO> subjectVOList = this.subjectService.findPermissionWithMapIdAndUserInfo(functionVO.getMapId(), newLoginUser);
|
||||
List<PermissionSubjectVO> subjectVOList = this.subjectService.findPermissionWithMapIdAndUserInfo(
|
||||
functionVO.getMapId(), newLoginUser);
|
||||
|
||||
List<PermissionSubjectVO> newVOLIst = this.filterUserPermission(subjectVOList, functionVO, newLoginUser);
|
||||
List<PermissionSubjectVO> newVOLIst = this.filterUserPermission(subjectVOList, functionVO,
|
||||
newLoginUser);
|
||||
if (CollectionUtils.isEmpty(newVOLIst)) {
|
||||
log.error("未找到对应的权限数据mapId[{}],functionId[{}],userId[{}]", functionVO.getMapId(), functionVO.getId(), newLoginUser.getAccountVO().getId());
|
||||
log.error("未找到对应的权限数据mapId[{}],functionId[{}],userId[{}]", functionVO.getMapId(),
|
||||
functionVO.getId(), newLoginUser.getAccountVO().getId());
|
||||
BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS.assertNotTrue(true, "未找到该权限");
|
||||
}
|
||||
Map<String, Boolean> resultMap2 = Maps.newHashMap();
|
||||
Map<String, List<PermissionSubjectVO>> subjectMapList = newVOLIst.stream().collect(Collectors.groupingBy(PermissionSubjectVO::getSubjectType));
|
||||
Map<String, List<PermissionSubjectVO>> subjectMapList = newVOLIst.stream()
|
||||
.collect(Collectors.groupingBy(PermissionSubjectVO::getSubjectType));
|
||||
for (PermissionSubjectTypeEnum st : PermissionSubjectTypeEnum.SORT_ENUM) {
|
||||
List<PermissionSubjectVO> tmpSubjectVOList = subjectMapList.get(st.name());
|
||||
if (CollectionUtils.isEmpty(tmpSubjectVOList)) {
|
||||
continue;
|
||||
}
|
||||
List<PermissionSubjectVO> canUseSubjectList = this.findCanUsedPermission(tmpSubjectVOList, functionVO, loginInfo);
|
||||
BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS.assertNotTrue(CollectionUtils.isEmpty(canUseSubjectList), "该权限过期");
|
||||
List<PermissionSubjectVO> canUseSubjectList = this.findCanUsedPermission(tmpSubjectVOList,
|
||||
functionVO, loginInfo);
|
||||
BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS.assertNotTrue(
|
||||
CollectionUtils.isEmpty(canUseSubjectList), "该权限过期");
|
||||
for (PermissionSubjectVO subjectVO : canUseSubjectList) {
|
||||
String key = String.format("%s-%s", st.name(), subjectVO.getId());
|
||||
List<Simulation> findSimList = this.simulationManager.finder(key);
|
||||
@ -167,49 +186,60 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
break;
|
||||
}
|
||||
}
|
||||
BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS.assertNotTrue(resultMap2.values().stream().allMatch(d -> Objects.equals(false, d)), "仿真生成数量过载");
|
||||
BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS.assertNotTrue(
|
||||
resultMap2.values().stream().allMatch(d -> Objects.equals(false, d)), "仿真生成数量过载");
|
||||
return resultMap2;
|
||||
}
|
||||
|
||||
private List<PermissionSubjectVO> findCanUsedPermission(List<PermissionSubjectVO> newVOLIst, MapFunctionVO functionVO, LoginUserInfoVO loginInfo) {
|
||||
List<PermissionSubjectVO> canUseSubjectList = newVOLIst.stream().filter(d -> Objects.equals(true, d.getForever())).collect(Collectors.toList());
|
||||
private List<PermissionSubjectVO> findCanUsedPermission(List<PermissionSubjectVO> newVOLIst,
|
||||
MapFunctionVO functionVO, LoginUserInfoVO loginInfo) {
|
||||
List<PermissionSubjectVO> canUseSubjectList = newVOLIst.stream()
|
||||
.filter(d -> Objects.equals(true, d.getForever())).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(canUseSubjectList)) {
|
||||
List<Long> timeOverIdList = newVOLIst.stream().filter(d -> Objects.nonNull(d.getEndTime()) && d.getEndTime().isAfter(LocalDateTime.now()))
|
||||
List<Long> timeOverIdList = newVOLIst.stream().filter(
|
||||
d -> Objects.nonNull(d.getEndTime()) && d.getEndTime().isAfter(LocalDateTime.now()))
|
||||
.map(d -> d.getId())
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(timeOverIdList)) {
|
||||
log.error("mapId[{}],functionId[{}] userId[{}] 权限过期", functionVO.getMapId(), functionVO.getId(), loginInfo.getAccountVO().getId());
|
||||
log.error("mapId[{}],functionId[{}] userId[{}] 权限过期", functionVO.getMapId(),
|
||||
functionVO.getId(), loginInfo.getAccountVO().getId());
|
||||
return Collections.emptyList();
|
||||
}
|
||||
canUseSubjectList = newVOLIst.stream().filter(d -> timeOverIdList.contains(d.getId())).collect(Collectors.toList());
|
||||
canUseSubjectList = newVOLIst.stream().filter(d -> timeOverIdList.contains(d.getId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
return canUseSubjectList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addItems(@NonNull String simulationId, Map<SimulationWorkParamVO.Item, String> itemMap) {
|
||||
public void addItems(@NonNull String simulationId,
|
||||
Map<SimulationWorkParamVO.Item, String> itemMap) {
|
||||
if (!CollectionUtils.isEmpty(itemMap)) {
|
||||
Simulation simulation = simulationManager.getById(simulationId, Simulation.class);
|
||||
Simulation.Type simulationType = simulation.getType();
|
||||
SimulationWorkService initService = simulationWorkServiceManager.getWorkService(simulationType);
|
||||
SimulationWorkService initService = simulationWorkServiceManager.getWorkService(
|
||||
simulationType);
|
||||
// if (StringUtils.hasText(simulation.getCreatorId())) {
|
||||
// BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertEquals(loginInfo.getAccountVO().getIdStr(), simulation.getCreatorId(),
|
||||
// "非仿真创建者不能使用该功能");
|
||||
// }
|
||||
initService.addItems(simulation, itemMap);
|
||||
SocketMessageVO<SimulationWorkParamVO> workParamMessage = SocketMessageFactory
|
||||
.buildSimulationWorkParamMessage(simulationId, simulation.getBuildParams().getWorkParamVO());
|
||||
.buildSimulationWorkParamMessage(simulationId,
|
||||
simulation.getBuildParams().getWorkParamVO());
|
||||
Set<String> users = simulation.getSimulationUserIds();
|
||||
stompMessageService.sendToUser(users, workParamMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeItems(@NonNull String simulationId, List<SimulationWorkParamVO.Item> items, LoginUserInfoVO loginInfo) {
|
||||
public void removeItems(@NonNull String simulationId, List<SimulationWorkParamVO.Item> items,
|
||||
LoginUserInfoVO loginInfo) {
|
||||
if (!CollectionUtils.isEmpty(items)) {
|
||||
Simulation simulation = simulationManager.getById(simulationId, Simulation.class);
|
||||
Simulation.Type simulationType = simulation.getType();
|
||||
SimulationWorkService initService = simulationWorkServiceManager.getWorkService(simulationType);
|
||||
SimulationWorkService initService = simulationWorkServiceManager.getWorkService(
|
||||
simulationType);
|
||||
// if (StringUtils.hasText(simulation.getCreatorId())) {
|
||||
// BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertEquals(loginInfo.getAccountVO().getIdStr(), simulation.getCreatorId(),
|
||||
// "非仿真创建者不能使用该功能");
|
||||
@ -221,14 +251,16 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
@Override
|
||||
public void runAsPlan(String simulationId, RunAsPlanParam param) {
|
||||
Simulation simulation = simulationManager.getById(simulationId, Simulation.class);
|
||||
SimulationWorkService initService = simulationWorkServiceManager.getWorkService(simulation.getType());
|
||||
SimulationWorkService initService = simulationWorkServiceManager.getWorkService(
|
||||
simulation.getType());
|
||||
initService.runAsPlan(simulation, param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset(String simulationId) {
|
||||
Simulation simulation = simulationManager.getById(simulationId, Simulation.class);
|
||||
SimulationWorkService initService = simulationWorkServiceManager.getWorkService(simulation.getType());
|
||||
SimulationWorkService initService = simulationWorkServiceManager.getWorkService(
|
||||
simulation.getType());
|
||||
initService.reset(simulation);
|
||||
}
|
||||
|
||||
@ -262,17 +294,21 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
@Override
|
||||
public void monitor(String simulationId, AccountVO user) {
|
||||
Simulation simulation = simulationManager.getById(simulationId, Simulation.class);
|
||||
SimulationUser simulationUser = new SimulationUser(simulation, user, club.joylink.rtss.simulation.SimulationUser.Type.TEACHER);
|
||||
SimulationUser simulationUser = new SimulationUser(simulation, user,
|
||||
club.joylink.rtss.simulation.SimulationUser.Type.TEACHER);
|
||||
simulationWorkServiceManager.addSimulationUser(simulation, simulationUser);
|
||||
}
|
||||
|
||||
private Simulation createSimulation(long mapId, MapFunctionVO mapFunctionVO, @NonNull SimulationWorkParamVO workParamVO,
|
||||
private Simulation createSimulation(long mapId, MapFunctionVO mapFunctionVO,
|
||||
@NonNull SimulationWorkParamVO workParamVO,
|
||||
@NonNull LoginUserInfoVO loginUserInfoVO, Map<String, Boolean> createUserType) {
|
||||
//获取仿真工作服务
|
||||
SimulationWorkService initService = simulationWorkServiceManager.getWorkService(workParamVO.getType());
|
||||
SimulationWorkService initService = simulationWorkServiceManager.getWorkService(
|
||||
workParamVO.getType());
|
||||
|
||||
//创建仿真
|
||||
String simulationId = SimulationIdGenerator.generateGroup(loginUserInfoVO.getAccountVO().getId(), mapId);
|
||||
String simulationId = SimulationIdGenerator.generateGroup(
|
||||
loginUserInfoVO.getAccountVO().getId(), mapId);
|
||||
Simulation simulation = initService.create(mapId, workParamVO, loginUserInfoVO, simulationId);
|
||||
|
||||
//语音配置数据
|
||||
@ -308,7 +344,8 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Simulation createSimulation(Long mapFunctionId, LoginUserInfoVO loginInfo, boolean checkAuth) {
|
||||
public Simulation createSimulation(Long mapFunctionId, LoginUserInfoVO loginInfo,
|
||||
boolean checkAuth) {
|
||||
MapFunctionVO mapFunctionVO = rtsMapFunctionService.get(mapFunctionId);
|
||||
Long mapId = mapFunctionVO.getMapId();
|
||||
Map<String, Boolean> createUserType = Maps.newHashMap();
|
||||
@ -326,7 +363,8 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
oldSimulationOptional.ifPresent(simulation -> simulationManager.destroy(simulation.getId()));
|
||||
}
|
||||
|
||||
return createSimulation(mapId, mapFunctionVO, mapFunctionVO.getParamVO(), loginInfo, createUserType);
|
||||
return createSimulation(mapId, mapFunctionVO, mapFunctionVO.getParamVO(), loginInfo,
|
||||
createUserType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -344,32 +382,39 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
|
||||
@Override
|
||||
public SimulationVO querySimulationJoinedByUser(long userId) {
|
||||
Optional<club.joylink.rtss.simulation.Simulation> optional = simulationManager.getSimulationStream(null)
|
||||
Optional<club.joylink.rtss.simulation.Simulation> optional = simulationManager.getSimulationStream(
|
||||
null)
|
||||
.filter(simulation -> simulation.querySimulationUserById(String.valueOf(userId)) != null)
|
||||
.findFirst();
|
||||
return optional.map(simulation -> groupSimulationService.getSimulationBasicInfo(simulation.getId())).orElse(null);
|
||||
return optional.map(
|
||||
simulation -> groupSimulationService.getSimulationBasicInfo(simulation.getId()))
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SimulationInfoVO> listSimulationByOrg(Long topOrgId, SimulationInfoQueryVO queryVO) {
|
||||
Stream<Simulation> stream = this.simulationManager.getSimulationStream(Simulation.class);
|
||||
stream = stream.filter(simulation -> Objects.equals(topOrgId, simulation.getBuildParams().getLoginUserInfo().getTopOrgId()));
|
||||
stream = stream.filter(simulation -> Objects.equals(topOrgId,
|
||||
simulation.getBuildParams().getLoginUserInfo().getTopOrgId()));
|
||||
|
||||
if (StringUtils.hasText(queryVO.getGroup())) {
|
||||
stream = stream.filter(simulation -> simulation.getId().contains(queryVO.getGroup()));
|
||||
}
|
||||
if (StringUtils.hasText(queryVO.getUserName())) {
|
||||
stream = stream.filter(simulation -> simulation.getSimulationUsers().stream().anyMatch(user -> user.getName().contains(queryVO.getUserName())));
|
||||
stream = stream.filter(simulation -> simulation.getSimulationUsers().stream()
|
||||
.anyMatch(user -> user.getName().contains(queryVO.getUserName())));
|
||||
}
|
||||
return stream.map(Simulation::convertToVO).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageVO<SimulationInfoVO> pagedSimulationByOrg(Long topOrgId, SimulationInfoQueryVO queryVO) {
|
||||
public PageVO<SimulationInfoVO> pagedSimulationByOrg(Long topOrgId,
|
||||
SimulationInfoQueryVO queryVO) {
|
||||
List<SimulationInfoVO> list = listSimulationByOrg(topOrgId, queryVO);
|
||||
Stream<SimulationInfoVO> stream = list.stream();
|
||||
int skipNum = (queryVO.getPageNum() - 1) * queryVO.getPageSize();
|
||||
List<SimulationInfoVO> collect = stream.skip(skipNum).limit(queryVO.getPageSize()).collect(Collectors.toList());
|
||||
List<SimulationInfoVO> collect = stream.skip(skipNum).limit(queryVO.getPageSize())
|
||||
.collect(Collectors.toList());
|
||||
return new PageVO<>(queryVO.getPageNum(), queryVO.getPageSize(), list.size(), collect);
|
||||
}
|
||||
|
||||
@ -385,4 +430,22 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
stompMessageService.sendToUser(member.getUserId(), message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SimulationInfoVO> listAllSimulation(SimulationInfoQueryVO queryVO) {
|
||||
List<Simulation> simulationList = this.simulationManager.getSimulationList();
|
||||
Stream<Simulation> stream = simulationList.stream();
|
||||
if (StringUtils.hasText(queryVO.getGroup())) {
|
||||
stream = stream.filter(simulation -> simulation.getId().contains(queryVO.getGroup()));
|
||||
}
|
||||
if (StringUtils.hasText(queryVO.getUserName())) {
|
||||
stream = stream.filter(simulation -> simulation.getSimulationUsers().stream()
|
||||
.anyMatch(user -> user.getName().contains(queryVO.getUserName())));
|
||||
}
|
||||
if (queryVO.getFunctionId() != null) {
|
||||
stream = stream.filter(
|
||||
simulation -> Objects.equals(queryVO.getFunctionId(), simulation.getMapFunctionId()));
|
||||
}
|
||||
return stream.map(Simulation::convertToVO).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +0,0 @@
|
||||
//package club.joylink.rtss.simulation.cbtc.communication.vo;
|
||||
//
|
||||
//import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityScreenDoor;
|
||||
//import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
|
||||
//import lombok.Getter;
|
||||
//
|
||||
///**
|
||||
// * 站台屏蔽门开/关门控制消息
|
||||
// */
|
||||
//@Getter
|
||||
//public class PsdSwitch extends ControllableDevice {
|
||||
//
|
||||
// /** true-开门 false-关门 */
|
||||
// @JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
// private boolean open;
|
||||
//
|
||||
// public PsdSwitch(VirtualRealityScreenDoor psd, boolean open) {
|
||||
// super(psd.getCode(), psd.getDeviceType());
|
||||
// this.open = open;
|
||||
// }
|
||||
//}
|
@ -1,25 +0,0 @@
|
||||
//package club.joylink.rtss.simulation.cbtc.communication.vo;
|
||||
//
|
||||
//import club.joylink.rtss.simulation.cbtc.constant.SignalAspect;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySignal;
|
||||
//import lombok.Getter;
|
||||
//
|
||||
///**
|
||||
// * 信号机点灯状态
|
||||
// */
|
||||
//@Getter
|
||||
//public class SignalLight extends ControllableDevice {
|
||||
// /**
|
||||
// * 信号显示
|
||||
// */
|
||||
// private SignalAspect aspect;
|
||||
//
|
||||
// public SignalLight(VirtualRealitySignal signal) {
|
||||
// super(signal.getCode(), signal.getDeviceType());
|
||||
// if (signal.getCommand() != null) {
|
||||
// this.aspect = signal.getCommand();
|
||||
// } else {
|
||||
// this.aspect = signal.getAspect();
|
||||
// }
|
||||
// }
|
||||
//}
|
@ -1,22 +0,0 @@
|
||||
//package club.joylink.rtss.simulation.cbtc.communication.vo;
|
||||
//
|
||||
//import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch;
|
||||
//import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
|
||||
//import lombok.Getter;
|
||||
//
|
||||
///**
|
||||
// * 道岔开始转动消息
|
||||
// */
|
||||
//@Getter
|
||||
//public class SwitchTurn extends ControllableDevice {
|
||||
//
|
||||
// /** true-转到定位 false-转到反位 */
|
||||
// @JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
// private boolean normal;
|
||||
//
|
||||
// public SwitchTurn(VirtualRealitySwitch vrSwitch, boolean normal) {
|
||||
// super(vrSwitch.getCode(), vrSwitch.getDeviceType());
|
||||
// this.normal = normal;
|
||||
// }
|
||||
//}
|
@ -1,20 +1,22 @@
|
||||
package club.joylink.rtss.simulation.cbtc.data.map;
|
||||
|
||||
import static club.joylink.rtss.simulation.cbtc.member.SimulationMember.Type.DISPATCHER;
|
||||
import static club.joylink.rtss.simulation.cbtc.member.SimulationMember.Type.ELECTRIC_DISPATCHER;
|
||||
import static club.joylink.rtss.simulation.cbtc.member.SimulationMember.Type.MAINTAINER;
|
||||
import static club.joylink.rtss.simulation.cbtc.member.SimulationMember.Type.STATION_SUPERVISOR;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.constant.RunLevel;
|
||||
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
||||
import club.joylink.rtss.vo.map.MapFunctionConfig;
|
||||
import club.joylink.rtss.vo.map.RealLineConfigVO;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static club.joylink.rtss.simulation.cbtc.member.SimulationMember.Type.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* 地图配置
|
||||
@ -193,40 +195,64 @@ public class MapConfig {
|
||||
*/
|
||||
private boolean holdCommandIgnoreControlMode;
|
||||
|
||||
/** 共享紧急关闭效果的车站 */
|
||||
/**
|
||||
* 共享紧急关闭效果的车站
|
||||
*/
|
||||
private Set<String> sharingECStations;
|
||||
|
||||
/** 取消联锁条件不满足的进路时需要延时解锁 */
|
||||
/**
|
||||
* 取消联锁条件不满足的进路时需要延时解锁
|
||||
*/
|
||||
private boolean delayWhenCancelRouteWithAbnormalInterlock;
|
||||
|
||||
/** 车次号的位数 */
|
||||
/**
|
||||
* 车次号的位数
|
||||
*/
|
||||
private int figuresOfTripNumber;
|
||||
|
||||
/** 服务号的位数 */
|
||||
/**
|
||||
* 服务号的位数
|
||||
*/
|
||||
private int figuresOfServiceNumber;
|
||||
|
||||
/** 设置头码车时检查方向 */
|
||||
/**
|
||||
* 设置头码车时检查方向
|
||||
*/
|
||||
private boolean checkDirectionWhenSetHead;
|
||||
|
||||
/** 转换轨进路只能通过故障解锁来取消 */
|
||||
/**
|
||||
* 转换轨进路只能通过故障解锁来取消
|
||||
*/
|
||||
private boolean transferRouteCanOnlyFaultUnlock;
|
||||
|
||||
/** 头码车抵达目的地后变为人工车 */
|
||||
/**
|
||||
* 头码车抵达目的地后变为人工车
|
||||
*/
|
||||
private boolean setManualWhenHeadTrainArriveTarget;
|
||||
|
||||
/** 进路默认开启冲突检测 */
|
||||
/**
|
||||
* 进路默认开启冲突检测
|
||||
*/
|
||||
private boolean routeDefaultCheckConflict;
|
||||
|
||||
/** 处理停车场/车辆段逻辑 */
|
||||
/**
|
||||
* 处理停车场/车辆段逻辑
|
||||
*/
|
||||
private boolean handleDepot;
|
||||
|
||||
/** 运行图中车次号是否唯一 */
|
||||
/**
|
||||
* 运行图中车次号是否唯一
|
||||
*/
|
||||
private boolean tripNumberIsUnique;
|
||||
|
||||
/** 站台折返策略不生效 */
|
||||
/**
|
||||
* 站台折返策略不生效
|
||||
*/
|
||||
private boolean standTbStrategyIsInvalid;
|
||||
|
||||
/** 根据服务号更新车次计划(西安三提出,抽线之后,后续列车还跑原来的服务,不会自动顶上) */
|
||||
/**
|
||||
* 根据服务号更新车次计划(西安三提出,抽线之后,后续列车还跑原来的服务,不会自动顶上)
|
||||
*/
|
||||
private boolean updateTripPlanByServiceNumber;
|
||||
|
||||
/**
|
||||
@ -236,8 +262,7 @@ public class MapConfig {
|
||||
/**
|
||||
* 对信号机封锁操作,是否影响信号显示
|
||||
* <p>
|
||||
* true-封锁信号机,会使信号机显示禁止色<br>
|
||||
* false-封锁信号机,不会影响信号机显示。
|
||||
* true-封锁信号机,会使信号机显示禁止色<br> false-封锁信号机,不会影响信号机显示。
|
||||
*/
|
||||
private boolean signalBolckOptReflectSignal;
|
||||
|
||||
@ -260,8 +285,14 @@ public class MapConfig {
|
||||
*/
|
||||
private boolean manualTrainDefaultStop;
|
||||
|
||||
/**
|
||||
* 办理引导进路时,如果进路首区段占用,引导信号15秒后关闭
|
||||
*/
|
||||
private boolean guideDelayCloseWhenFirstSectionOccupied;
|
||||
|
||||
private Set<SimulationMember.Type> needConfirmConnectMembers =
|
||||
Stream.of(DISPATCHER, STATION_SUPERVISOR, MAINTAINER, ELECTRIC_DISPATCHER).collect(Collectors.toSet());
|
||||
Stream.of(DISPATCHER, STATION_SUPERVISOR, MAINTAINER, ELECTRIC_DISPATCHER)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
public MapConfig() {
|
||||
this.lockFirst = false;
|
||||
@ -290,8 +321,10 @@ public class MapConfig {
|
||||
setParkingSM(configVO.getParkingSM());
|
||||
setRmAtpSpeed(configVO.getRmAtpSpeed() / 3.6f);
|
||||
setUrmAtpSpeed(configVO.getUrmAtpSpeed() / 3.6f);
|
||||
setCancelAtsControlOfAllRoutesWhenCancelRoute(configVO.isCancelAtsControlOfAllRoutesWhenCancelRoute());
|
||||
setSignalHumanControlBeforeSetAtsControlOrCIAutoTrigger(configVO.isSignalHumanControlBeforeSetAtsControlOrCIAutoTrigger());
|
||||
setCancelAtsControlOfAllRoutesWhenCancelRoute(
|
||||
configVO.isCancelAtsControlOfAllRoutesWhenCancelRoute());
|
||||
setSignalHumanControlBeforeSetAtsControlOrCIAutoTrigger(
|
||||
configVO.isSignalHumanControlBeforeSetAtsControlOrCIAutoTrigger());
|
||||
setAllowEarlyDepartureWhenHoldTrain(configVO.isAllowEarlyDepartureWhenHoldTrain());
|
||||
setEBWhenCancelRoute(configVO.isEBWhenCancelRoute());
|
||||
setAdjustOperationAutomatically(configVO.isAdjustOperationAutomatically());
|
||||
@ -302,9 +335,11 @@ public class MapConfig {
|
||||
setBlockadeCommandOnlyValidInStandbyMode(configVO.isBlockadeCommandOnlyValidInStandbyMode());
|
||||
// setSomeCommandNeedInit(configVO.isSwitchBlockadeCommandNeedInit());
|
||||
setStationPreResetBeforeAxlePreReset(configVO.isStationPreResetBeforeAxlePreReset());
|
||||
setSwitchTurnOperationCanRecoverSplitFault(configVO.isSwitchTurnOperationCanRecoverSplitFault());
|
||||
setSwitchTurnOperationCanRecoverSplitFault(
|
||||
configVO.isSwitchTurnOperationCanRecoverSplitFault());
|
||||
setHoldCommandIgnoreControlMode(configVO.isHoldCommandIgnoreControlMode());
|
||||
setDelayWhenCancelRouteWithAbnormalInterlock(configVO.isDelayWhenCancelRouteWithAbnormalInterlock());
|
||||
setDelayWhenCancelRouteWithAbnormalInterlock(
|
||||
configVO.isDelayWhenCancelRouteWithAbnormalInterlock());
|
||||
setFiguresOfTripNumber(configVO.getFiguresOfTripNumber());
|
||||
setFiguresOfServiceNumber(configVO.getFiguresOfServiceNumber());
|
||||
setCheckDirectionWhenSetHead(configVO.isCheckDirectionWhenSetHead());
|
||||
@ -319,12 +354,15 @@ public class MapConfig {
|
||||
setSFUCanOnlyApplyForFaultLockSection(configVO.isSFUCanOnlyApplyForFaultLockSection());
|
||||
setRouteCanSetWhenSwitchFault(configVO.isRouteCanSetWhenSwitchFault());
|
||||
setManualTrainDefaultStop(configVO.isManualTrainDefaultStop());
|
||||
setGuideDelayCloseWhenFirstSectionOccupied(
|
||||
configVO.isGuideDelayCloseWhenFirstSectionOccupied());
|
||||
}
|
||||
}
|
||||
|
||||
public void copyConfigBy(MapFunctionConfig mapFunctionConfig) {
|
||||
if (mapFunctionConfig == null)
|
||||
if (mapFunctionConfig == null) {
|
||||
return;
|
||||
}
|
||||
this.hasCTC = mapFunctionConfig.isHasCTC();
|
||||
this.hasTDCS = mapFunctionConfig.isHasTDCS();
|
||||
}
|
||||
@ -334,7 +372,8 @@ public class MapConfig {
|
||||
if (noParkingSM.contains("-")) {
|
||||
String[] split = noParkingSM.split("-");
|
||||
if (split.length == 2) {
|
||||
return Integer.parseInt(serviceNumber) >= Integer.parseInt(split[0]) && Integer.parseInt(serviceNumber) <= Integer.parseInt(split[1]);
|
||||
return Integer.parseInt(serviceNumber) >= Integer.parseInt(split[0])
|
||||
&& Integer.parseInt(serviceNumber) <= Integer.parseInt(split[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -346,7 +385,8 @@ public class MapConfig {
|
||||
if (parkingSM.contains("-")) {
|
||||
String[] split = parkingSM.split("-");
|
||||
if (split.length == 2) {
|
||||
return Integer.parseInt(serviceNumber) >= Integer.parseInt(split[0]) && Integer.parseInt(serviceNumber) <= Integer.parseInt(split[1]);
|
||||
return Integer.parseInt(serviceNumber) >= Integer.parseInt(split[0])
|
||||
&& Integer.parseInt(serviceNumber) <= Integer.parseInt(split[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -375,12 +415,14 @@ public class MapConfig {
|
||||
}
|
||||
|
||||
public boolean isSharingECStation(String stationCode) {
|
||||
if (CollectionUtils.isEmpty(this.sharingECStations))
|
||||
if (CollectionUtils.isEmpty(this.sharingECStations)) {
|
||||
return false;
|
||||
}
|
||||
for (String code : sharingECStations) {
|
||||
if (code.equals(stationCode))
|
||||
if (code.equals(stationCode)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -396,6 +438,7 @@ public class MapConfig {
|
||||
/**
|
||||
* 直接取消
|
||||
*/
|
||||
DIRECT,;
|
||||
DIRECT,
|
||||
;
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +0,0 @@
|
||||
//package club.joylink.rtss.simulation.cbtc.data.support;
|
||||
//
|
||||
//import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||
//import lombok.Getter;
|
||||
//
|
||||
///**
|
||||
// * 列车停稳消息
|
||||
// */
|
||||
//@Getter
|
||||
//public class TrainStopMessage {
|
||||
//
|
||||
// private VirtualRealityTrain train;
|
||||
//
|
||||
// private Section section;
|
||||
//
|
||||
// public TrainStopMessage(VirtualRealityTrain train) {
|
||||
// this.train = train;
|
||||
// this.section = train.getHeadPosition().getSection();
|
||||
// }
|
||||
//
|
||||
//}
|
@ -9,7 +9,8 @@ import lombok.Setter;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class VirtualRealityScreenDoor extends ControllableVrDevice<VirtualRealityScreenDoor.Operation> {
|
||||
public class VirtualRealityScreenDoor extends
|
||||
ControllableVrDevice<VirtualRealityScreenDoor.Operation> {
|
||||
|
||||
public boolean isCommandOpen() {
|
||||
return Operation.K.equals(this.getCommand());
|
||||
@ -19,9 +20,13 @@ public class VirtualRealityScreenDoor extends ControllableVrDevice<VirtualRealit
|
||||
* 道岔支持的操作
|
||||
*/
|
||||
public enum Operation {
|
||||
/** 开门 */
|
||||
/**
|
||||
* 开门
|
||||
*/
|
||||
K,
|
||||
/** 关门 */
|
||||
/**
|
||||
* 关门
|
||||
*/
|
||||
G,
|
||||
}
|
||||
|
||||
@ -53,7 +58,7 @@ public class VirtualRealityScreenDoor extends ControllableVrDevice<VirtualRealit
|
||||
private Fault fault;
|
||||
|
||||
public VirtualRealityScreenDoor(String code, String name) {
|
||||
super(code, name, MapElement.DeviceType.PSD, 3*1000);
|
||||
super(code, name, MapElement.DeviceType.PSD, 3 * 1000);
|
||||
this.close = true;
|
||||
this.lock = true;
|
||||
}
|
||||
@ -71,8 +76,9 @@ public class VirtualRealityScreenDoor extends ControllableVrDevice<VirtualRealit
|
||||
|
||||
@Override
|
||||
protected boolean checkConditionBeforeControl(Operation command) {
|
||||
if (command == null)
|
||||
if (command == null) {
|
||||
return false;
|
||||
}
|
||||
switch (command) {
|
||||
case K:
|
||||
return !open2End;
|
||||
@ -108,18 +114,20 @@ public class VirtualRealityScreenDoor extends ControllableVrDevice<VirtualRealit
|
||||
return;
|
||||
}
|
||||
switch (command) {
|
||||
case K:{
|
||||
if (this.isOpen2End())
|
||||
case K: {
|
||||
if (this.isOpen2End()) {
|
||||
setRemain(0);
|
||||
else
|
||||
} else {
|
||||
setClose(false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case G: {
|
||||
if (this.isLockAndClose())
|
||||
if (this.isLockAndClose()) {
|
||||
setRemain(0);
|
||||
else
|
||||
} else {
|
||||
setOpen2End(false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -130,7 +138,7 @@ public class VirtualRealityScreenDoor extends ControllableVrDevice<VirtualRealit
|
||||
@Override
|
||||
protected void doFinish(Operation command) {
|
||||
switch (command) {
|
||||
case K:{
|
||||
case K: {
|
||||
this.setClose(false);
|
||||
this.open2End = true;
|
||||
break;
|
||||
@ -149,15 +157,17 @@ public class VirtualRealityScreenDoor extends ControllableVrDevice<VirtualRealit
|
||||
}
|
||||
|
||||
public void setClose(boolean close) {
|
||||
if ((Fault.CANNOT_BE_CLOSED.equals(this.fault) && close)||
|
||||
(Fault.CANNOT_BE_OPENED.equals(this.fault) && !close))
|
||||
if ((Fault.CANNOT_BE_CLOSED.equals(this.fault) && close) ||
|
||||
(Fault.CANNOT_BE_OPENED.equals(this.fault) && !close)) {
|
||||
return;
|
||||
}
|
||||
this.close = close;
|
||||
}
|
||||
|
||||
public void setLock(boolean lock) {
|
||||
if (Fault.NO_CLOSE_AND_LOCK.equals(this.fault) && lock)
|
||||
if (Fault.NO_CLOSE_AND_LOCK.equals(this.fault) && lock) {
|
||||
return;
|
||||
}
|
||||
this.lock = lock;
|
||||
}
|
||||
|
||||
@ -217,16 +227,16 @@ public class VirtualRealityScreenDoor extends ControllableVrDevice<VirtualRealit
|
||||
CANNOT_BE_CLOSED {
|
||||
@Override
|
||||
public void apply(VirtualRealityScreenDoor door) {
|
||||
door.setFault(null);
|
||||
door.control(Operation.K);
|
||||
// door.setFault(null);
|
||||
// door.control(Operation.K);
|
||||
door.setFault(this);
|
||||
}
|
||||
},
|
||||
CANNOT_BE_OPENED {
|
||||
@Override
|
||||
public void apply(VirtualRealityScreenDoor door) {
|
||||
door.setFault(null);
|
||||
door.control(Operation.G);
|
||||
// door.setFault(null);
|
||||
// door.control(Operation.G);
|
||||
door.setFault(this);
|
||||
}
|
||||
},
|
||||
@ -241,8 +251,9 @@ public class VirtualRealityScreenDoor extends ControllableVrDevice<VirtualRealit
|
||||
public abstract void apply(VirtualRealityScreenDoor door);
|
||||
|
||||
public void fix(VirtualRealityScreenDoor vrPSD) {
|
||||
if (this.equals(vrPSD.getFault()))
|
||||
if (this.equals(vrPSD.getFault())) {
|
||||
vrPSD.setFault(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,9 +78,13 @@ public class VirtualRealitySwitch extends ControllableVrDevice<VirtualRealitySwi
|
||||
* 道岔支持的操作
|
||||
*/
|
||||
public enum Operation {
|
||||
/** 定操 */
|
||||
/**
|
||||
* 定操
|
||||
*/
|
||||
NP,
|
||||
/** 反操 */
|
||||
/**
|
||||
* 反操
|
||||
*/
|
||||
RP,
|
||||
}
|
||||
|
||||
@ -120,8 +124,9 @@ public class VirtualRealitySwitch extends ControllableVrDevice<VirtualRealitySwi
|
||||
SPLIT {
|
||||
@Override
|
||||
public boolean apply(VirtualRealitySwitch vrSwitch) {
|
||||
if (this.equals(vrSwitch.getFault()))
|
||||
if (this.equals(vrSwitch.getFault())) {
|
||||
return false;
|
||||
}
|
||||
vrSwitch.setFault(this);
|
||||
vrSwitch.setP(SwitchIndication.NO);
|
||||
return true;
|
||||
@ -133,8 +138,9 @@ public class VirtualRealitySwitch extends ControllableVrDevice<VirtualRealitySwi
|
||||
SQUEEZE {
|
||||
@Override
|
||||
public boolean apply(VirtualRealitySwitch vrSwitch) {
|
||||
if (this.equals(vrSwitch.getFault()))
|
||||
if (this.equals(vrSwitch.getFault())) {
|
||||
return false;
|
||||
}
|
||||
vrSwitch.setFault(this);
|
||||
vrSwitch.setP(SwitchIndication.EX);
|
||||
return true;
|
||||
|
@ -0,0 +1,26 @@
|
||||
package club.joylink.rtss.simulation.cbtc.device.real.modbustcp.cgy;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.common.RealDeviceConfig;
|
||||
import club.joylink.rtss.util.JsonUtils;
|
||||
import club.joylink.rtss.vo.client.project.ProjectDeviceVO;
|
||||
import club.joylink.rtss.vo.client.project.cgy.CgyPslConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.sdy.SdyPslConfigVO;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class CgyPslConfig extends RealDeviceConfig {
|
||||
|
||||
private CgyPslConfigVO configVO;
|
||||
|
||||
public CgyPslConfig(ProjectDeviceVO projectDevice) {
|
||||
super(projectDevice);
|
||||
if (projectDevice != null) {
|
||||
this.configVO = JsonUtils.read(projectDevice.getConfig(), CgyPslConfigVO.class);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String findDeviceCode() {
|
||||
return configVO.findDeviceCode();
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package club.joylink.rtss.simulation.cbtc.device.real.modbustcp.cgy;
|
||||
|
||||
import club.joylink.rtss.services.psl.IVirtualRealityPslService;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl.Button;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.PlcGatewayService;
|
||||
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.CgyPslConfigVO;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class CgyPslServiceImpl implements RealDeviceService {
|
||||
|
||||
@Autowired
|
||||
private PlcGatewayService plcGatewayService;
|
||||
@Autowired
|
||||
private IVirtualRealityPslService virtualRealityPslService;
|
||||
|
||||
@Override
|
||||
public boolean canHandle(RealDeviceConfig deviceConfig) {
|
||||
return deviceConfig instanceof CgyPslConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Simulation simulation, RealDeviceConfig deviceConfig) {
|
||||
// PlcGateway plcGateway = simulation.getPlcGateway();
|
||||
// CgyPslConfigVO configVO = ((CgyPslConfig) deviceConfig).getConfigVO();
|
||||
// Channel channel = plcGateway.getChannel();
|
||||
// int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr();
|
||||
// plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_gm_light(), false, channel);
|
||||
// plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_km_light(), false, channel);
|
||||
// plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_psl_light(), false, channel);
|
||||
// plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_gbsj_light(), false, channel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(Simulation simulation, RealDeviceConfig deviceConfig, ByteBuf byteBuf) {
|
||||
PlcGateway plcGateway = simulation.queryPlcGatewayDevice();
|
||||
if (plcGateway == null) {
|
||||
return;
|
||||
}
|
||||
CgyPslConfig config = (CgyPslConfig) deviceConfig;
|
||||
CgyPslConfigVO configVO = config.getConfigVO();
|
||||
if (!StringUtils.hasText(configVO.getPslCode())) {
|
||||
return;
|
||||
}
|
||||
VirtualRealityPsl vrPsl = simulation.getRepository()
|
||||
.getByCode(configVO.getPslCode(), VirtualRealityPsl.class);
|
||||
ByteBuf deviceStatus = RealDeviceConfig.getDeviceCoilStatus(byteBuf, configVO.getAddr(),
|
||||
configVO.getQuantity());
|
||||
boolean r_km_btn = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_km_btn());
|
||||
boolean r_gm_btn = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_gm_btn());
|
||||
boolean r_yxjz_btn = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_yxjz_btn());
|
||||
boolean r_hsjc_key = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_hsjc_key());
|
||||
boolean r_xy_btn = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_xy_btn());
|
||||
boolean w_km_light = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_km_light());
|
||||
boolean w_gm_light = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_gm_light());
|
||||
boolean w_yxcz_light = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_yxcz_light());
|
||||
boolean w_gbsj_light = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_gbsj_light());
|
||||
//向vrPSL同步操作
|
||||
virtualRealityPslService.updateStatus(simulation, vrPsl, Button.KM, r_km_btn);
|
||||
virtualRealityPslService.updateStatus(simulation, vrPsl, Button.GM, r_gm_btn);
|
||||
virtualRealityPslService.updateStatus(simulation, vrPsl, Button.YXJZ, r_yxjz_btn);
|
||||
virtualRealityPslService.updateStatus(simulation, vrPsl, Button.HSJC, r_hsjc_key);
|
||||
//向实体PSL同步状态
|
||||
int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr();
|
||||
Channel channel = plcGateway.getChannel();
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_km_light(),
|
||||
w_km_light, vrPsl.isKmLight(), channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_gm_light(),
|
||||
w_gm_light, vrPsl.isGmLight(), channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yxcz_light(),
|
||||
w_yxcz_light, vrPsl.isYxjzKey(), channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_gbsj_light(),
|
||||
w_gbsj_light, vrPsl.isQbgmLight(), channel);
|
||||
}
|
||||
}
|
@ -1,44 +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 club.joylink.rtss.vo.client.project.say.SaySectionConfigVO;
|
||||
//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_clear = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_clear());
|
||||
// vrAxleCounter.setOccupy(!r_clear);
|
||||
// }
|
||||
//}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -46,29 +46,34 @@ public class CgySignalServiceImpl implements RealDeviceService {
|
||||
Channel channel = plcGateway.getChannel();
|
||||
switch (aspect) {
|
||||
case No:
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_red(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_green(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yellow(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_ddj(), true, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_lxj(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yxj(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_zxj(), false, channel);
|
||||
break;
|
||||
case R:
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_red(), true, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_green(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yellow(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_ddj(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_lxj(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yxj(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_zxj(), false, channel);
|
||||
break;
|
||||
case G:
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_red(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_green(), true, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yellow(), 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(), true, channel);
|
||||
break;
|
||||
case Y:
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_red(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_green(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yellow(), true, 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);
|
||||
break;
|
||||
case RY:
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_red(), true, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_green(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yellow(), true, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_ddj(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_lxj(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yxj(), true, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_zxj(), false, channel);
|
||||
break;
|
||||
default:
|
||||
log.error("不支持的显示:{}", aspect);
|
||||
@ -91,84 +96,83 @@ public class CgySignalServiceImpl implements RealDeviceService {
|
||||
ByteBuf deviceStatus = RealDeviceConfig.getDeviceCoilStatus(byteBuf, configVO.getAddr(),
|
||||
configVO.getQuantity());
|
||||
|
||||
boolean r_r = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_red());
|
||||
boolean r_g = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_green());
|
||||
boolean r_y = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_yellow());
|
||||
|
||||
SignalAspect aspect = null;
|
||||
if (!r_r && !r_g && !r_y) {
|
||||
aspect = SignalAspect.No;
|
||||
} else if (r_r && !r_g && !r_y) {
|
||||
aspect = SignalAspect.R;
|
||||
} else if (!r_r && r_g && !r_y) {
|
||||
aspect = SignalAspect.G;
|
||||
} else if (!r_r && !r_g && r_y) {
|
||||
aspect = SignalAspect.Y;
|
||||
} else if (r_r && !r_g && r_y) {
|
||||
aspect = SignalAspect.RY;
|
||||
}
|
||||
if (aspect == null) {
|
||||
log.error("未知的信号组合[红:%s][绿:%s][黄:%s]", r_r, r_g, r_y);
|
||||
} else {
|
||||
//同步信号显示
|
||||
SignalAspect aspect = getAspect(deviceStatus, configVO);
|
||||
vrSignal.apply(aspect);
|
||||
}
|
||||
|
||||
//驱动信号显示
|
||||
if (vrSignal.isTurning()) {
|
||||
boolean w_r = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_red());
|
||||
boolean w_g = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_green());
|
||||
boolean w_y = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_yellow());
|
||||
boolean w_ddj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_ddj());
|
||||
boolean w_lxj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_lxj());
|
||||
boolean w_yxj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_yxj());
|
||||
boolean w_zxj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_zxj());
|
||||
|
||||
int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr();
|
||||
Channel channel = plcGateway.getChannel();
|
||||
SignalAspect command = vrSignal.getCommand();
|
||||
switch (command) {
|
||||
case No:
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_red(), w_r, false,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_ddj(), w_ddj, true,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_green(), w_g,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_lxj(), w_lxj,
|
||||
false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yellow(), w_y,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yxj(), w_yxj,
|
||||
false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_zxj(), w_zxj,
|
||||
false,
|
||||
channel);
|
||||
break;
|
||||
case R:
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_red(), w_r, true,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_green(), w_g,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_ddj(), w_ddj,
|
||||
false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yellow(), w_y,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_lxj(), w_lxj,
|
||||
false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yxj(), w_yxj,
|
||||
false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_zxj(), w_zxj,
|
||||
false,
|
||||
channel);
|
||||
break;
|
||||
case G:
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_red(), w_r, false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_green(), w_g, true,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yellow(), w_y,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_ddj(), w_ddj,
|
||||
false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_lxj(), w_lxj, true,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yxj(), w_yxj,
|
||||
false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_zxj(), w_zxj, true,
|
||||
channel);
|
||||
break;
|
||||
case Y:
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_red(), w_r, false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_green(), w_g,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_ddj(), w_ddj,
|
||||
false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yellow(), w_y,
|
||||
true,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_lxj(), w_lxj, true,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yxj(), w_yxj,
|
||||
false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_zxj(), w_zxj,
|
||||
false,
|
||||
channel);
|
||||
break;
|
||||
case RY:
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_red(), w_r, true,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_green(), w_g,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_ddj(), w_ddj,
|
||||
false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yellow(), w_y,
|
||||
true,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_lxj(), w_lxj,
|
||||
false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yxj(), w_yxj, true,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_zxj(), w_zxj,
|
||||
false,
|
||||
channel);
|
||||
break;
|
||||
default:
|
||||
@ -177,4 +181,22 @@ public class CgySignalServiceImpl implements RealDeviceService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private SignalAspect getAspect(ByteBuf deviceStatus, CgySignalConfigVO configVO) {
|
||||
boolean r_ddj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_ddj());
|
||||
boolean r_lxj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_lxj());
|
||||
boolean r_yxj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_yxj());
|
||||
boolean r_zxj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_zxj());
|
||||
if (r_yxj) {
|
||||
return SignalAspect.RY;
|
||||
} else if (r_lxj && r_zxj) {
|
||||
return SignalAspect.G;
|
||||
} else if (r_lxj) {
|
||||
return SignalAspect.Y;
|
||||
} else if (!r_ddj) {
|
||||
return SignalAspect.R;
|
||||
} else {
|
||||
return SignalAspect.No;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class CgySwitchServiceImpl implements RealDeviceService {
|
||||
CgySwitchConfigVO configVO = config.getConfigVO();
|
||||
int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr();
|
||||
Channel channel = plcGateway.getChannel();
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_sj(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_js(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_dc(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_fc(), false, channel);
|
||||
}
|
||||
@ -63,7 +63,7 @@ public class CgySwitchServiceImpl implements RealDeviceService {
|
||||
boolean r_fb = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_fb());
|
||||
vrSwitch.apply(r_db, r_fb);
|
||||
|
||||
//以下操作实体设备的逻辑中,防止继电器长期接通的逻辑将定反操视为技能,共用3秒冷却,技能持续时间也是3秒
|
||||
//以下操作实体设备的逻辑中,防止继电器长期接通的逻辑,将定反操视为技能,共用3秒冷却,技能持续时间也是3秒
|
||||
if (config.isEnd()) { //此判断既可视为操作是否冷却,也可视为持续时间是否耗尽
|
||||
config.sync(r_db, r_fb);
|
||||
release(deviceStatus, baseAddr, configVO, channel); //操作持续时间耗尽后断开所有继电器
|
||||
@ -87,10 +87,10 @@ public class CgySwitchServiceImpl implements RealDeviceService {
|
||||
|
||||
private void turnToN(ByteBuf deviceStatus, int baseAddr, CgySwitchConfigVO configVO,
|
||||
Channel channel) {
|
||||
boolean w_sb = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_sj());
|
||||
boolean w_sb = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_js());
|
||||
boolean w_dc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_dc());
|
||||
boolean w_fc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_fc());
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sj(), w_sb, true,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_js(), w_sb, true,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dc(), w_dc, true,
|
||||
channel);
|
||||
@ -100,10 +100,10 @@ public class CgySwitchServiceImpl implements RealDeviceService {
|
||||
|
||||
private void turnToP(ByteBuf deviceStatus, int baseAddr, CgySwitchConfigVO configVO,
|
||||
Channel channel) {
|
||||
boolean w_sb = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_sj());
|
||||
boolean w_js = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_js());
|
||||
boolean w_dc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_dc());
|
||||
boolean w_fc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_fc());
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sj(), w_sb, true,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_js(), w_js, true,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dc(), w_dc, false,
|
||||
channel);
|
||||
@ -113,10 +113,10 @@ public class CgySwitchServiceImpl implements RealDeviceService {
|
||||
|
||||
private void release(ByteBuf deviceStatus, int baseAddr, CgySwitchConfigVO configVO,
|
||||
Channel channel) {
|
||||
boolean w_sj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_sj());
|
||||
boolean w_sj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_js());
|
||||
boolean w_dc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_dc());
|
||||
boolean w_fc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_fc());
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sj(), w_sj, false,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_js(), w_sj, false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dc(), w_dc, false,
|
||||
channel);
|
||||
|
@ -10,13 +10,13 @@ import club.joylink.rtss.simulation.cbtc.data.map.Signal;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class TrainTargetUpdateService {
|
||||
|
||||
public static final String Model_Name = "TrainTargetUpdate";
|
||||
public static final int Rate = 5000;
|
||||
|
||||
@ -28,10 +28,10 @@ public class TrainTargetUpdateService {
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
List<VirtualRealityTrain> onlineTrain = repository.getOnlineTrainList();
|
||||
for (VirtualRealityTrain train : onlineTrain) {
|
||||
TrainInfo trainInfo = repository.getSupervisedTrainByGroup(train.getGroupNumber());
|
||||
// if (!trainInfo.isManualTrain()) {
|
||||
// continue;
|
||||
// }
|
||||
TrainInfo trainInfo = repository.findSupervisedTrainByGroup(train.getGroupNumber());
|
||||
if (trainInfo == null) {
|
||||
continue;
|
||||
}
|
||||
Section target = train.getTarget();
|
||||
Section newTarget = this.queryArriveTarget(train, trainInfo);
|
||||
if (newTarget != null && !Objects.equals(target, newTarget)) {
|
||||
@ -40,14 +40,16 @@ public class TrainTargetUpdateService {
|
||||
}
|
||||
}
|
||||
|
||||
private Section queryArriveTarget4Manual(VirtualRealityTrain train, TrainInfo trainInfo, Section target) {
|
||||
private Section queryArriveTarget4Manual(VirtualRealityTrain train, TrainInfo trainInfo,
|
||||
Section target) {
|
||||
SectionPosition headPosition = train.getHeadPosition();
|
||||
boolean right = train.isRight();
|
||||
Section newTarget = target;
|
||||
Section temp = headPosition.getSection();
|
||||
for (int i = 0; i < 50; i++) {
|
||||
if (temp == null)
|
||||
if (temp == null) {
|
||||
break;
|
||||
}
|
||||
if (!temp.isFunctionTrack()) {
|
||||
temp = temp.findNextRunningSectionBaseRealSwitch(right);
|
||||
continue;
|
||||
@ -55,12 +57,14 @@ public class TrainTargetUpdateService {
|
||||
Signal signal = temp.getSignalOf(right);
|
||||
if (signal != null && !signal.isMainAspect()) {
|
||||
newTarget = temp;
|
||||
if (temp.isFunctionTrack())
|
||||
if (temp.isFunctionTrack()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (temp.isNormalStandTrack() || temp.isTransferTrack()) {
|
||||
if (temp.isNormalStandTrack()) {
|
||||
if (temp.getStandList().stream().anyMatch(stand -> stand.isJumpStop(train.getGroupNumber()))) { //该列车应在站台跳停
|
||||
if (temp.getStandList().stream()
|
||||
.anyMatch(stand -> stand.isJumpStop(train.getGroupNumber()))) { //该列车应在站台跳停
|
||||
temp = temp.findNextRunningSectionBaseRealSwitch(right);
|
||||
continue;
|
||||
}
|
||||
@ -88,8 +92,9 @@ public class TrainTargetUpdateService {
|
||||
private Section queryArriveTarget(VirtualRealityTrain train, TrainInfo trainInfo) {
|
||||
Section newTarget = null;
|
||||
MaService.Ma ma = train.getMa2();
|
||||
if (ma == null)
|
||||
if (ma == null) {
|
||||
return null;
|
||||
}
|
||||
SectionPosition eoaPosition = ma.getEoaPosition();
|
||||
Section eoaSection = eoaPosition.getSection();
|
||||
SectionPosition headPosition = train.getHeadPosition();
|
||||
|
@ -1,356 +0,0 @@
|
||||
//package club.joylink.rtss.simulation.cbtc.passenger.strategy.service;
|
||||
//
|
||||
//import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.map.Stand;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.plan.RealRun;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.plan.StationPlan;
|
||||
//import club.joylink.rtss.simulation.cbtc.data.plan.TripPlan;
|
||||
//import club.joylink.rtss.simulation.cbtc.passenger.strategy.Config;
|
||||
//import club.joylink.rtss.simulation.cbtc.passenger.strategy.data.*;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//import org.springframework.util.CollectionUtils;
|
||||
//
|
||||
//import java.time.LocalDateTime;
|
||||
//import java.time.LocalTime;
|
||||
//import java.util.*;
|
||||
//
|
||||
//@Slf4j
|
||||
//@Component
|
||||
//public class JumpAndParkTimeStrategyServiceImpl implements StrategyService<JumpAndParkTimeStrategy> {
|
||||
//
|
||||
// @Override
|
||||
// public List<JumpAndParkTimeStrategy> generateStrategy(StrategyCalculateData data) {
|
||||
// List<JumpAndParkTimeStrategy> list = new ArrayList<>();
|
||||
// List<StandPassenger> lpfList = data.queryLpfList();
|
||||
// if (CollectionUtils.isEmpty(lpfList)) {
|
||||
// return null;
|
||||
// }
|
||||
// // 暂时按一个站大客流处理
|
||||
// StandPassenger standPassenger = lpfList.get(0);
|
||||
// Stand stand = standPassenger.getStand();
|
||||
// Map<String, List<TripPlan>> planMap = data.getPlanMap();
|
||||
// int planParkTime = 0; // 计划停站时间
|
||||
// for (List<TripPlan> planList : planMap.values()) {
|
||||
// for (TripPlan tripPlan : planList) {
|
||||
// List<StationPlan> stationPlanList = tripPlan.getPlanList();
|
||||
// for (StationPlan stationPlan : stationPlanList) {
|
||||
// if (Objects.equals(stationPlan.getSection(), stand.getSection()) &&
|
||||
// stationPlan.getParkTime() > 0) {
|
||||
// planParkTime = stationPlan.getParkTime();
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (planParkTime > 0) {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (planParkTime <= 0) {
|
||||
// throw new IllegalArgumentException(String.format("计划或站台[%s]数据异常,找到的计划停站时间异常:为[%s]", stand.debugStr(), planParkTime));
|
||||
// }
|
||||
// // 最大停站时间内每隔5秒生成一个策略(策略的停站时间为计划停站时间+5*i)
|
||||
// int iter = (Config.STAND_MAX_STOP_TIME - planParkTime) / 5;
|
||||
// for (int i = 1; i <= iter; i++) {
|
||||
// list.add(new JumpAndParkTimeStrategy(stand, planParkTime + i * 5));
|
||||
// }
|
||||
// List<Stand> leftStandList = data.getLeftStandList();
|
||||
// List<Stand> rightStandList = data.getRightStandList();
|
||||
// boolean right = false;
|
||||
// int index = leftStandList.indexOf(stand);
|
||||
// if (index < 0) {
|
||||
// // 不是左向站台
|
||||
// right = true;
|
||||
// index = rightStandList.indexOf(stand);
|
||||
// }
|
||||
// BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(index >= 0, String.format("未找到站台[%s]", stand.debugStr()));
|
||||
// log.debug(String.format("[%s]第[%s]个站台大客流", right?"右向":"左向", (index+1)));
|
||||
//
|
||||
// boolean hasJump = false;
|
||||
// if (index == 0) {
|
||||
// // 第一站,不生成跳停策略
|
||||
// log.debug(String.format("第一个站,不生成跳停策略"));
|
||||
// }
|
||||
// List<Stand> jumpableStandList;
|
||||
// if (right) {
|
||||
// jumpableStandList = rightStandList.subList(0, index);
|
||||
// } else {
|
||||
// jumpableStandList = leftStandList.subList(0, index);
|
||||
// }
|
||||
// List<TrainPassenger> trainPassengerList = data.getTrainPassengerList();
|
||||
// for (int i = jumpableStandList.size()-1; i > 0; i--) { // 起始站不跳停
|
||||
// Stand s = jumpableStandList.get(i);
|
||||
// // 该站台人数是否支持跳停
|
||||
// StandPassenger sp = data.getStandPassengerByStand(s);
|
||||
// if (sp.getWait() >= Config.STAND_JUMP_MAX) {
|
||||
// log.debug(String.format("站台[%s]客流数[%s]>=站台跳停最大客流量[%s],不能跳停",
|
||||
// s.debugStr(), sp.getWait(), Config.STAND_JUMP_MAX));
|
||||
// continue;
|
||||
// }
|
||||
// // 该站是否被前列车跳过
|
||||
// RealRun jumpRun = this.isJustJumped(data, s);
|
||||
// if (jumpRun != null) {
|
||||
// log.debug(String.format("站台[%s]刚被跳停,不生成", s.debugStr()));
|
||||
// continue;
|
||||
// }
|
||||
// // 前一站是否刚跳停
|
||||
// if (i - 1 > 0) {
|
||||
// Stand pre = jumpableStandList.get(i - 1);
|
||||
// jumpRun = this.isJustJumped(data, pre);
|
||||
// if (jumpRun != null) {
|
||||
// boolean jump = false;
|
||||
// List<RealRun> realRuns = data.queryRealRuns(jumpRun.getGroupNumber());
|
||||
// int i1 = realRuns.indexOf(jumpRun);
|
||||
// for (int j = i1; j < realRuns.size(); j++) {
|
||||
// RealRun realRun = realRuns.get(j);
|
||||
// if (Objects.equals(realRun.getSectionCode(), s.getSection().getCode())) {
|
||||
// if (!realRun.isArrive()) {
|
||||
// jump = true;
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (jump) {
|
||||
// log.debug(String.format("站台[%s]的前一站台[%s]刚被跳停,不生成", s.debugStr(), pre.debugStr()));
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// hasJump = true;
|
||||
// for (JumpAndParkTimeStrategy jumpAndParkTimeStrategy : list) {
|
||||
// jumpAndParkTimeStrategy.setJumpStand(s);
|
||||
// }
|
||||
// }
|
||||
// if (!hasJump) {
|
||||
// list.clear();
|
||||
// }
|
||||
// log.debug(String.format("生成跳停+停站时间策略[%s]个", list.size()));
|
||||
// return list;
|
||||
// }
|
||||
//
|
||||
// private RealRun isJustJumped(StrategyCalculateData data, Stand stand) {
|
||||
// List<TrainPassenger> trainPassengerList = data.getTrainPassengerList();
|
||||
// StationPlan plan = null;
|
||||
// boolean jump = false;
|
||||
// RealRun standLastRun = null;
|
||||
// for (TrainPassenger trainPassenger : trainPassengerList) {
|
||||
// String groupNumber = trainPassenger.getGroupNumber();
|
||||
// TripPlan tripPlan = data.queryTripPlan(trainPassenger.getServiceNumber(), trainPassenger.getTripNumber());
|
||||
// if (tripPlan == null) {
|
||||
// log.warn(String.format("列车[%s-%s|%s]没有找到车次计划",
|
||||
// groupNumber, trainPassenger.getServiceNumber(), trainPassenger.getTripNumber()));
|
||||
// continue;
|
||||
// }
|
||||
// int index = tripPlan.getPlanIndex(stand.getSection());
|
||||
// if (index < 0) { // 没有对应站台计划,无需判断跳停
|
||||
// continue;
|
||||
// }
|
||||
// List<RealRun> realRunList = data.queryRealRuns(groupNumber);
|
||||
// if (!CollectionUtils.isEmpty(realRunList)) {
|
||||
// realRunList.sort(Comparator.comparing(RealRun::getTime));
|
||||
// RealRun last = realRunList.get(realRunList.size() - 1);
|
||||
// int lastRunIndex = tripPlan.getPlanIndex(last.getSectionCode());
|
||||
// if (lastRunIndex < index) { // 列车实际运行未过站台
|
||||
// StationPlan stationPlan = tripPlan.getPlanList().get(index);
|
||||
// if (plan == null || plan.getArriveTime().isAfter(stationPlan.getArriveTime())) {
|
||||
// plan = stationPlan;
|
||||
// }
|
||||
// continue;
|
||||
// }
|
||||
// for (int i = realRunList.size() - 1; i >= 0; i--) {
|
||||
// RealRun realRun = realRunList.get(i);
|
||||
// if (!Objects.equals(realRun.getServiceNumber(), trainPassenger.getServiceNumber()) ||
|
||||
// !Objects.equals(realRun.getTripNumber(), trainPassenger.getTripNumber())) {
|
||||
// break;
|
||||
// }
|
||||
// if (Objects.equals(realRun.getSectionCode(), stand.getSection().getCode())) {
|
||||
// if (!realRun.isArrive() && i > 0) {
|
||||
// RealRun pre = realRunList.get(i - 1);
|
||||
// if (pre.isArrive() &&
|
||||
// Objects.equals(pre.getSectionCode(), stand.getSection().getCode())) {
|
||||
// if (standLastRun == null || standLastRun.getTime().isAfter(pre.getTime())) {
|
||||
// jump = false;
|
||||
// standLastRun = pre;
|
||||
// }
|
||||
// } else {
|
||||
// if (standLastRun == null || standLastRun.getTime().isAfter(realRun.getTime())) {
|
||||
// jump = true;
|
||||
// standLastRun = realRun;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (jump) {
|
||||
// return standLastRun;
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void calculate(StrategyCalculateData data, JumpAndParkTimeStrategy strategy) {
|
||||
// List<TrainPassenger> trainPassengerList = data.getTrainPassengerList();
|
||||
// LocalDateTime systemTime = data.getSystemTime();
|
||||
// LocalDateTime startTime = systemTime;
|
||||
// LocalDateTime endTime = systemTime.plusMinutes(Config.STRATEGY_CAL_TIME);
|
||||
// boolean jump = false;
|
||||
// int i = 0;
|
||||
// while (startTime.isBefore(endTime) && i < 1000) {
|
||||
// ++i;
|
||||
// LocalDateTime nextTime = null;
|
||||
// for (TrainPassenger trainPassenger : trainPassengerList) {
|
||||
// String groupNumber = trainPassenger.getGroupNumber();
|
||||
// List<RealRun> realRunList = data.queryRealRuns(groupNumber);
|
||||
// if (CollectionUtils.isEmpty(realRunList)) {
|
||||
// TripPlan tripPlan = data.queryTripPlan(trainPassenger.getServiceNumber(), trainPassenger.getTripNumber());
|
||||
// if (tripPlan == null) {
|
||||
// log.warn(String.format("列车[%s-%s|%s]没有找到车次计划",
|
||||
// groupNumber, trainPassenger.getServiceNumber(), trainPassenger.getTripNumber()));
|
||||
// continue;
|
||||
// }
|
||||
// if (tripPlan.isBackup()) {
|
||||
// continue;
|
||||
// }
|
||||
// List<StationPlan> planList = tripPlan.getPlanList();
|
||||
// for (StationPlan stationPlan : planList) {
|
||||
// if (stationPlan.getArriveTime().compareTo(systemTime.toLocalTime()) >= 0) {
|
||||
// this.handleTrainRun(data, strategy, trainPassenger, tripPlan, stationPlan);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// realRunList = data.queryRealRuns(groupNumber);
|
||||
// if (CollectionUtils.isEmpty(realRunList)) {
|
||||
// log.error(String.format("列车[%s-%s|%s],车次[%s],时间[%s]",
|
||||
// groupNumber, trainPassenger.getServiceNumber(), trainPassenger.getTripNumber(),
|
||||
// tripPlan.debugStr(), systemTime.toString()));
|
||||
// }
|
||||
// } else {
|
||||
// RealRun lastRun = realRunList.get(realRunList.size() - 1);
|
||||
// TripPlan tripPlan = data.queryTripPlan(lastRun.getServiceNumber(), lastRun.getTripNumber());
|
||||
// StationPlan stationPlan = tripPlan.queryStationPlanByStationCode(lastRun.getStationCode());
|
||||
// BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(stationPlan);
|
||||
// if (lastRun.isArrive()) {
|
||||
// this.handleTrainRun(data, strategy, trainPassenger, tripPlan, stationPlan);
|
||||
// } else {
|
||||
// if (tripPlan.isLastPlan(stationPlan)) {
|
||||
// TripPlan nextTripPlan = data.queryNextTripPlan(tripPlan);
|
||||
// if (nextTripPlan != null) {
|
||||
// StationPlan nextStationPlan = nextTripPlan.getFirstStationPlan();
|
||||
// this.handleTrainRun(data, strategy, trainPassenger, nextTripPlan, nextStationPlan);
|
||||
// }
|
||||
// } else {
|
||||
// StationPlan nextStationPlan = tripPlan.queryNextStationPlan(stationPlan.getStation());
|
||||
// this.handleTrainRun(data, strategy, trainPassenger, tripPlan, nextStationPlan);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// // 更新nextTime
|
||||
// if (!CollectionUtils.isEmpty(realRunList)) {
|
||||
// RealRun last = realRunList.get(realRunList.size() - 1);
|
||||
// if (nextTime == null || nextTime.isAfter(last.getTime())) {
|
||||
// nextTime = last.getTime();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// systemTime = nextTime;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void handleTrainRun(StrategyCalculateData data,
|
||||
// JumpAndParkTimeStrategy strategy,
|
||||
// TrainPassenger trainPassenger,
|
||||
// TripPlan tripPlan, StationPlan stationPlan) {
|
||||
// Stand stand = strategy.getJumpStand();
|
||||
// String groupNumber = trainPassenger.getGroupNumber();
|
||||
// List<RealRun> realRunList = data.queryRealRuns(groupNumber);
|
||||
// RealRun lastRun = null;
|
||||
// int offset = 0;
|
||||
// if (!CollectionUtils.isEmpty(realRunList)) {
|
||||
// // 获取上一个实际运行,并计算时间偏移
|
||||
// lastRun = realRunList.get(realRunList.size() - 1);
|
||||
// TripPlan lastTripPlan = data.queryTripPlan(lastRun.getServiceNumber(), lastRun.getTripNumber());
|
||||
// StationPlan lastStationPlan = lastTripPlan.queryStationPlanByStationCode(lastRun.getStationCode());
|
||||
// if (lastRun.isArrive()) {
|
||||
// offset = lastRun.getTime().toLocalTime().toSecondOfDay() - lastStationPlan.getArriveTime().toSecondOfDay();
|
||||
// } else {
|
||||
// offset = lastRun.getTime().toLocalTime().toSecondOfDay() - lastStationPlan.getLeaveTime().toSecondOfDay();
|
||||
// }
|
||||
// }
|
||||
// if (Objects.equals(stand.getSection(), stationPlan.getSection()) && !strategy.isJumped()) { // 跳停站台计划
|
||||
// // 跳停策略指定的跳停站台,构建跳停运行,并更新策略
|
||||
// RealRun passing = this.buildRealRun(groupNumber, tripPlan, stationPlan, false,
|
||||
// stationPlan.getArriveTime(), offset, data.getSystemTime());
|
||||
// data.addRealRun(passing);
|
||||
// strategy.jumpedByTrain(groupNumber, tripPlan);
|
||||
// strategy.addOffset(-Config.TRAIN_PASS_SAVE_TIME);
|
||||
// StandPassenger standPassenger = data.getStandPassengerByStand(stand);
|
||||
// strategy.addEffectTrain(groupNumber);
|
||||
// strategy.addExtraNum(standPassenger.getWait());
|
||||
// return;
|
||||
// }
|
||||
// // 非跳停,根据计划更新预测运行
|
||||
// if (lastRun == null ||
|
||||
// !Objects.equals(stationPlan.getStation().getCode(), lastRun.getStationCode())) {
|
||||
// RealRun arrive = this.buildRealRun(groupNumber, tripPlan, stationPlan, true,
|
||||
// stationPlan.getArriveTime(), offset, data.getSystemTime());
|
||||
// data.addRealRun(arrive);
|
||||
// }
|
||||
// int parkTime = stationPlan.getParkTime();
|
||||
// // 列车到站乘客上车,更新列车上人数
|
||||
// if (stationPlan.getSection().getStandList().size() == 0) {
|
||||
// return;
|
||||
// }
|
||||
// Stand parkStand = strategy.getParkStand();
|
||||
// LocalTime arriveTime = stationPlan.getArriveTime();
|
||||
// LocalTime leaveTime = stationPlan.getLeaveTime();
|
||||
// // 列车到站乘客上车,更新列车上人数
|
||||
// StandPassenger standPassenger = data.getStandPassengerByStand(stationPlan.getSection().getStandList().get(0));
|
||||
// int wait = standPassenger.getWait(); // 站台等待乘客数
|
||||
// int normal = (parkTime - Config.INVALID_BOARD_TIME) * Config.PASSENGER_BOARD_SPEED; // 根据停站预测的可上车人数
|
||||
// int remain = Config.TRAIN_CAPACITY - trainPassenger.getNum(); // 列车上剩余可载人数
|
||||
// // 大客流站计算指标
|
||||
// if (Objects.equals(stationPlan.getSection(), parkStand.getSection())) {
|
||||
// // 时刻表偏差
|
||||
// parkTime = strategy.getTime();
|
||||
// leaveTime = arriveTime.plusSeconds(parkTime);
|
||||
//// strategy.addTarget1(parkTime - stationPlan.getParkTime());
|
||||
//// // 乘客等待时间(按人数统计,不考虑时间)
|
||||
//// strategy.addTarget2(standPassenger.getWait());
|
||||
// //
|
||||
// strategy.addEffectTrain(groupNumber);
|
||||
// int extraTime = strategy.getTime() - stationPlan.getParkTime();
|
||||
// strategy.addOffset(extraTime);
|
||||
// int extraNum = extraTime * Config.PASSENGER_BOARD_SPEED;
|
||||
// int extra = extraNum;
|
||||
// if (normal + extraNum > remain) {
|
||||
// if (normal < remain) {
|
||||
// extra = remain - normal;
|
||||
// } else {
|
||||
// extra = 0;
|
||||
// }
|
||||
// }
|
||||
// strategy.addExtraNum(extra);
|
||||
// normal += extraNum;
|
||||
// }
|
||||
// float min = Math.min(Math.min(wait, normal), remain); // 实际上车人数
|
||||
// standPassenger.minus(min);
|
||||
// trainPassenger.plus(min);
|
||||
//// // 大客流站计算指标
|
||||
//// if (data.isLpfStand(stationPlan.getSection())) {
|
||||
//// // 乘客等待时间(按人数统计,不考虑时间)
|
||||
//// strategy.addTarget2(standPassenger.getWait());
|
||||
//// }
|
||||
// // 生成预测实际运行图
|
||||
// RealRun leave = this.buildRealRun(trainPassenger.getGroupNumber(), tripPlan, stationPlan, false,
|
||||
// leaveTime, offset, data.getSystemTime());
|
||||
// data.addRealRun(leave);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getName() {
|
||||
// return "跳停策略服务";
|
||||
// }
|
||||
//
|
||||
//}
|
@ -345,10 +345,15 @@ public class SimulationRobotService {
|
||||
|| Objects.equals(vrSignal.getAspect(), signal.getGuideAspect())) { //引导信号
|
||||
if (!Objects.equals(signal, throughSignal) || !Objects.equals(vrSignal.getAspect(),
|
||||
throughAspect)) {
|
||||
SectionPosition noPassPosition = CalculateService.calculateNextPositionByStartAndLen(
|
||||
SectionPosition tempPosition;
|
||||
if (section.isFunctionTrack()) { //解决福州一列车从车辆段开出来时,在转换轨停车位置有误,导致无法发车的问题
|
||||
tempPosition = new SectionPosition(section, section.getStopPointByDirection(right));
|
||||
} else {
|
||||
tempPosition = CalculateService.calculateNextPositionByStartAndLen(
|
||||
signalPosition, !right, 2, true);
|
||||
if (targetPosition == null || noPassPosition.isAheadOf(targetPosition, right)) {
|
||||
targetPosition = noPassPosition;
|
||||
}
|
||||
if (targetPosition == null || tempPosition.isAheadOf(targetPosition, right)) {
|
||||
targetPosition = tempPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ public class MetroSimulationWorkServiceImpl implements SimulationWorkService {
|
||||
faultGenerator.addJobs(simulation);
|
||||
atsMessageCollectAndDispatcher.addJobs(simulation);
|
||||
nccAlarmService.addJobs(simulation);
|
||||
trainMessageDiagram.addJobs(simulation);
|
||||
// trainMessageDiagram.addJobs(simulation); 逻辑报错,暂时注掉
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,23 @@
|
||||
package club.joylink.rtss.vo.client.cgy;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class CgyThirdPartyLoginInfoVO {
|
||||
|
||||
@NotEmpty(message = "appId不能为空")
|
||||
private String appId;
|
||||
private String sessionId;
|
||||
private Long timeStamp;
|
||||
@NotEmpty(message = "账号不能为空")
|
||||
private String account;
|
||||
@NotEmpty(message = "用户名不能为空")
|
||||
private String name;
|
||||
|
||||
private String parentAccount;
|
||||
}
|
@ -4,6 +4,7 @@ import club.joylink.rtss.constants.ProjectCode;
|
||||
import club.joylink.rtss.constants.ProjectDeviceType;
|
||||
import club.joylink.rtss.entity.ProjectDevice;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.cgy.CgyPslConfig;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.cgy.CgySectionConfig;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.cgy.CgySignalConfig;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.cgy.CgySwitchConfig;
|
||||
@ -175,6 +176,9 @@ public class ProjectDeviceVO {
|
||||
case SECTION:
|
||||
list.add(new CgySectionConfig(deviceVO));
|
||||
break;
|
||||
case PSL:
|
||||
list.add(new CgyPslConfig(deviceVO));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
@ -0,0 +1,71 @@
|
||||
package club.joylink.rtss.vo.client.project.cgy;
|
||||
|
||||
import club.joylink.rtss.vo.client.project.RealConfigVO;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class CgyPslConfigVO extends RealConfigVO {
|
||||
|
||||
private String pslCode;
|
||||
|
||||
/**
|
||||
* 开门按钮
|
||||
*/
|
||||
private Integer r_km_btn = 32;
|
||||
|
||||
/**
|
||||
* 关门按钮
|
||||
*/
|
||||
private Integer r_gm_btn = 33;
|
||||
|
||||
/**
|
||||
* 就地(允许/禁止)按钮
|
||||
*/
|
||||
private Integer r_yxjz_btn = 34;
|
||||
|
||||
/**
|
||||
* 互锁解除钥匙(true-互锁解除)
|
||||
*/
|
||||
private Integer r_hsjc_key = 46;
|
||||
|
||||
/**
|
||||
* 消音按钮(不知道消的啥音)
|
||||
*/
|
||||
private Integer r_xy_btn = 47;
|
||||
|
||||
/**
|
||||
* 控制-开门指示灯
|
||||
*/
|
||||
private Integer w_km_light = 48;
|
||||
|
||||
/**
|
||||
* 控制-关门指示灯
|
||||
*/
|
||||
private Integer w_gm_light = 49;
|
||||
|
||||
/**
|
||||
* 控制-psl允许操作指示灯
|
||||
*/
|
||||
private Integer w_yxcz_light = 50;
|
||||
|
||||
/**
|
||||
* 控制-关闭锁紧指示灯
|
||||
*/
|
||||
private Integer w_gbsj_light = 55;
|
||||
|
||||
public CgyPslConfigVO(String pslCode) {
|
||||
this();
|
||||
this.pslCode = pslCode;
|
||||
}
|
||||
|
||||
public CgyPslConfigVO() {
|
||||
super(0, 64);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String findDeviceCode() {
|
||||
return pslCode;
|
||||
}
|
||||
}
|
@ -11,10 +11,16 @@ public class CgySectionConfigVO extends RealConfigVO {
|
||||
/**
|
||||
* 出清
|
||||
*/
|
||||
private Integer r_occupied = 6;
|
||||
private Integer r_occupied;
|
||||
|
||||
public CgySectionConfigVO(String sectionCode, Integer r_occupied) {
|
||||
this();
|
||||
this.sectionCode = sectionCode;
|
||||
this.r_occupied = r_occupied;
|
||||
}
|
||||
|
||||
public CgySectionConfigVO() {
|
||||
super(0, 32);
|
||||
super(0, 64);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,46 +1,62 @@
|
||||
package club.joylink.rtss.vo.client.project.cgy;
|
||||
|
||||
import club.joylink.rtss.vo.client.project.RealConfigVO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 红灯常亮DDJ吸起红灯灭 Lxj吸起黄灯 YxJ红黄 LXJ、ZXJ吸起绿灯
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class CgySignalConfigVO extends RealConfigVO {
|
||||
|
||||
private String signalCode;
|
||||
|
||||
/**
|
||||
* 红
|
||||
*/
|
||||
private Integer r_red;
|
||||
private Integer r_ddj;
|
||||
|
||||
private Integer r_lxj;
|
||||
|
||||
/**
|
||||
* 绿
|
||||
* 主灯丝报警
|
||||
*/
|
||||
private Integer r_green;
|
||||
private Integer r_dj;
|
||||
|
||||
private Integer r_zxj;
|
||||
|
||||
private Integer r_yxj;
|
||||
|
||||
/**
|
||||
* 黄
|
||||
* 副灯丝报警
|
||||
*/
|
||||
private Integer r_yellow;
|
||||
private Integer r_dj2;
|
||||
|
||||
private Integer w_red;
|
||||
private Integer w_ddj;
|
||||
|
||||
private Integer w_green;
|
||||
private Integer w_lxj;
|
||||
|
||||
private Integer w_yellow;
|
||||
private Integer w_zxj;
|
||||
|
||||
public CgySignalConfigVO(String signalCode, Integer r_red,
|
||||
Integer r_green, Integer r_yellow, Integer w_red, Integer w_green, Integer w_yellow) {
|
||||
super(0, 24);
|
||||
private Integer w_yxj;
|
||||
|
||||
public CgySignalConfigVO(String signalCode, Integer r_ddj,
|
||||
Integer r_lxj, Integer r_dj, Integer r_zxj, Integer r_yxj, Integer r_dj2, Integer w_ddj,
|
||||
Integer w_lxj, Integer w_zxj, Integer w_yxj) {
|
||||
this();
|
||||
this.signalCode = signalCode;
|
||||
this.r_red = r_red;
|
||||
this.r_green = r_green;
|
||||
this.r_yellow = r_yellow;
|
||||
this.w_red = w_red;
|
||||
this.w_green = w_green;
|
||||
this.w_yellow = w_yellow;
|
||||
this.r_ddj = r_ddj;
|
||||
this.r_lxj = r_lxj;
|
||||
this.r_dj = r_dj;
|
||||
this.r_zxj = r_zxj;
|
||||
this.r_yxj = r_yxj;
|
||||
this.r_dj2 = r_dj2;
|
||||
this.w_ddj = w_ddj;
|
||||
this.w_lxj = w_lxj;
|
||||
this.w_zxj = w_zxj;
|
||||
this.w_yxj = w_yxj;
|
||||
}
|
||||
|
||||
public CgySignalConfigVO() {
|
||||
|
@ -10,30 +10,39 @@ public class CgySwitchConfigVO extends RealConfigVO {
|
||||
|
||||
private String switchCode;
|
||||
|
||||
/**
|
||||
* 解锁表示
|
||||
*/
|
||||
private Integer r_js = 12;
|
||||
/**
|
||||
* 定表
|
||||
*/
|
||||
private Integer r_db = 0;
|
||||
private Integer r_db = 13;
|
||||
|
||||
/**
|
||||
* 反表
|
||||
*/
|
||||
private Integer r_fb = 1;
|
||||
private Integer r_fb = 14;
|
||||
|
||||
/**
|
||||
* 锁接
|
||||
* 解锁
|
||||
*/
|
||||
private Integer w_sj = 8;
|
||||
private Integer w_js = 24;
|
||||
|
||||
/**
|
||||
* 定操
|
||||
*/
|
||||
private Integer w_dc = 9;
|
||||
private Integer w_dc = 25;
|
||||
|
||||
/**
|
||||
* 反操
|
||||
*/
|
||||
private Integer w_fc = 10;
|
||||
private Integer w_fc = 26;
|
||||
|
||||
public CgySwitchConfigVO(String switchCode) {
|
||||
this();
|
||||
this.switchCode = switchCode;
|
||||
}
|
||||
|
||||
public CgySwitchConfigVO() {
|
||||
super(0, 32);
|
||||
|
@ -0,0 +1,16 @@
|
||||
package club.joylink.rtss.vo.client.simulationUsage;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SimulationUsageRecordQueryVO {
|
||||
|
||||
private Long uid;
|
||||
private Long functionId;
|
||||
}
|
@ -9,9 +9,12 @@ import lombok.Setter;
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SimulationInfoQueryVO extends PageQueryVO {
|
||||
|
||||
private String project;
|
||||
|
||||
private String group;
|
||||
|
||||
private String userName;
|
||||
|
||||
private Long functionId;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -10,7 +10,7 @@ import lombok.Setter;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
*地图线路公共配置项
|
||||
* 地图线路公共配置项
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ -18,12 +18,12 @@ import org.springframework.util.StringUtils;
|
||||
public class RealLineConfigVO {
|
||||
|
||||
/**
|
||||
*上行是否右方向
|
||||
* 上行是否右方向
|
||||
*/
|
||||
private Boolean upRight = true;
|
||||
|
||||
/**
|
||||
*进路办理是否先锁闭——开始办理直接先锁闭区段(如福州一号线)
|
||||
* 进路办理是否先锁闭——开始办理直接先锁闭区段(如福州一号线)
|
||||
*/
|
||||
private Boolean lockFirst = false;
|
||||
|
||||
@ -38,76 +38,76 @@ public class RealLineConfigVO {
|
||||
private boolean routeSettingNoFail = false;
|
||||
|
||||
/**
|
||||
*是否列车停站开门后,才办理出站进路开放出站信号机
|
||||
* 是否列车停站开门后,才办理出站进路开放出站信号机
|
||||
*/
|
||||
private boolean signalOpenAfterParking = false;
|
||||
|
||||
/**
|
||||
*站台扣车是否关闭逻辑点灯的信号机
|
||||
* 站台扣车是否关闭逻辑点灯的信号机
|
||||
*/
|
||||
private boolean standHoldCloseLogicLight = false;
|
||||
|
||||
/**
|
||||
*ATS是否自动处理人工设置的站前折返自动更新车次
|
||||
* ATS是否自动处理人工设置的站前折返自动更新车次
|
||||
*/
|
||||
private boolean atsAutoHandleManualFrontTurnBack = false;
|
||||
|
||||
/**
|
||||
*CTC列车进路延续保护仅折返站处锁闭
|
||||
* CTC列车进路延续保护仅折返站处锁闭
|
||||
*/
|
||||
private boolean ctcOverlapOnlyTurnBackStationLock = false;
|
||||
|
||||
/**
|
||||
*引导办理是否需要先排列进路
|
||||
* 引导办理是否需要先排列进路
|
||||
*/
|
||||
private boolean guideNeedRouteSettingFirst = true;
|
||||
|
||||
/**
|
||||
*道岔区段状态改变按单个道岔处理
|
||||
* 道岔区段状态改变按单个道岔处理
|
||||
*/
|
||||
private Boolean switchSingleHandle = true;
|
||||
|
||||
/**
|
||||
*道岔正/反操是否联动
|
||||
* 道岔正/反操是否联动
|
||||
*/
|
||||
private Boolean switchNRTurnChain = false;
|
||||
|
||||
/**
|
||||
*道岔单解/锁是否联动
|
||||
* 道岔单解/锁是否联动
|
||||
*/
|
||||
private Boolean switchSingleLockChain = false;
|
||||
|
||||
/**
|
||||
*道岔故障失表是否联动
|
||||
* 道岔故障失表是否联动
|
||||
*/
|
||||
private Boolean switchLossChain = false;
|
||||
|
||||
/**
|
||||
*是否强制取消进路/在接近区段占用时是否依旧强制执行取消进路
|
||||
* 是否强制取消进路/在接近区段占用时是否依旧强制执行取消进路
|
||||
*/
|
||||
private MapConfig.ApproachLockCancel singleApproachLockCancelRoute = MapConfig.ApproachLockCancel.NOT;
|
||||
|
||||
/**
|
||||
*列车控制模式/级别
|
||||
* 列车控制模式/级别
|
||||
*/
|
||||
private String runMode = RunLevel.CBTC.name();
|
||||
|
||||
/**
|
||||
*不停站头码车服务号列表
|
||||
* 不停站头码车服务号列表
|
||||
*/
|
||||
private String noParkingSM="";
|
||||
private String noParkingSM = "";
|
||||
/**
|
||||
*停站头码车服务号列表
|
||||
* 停站头码车服务号列表
|
||||
*/
|
||||
private String parkingSM="";
|
||||
private String parkingSM = "";
|
||||
|
||||
/**
|
||||
*RM模式下ATP防护速度(单位km/h)
|
||||
* RM模式下ATP防护速度(单位km/h)
|
||||
*/
|
||||
private float rmAtpSpeed = 25f;
|
||||
|
||||
/**
|
||||
*URM模式下ATP防护速度(单位km/h)
|
||||
* URM模式下ATP防护速度(单位km/h)
|
||||
*/
|
||||
private float urmAtpSpeed = 45f;
|
||||
|
||||
@ -186,34 +186,54 @@ public class RealLineConfigVO {
|
||||
*/
|
||||
private boolean holdCommandIgnoreControlMode;
|
||||
|
||||
/** 取消联锁条件不满足的进路时需要延时解锁 */
|
||||
/**
|
||||
* 取消联锁条件不满足的进路时需要延时解锁
|
||||
*/
|
||||
private boolean delayWhenCancelRouteWithAbnormalInterlock;
|
||||
|
||||
/** 车次号的位数 */
|
||||
/**
|
||||
* 车次号的位数
|
||||
*/
|
||||
private int figuresOfTripNumber = 4;
|
||||
|
||||
/** 服务号的位数 */
|
||||
/**
|
||||
* 服务号的位数
|
||||
*/
|
||||
private int figuresOfServiceNumber = 3;
|
||||
|
||||
/** 设置头码车时检查方向 */
|
||||
/**
|
||||
* 设置头码车时检查方向
|
||||
*/
|
||||
private boolean checkDirectionWhenSetHead;
|
||||
|
||||
/** 转换轨进路只能通过故障解锁来取消 */
|
||||
/**
|
||||
* 转换轨进路只能通过故障解锁来取消
|
||||
*/
|
||||
private boolean transferRouteCanOnlyFaultUnlock;
|
||||
|
||||
/** 头码车抵达目的地后变为人工车 */
|
||||
/**
|
||||
* 头码车抵达目的地后变为人工车
|
||||
*/
|
||||
private boolean setManualWhenHeadTrainArriveTarget;
|
||||
|
||||
/** 进路默认开启冲突检测 */
|
||||
/**
|
||||
* 进路默认开启冲突检测
|
||||
*/
|
||||
private boolean routeDefaultCheckConflict;
|
||||
|
||||
/** 运行图中车次号是否唯一 */
|
||||
/**
|
||||
* 运行图中车次号是否唯一
|
||||
*/
|
||||
private boolean tripNumberIsUnique;
|
||||
|
||||
/** 站台折返策略不生效 */
|
||||
/**
|
||||
* 站台折返策略不生效
|
||||
*/
|
||||
private boolean standTbStrategyIsInvalid;
|
||||
|
||||
/** 根据服务号更新车次计划 */
|
||||
/**
|
||||
* 根据服务号更新车次计划
|
||||
*/
|
||||
private boolean updateTripPlanByServiceNumber;
|
||||
|
||||
/**
|
||||
@ -223,10 +243,9 @@ public class RealLineConfigVO {
|
||||
/**
|
||||
* 对信号机封锁操作,是否影响信号显示
|
||||
* <p>
|
||||
* true-封锁信号机,会使信号机显示禁止色<br>
|
||||
* false-封锁信号机,不会影响信号机显示。
|
||||
* true-封锁信号机,会使信号机显示禁止色<br> false-封锁信号机,不会影响信号机显示。
|
||||
*/
|
||||
private boolean signalBolckOptReflectSignal=true;
|
||||
private boolean signalBolckOptReflectSignal = true;
|
||||
|
||||
|
||||
/**
|
||||
@ -245,6 +264,11 @@ public class RealLineConfigVO {
|
||||
*/
|
||||
private boolean manualTrainDefaultStop;
|
||||
|
||||
/**
|
||||
* 办理引导进路时,如果进路首区段占用,引导信号15秒后关闭
|
||||
*/
|
||||
private boolean guideDelayCloseWhenFirstSectionOccupied;
|
||||
|
||||
public static RealLineConfigVO parseJsonStr(String configData) {
|
||||
if (StringUtils.hasText(configData)) {
|
||||
return JsonUtils.read(configData, RealLineConfigVO.class);
|
||||
|
@ -21,9 +21,9 @@ import java.util.Map;
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class FindPaperCompositionPageReqVo extends PageQueryVO {
|
||||
|
||||
/**
|
||||
* 组织id<br>
|
||||
* 选填<br>
|
||||
* 组织id<br> 选填<br>
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long orgId;
|
||||
@ -32,29 +32,24 @@ public class FindPaperCompositionPageReqVo extends PageQueryVO {
|
||||
*/
|
||||
private Long mapId;
|
||||
/**
|
||||
* 试卷蓝图名称<br>
|
||||
* 选填<br>
|
||||
* 试卷蓝图名称<br> 选填<br>
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 试卷蓝图名称--是否模糊查询,默认true<br>
|
||||
* 选填<br>
|
||||
* 试卷蓝图名称--是否模糊查询,默认true<br> 选填<br>
|
||||
*/
|
||||
private Boolean nameLike = true;
|
||||
/**
|
||||
* 试卷蓝图简介<br>
|
||||
* 选填<br>
|
||||
* 试卷蓝图简介<br> 选填<br>
|
||||
*/
|
||||
private String profile;
|
||||
/**
|
||||
* 试卷蓝图简介--是否模糊查询,默认true<br>
|
||||
* 选填<br>
|
||||
* 试卷蓝图简介--是否模糊查询,默认true<br> 选填<br>
|
||||
*/
|
||||
private Boolean profileLike = true;
|
||||
/**
|
||||
* 根据试卷蓝图的状态查找,默认值FindPcType.All<br>
|
||||
* All(1)-所有,Editing(2)-正在编辑的,CanUse(3)-可以用于生成试卷的,Locked(4)-封存,Used(5)-已经被使用过<br>
|
||||
* 选填<br>
|
||||
* All(1)-所有,Editing(2)-正在编辑的,CanUse(3)-可以用于生成试卷的,Locked(4)-封存,Used(5)-已经被使用过<br> 选填<br>
|
||||
*/
|
||||
private FindPcType findState = FindPcType.All;
|
||||
/**
|
||||
@ -72,11 +67,16 @@ public class FindPaperCompositionPageReqVo extends PageQueryVO {
|
||||
* 选填
|
||||
*/
|
||||
private Boolean desc = true;
|
||||
|
||||
/**
|
||||
* 试卷蓝图状态:1-正在编辑,2-封存(不能修改),3-已经被使用(不能修改删除)<br>
|
||||
* 选填<br>
|
||||
* 试卷创建者的ID
|
||||
*/
|
||||
public List<PaperCompositionState> stateList(){
|
||||
private Long creatorId;
|
||||
|
||||
/**
|
||||
* 试卷蓝图状态:1-正在编辑,2-封存(不能修改),3-已经被使用(不能修改删除)<br> 选填<br>
|
||||
*/
|
||||
public List<PaperCompositionState> stateList() {
|
||||
return FindPcType.stateList(findState);
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
/*
|
||||
package club.joylink.rtss.vo.permission;
|
||||
|
||||
import club.joylink.rtss.vo.permission.subject.PermissionSubjectVO;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PermissionRefParamVO {
|
||||
private Long distributeId;
|
||||
private Long permissionId;
|
||||
|
||||
public static List<PermissionRefParamVO> convert(List<PermissionSubjectVO> vo){
|
||||
List<PermissionRefParamVO> list = Lists.newArrayList();
|
||||
for (PermissionSubjectVO subjectVO : vo) {
|
||||
list.add(new PermissionRefParamVO(subjectVO.getDistributeId(),subjectVO.getPermissionId()));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
*/
|
@ -0,0 +1,13 @@
|
||||
package club.joylink.rtss.vo.voice;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class VoiceVerifyResultVO {
|
||||
|
||||
private String text;
|
||||
|
||||
private boolean match;
|
||||
}
|
204
src/main/resources/mybatis/mapper/CgyViewDAO.xml
Normal file
204
src/main/resources/mybatis/mapper/CgyViewDAO.xml
Normal file
@ -0,0 +1,204 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="club.joylink.rtss.dao.CgyViewDAO">
|
||||
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.CgyView">
|
||||
<id column="app_id" jdbcType="VARCHAR" property="appId" />
|
||||
<result column="app_secret" jdbcType="VARCHAR" property="appSecret" />
|
||||
<result column="function_id" jdbcType="BIGINT" property="functionId" />
|
||||
<result column="view_count" jdbcType="BIGINT" property="viewCount" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Update_By_Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
app_id, app_secret, function_id, view_count
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="club.joylink.rtss.entity.CgyViewExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from cgy_view
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
<if test="limit != null">
|
||||
<if test="offset != null">
|
||||
limit ${offset}, ${limit}
|
||||
</if>
|
||||
<if test="offset == null">
|
||||
limit ${limit}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from cgy_view
|
||||
where app_id = #{appId,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from cgy_view
|
||||
where app_id = #{appId,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.CgyViewExample">
|
||||
delete from cgy_view
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="club.joylink.rtss.entity.CgyView">
|
||||
insert into cgy_view (app_id, app_secret, function_id,
|
||||
view_count)
|
||||
values (#{appId,jdbcType=VARCHAR}, #{appSecret,jdbcType=VARCHAR}, #{functionId,jdbcType=BIGINT},
|
||||
#{viewCount,jdbcType=BIGINT})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.CgyView">
|
||||
insert into cgy_view
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="appId != null">
|
||||
app_id,
|
||||
</if>
|
||||
<if test="appSecret != null">
|
||||
app_secret,
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
function_id,
|
||||
</if>
|
||||
<if test="viewCount != null">
|
||||
view_count,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="appId != null">
|
||||
#{appId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="appSecret != null">
|
||||
#{appSecret,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
#{functionId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="viewCount != null">
|
||||
#{viewCount,jdbcType=BIGINT},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="club.joylink.rtss.entity.CgyViewExample" resultType="java.lang.Long">
|
||||
select count(*) from cgy_view
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update cgy_view
|
||||
<set>
|
||||
<if test="record.appId != null">
|
||||
app_id = #{record.appId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.appSecret != null">
|
||||
app_secret = #{record.appSecret,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.functionId != null">
|
||||
function_id = #{record.functionId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.viewCount != null">
|
||||
view_count = #{record.viewCount,jdbcType=BIGINT},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update cgy_view
|
||||
set app_id = #{record.appId,jdbcType=VARCHAR},
|
||||
app_secret = #{record.appSecret,jdbcType=VARCHAR},
|
||||
function_id = #{record.functionId,jdbcType=BIGINT},
|
||||
view_count = #{record.viewCount,jdbcType=BIGINT}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.CgyView">
|
||||
update cgy_view
|
||||
<set>
|
||||
<if test="appSecret != null">
|
||||
app_secret = #{appSecret,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
function_id = #{functionId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="viewCount != null">
|
||||
view_count = #{viewCount,jdbcType=BIGINT},
|
||||
</if>
|
||||
</set>
|
||||
where app_id = #{appId,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.CgyView">
|
||||
update cgy_view
|
||||
set app_secret = #{appSecret,jdbcType=VARCHAR},
|
||||
function_id = #{functionId,jdbcType=BIGINT},
|
||||
view_count = #{viewCount,jdbcType=BIGINT}
|
||||
where app_id = #{appId,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user