Compare commits

..

1 Commits

Author SHA1 Message Date
joylink_zhangsai
5634ab0a39 南昌工学院沙盘项目特殊改动 2023-08-21 21:11:50 +08:00
352 changed files with 42955 additions and 97726 deletions

View File

@ -1,32 +0,0 @@
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

View File

@ -1,61 +0,0 @@
name: CI
run-name: ${{ gitea.actor }} is testing out Gitea Actions
on:
push:
branches:
- local-test
jobs:
Docker-Build:
runs-on: joylink-local233
steps:
- name: 检出代码
uses: https://gitea.joylink.club/actions/checkout@v4
with:
submodules: recursive
- name: 设置java环境
uses: https://gitea.joylink.club/actions/setup-java@v4
with:
java-version: '11'
distribution: 'zulu'
cache: 'maven'
cache-dependency-path: './pom.xml'
- name: 设置Maven环境
uses: https://gitea.joylink.club/actions/local-setup-maven@v0.1.1
with:
maven-version: 3.8.8
- name: 构建
run: |
mvn -Dmaven.test.skip=true clean package
- name: 设置 Docker
uses: https://gitea.joylink.club/actions/local-setup-docker-cli-action@v0.1.1
- name: 设置 Docker Buildx
uses: https://gitea.joylink.club/actions/local-setup-buildx-action@v0.1.3
- name: docker登录gitea.joylink.club
uses: https://gitea.joylink.club/docker/login-action@v3
with:
registry: gitea.joylink.club
username: shengxuqiang
password: ${{ secrets.SHENGXUQIANG_PASSWORD }}
- name: Docker Build and push
uses: https://gitea.joylink.club/docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: |
gitea.joylink.club/joylink/rt-sim-training-service:local-test
- name: 发布到本地测试环境
uses: https://gitea.joylink.club/appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.LOCAL_233_SSH_HOST }}
port: ${{ secrets.LOCAL_233_SSH_PORT }}
username: ${{ secrets.LOCAL_233_SSH_USER }}
password: ${{ secrets.LOCAL_233_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: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"

View File

@ -1,61 +0,0 @@
name: 版本发布docker构建并上传
run-name: ${{ gitea.actor }} is testing out Gitea Actions
on:
release:
types: [ published ]
jobs:
Docker-Build-Push:
runs-on: joylink-local233
steps:
- name: 检出代码
uses: https://gitea.joylink.club/actions/checkout@v4
with:
submodules: recursive
- name: 设置java环境
uses: https://gitea.joylink.club/actions/setup-java@v4
with:
java-version: '11'
distribution: 'zulu'
cache: 'maven'
cache-dependency-path: './pom.xml'
- name: 设置Maven环境
uses: https://gitea.joylink.club/actions/local-setup-maven@v0.1.1
with:
maven-version: 3.8.8
- name: 构建
run: |
mvn -Dmaven.test.skip=true clean package
- name: 设置 Docker
uses: https://gitea.joylink.club/actions/local-setup-docker-cli-action@v0.1.1
- name: 设置 Docker Buildx
uses: https://gitea.joylink.club/actions/local-setup-buildx-action@v0.1.3
- name: docker登录gitea.joylink.club
uses: https://gitea.joylink.club/docker/login-action@v3
with:
registry: gitea.joylink.club
username: shengxuqiang
password: ${{ secrets.SHENGXUQIANG_PASSWORD }}
- name: Docker Build and push
uses: https://gitea.joylink.club/docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
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:
# host: ${{ secrets.LOCAL_233_SSH_HOST }}
# port: ${{ secrets.LOCAL_233_SSH_PORT }}
# username: ${{ secrets.LOCAL_233_SSH_USER }}
# password: ${{ secrets.LOCAL_233_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 --restart=always --network net --ip 192.168.53.3 -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

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "rt-sim-training-message"]
path = rt-sim-training-message
url = http://120.46.212.6:3000/joylink/rt-sim-training-message.git

View File

@ -1,11 +0,0 @@
FROM azul/zulu-openjdk-alpine:11
ADD target/rtss-0.0.1-SNAPSHOT.jar rtss-service.jar
ENV APP_ENV=prd
EXPOSE 9000 19000/tcp
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
CMD java -jar -Dfile.encoding=UTF-8 -Dspring.profiles.active=$APP_ENV /rtss-service.jar

View File

@ -1,7 +0,0 @@
# CI、CD说明
- 分支主要为developlocal-testmaster
- 本地233服务器部署方式为push到local-test分支即可触发
- 公网服务器发布方式:
1. push到master虽然可以用别的分支但不建议
2. 在版本发布处发布新版本触发构建docker镜像
3. 待docker镜像构建完成后点击Actions中CD_pub_deploy.yaml进入第一个任务点击重新运行所有任务进行服务发布

31
pom.xml
View File

@ -144,13 +144,9 @@
<dependency> <dependency>
<groupId>com.google.protobuf</groupId> <groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId> <artifactId>protobuf-java</artifactId>
<version>3.23.1</version> <version>3.19.3</version>
</dependency>
<dependency>
<groupId>com.hubspot.jackson</groupId>
<artifactId>jackson-datatype-protobuf</artifactId>
<version>0.9.12</version>
</dependency> </dependency>
<!-- <dependency> <!-- <dependency>
<groupId>com.chenlb.mmseg4j</groupId> <groupId>com.chenlb.mmseg4j</groupId>
<artifactId>mmseg4j-core</artifactId> <artifactId>mmseg4j-core</artifactId>
@ -227,26 +223,5 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </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> </project>

@ -1 +0,0 @@
Subproject commit 5dd7fdb3d568c829356fa59b746b559d17da49b8

16
sql/20230206-zhou.sql Normal file
View File

@ -0,0 +1,16 @@
-- 用户答题生成对应的规则id
ALTER TABLE `rts_paper_user_question`
ADD COLUMN `rule_id` bigint not NULL COMMENT '试卷规则rts_paper_rule的id' AFTER `pu_id`;
ALTER TABLE `rts_paper_user_question`
ADD COLUMN `sub_type` int not NULL COMMENT '规则类型:理论题(1-单选题2-多选题3-判断题);实训题(4-单操实训5-场景实训)' AFTER `type`;
ALTER TABLE `rts_paper_user_question` MODIFY COLUMN tmp_answer longtext;
ALTER TABLE `rts_paper_rule` ADD COLUMN scene_detail VARCHAR(1000) COMMENT '场景实训考试的规则';
ALTER TABLE `rts_paper_user_question`
ADD COLUMN `scene_cosplay_id` varchar(10) COMMENT '场景实训考试扮演的角色';

View File

@ -0,0 +1,2 @@
ALTER TABLE `joylink`.`rts_map_function`
ADD COLUMN `bg_url` varchar(255) NULL COMMENT '背景图片的url' AFTER `desc`;

View File

@ -0,0 +1,11 @@
CREATE TABLE `rts_map_function_template` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(64) COLLATE utf8mb4_general_ci NOT NULL,
`map_function_param` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '地图功能参数',
`assistant_param` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '辅助参数(如默认角色类型)',
`create_time` datetime NOT NULL,
`creator_id` bigint NOT NULL,
`update_time` datetime DEFAULT NULL,
`updater_id` bigint DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='地图功能模板';

View File

@ -0,0 +1,3 @@
ALTER TABLE `joylink`.`rts_published_training2` ADD COLUMN `shared` int NULL DEFAULT 0 COMMENT '0 不共享1共享' AFTER `client`;
update rts_published_training2 SET shared = 1,org_id = null WHERE creator_id = 0 ;

View File

@ -0,0 +1,14 @@
CREATE TABLE `rts_voice_discriminate_config` (
`id` bigint NOT NULL AUTO_INCREMENT,
`key_word_rules` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '关键字正则',
`params_rules` json DEFAULT NULL COMMENT ' /**\r\n * 所需参数 List\r\n * {@link ParamExtractRule}\r\n */',
`exec_operate_rule` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT ' /**\r\n * 执行指令(系统操作指令)\r\n * {@link OperateRule}\r\n */',
`reply_rule` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT ' /**\r\n * 回复指令(系统指令操作完毕或者无系统指令时,交互回复)\r\n * {@link ReplyRule}\r\n */',
`map_id` bigint DEFAULT NULL,
`create_time` datetime DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`operate_id` bigint DEFAULT NULL,
`describe` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '描述',
`status` int DEFAULT NULL COMMENT '状态0=编辑,1=使用',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

View File

@ -0,0 +1,13 @@
CREATE TABLE `rts_conversation_group_info` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '群组名称',
`map_id` bigint DEFAULT NULL COMMENT '所属地图ID',
`project_code` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '所属项目',
`leader_id` varchar(12) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '群主角色ID',
`member_ids` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '群组用户角色ID',
`create_time` datetime DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
`creator_id` bigint DEFAULT NULL,
`status` int DEFAULT NULL COMMENT '状态0=编辑,1=使用',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='群组信息设置';

View File

@ -0,0 +1,2 @@
ALTER TABLE `joylink`.`rts_conversation_group_info` ADD COLUMN `image_url` varchar(255) NULL COMMENT '头像路径' AFTER `name`;
DROP TABLE IF EXISTS `joylink`.`rts_conversation_group_info`;

View File

@ -0,0 +1,10 @@
CREATE TABLE `rts_alarm_tips` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`alarm_type` varchar(255) COLLATE utf8mb4_general_ci NOT NULL,
`alarm_level` varchar(255) COLLATE utf8mb4_general_ci NOT NULL,
`tips` varchar(10000) COLLATE utf8mb4_general_ci NOT NULL,
`update_time` datetime NOT NULL,
`updater_id` bigint NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `alarm` (`alarm_type`,`alarm_level`) COMMENT '用以保证提示信息唯一'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='ATS报警信息提示';

View File

@ -0,0 +1 @@
ALTER TABLE `joylink`.`rts_training2_rule` ADD COLUMN `score_rule` text NULL COMMENT '得分规则' AFTER `location_rule`;

View File

@ -0,0 +1 @@
ALTER TABLE `rts_paper_rule` ADD COLUMN `sub_type_param` varchar(255) NULL COMMENT '规则参数';

View File

@ -0,0 +1,9 @@
INSERT INTO rts_user_simulation_record (map_id, user_id, type, duration, start_time, end_time)
SELECT map_id,
user_id,
'SIM',
duration,
start_time,
end_time
FROM user_simulation_stats
WHERE end_time > '2000-01-01 00:00:00';

View File

@ -1,41 +0,0 @@
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());
}
}

View File

@ -1,32 +0,0 @@
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;
}

View File

@ -1,101 +0,0 @@
package club.joylink.rtss.bo.race;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.race.RaceApplication;
import club.joylink.rtss.vo.race.RaceApplication.ResultNode;
import club.joylink.rtss.vo.race.RaceApplication.ResultNode.Builder;
import club.joylink.rtss.vo.race.RaceTask;
import club.joylink.rtss.vo.race.RaceTask.RacePaperSingleModuleGroupTask;
import club.joylink.rtss.vo.race.RaceTask.RaceTaskChildVO;
import club.joylink.rtss.vo.race.RaceTask.RaceTaskChildVO.ChildNodeType;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.Data;
@Data
public class RaceContent {
private long userId;
private long paperId;
private int moduleId;
/**
* 训练使用到的任务树
*/
private RaceTask.RacePaperSingleModuleGroupTask taskTree;
/**
* 训练结果
*/
private RaceApplication.RacePracticeResult.Builder result;
/**
* 结果节点映射仅为了通过ID找节点
*/
private Map<Long, Builder> resultNodeMap = new HashMap<>();
public RaceContent(long userId, long paperId, int moduleId,
RacePaperSingleModuleGroupTask taskTree) {
this.userId = userId;
this.paperId = paperId;
this.moduleId = moduleId;
this.taskTree = taskTree;
this.result = RaceApplication.RacePracticeResult.newBuilder();
result.setCustomModuleId(taskTree.getCustomModuleId());
Builder rootNode = ResultNode.newBuilder();
buildResultNodeTree(taskTree.getChildList(), rootNode);
result.addAllNode(rootNode.getChildList());
// for (RaceTaskChildVO childVO : taskTree.getChildList()) {
// Builder nodeBuilder = result.addNodeBuilder();
// nodeBuilder.setName(childVO.getName());
// nodeBuilder.setType(childVO.getNodeType());
// nodeBuilder.setSceneId(childVO.getSceneId());
// //构建任务映射
// if (ChildNodeType.TASK == childVO.getNodeType()) {
// resultNodeMap.put(childVO.getId(), nodeBuilder);
// }
// //递归
// buildResultNodeTree(childVO, nodeBuilder);
// }
}
public Builder getResultNode(long taskId) {
Builder builder = resultNodeMap.get(taskId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(builder,
String.format("任务[%d]不存在", taskId));
return builder;
}
private void buildResultNodeTree(List<RaceTaskChildVO> children, Builder parentNode) {
for (RaceTaskChildVO childVO : children) {
//构建对应的结果Node
Builder nodeBuilder = parentNode.addChildBuilder();
nodeBuilder.setName(childVO.getName());
nodeBuilder.setType(childVO.getNodeType());
nodeBuilder.setSceneId(childVO.getSceneId());
//构建任务映射
if (ChildNodeType.TASK == childVO.getNodeType()) {
resultNodeMap.put(childVO.getId(), nodeBuilder);
}
//递归
buildResultNodeTree(childVO.getChildrenList(), nodeBuilder);
}
}
// private void buildResultNodeTree(RaceTaskChildVO children, Builder parentNode) {
// for (RaceTaskChildVO childVO : children.getChildrenList()) {
// //构建对应的结果Node
// Builder nodeBuilder = parentNode.addChildBuilder();
// nodeBuilder.setName(childVO.getName());
// nodeBuilder.setType(childVO.getNodeType());
// nodeBuilder.setSceneId(childVO.getSceneId());
// //构建任务映射
// if (ChildNodeType.TASK == childVO.getNodeType()) {
// resultNodeMap.put(childVO.getId(), nodeBuilder);
// }
// //递归
// buildResultNodeTree(childVO, nodeBuilder);
// }
// }
}

View File

@ -6,7 +6,6 @@ import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer; import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
import com.hubspot.jackson.datatype.protobuf.ProtobufModule;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@ -18,7 +17,6 @@ import java.time.format.DateTimeFormatter;
@Configuration @Configuration
public class LocalDateTimeSerializerConfig { public class LocalDateTimeSerializerConfig {
/** /**
* Date格式化字符串 * Date格式化字符串
*/ */
@ -35,8 +33,6 @@ public class LocalDateTimeSerializerConfig {
@Bean @Bean
public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() { public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() {
return builder -> { return builder -> {
builder.modulesToInstall(ProtobufModule.class);
builder.failOnUnknownProperties(false);
builder.serializerByType(LocalDateTime.class, builder.serializerByType(LocalDateTime.class,
new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DATETIME_FORMAT))); new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DATETIME_FORMAT)));
builder.deserializerByType(LocalDateTime.class, builder.deserializerByType(LocalDateTime.class,
@ -52,6 +48,5 @@ public class LocalDateTimeSerializerConfig {
builder.deserializerByType(LocalTime.class, builder.deserializerByType(LocalTime.class,
new LocalTimeDeserializer(DateTimeFormatter.ofPattern(TIME_FORMAT))); new LocalTimeDeserializer(DateTimeFormatter.ofPattern(TIME_FORMAT)));
}; };
} }
} }

View File

@ -70,8 +70,6 @@ public class WebConfig implements WebMvcConfigurer {
whiteList.add("/api/v2/paper/composition/oldData/handle"); whiteList.add("/api/v2/paper/composition/oldData/handle");
whiteList.add("/api/user/sync"); whiteList.add("/api/user/sync");
whiteList.add("/dataHandle"); whiteList.add("/dataHandle");
//modbus测试
whiteList.add("/api/test/modbus/writeCoil");
registry.addInterceptor(authenticateInterceptor).excludePathPatterns(whiteList); registry.addInterceptor(authenticateInterceptor).excludePathPatterns(whiteList);
} }

View File

@ -5,7 +5,5 @@ public interface ProjectCode {
String THAILAND_SANDBOX = "THAILAND_SANDBOX"; String THAILAND_SANDBOX = "THAILAND_SANDBOX";
String SR_SANDBOX = "SR_SANDBOX"; String SR_SANDBOX = "SR_SANDBOX";
String NGY_SAND_TABLE = "NGY_SAND_TABLE"; String NGY_SAND_TABLE = "NGY_SAND_TABLE";
String CDGXY = "CDGXY";
String CGY = "CGY";
} }

View File

@ -121,8 +121,6 @@ public enum ProjectDeviceType {
PIS_STAND, PIS_STAND,
PIS_TRAIN, PIS_TRAIN,
PIS,
TMS,
/* -----------client device end---------- */ /* -----------client device end---------- */
/* -----------Other start---------- */ /* -----------Other start---------- */
/** /**

View File

@ -7,19 +7,13 @@ import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.LoginStatusVO; import club.joylink.rtss.vo.client.LoginStatusVO;
import club.joylink.rtss.vo.client.LoginUserVO; 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.LoginInfoCheck;
import club.joylink.rtss.vo.client.validGroup.ThirdLoginInfoCheck; import club.joylink.rtss.vo.client.validGroup.ThirdLoginInfoCheck;
import javax.validation.constraints.NotBlank;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import javax.validation.constraints.NotBlank;
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 @RestController
@RequestMapping("/api/login") @RequestMapping("/api/login")
@ -28,14 +22,8 @@ public class LoginController {
@Autowired @Autowired
private IAuthenticateService iAuthenticateService; private IAuthenticateService iAuthenticateService;
@PostMapping("/cgy/third")
public String cgyThirdPartyLogin(@RequestBody @Validated CgyThirdPartyLoginInfoVO loginInfo) {
return this.iAuthenticateService.cgyThirdPartyLogin(loginInfo);
}
@PostMapping(path = "/third") @PostMapping(path = "/third")
public String thirdPartyLogin( public String thirdPartyLogin(@RequestBody @Validated(ThirdLoginInfoCheck.class) LoginUserVO loginInfo) {
@RequestBody @Validated(ThirdLoginInfoCheck.class) LoginUserVO loginInfo) {
return this.iAuthenticateService.thirdPartyLogin(loginInfo); return this.iAuthenticateService.thirdPartyLogin(loginInfo);
} }

View File

@ -40,11 +40,11 @@ public class CommonResponseBody implements ResponseBodyAdvice {
return body; return body;
} }
//byte[] //byte[]
/*if(body instanceof AbstractMessageLite){ if(body instanceof AbstractMessageLite){
response.getHeaders().setContentType(MediaType.APPLICATION_OCTET_STREAM); response.getHeaders().setContentType(MediaType.APPLICATION_OCTET_STREAM);
final AbstractMessageLite proto = (AbstractMessageLite) body; final AbstractMessageLite proto = (AbstractMessageLite) body;
return proto.toByteArray(); return proto.toByteArray();
}*/ }
if(body instanceof CommonJsonResponse) { if(body instanceof CommonJsonResponse) {
return body; return body;
} }
@ -83,8 +83,7 @@ public class CommonResponseBody implements ResponseBodyAdvice {
sb.append(error.getDefaultMessage()).append(";")); sb.append(error.getDefaultMessage()).append(";"));
log.error("【参数校验异常】{}", e); log.error("【参数校验异常】{}", e);
return CommonJsonResponse.newErrorResponse(ResponseConsts.VALIDATE_ERROR.getCode(), sb.toString()); return CommonJsonResponse.newErrorResponse(ResponseConsts.VALIDATE_ERROR.getCode(), sb.toString());
} } if(e instanceof BusinessException) {
if (e instanceof BusinessException) {
club.joylink.rtss.exception.BusinessException be = (club.joylink.rtss.exception.BusinessException) e; club.joylink.rtss.exception.BusinessException be = (club.joylink.rtss.exception.BusinessException) e;
log.error("【业务异常】{}", e); log.error("【业务异常】{}", e);
return CommonJsonResponse.newErrorResponse(be.getCode(), be.getVoMessage()); return CommonJsonResponse.newErrorResponse(be.getCode(), be.getVoMessage());

View File

@ -9,7 +9,6 @@ import club.joylink.rtss.vo.paper.CreatePaperCompositionRspVo;
import club.joylink.rtss.vo.paper.FindPaperCompositionByAccountReqVo; import club.joylink.rtss.vo.paper.FindPaperCompositionByAccountReqVo;
import club.joylink.rtss.vo.paper.FindPaperCompositionPageReqVo; import club.joylink.rtss.vo.paper.FindPaperCompositionPageReqVo;
import club.joylink.rtss.vo.paper.PaperCompositionWithRuleVo; import club.joylink.rtss.vo.paper.PaperCompositionWithRuleVo;
import club.joylink.rtss.vo.paper.PaperCompositionWithRuleVo.CreatorBasic;
import java.util.List; import java.util.List;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -110,14 +109,6 @@ public class PaperCompositionController {
return this.compositionService.findPaperCompositionByPage(req); return this.compositionService.findPaperCompositionByPage(req);
} }
/**
* 查询试卷的创建者的信息
*/
@PostMapping("/list/creatorInfo")
public List<CreatorBasic> queryCreatorList(@RequestBody FindPaperCompositionPageReqVo req) {
return compositionService.queryCreatorList(req);
}
/** /**
* 根据mapId查询蓝图的基本信息 * 根据mapId查询蓝图的基本信息
* *

View File

@ -310,9 +310,4 @@ public class DeviceController {
AccountVO accountVO, @PathVariable Long mapId) { AccountVO accountVO, @PathVariable Long mapId) {
this.deviceService.addOrUpdateNgyDeviceConfig(accountVO, mapId); this.deviceService.addOrUpdateNgyDeviceConfig(accountVO, mapId);
} }
@PostMapping("/cdgxy/addOrUpdate")
public void addOrUpdateCdgxyDeviceConfig(@RequestAttribute AccountVO user) {
this.deviceService.addOrUpdateCdgxyDeviceConfig(user);
}
} }

View File

@ -1,91 +0,0 @@
package club.joylink.rtss.controller.racetr;
import club.joylink.rtss.services.race.RaceApplicationService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.paper.PaperTrainAnswerDetail;
import club.joylink.rtss.vo.race.RaceApplication;
import club.joylink.rtss.vo.race.RaceTask;
import club.joylink.rtss.vo.race.RaceTaskFinishParamDTO;
import java.util.List;
import lombok.AllArgsConstructor;
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.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 赛题训练接口
*/
@RestController
@RequestMapping("/api/race")
@AllArgsConstructor
public class RaceApplicationController {
private RaceApplicationService raceApplicationService;
/**
* 开始训练
* <p>
* 目前用用户id作为训练上下文的ID即用户同时进行一个训练
*
* @param paperId 赛题ID
* @return 训练的信息
*/
@PostMapping("/{paperId}/{moduleId}")
public RaceTask.RacePaperSingleModuleGroupTask start(@PathVariable long paperId,
@PathVariable int moduleId, @RequestAttribute AccountVO user) {
return raceApplicationService.start(paperId, moduleId, user.getId());
}
/**
* 加载场景
*
* @param simulationId 场景依托的仿真
* @param sceneId 场景的ID
*/
@PutMapping("/{simulationId}/load/{sceneId}")
public void loadScene(@PathVariable String simulationId, @PathVariable long sceneId,
@RequestAttribute LoginUserInfoVO loginInfo) {
raceApplicationService.loadScene(simulationId, sceneId, loginInfo);
}
/**
* 完成任务
*
* @param taskId 任务ID
* @param paramDTO 完成任务所需的参数主要就是需要前端做判定的操作/步骤
* @return
*/
@PutMapping("/{taskId}/finish")
public List<PaperTrainAnswerDetail> finishTask(@PathVariable long taskId,
@RequestBody RaceTaskFinishParamDTO paramDTO, @RequestAttribute AccountVO user) {
return raceApplicationService.finishTask(taskId, paramDTO, user);
}
/**
* 完成训练
*
* @return 评分结果
*/
@PutMapping("/finish")
public RaceApplication.RacePracticeResult finish(@RequestAttribute AccountVO user) {
return raceApplicationService.finish(user.getId());
}
// /**
// * 获取用户正在进行的竞赛信息
// * <p>
// * 目前想到的使用场景就是页面刷新后
// *
// * @return 竞赛信息
// */
// @GetMapping("")
// public Object getRaceInfo() {
// return null;
// }
}

View File

@ -1,145 +0,0 @@
package club.joylink.rtss.controller.racetr;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.paper.PagerQuestionService;
import club.joylink.rtss.services.race.RacePaperService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperCreateVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperDetailVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperMenuVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperModuleVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperVO;
import club.joylink.rtss.vo.race.RacePaperQueryVO;
import club.joylink.rtss.vo.race.RaceTask.RacePaperSingleModuleGroupTask;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
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.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 竞赛-试题管理
*/
@RestController
@RequestMapping("/api/exercise/race/paper")
public class RacePaperController {
@Autowired
private RacePaperService racePaperService;
@Autowired
private PagerQuestionService questionService;
@GetMapping("/questions")
public List<Long> queryQuestionFromPBank() {
return this.questionService.queryAllDefaultOrgPaperIds();
}
/**
* 创建试卷
*/
@PostMapping()
public void save(@RequestBody RacePaperCreateVO createVO, @RequestAttribute AccountVO user) {
racePaperService.create(createVO, user);
}
/**
* 更新试卷内容
*
* @param id
* @param updateVO
* @param user
*/
@PostMapping("/{id}")
public void update(@PathVariable("id") Long id, @RequestBody RacePaperCreateVO updateVO,
@RequestAttribute AccountVO user) {
this.racePaperService.update(id, updateVO, user);
}
/**
* 分页查询
*/
@GetMapping("/page")
public PageVO<RacePaperVO> pageQuery(RacePaperQueryVO queryVO) {
return racePaperService.pageQuery(queryVO);
}
/**
* 获取赛季试卷菜单
*
* @param queryVO
* @return
*/
@GetMapping("/menu")
public RacePaperMenuVO pageMenu(RacePaperQueryVO queryVO) {
return this.racePaperService.pageMenuQuery(queryVO);
}
/**
* 试卷配置
*
* @param id
* @param moduleVO
* @param user
*/
@PostMapping("/{id}/config")
public void configSeting(@PathVariable("id") Long id, @RequestBody RacePaperModuleVO moduleVO,
@RequestAttribute AccountVO user) {
this.racePaperService.configSeting(id, moduleVO, user);
}
/**
* 获取明细
*
* @param id
* @return
*/
@GetMapping("/{id}")
public RacePaperDetailVO detail(@PathVariable("id") Long id) {
return this.racePaperService.detail(id);
}
/**
* 拷贝功能
*
* @param id
* @param user
*/
@PutMapping("/{id}/copy")
public void copy(@PathVariable("id") Long id, @RequestAttribute AccountVO user) {
this.racePaperService.copy(id, user);
}
/**
* 删除
*/
@DeleteMapping("/{id}")
public void delete(@PathVariable("id") Long id) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(id);
racePaperService.delete(id);
}
/**
* 获取试卷对应模块的模块任务树
*
* @param id
* @param moduleId
* @return
*/
@GetMapping("/{paperId}/module/{moduleId}/task")
public RacePaperSingleModuleGroupTask paperModuleTask(@PathVariable("paperId") Long id,
@PathVariable("moduleId") Integer moduleId) {
return this.racePaperService.singlePaperModuleTask(id, moduleId);
}
}

View File

@ -1,85 +0,0 @@
package club.joylink.rtss.controller.racetr;
import club.joylink.rtss.services.race.RaceSceneService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceSceneListVO;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScenePublishVO;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceSceneVO;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.SceneCustomCreateVO;
import club.joylink.rtss.vo.race.RaceSceneQueryVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
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.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 竞赛-场景管理-发布的管理
*/
@RestController
@RequestMapping("/api/exercise/race/scene")
public class RaceSceneController {
@Autowired
private RaceSceneService sceneService;
@PostMapping("/custom/edit")
public void customSave(@RequestBody SceneCustomCreateVO vo, @RequestAttribute AccountVO user) {
this.sceneService.customSave(vo, user);
}
@PostMapping("/custom/{id}/edit")
public void customUpdate(@PathVariable("id") Long id, @RequestBody SceneCustomCreateVO vo, @RequestAttribute AccountVO user) {
this.sceneService.customUpdate(id, vo, user);
}
/**
* 草稿实训发布到场景
*
* @param vo
* @param user
*/
@PostMapping("/publish/training")
public void publishHere(@RequestBody RaceScenePublishVO vo, @RequestAttribute AccountVO user) {
this.sceneService.publishHere(vo, user);
}
/**
* 获取明细
*
* @param id
* @return
*/
@GetMapping("/{id}")
public RaceSceneVO detail(@PathVariable("id") Long id) {
return this.sceneService.detail(id);
}
/**
* 分页
*
* @param query
* @return
*/
@GetMapping("/page")
public PageVO<RaceSceneListVO> page(RaceSceneQueryVO query) {
return this.sceneService.page(query);
}
/**
* 删除
*
* @param id
*/
@DeleteMapping("/{id}")
public void delete(@PathVariable("id") Long id) {
this.sceneService.delete(id);
}
}

View File

@ -1,88 +0,0 @@
package club.joylink.rtss.controller.racetr;
import club.joylink.rtss.services.race.RaceScoreRuleService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.race.RaceScoringRule.RaceScoringRuleListVO;
import club.joylink.rtss.vo.race.RaceScoringRule.RaceScoringRuleVO;
import club.joylink.rtss.vo.race.RaceScoringRule.Rule;
import club.joylink.rtss.vo.race.TaskRuleQueryVO;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
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.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 竞赛-评分
*/
@RestController
@RequestMapping("/api/exercise/race/score")
public class RaceScoreRuleController {
@Autowired
private RaceScoreRuleService scoreRuleService;
/**
* 1.创建基础信息
*
* @param nameMap
* @param user
*/
@PostMapping
public void saveBasic(@RequestBody Map<String, String> nameMap, @RequestAttribute AccountVO user) {
this.scoreRuleService.saveBasic(nameMap.get("name"), user);
}
/**
* 评分配置
*
* @param ruleId
* @param rule
* @param user
*/
@PostMapping("/edit/rule/{ruleId}")
public void editRule(@PathVariable("ruleId") Long ruleId, @RequestBody Rule rule, @RequestAttribute AccountVO user) {
this.scoreRuleService.editRule(ruleId, rule, user);
}
/**
* 明细
*
* @param id
* @return
*/
@GetMapping(value = "/{id}")
public RaceScoringRuleVO detail(@PathVariable("id") Long id) {
return this.scoreRuleService.detail(id);
}
/**
* 分页
*
* @param query
* @return
*/
@GetMapping("/page")
public PageVO<RaceScoringRuleListVO> page(TaskRuleQueryVO query) {
return this.scoreRuleService.page(query);
}
/**
* 删除
*
* @param id
*/
@DeleteMapping("{id}")
public void delete(@PathVariable("id") Long id) {
this.scoreRuleService.delete(id);
}
}

View File

@ -1,102 +0,0 @@
package club.joylink.rtss.controller.racetr;
import club.joylink.rtss.services.race.RaceSeasonService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeasonCreateVO;
import club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeasonVO;
import club.joylink.rtss.vo.race.RaceSeasonQueryVO;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.DeleteMapping;
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.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 竞赛-赛季管理
*/
@RestController
@RequestMapping("/api/exercise/race/season")
public class RaceSeasonController {
@Autowired
private RaceSeasonService raceSeasonService;
/**
* 添加
*
* @param dto
* @param user
*/
@PostMapping
public void save(@RequestBody RaceSeasonCreateVO dto, @RequestAttribute AccountVO user) {
this.raceSeasonService.save(dto, user);
}
/**
* 修改
*
* @param id
* @param dto
* @param user
*/
@PostMapping("/{id}")
public void update(@PathVariable("id") Long id, @RequestBody RaceSeasonCreateVO dto, @RequestAttribute AccountVO user) {
this.raceSeasonService.update(id, dto, user);
}
/**
* 编辑html内容
*
* @param id
* @param user
*/
@PostMapping("/{id}/html")
public void updateHtmlContent(@PathVariable("id") Long id, @RequestBody Map<String, String> contentMap, @RequestAttribute AccountVO user) {
String content = contentMap.get("htmlContent");
this.raceSeasonService.updateHtmlContent(id, content, user);
}
/**
* 查找对应的html content
*
* @param id
* @return
*/
@GetMapping("/{id}/html")
public Map<String, String> queryHtmlContent(@PathVariable("id") Long id) {
String html = this.raceSeasonService.queryHtmlContent(id);
return Map.of("html", StringUtils.hasText(html) ? html : "");
}
/**
* 查找
*
* @param query
* @return
*/
@GetMapping(value = "/page")
public PageVO<RaceSeasonVO> page(RaceSeasonQueryVO query) {
return raceSeasonService.page(query);
}
/**
* 删除
*
* @param id
*/
//绑定过的数据不能删除没有绑定的可以删除物理删除
@DeleteMapping("/{id}")
public void delete(@PathVariable("id") Long id) {
this.raceSeasonService.delete(id);
}
}

View File

@ -1,94 +0,0 @@
package club.joylink.rtss.controller.racetr;
import club.joylink.rtss.services.race.RaceTaskService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.race.RaceTask.RaceTaskBind;
import club.joylink.rtss.vo.race.RaceTask.RaceTaskCreateVO;
import club.joylink.rtss.vo.race.RaceTask.RaceTaskDetailVO;
import club.joylink.rtss.vo.race.RaceTaskTreeVO;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
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.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/exercise/race/task")
public class RaceTaskController {
@Autowired
private RaceTaskService taskService;
/**
* 创建任务并绑定对应的发布场景
*
* @param vo
* @param user
*/
@PostMapping
public void save(@RequestBody RaceTaskCreateVO vo, @RequestAttribute AccountVO user) {
this.taskService.save(vo, user);
}
@PostMapping("/{id}")
public void update(@PathVariable("id") Long id, @RequestBody RaceTaskCreateVO vo,
@RequestAttribute AccountVO user) {
this.taskService.update(id, vo, user);
}
@PostMapping("/{taskId}/bind")
public void bind(@PathVariable("taskId") Long taskId, @RequestBody List<RaceTaskBind> bind,
@RequestAttribute AccountVO user) {
this.taskService.bind(taskId, bind, user);
}
/**
* 返回任务数据以""的结构
*
* @return
*/
@GetMapping("/tree")
public List<RaceTaskTreeVO> tree() {
return this.taskService.tree();
}
/**
* 删除
*
* @param id
*/
@DeleteMapping("/{id}")
public void delete(@PathVariable("id") Long id) {
this.taskService.delete(id);
}
/**
* 获取一个节点下的所有数据
*
* @param id
* @return
*/
@GetMapping("/{id}/children")
public List<RaceTaskTreeVO> childList(@PathVariable("id") Long id) {
return this.taskService.findChildren(id);
}
/**
* 获取一个节点的明细
*
* @param id
* @return
*/
@GetMapping("/{id}")
public RaceTaskDetailVO detail(@PathVariable("id") Long id) {
return this.taskService.detail(id);
}
}

View File

@ -15,10 +15,8 @@ import club.joylink.rtss.simulation.cbtc.command.CommandInitiateVO;
import club.joylink.rtss.simulation.cbtc.communication.vo.fault.DeviceFaultInfo; import club.joylink.rtss.simulation.cbtc.communication.vo.fault.DeviceFaultInfo;
import club.joylink.rtss.simulation.cbtc.data.status.IbpStatus; import club.joylink.rtss.simulation.cbtc.data.status.IbpStatus;
import club.joylink.rtss.simulation.cbtc.data.vo.SimulationVO; import club.joylink.rtss.simulation.cbtc.data.vo.SimulationVO;
import club.joylink.rtss.simulation.cbtc.member.MemberManager;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember; import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import club.joylink.rtss.simulation.cbtc.script.ScriptBO; import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO;
import club.joylink.rtss.simulation.vo.SimulationInfoVO; import club.joylink.rtss.simulation.vo.SimulationInfoVO;
import club.joylink.rtss.vo.AccountVO; import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.LoginUserInfoVO;
@ -32,35 +30,22 @@ import club.joylink.rtss.vo.client.operation.DriveParamVO;
import club.joylink.rtss.vo.client.psl.PslStatus; import club.joylink.rtss.vo.client.psl.PslStatus;
import club.joylink.rtss.vo.client.runplan.PlanTripNumberVO; import club.joylink.rtss.vo.client.runplan.PlanTripNumberVO;
import club.joylink.rtss.vo.client.runplan.RunPlanEChartsDataVO; import club.joylink.rtss.vo.client.runplan.RunPlanEChartsDataVO;
import club.joylink.rtss.vo.client.simulationv1.RunAsPlanParam; import club.joylink.rtss.vo.client.simulationv1.*;
import club.joylink.rtss.vo.client.simulationv1.SimulationInfoQueryVO;
import club.joylink.rtss.vo.client.simulationv1.SimulationLogPagedQueryVO;
import club.joylink.rtss.vo.client.simulationv1.SimulationMemberVO;
import club.joylink.rtss.vo.client.simulationv1.SimulationUserVO;
import club.joylink.rtss.vo.map.MapVO; import club.joylink.rtss.vo.map.MapVO;
import club.joylink.rtss.vo.map.graph.MapStationNewVO; import club.joylink.rtss.vo.map.graph.MapStationNewVO;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import javax.validation.constraints.NotBlank;
import org.springframework.web.bind.annotation.PostMapping; import javax.validation.constraints.NotNull;
import org.springframework.web.bind.annotation.PutMapping; import java.time.LocalDateTime;
import org.springframework.web.bind.annotation.RequestAttribute; import java.time.LocalTime;
import org.springframework.web.bind.annotation.RequestBody; import java.util.*;
import org.springframework.web.bind.annotation.RequestMapping; import java.util.stream.Collectors;
import org.springframework.web.bind.annotation.RestController; import java.util.stream.Stream;
/** /**
* 新仿真接口 * 新仿真接口
@ -84,8 +69,6 @@ public class SimulationV1Controller {
private SimulationService simulationService; private SimulationService simulationService;
@Autowired @Autowired
private SimulationManager simulationManager; private SimulationManager simulationManager;
@Autowired
private MemberManager memberManager;
/** /**
* 根据产品类型创建仿真 * 根据产品类型创建仿真
@ -180,8 +163,7 @@ public class SimulationV1Controller {
* 加载草稿运行图 * 加载草稿运行图
*/ */
@PutMapping("/{simulationId}/load/draftRunPlan/{draftRunPlanId}") @PutMapping("/{simulationId}/load/draftRunPlan/{draftRunPlanId}")
public void loadDraftRunPlan(@PathVariable String simulationId, public void loadDraftRunPlan(@PathVariable String simulationId, @PathVariable long draftRunPlanId) {
@PathVariable long draftRunPlanId) {
this.simulationService.loadDraftRunPlan(simulationId, draftRunPlanId); this.simulationService.loadDraftRunPlan(simulationId, draftRunPlanId);
} }
@ -221,10 +203,8 @@ public class SimulationV1Controller {
* 根据服务号和车次号获取计划车次信息 * 根据服务号和车次号获取计划车次信息
*/ */
@GetMapping("/{group}/planTripInfoBySt") @GetMapping("/{group}/planTripInfoBySt")
public PlanTripNumberVO planTripInfoBySt(@PathVariable String group, String serviceNumber, public PlanTripNumberVO planTripInfoBySt(@PathVariable String group, String serviceNumber, String tripNumber) {
String tripNumber) { return this.groupSimulationService.planTripInfoByServiceAndTripNumber(group, serviceNumber, tripNumber);
return this.groupSimulationService.planTripInfoByServiceAndTripNumber(group, serviceNumber,
tripNumber);
} }
/** /**
@ -243,8 +223,7 @@ public class SimulationV1Controller {
* 仿真指令 * 仿真指令
*/ */
@PostMapping("/{group}/command") @PostMapping("/{group}/command")
public void command(@PathVariable String group, public void command(@PathVariable String group, @RequestBody @Validated CommandInitiateVO initiateVO, @RequestAttribute AccountVO user) {
@RequestBody @Validated CommandInitiateVO initiateVO, @RequestAttribute AccountVO user) {
Simulation simulation = this.groupSimulationService.getSimulationByGroup(group); Simulation simulation = this.groupSimulationService.getSimulationByGroup(group);
SimulationMember member = simulation.getSimulationMemberByUserId(user.getId()); SimulationMember member = simulation.getSimulationMemberByUserId(user.getId());
this.groupSimulationService.command(simulation, initiateVO, member); this.groupSimulationService.command(simulation, initiateVO, member);
@ -293,7 +272,8 @@ public class SimulationV1Controller {
} }
/** /**
* 销毁仿真 由系统管理员或老师在仿真监管功能中使用 * 销毁仿真
* 由系统管理员或老师在仿真监管功能中使用
*/ */
@DeleteMapping("/{simulationId}/destroy") @DeleteMapping("/{simulationId}/destroy")
public void destroySimulation(@PathVariable String simulationId) { public void destroySimulation(@PathVariable String simulationId) {
@ -341,8 +321,7 @@ public class SimulationV1Controller {
* 取消自动故障 * 取消自动故障
*/ */
@PutMapping(path = "/{group}/faultMode/{id}") @PutMapping(path = "/{group}/faultMode/{id}")
public void setFaultMode(@PathVariable @NotBlank String group, public void setFaultMode(@PathVariable @NotBlank String group, @PathVariable(required = false) Integer id) {
@PathVariable(required = false) Integer id) {
if (Objects.isNull(id)) { if (Objects.isNull(id)) {
this.groupSimulationService.clearAllAutoFault(group); this.groupSimulationService.clearAllAutoFault(group);
return; return;
@ -354,8 +333,7 @@ public class SimulationV1Controller {
* 设置自动故障 * 设置自动故障
*/ */
@PostMapping(path = "/{group}/faultMode") @PostMapping(path = "/{group}/faultMode")
public Integer setFaultMode(@PathVariable @NotBlank String group, public Integer setFaultMode(@PathVariable @NotBlank String group, @RequestBody FaultRuleVO ruleVO) {
@RequestBody FaultRuleVO ruleVO) {
return this.groupSimulationService.setFaultMode(group, ruleVO); return this.groupSimulationService.setFaultMode(group, ruleVO);
} }
@ -413,8 +391,7 @@ public class SimulationV1Controller {
* 仿真报警确认 * 仿真报警确认
*/ */
@PutMapping(path = "/{group}/alarm/confirm") @PutMapping(path = "/{group}/alarm/confirm")
public void AlarmConfirm(@PathVariable String group, @RequestBody List<String> codes, public void AlarmConfirm(@PathVariable String group, @RequestBody List<String> codes, @RequestAttribute AccountVO user) {
@RequestAttribute AccountVO user) {
groupSimulationService.alarmConfirm(group, codes, user); groupSimulationService.alarmConfirm(group, codes, user);
} }
@ -430,8 +407,7 @@ public class SimulationV1Controller {
* 获取仿真日志 * 获取仿真日志
*/ */
@GetMapping("/{group}/log") @GetMapping("/{group}/log")
public PageVO<SimulationLog> getLog(@PathVariable String group, public PageVO<SimulationLog> getLog(@PathVariable String group, SimulationLogPagedQueryVO queryVO) {
SimulationLogPagedQueryVO queryVO) {
return groupSimulationService.getLog(group, queryVO); return groupSimulationService.getLog(group, queryVO);
} }
@ -439,8 +415,7 @@ public class SimulationV1Controller {
* 获取机器人驾驶参数 * 获取机器人驾驶参数
*/ */
@GetMapping("/{simulationId}/driveParam/{groupNumber}") @GetMapping("/{simulationId}/driveParam/{groupNumber}")
public DriveParamVO getDriveParam(@PathVariable String simulationId, public DriveParamVO getDriveParam(@PathVariable String simulationId, @PathVariable String groupNumber) {
@PathVariable String groupNumber) {
return groupSimulationService.getDriveParam(simulationId, groupNumber); return groupSimulationService.getDriveParam(simulationId, groupNumber);
} }
@ -450,8 +425,7 @@ public class SimulationV1Controller {
* 查询进路路径 * 查询进路路径
*/ */
@GetMapping("/{group}/querySectionPaths") @GetMapping("/{group}/querySectionPaths")
public List<List<String>> querySectionPaths(@PathVariable String group, String groupNumber, public List<List<String>> querySectionPaths(@PathVariable String group, String groupNumber, String standCode, String signalCode) {
String standCode, String signalCode) {
return simulationSupportService.queryRoutePaths(group, groupNumber, standCode, signalCode); return simulationSupportService.queryRoutePaths(group, groupNumber, standCode, signalCode);
} }
@ -459,18 +433,15 @@ public class SimulationV1Controller {
* 查询列车或运行线经过的站台 * 查询列车或运行线经过的站台
*/ */
@GetMapping("/{group}/queryStands/trainOrDestination") @GetMapping("/{group}/queryStands/trainOrDestination")
public List<String> queryStandsThatTrainGoingThrough(@PathVariable String group, public List<String> queryStandsThatTrainGoingThrough(@PathVariable String group, String groupNumber, String destinationCode) {
String groupNumber, String destinationCode) { return simulationSupportService.queryStandsThatTrainGoingThrough(group, groupNumber, destinationCode);
return simulationSupportService.queryStandsThatTrainGoingThrough(group, groupNumber,
destinationCode);
} }
/** /**
* 查询为该列车已建立的进路 * 查询为该列车已建立的进路
*/ */
@GetMapping("/{group}/queryEstablishedRoutes/{groupNumber}") @GetMapping("/{group}/queryEstablishedRoutes/{groupNumber}")
public List<String> queryEstablishedRoutes(@PathVariable String group, public List<String> queryEstablishedRoutes(@PathVariable String group, @PathVariable String groupNumber) {
@PathVariable String groupNumber) {
return simulationSupportService.queryEstablishedRoutes(group, groupNumber); return simulationSupportService.queryEstablishedRoutes(group, groupNumber);
} }
@ -498,8 +469,7 @@ public class SimulationV1Controller {
* 条件查询仿真中的ISCS系统资源 * 条件查询仿真中的ISCS系统资源
*/ */
@GetMapping("/{group}/iscs/systemResources") @GetMapping("/{group}/iscs/systemResources")
public List<IscsSystemResourcesVO> getAllIscsSystemResources(@PathVariable String group, public List<IscsSystemResourcesVO> getAllIscsSystemResources(@PathVariable String group, IscsSystemResourcesQueryVO queryVO) {
IscsSystemResourcesQueryVO queryVO) {
return groupSimulationService.getAllIscsSystemResources(group, queryVO); return groupSimulationService.getAllIscsSystemResources(group, queryVO);
} }
@ -514,31 +484,29 @@ public class SimulationV1Controller {
/* ----------------------- 仿真新接口 ----------------------- */ /* ----------------------- 仿真新接口 ----------------------- */
/** /**
* 根据功能配置创建仿真 * 仿真创建接口
*/ */
/*@Deprecated
@PostMapping("/new/{mapId}") @PostMapping("/new/{mapId}")
public String createSimulation(@PathVariable long mapId, public String createSimulation(@PathVariable long mapId, @RequestBody @Validated SimulationWorkParamVO paramVO,
@RequestBody @Validated SimulationWorkParamVO paramVO,
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) @RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY)
LoginUserInfoVO loginUserInfoVO) { LoginUserInfoVO loginUserInfoVO) {
return simulationService.createSimulation(mapId, paramVO, loginUserInfoVO); return simulationService.createSimulation(mapId, null, paramVO, loginUserInfoVO);
} }*/
/** /**
* 根据地图功能id创建仿真 * 根据地图功能id创建仿真
*/ */
@PostMapping("/new/mapFunction/{mapFunctionId}") @PostMapping("/new/mapFunction/{mapFunctionId}")
public String createSimulationByMapFunction(@PathVariable long mapFunctionId, public String createSimulationByMapFunction(@PathVariable long mapFunctionId, @RequestAttribute LoginUserInfoVO loginInfo) {
@RequestAttribute LoginUserInfoVO loginInfo) { return simulationService.createSimulation(mapFunctionId, loginInfo);
return simulationService.createSimulation(mapFunctionId, loginInfo, true).getId();
} }
/** /**
* 按计划行车 * 按计划行车
*/ */
@PostMapping("/new/{simulationId}/runAsPlan") @PostMapping("/new/{simulationId}/runAsPlan")
public void runAsPlanNew(@PathVariable String simulationId, public void runAsPlanNew(@PathVariable String simulationId, @RequestBody @Validated RunAsPlanParam param) {
@RequestBody @Validated RunAsPlanParam param) {
simulationService.runAsPlan(simulationId, param); simulationService.runAsPlan(simulationId, param);
} }
@ -548,9 +516,6 @@ public class SimulationV1Controller {
@PutMapping("/new/{simulationId}/reset") @PutMapping("/new/{simulationId}/reset")
public void reset(@PathVariable String simulationId) { public void reset(@PathVariable String simulationId) {
simulationService.reset(simulationId); simulationService.reset(simulationId);
Simulation simulation = simulationManager.getById(simulationId, Simulation.class);
// 写在这里为了不与加载实训时冲突如果写入reset方法实训加载会多次处理会有问题
memberManager.loadExtraMembers(simulation, null);
} }
/** /**
@ -568,8 +533,7 @@ public class SimulationV1Controller {
* 按组织查询存在的仿真(监管仿真) * 按组织查询存在的仿真(监管仿真)
*/ */
@GetMapping("/supervise") @GetMapping("/supervise")
public List<SimulationInfoVO> listSimulationByOrg( public List<SimulationInfoVO> listSimulationByOrg(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO,
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO,
SimulationInfoQueryVO queryVO) { SimulationInfoQueryVO queryVO) {
return simulationService.listSimulationByOrg(loginUserInfoVO.getTopOrgId(), queryVO); return simulationService.listSimulationByOrg(loginUserInfoVO.getTopOrgId(), queryVO);
} }
@ -578,8 +542,7 @@ public class SimulationV1Controller {
* 分页按组织查询存在的仿真(监管仿真) * 分页按组织查询存在的仿真(监管仿真)
*/ */
@GetMapping("/paged/supervise") @GetMapping("/paged/supervise")
public PageVO<SimulationInfoVO> pagedSuperviseSimulation( public PageVO<SimulationInfoVO> pagedSuperviseSimulation(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO,
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO,
SimulationInfoQueryVO queryVO) { SimulationInfoQueryVO queryVO) {
return simulationService.pagedSimulationByOrg(loginUserInfoVO.getTopOrgId(), queryVO); return simulationService.pagedSimulationByOrg(loginUserInfoVO.getTopOrgId(), queryVO);
} }
@ -589,7 +552,15 @@ public class SimulationV1Controller {
*/ */
@GetMapping("/list") @GetMapping("/list")
public List<SimulationInfoVO> queryInfo(SimulationInfoQueryVO queryVO) { public List<SimulationInfoVO> queryInfo(SimulationInfoQueryVO queryVO) {
return simulationService.listAllSimulation(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());
} }
/** /**
@ -620,8 +591,7 @@ public class SimulationV1Controller {
* 获取仿真中所有仿真用户 * 获取仿真中所有仿真用户
*/ */
@GetMapping("/{id}/users") @GetMapping("/{id}/users")
public List<club.joylink.rtss.simulation.vo.SimulationUserVO> getSimulationUsers( public List<club.joylink.rtss.simulation.vo.SimulationUserVO> getSimulationUsers(@PathVariable String id) {
@PathVariable String id) {
return this.simulationManager.getSimulationUsers(id).stream() return this.simulationManager.getSimulationUsers(id).stream()
.map(club.joylink.rtss.simulation.SimulationUser::convertToVO) .map(club.joylink.rtss.simulation.SimulationUser::convertToVO)
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -642,10 +612,4 @@ public class SimulationV1Controller {
public SimulationVO querySimulationJoinedByMe(@RequestAttribute LoginUserInfoVO loginInfo) { public SimulationVO querySimulationJoinedByMe(@RequestAttribute LoginUserInfoVO loginInfo) {
return simulationService.querySimulationJoinedByUser(loginInfo.getAccountVO().getId()); return simulationService.querySimulationJoinedByUser(loginInfo.getAccountVO().getId());
} }
@GetMapping("/{simulationId}/{memberId}/unreceivedMessages")
public void sendUnreceivedMessages(@PathVariable String simulationId,
@PathVariable String memberId) {
simulationService.sendUnreceivedMessages(simulationId, memberId);
}
} }

View File

@ -6,33 +6,17 @@ import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
import club.joylink.rtss.controller.advice.Role; import club.joylink.rtss.controller.advice.Role;
import club.joylink.rtss.entity.training2.ExportTraining2; import club.joylink.rtss.entity.training2.ExportTraining2;
import club.joylink.rtss.entity.training2.PublishedTraining2; import club.joylink.rtss.entity.training2.PublishedTraining2;
import club.joylink.rtss.services.training2.Training2DraftPublishService; import club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs;
import club.joylink.rtss.services.training2.Training2PublishService; import club.joylink.rtss.services.training2.Training2PublishService;
import club.joylink.rtss.services.training2.Training2TypeEnum;
import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.training2.publish.DeletePublishedTraining2ReqVo; import club.joylink.rtss.vo.training2.publish.*;
import club.joylink.rtss.vo.training2.publish.DeletePublishedTraining2RspVo;
import club.joylink.rtss.vo.training2.publish.PublishedTraining2DetailRspVo;
import club.joylink.rtss.vo.training2.publish.PublishedTraining2InfoPageReqVo;
import club.joylink.rtss.vo.training2.publish.PublishedTraining2InfoRspVo;
import club.joylink.rtss.vo.training2.publish.PublishedTrainingListRspVo;
import club.joylink.rtss.vo.training2.publish.PullOffPublishedTraining2ReqVo;
import club.joylink.rtss.vo.training2.publish.PullOffPublishedTraining2RspVo;
import club.joylink.rtss.vo.training2.publish.PutOnPublishedTraining2ReqVo;
import club.joylink.rtss.vo.training2.publish.PutOnPublishedTraining2RspVo;
import java.util.List;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute; import java.util.List;
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.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/** /**
* 已发布实训管理接口 * 已发布实训管理接口
@ -41,105 +25,80 @@ import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("/api/v2/training/published") @RequestMapping("/api/v2/training/published")
public class TrainingV2PublishController { public class TrainingV2PublishController {
@Autowired @Autowired
private Training2PublishService publishService; private Training2PublishService publishService;
@Autowired
private Training2DraftPublishService training2DraftPublishService;
/** /**
* 已发布实训分页列表 * 已发布实训分页列表
*/ */
@PostMapping("/page") @PostMapping("/page")
public PageVO<PublishedTraining2InfoRspVo> publishedTrainingsPage( public PageVO<PublishedTraining2InfoRspVo> publishedTrainingsPage(@RequestBody PublishedTraining2InfoPageReqVo req){
@RequestBody PublishedTraining2InfoPageReqVo req) {
return this.publishService.publishedTrainingsPage(req); return this.publishService.publishedTrainingsPage(req);
} }
/** /**
* 已发布实训上架 * 已发布实训上架
*/ */
@PostMapping("/put/on") @PostMapping("/put/on")
public PutOnPublishedTraining2RspVo putOnPublishedTrainings( public PutOnPublishedTraining2RspVo putOnPublishedTrainings(@RequestBody PutOnPublishedTraining2ReqVo req,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
@RequestBody PutOnPublishedTraining2ReqVo req,
@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
return this.publishService.putOnPublishedTrainings(req,userInfoVO); return this.publishService.putOnPublishedTrainings(req,userInfoVO);
} }
/** /**
* 已发布实训下架 * 已发布实训下架
*/ */
@PostMapping("/pull/off") @PostMapping("/pull/off")
public PullOffPublishedTraining2RspVo pullOffPublishedTrainings( public PullOffPublishedTraining2RspVo pullOffPublishedTrainings(@RequestBody PullOffPublishedTraining2ReqVo req,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
@RequestBody PullOffPublishedTraining2ReqVo req,
@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
return this.publishService.pullOffPublishedTrainings(req,userInfoVO); return this.publishService.pullOffPublishedTrainings(req,userInfoVO);
} }
/** /**
* 变更共享状态 * 变更共享状态
*
* @param id * @param id
* @param shared * @param shared
* @param userInfoVO * @param userInfoVO
*/ */
@GetMapping("/{id}/{shared}") @GetMapping("/{id}/{shared}")
public void changeSharedStatus(@PathVariable(name = "id") Long id, public void changeSharedStatus(@PathVariable(name="id") Long id,@PathVariable(name="shared") Integer shared,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
@PathVariable(name = "shared") Integer shared,
@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
this.publishService.changeSharedStatus(id,shared,userInfoVO); this.publishService.changeSharedStatus(id,shared,userInfoVO);
} }
/** /**
* 删除已发布实训 * 删除已发布实训
*/ */
@DeleteMapping @DeleteMapping
public DeletePublishedTraining2RspVo deletePublishedTrainings( public DeletePublishedTraining2RspVo deletePublishedTrainings(@RequestBody DeletePublishedTraining2ReqVo req,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
@RequestBody DeletePublishedTraining2ReqVo req,
@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
return this.publishService.deletePublishedTrainings(req,userInfoVO); return this.publishService.deletePublishedTrainings(req,userInfoVO);
} }
/** /**
* 实训查询用户管理 * 实训查询用户管理
*
* @param vo * @param vo
* @return * @return
*/ */
@PostMapping("/manage/infos") @PostMapping("/manage/infos")
public PageVO<PublishedTraining2InfoRspVo> findTrainingListManageInfosForPage( public PageVO<PublishedTraining2InfoRspVo> findTrainingListManageInfosForPage(@RequestBody PublishedTrainingListRspVo vo,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
@RequestBody PublishedTrainingListRspVo vo,
@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
vo.setOrgId(userInfoVO.getTopOrgId()); vo.setOrgId(userInfoVO.getTopOrgId());
return this.publishService.findTrainingInfoForPage(vo,userInfoVO,true); return this.publishService.findTrainingInfoForPage(vo,userInfoVO,true);
} }
/** /**
* 实训查询 * 实训查询
*
* @param vo * @param vo
* @return * @return
*/ */
@PostMapping("/infos") @PostMapping("/infos")
public List<PublishedTraining2InfoRspVo> findTrainingListInfos( public List<PublishedTraining2InfoRspVo> findTrainingListInfos(@RequestBody PublishedTrainingListRspVo vo
@RequestBody PublishedTrainingListRspVo vo, ,@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO){
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO) {
//只查询以上架 //只查询以上架
vo.setState(BusinessConsts.STATUS_USE_INT); vo.setState(BusinessConsts.STATUS_USE_INT);
vo.setOrgId(loginUserInfoVO.getTopOrgId()); vo.setOrgId(loginUserInfoVO.getTopOrgId());
return this.publishService.findTrainingInfo(vo,loginUserInfoVO); return this.publishService.findTrainingInfo(vo,loginUserInfoVO);
} }
/** /**
* 查所有的已发布场景实训的基础信息 * 查所有的已发布场景实训的基础信息
*/ */
@Role(value = RoleEnum.SuperAdmin) @Role(value = RoleEnum.SuperAdmin)
@GetMapping("/list") @GetMapping("/list")
public PageVO<PublishedTraining2InfoRspVo> findTrainingList( public PageVO<PublishedTraining2InfoRspVo> findTrainingList(@ModelAttribute PublishedTrainingListRspVo vo,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
@ModelAttribute PublishedTrainingListRspVo vo,
@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
return this.publishService.findTrainingInfoForPage(vo,userInfoVO,false); return this.publishService.findTrainingInfoForPage(vo,userInfoVO,false);
} }
@ -147,8 +106,7 @@ public class TrainingV2PublishController {
* 根据实训id查该已发布实训的所有信息 * 根据实训id查该已发布实训的所有信息
*/ */
@GetMapping("/{trainingId}") @GetMapping("/{trainingId}")
public PublishedTraining2DetailRspVo findTrainingAllInfo( public PublishedTraining2DetailRspVo findTrainingAllInfo(@PathVariable("trainingId") Long trainingId){
@PathVariable("trainingId") Long trainingId) {
return this.publishService.findTrainingAllInfoById(trainingId); return this.publishService.findTrainingAllInfoById(trainingId);
} }
@ -160,27 +118,16 @@ public class TrainingV2PublishController {
publishService.updateTrainingLabel(training2); publishService.updateTrainingLabel(training2);
} }
/**
* 更新发布实训信息
*/
@PutMapping("/update")
public void updateTraining(@RequestBody PublishedTraining2 training2) {
publishService.updateTrainingBaseInfo(training2);
}
/** /**
* 批量更新实训label * 批量更新实训label
*/ */
@PutMapping("/update/batch/label") @PutMapping("/update/batch/label")
public void updateTrainingLabelList( public void updateTrainingLabelList(@RequestBody List<PublishedTraining2> publishedTraining2List) {
@RequestBody List<PublishedTraining2> publishedTraining2List) {
publishService.updateTrainingLabelList(publishedTraining2List); publishService.updateTrainingLabelList(publishedTraining2List);
} }
/** /**
* 导出所选实训 * 导出所选实训
*
* @param tidList 实训ID列表 * @param tidList 实训ID列表
* @return 实训详情信息 * @return 实训详情信息
*/ */
@ -191,21 +138,10 @@ public class TrainingV2PublishController {
/** /**
* 导入实训信息 * 导入实训信息
*
* @return 导入结果 * @return 导入结果
*/ */
@PostMapping("/import") @PostMapping("/import")
public List<String> importTraining(@RequestBody List<ExportTraining2> trainingList, public List<String> importTraining(@RequestBody List<ExportTraining2> trainingList, @RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
return publishService.importTraining(trainingList, userInfoVO); return publishService.importTraining(trainingList, userInfoVO);
} }
/**
* 保存为草稿
*/
@PostMapping("/{trainingId}/saveAsDraft")
public void saveAsDraft(@PathVariable("trainingId") Long trainingId,
@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
training2DraftPublishService.saveAsDraft(trainingId, userInfoVO);
}
} }

View File

@ -4,25 +4,15 @@ import club.joylink.rtss.services.ISysUserService;
import club.joylink.rtss.vo.AccountVO; import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.UserQueryVO; import club.joylink.rtss.vo.UserQueryVO;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.user.MobileInfoVO; import club.joylink.rtss.vo.client.user.*;
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.AccountCreateVO;
import club.joylink.rtss.vo.user.AccountRegisterVO; import club.joylink.rtss.vo.user.AccountRegisterVO;
import club.joylink.rtss.vo.user.UserRegisterCheck; import club.joylink.rtss.vo.user.UserRegisterCheck;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import java.util.List;
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;
/** /**
* 系统账户接口 * 系统账户接口
@ -35,8 +25,7 @@ public class SysAccountController {
private ISysUserService iSysUserService; private ISysUserService iSysUserService;
@PostMapping("/register") @PostMapping("/register")
public void register( public void register(@RequestBody @Validated(value = UserRegisterCheck.class) AccountCreateVO accountCreateVO) {
@RequestBody @Validated(value = UserRegisterCheck.class) AccountCreateVO accountCreateVO) {
this.iSysUserService.register(accountCreateVO); this.iSysUserService.register(accountCreateVO);
} }
@ -149,8 +138,7 @@ public class SysAccountController {
*更新用户手机号 *更新用户手机号
*/ */
@PutMapping(path = "/{id}/mobile") @PutMapping(path = "/{id}/mobile")
public void updateMobile(@PathVariable Long id, public void updateMobile(@PathVariable Long id, @RequestBody @Validated UpdateMobileVO updateMobileVO) {
@RequestBody @Validated UpdateMobileVO updateMobileVO) {
this.iSysUserService.updateMobile(id, updateMobileVO); this.iSysUserService.updateMobile(id, updateMobileVO);
} }
@ -158,8 +146,7 @@ public class SysAccountController {
*更新用户邮箱 *更新用户邮箱
*/ */
@PutMapping(path = "/{id}/email") @PutMapping(path = "/{id}/email")
public void updateEmail(@PathVariable Long id, public void updateEmail(@PathVariable Long id, @RequestBody @Validated UpdateEmailVO updateEmailVO) {
@RequestBody @Validated UpdateEmailVO updateEmailVO) {
this.iSysUserService.updateEmail(id, updateEmailVO); this.iSysUserService.updateEmail(id, updateEmailVO);
} }
@ -167,8 +154,7 @@ public class SysAccountController {
*更新用户登陆密码 *更新用户登陆密码
*/ */
@PutMapping(path = "/{id}/password") @PutMapping(path = "/{id}/password")
public void updatePassword(@PathVariable Long id, public void updatePassword(@PathVariable Long id, @RequestBody @Validated UpdatePasswordVO updatePasswordVO) {
@RequestBody @Validated UpdatePasswordVO updatePasswordVO) {
this.iSysUserService.updatePassword(id, updatePasswordVO); this.iSysUserService.updatePassword(id, updatePasswordVO);
} }
@ -176,8 +162,7 @@ public class SysAccountController {
* 按条件分页查询指定来源的账号 * 按条件分页查询指定来源的账号
*/ */
@GetMapping("/page/criteria/{source}") @GetMapping("/page/criteria/{source}")
public PageVO<AccountVO> queryPagedAccountOfTheSource(UserQueryVO queryVO, public PageVO<AccountVO> queryPagedAccountOfTheSource(UserQueryVO queryVO, @PathVariable String source) {
@PathVariable String source) {
queryVO.setSource(source); queryVO.setSource(source);
return this.iSysUserService.queryPagedUser(queryVO); return this.iSysUserService.queryPagedUser(queryVO);
} }
@ -197,20 +182,4 @@ public class SysAccountController {
public void retrievePwd(@RequestBody @Validated RetrievePwdVO vo) { public void retrievePwd(@RequestBody @Validated RetrievePwdVO vo) {
iSysUserService.retrievePwd(vo); iSysUserService.retrievePwd(vo);
} }
/**
* 根据用户id列表获取用户信息
*/
@PostMapping("/list/ids")
public List<AccountVO> listByIds(@RequestBody List<Long> ids) {
return iSysUserService.listByIds(ids);
}
/**
* 查询所有用户
*/
@GetMapping("/list/all")
public List<AccountVO> listAll() {
return iSysUserService.listAll();
}
} }

View File

@ -4,14 +4,11 @@ import club.joylink.rtss.services.voice.IVoiceTrainingService;
import club.joylink.rtss.services.voice.baidu.TokenHolder; import club.joylink.rtss.services.voice.baidu.TokenHolder;
import club.joylink.rtss.vo.client.PageQueryVO; import club.joylink.rtss.vo.client.PageQueryVO;
import club.joylink.rtss.vo.client.PageVO; 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.VoiceRecognitionResult;
import club.joylink.rtss.vo.voice.VoiceVerifyResultVO; import club.joylink.rtss.vo.client.competition.VoiceErrorVO;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; 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.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -28,7 +25,6 @@ public class VoiceController {
/** /**
* 语音识别 * 语音识别
*
* @param file * @param file
* @return * @return
*/ */
@ -39,7 +35,6 @@ public class VoiceController {
/** /**
* 查询语音识别错误集 * 查询语音识别错误集
*
* @param queryVO * @param queryVO
* @return * @return
*/ */
@ -55,14 +50,4 @@ public class VoiceController {
public String getBaiduToken() { public String getBaiduToken() {
return TokenHolder.getInstance().getToken(); 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);
}
} }

View File

@ -2,22 +2,21 @@ package club.joylink.rtss.controller.voice;
import club.joylink.rtss.controller.advice.AuthenticateInterceptor; import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
import club.joylink.rtss.services.voice.IVoiceDataConfigService; 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.LoginUserInfoVO;
import club.joylink.rtss.vo.client.PageQueryVO;
import club.joylink.rtss.vo.client.PageVO; 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.VoiceDiscriminateConfigVO;
import club.joylink.rtss.vo.voice.VoiceQueryVO; import club.joylink.rtss.vo.voice.VoiceQueryVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.multipart.MultipartFile;
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 @RestController
@RequestMapping("/api/voice/manage") @RequestMapping("/api/voice/manage")
@ -28,8 +27,7 @@ public class VoiceManageController {
@PostMapping("saveOrUpdate") @PostMapping("saveOrUpdate")
public void saveOrUpdate(@RequestBody VoiceDiscriminateConfigVO configVO, public void saveOrUpdate(@RequestBody VoiceDiscriminateConfigVO configVO, @RequestAttribute(name= AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
this.configService.saveOrUpdate(configVO,userInfoVO); this.configService.saveOrUpdate(configVO,userInfoVO);
} }
@ -48,9 +46,7 @@ public class VoiceManageController {
* 获取百度语音识别token * 获取百度语音识别token
*/ */
@GetMapping("{id}/{status}") @GetMapping("{id}/{status}")
public void changeStatus(@PathVariable(value = "id") Long id, public void changeStatus(@PathVariable(value = "id") Long id,@PathVariable(value = "status")Integer status,@RequestAttribute(name= AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
@PathVariable(value = "status") Integer status,
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
this.configService.changeStatus(id,status,userInfoVO); this.configService.changeStatus(id,status,userInfoVO);
} }
} }

View File

@ -1,12 +0,0 @@
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> {
}

View File

@ -0,0 +1,12 @@
//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> {
////}

View File

@ -14,7 +14,6 @@ import java.util.List;
@Mapper @Mapper
@Repository @Repository
public interface PaperQuestionDAO { public interface PaperQuestionDAO {
@Select("<script>" + @Select("<script>" +
"select * from rts_paper_question where 1 = 1 " + "select * from rts_paper_question where 1 = 1 " +
// "<choose>" + // "<choose>" +
@ -42,12 +41,6 @@ public interface PaperQuestionDAO {
"</if>" + "</if>" +
"</script>") "</script>")
List<PaperQuestionWithBLOBs> findFromAndRaceLable(Long companyId,int isDelete, List<String> lable, List<String> types); List<PaperQuestionWithBLOBs> findFromAndRaceLable(Long companyId,int isDelete, List<String> lable, List<String> types);
@Select("<script>" +
"select id from rts_paper_question where org_id = #{orgId} "
+ "</script>")
List<Long> findAllId(@Param("orgId") Long id);
long countByExample(PaperQuestionExample example); long countByExample(PaperQuestionExample example);
int deleteByExample(PaperQuestionExample example); int deleteByExample(PaperQuestionExample example);

View File

@ -1,55 +0,0 @@
package club.joylink.rtss.dao.racetr;
import club.joylink.rtss.dao.MyBatisBaseDao;
import club.joylink.rtss.entity.racetr.RacetrPaper;
import club.joylink.rtss.entity.racetr.RacetrPaperExample;
import club.joylink.rtss.vo.race.RacePaperPageVO;
import club.joylink.rtss.vo.race.RacePaperQueryVO;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
/**
* RacetrPaperDAO继承基类
*/
@Repository
public interface RacetrPaperDAO extends MyBatisBaseDao<RacetrPaper, Long, RacetrPaperExample> {
@Select("<script>"
+ " select A.id,A.name,A.`desc`,A.season_id as seasonId ,B.code as seasonName,B.group,B.term as seasonTerm"
+ " ,A.creator_id,A.create_time,A.updater_id,A.update_time,C.nickname as creatorName,D.nickname as updaterName "
+ " from racetr_paper A left join racetr_season B on A.season_id = B.id "
+ " left join sys_account C on A.creator_id = C.id "
+ " left JOIN sys_account D on A.updater_id = D.id "
+ " where 1 = 1 "
+ "<if test='vo.name!= null and vo.name!= \"\"'> "
+ " and A.name like CONCAT('%',#{vo.name},'%') "
+ "</if> "
+ "<if test='vo.group!= null and vo.group != \"\"'> "
+ " and B.group = #{vo.group} "
+ "</if> "
+ "<if test='vo.seasonId!= null and vo.seasonId!= \"\"'> "
+ " and A.season_id = #{vo.seasonId} "
+ "</if> "
+ "<if test='vo.seasonName!= null and vo.seasonName!= \"\"'> "
+ " and B.code like CONCAT('%',#{vo.seasonName},'%') "
+ "</if> "
+ "</script>")
List<RacePaperPageVO> pages(@Param("vo") RacePaperQueryVO vo);
@Select("<script>"
+ " select A.id,A.name,A.`desc`,A.season_id as seasonId ,B.code as seasonName "
+ " ,A.configs,A.creator_id,A.create_time,A.updater_id,A.update_time,C.nickname as creatorName,D.nickname as updaterName "
+ " from racetr_paper A left join racetr_season B on A.season_id = B.id "
+ " left join sys_account C on A.creator_id = C.id "
+ " left JOIN sys_account D on A.updater_id = D.id "
+ " where 1 = 1 "
+ " and A.id = #{id}"
+ "</script>")
RacePaperPageVO detail(@Param("id") Long id);
}

View File

@ -1,47 +0,0 @@
package club.joylink.rtss.dao.racetr;
import club.joylink.rtss.dao.MyBatisBaseDao;
import club.joylink.rtss.entity.racetr.RacetrScene;
import club.joylink.rtss.entity.racetr.RacetrSceneExample;
import club.joylink.rtss.vo.race.RaceScenePageVO;
import club.joylink.rtss.vo.race.RaceSceneQueryVO;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
/**
* RacetrSceneDAO继承基类
*/
@Repository
public interface RacetrSceneDAO extends MyBatisBaseDao<RacetrScene, Long, RacetrSceneExample> {
@Select("<script>"
+ "select A.id,A.name,A.type,A.map_id as mapId, B.name as mapName, "
+ "A.creator_id,A.create_time,A.updater_id,A.update_time,C.nickname as creatorName,D.nickname as updaterName "
+ "from racetr_scene A left join map_info B on A.map_id = B.id "
+ "left join sys_account C on A.creator_id = C.id "
+ "left JOIN sys_account D on A.updater_id = D.id "
+ " where 1 = 1 "
+ "<if test='vo.name!= null and vo.name!= \"\"'> "
+ " and A.name like CONCAT('%',#{vo.name},'%') "
+ "</if> "
+ "<if test='vo.type!= null and vo.type!= \"\"'> "
+ " and A.type = #{vo.type}"
+ "</if> "
+ "</script>")
List<RaceScenePageVO> pages(@Param("vo") RaceSceneQueryVO vo);
@Select("<script>"
+ "select A.id,A.name,A.type,A.map_id as mapId, B.name as mapName, A.proto"
+ ",A.creator_id,A.create_time,A.updater_id,A.update_time,C.nickname as creatorName,D.nickname as updaterName "
+ "from racetr_scene A left join map_info B on A.map_id = B.id "
+ "left join sys_account C on A.creator_id = C.id "
+ "left JOIN sys_account D on A.updater_id = D.id "
+ " where 1 = 1 "
+ " and A.id = #{id} "
+ "</script>")
RaceScenePageVO detail(@Param("id") Long id);
}

View File

@ -1,47 +0,0 @@
package club.joylink.rtss.dao.racetr;
import club.joylink.rtss.dao.MyBatisBaseDao;
import club.joylink.rtss.entity.racetr.RacetrScoringRule;
import club.joylink.rtss.entity.racetr.RacetrScoringRuleExample;
import club.joylink.rtss.vo.race.RaceRuleListVO;
import club.joylink.rtss.vo.race.TaskRuleQueryVO;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
/**
* RacetrScoringRuleDAO继承基类
*/
@Repository
public interface RacetrScoringRuleDAO extends MyBatisBaseDao<RacetrScoringRule, Long, RacetrScoringRuleExample> {
@Select("<script>"
+ " select A.id,A.name"
+ " ,A.creator_id,A.create_time,A.updater_id,A.update_time,C.nickname as creatorName,D.nickname as updaterName "
+ " from racetr_scoring_rule A "
+ " left join sys_account C on A.creator_id = C.id "
+ " left JOIN sys_account D on A.updater_id = D.id "
+ " where 1 = 1 "
+ "<if test='vo.name!= null and vo.name!= \"\"'> "
+ " and A.name like CONCAT('%',#{vo.name},'%') "
+ "</if> "
+ "<if test='vo.id!= null and vo.id >=0'> "
+ " and A.id = #{vo.id}"
+ "</if> "
+ "</script>")
List<RaceRuleListVO> pages(@Param("vo") TaskRuleQueryVO vo);
@Select("<script>"
+ " select A.id,A.name,A.rule"
+ " ,A.creator_id,A.create_time,A.updater_id,A.update_time,C.nickname as creatorName,D.nickname as updaterName "
+ " from racetr_scoring_rule A "
+ " left join sys_account C on A.creator_id = C.id "
+ " left JOIN sys_account D on A.updater_id = D.id "
+ " where 1 = 1 "
+ " and A.id = #{id}"
+ "</script>")
RaceRuleListVO detail(@Param("id") Long id);
}

View File

@ -1,18 +0,0 @@
package club.joylink.rtss.dao.racetr;
import club.joylink.rtss.dao.MyBatisBaseDao;
import club.joylink.rtss.entity.racetr.RacetrSeason;
import club.joylink.rtss.entity.racetr.RacetrSeasonExample;
import java.util.List;
import org.springframework.stereotype.Repository;
/**
* RacetrSeasonDAO继承基类
*/
@Repository
public interface RacetrSeasonDAO extends MyBatisBaseDao<RacetrSeason, Long, RacetrSeasonExample> {
List<RacetrSeason> selectByExampleWithBLOBs(RacetrSeasonExample example);
}

View File

@ -1,33 +0,0 @@
package club.joylink.rtss.dao.racetr;
import club.joylink.rtss.dao.MyBatisBaseDao;
import club.joylink.rtss.entity.racetr.RacetrTask;
import club.joylink.rtss.entity.racetr.RacetrTaskExample;
import club.joylink.rtss.vo.race.RaceTaskDetailDTO;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
/**
* RacetrTaskDAO继承基类
*/
@Repository
public interface RacetrTaskDAO extends MyBatisBaseDao<RacetrTask, Long, RacetrTaskExample> {
@Select("<script>"
+ "select A.id,A.name,A.desc,A.content,A.standards,B.id as scene_id,B.name as sceneName, "
+ "A.score_rule_id as rule_id,C.name as ruleName,A.parent_id,"
+ "A.creator_id,A.create_time,A.updater_id,A.update_time,D.nickname as creatorName,E.nickname as updaterName "
+ " from racetr_task A left join racetr_scene B on A.scene_id = B.id "
+ " left join racetr_scoring_rule C on A.score_rule_id = C.id "
+ " left join sys_account D on A.creator_id = D.id "
+ " left JOIN sys_account E on A.updater_id = E.id "
+ " where 1 = 1 "
+ " and A.id = #{id}"
+ "</script>")
RaceTaskDetailDTO details(@Param("id") Long id);
List<RaceTaskDetailDTO> recursiveFindTask(@Param("taskIds") List<Long> taskIds);
}

View File

@ -1,107 +0,0 @@
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();
}
}

View File

@ -1,482 +0,0 @@
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);
}
}
}

View File

@ -1,57 +0,0 @@
package club.joylink.rtss.entity.racetr;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import lombok.Data;
/**
* @author
*/
@Data
public class RacetrPaper implements Serializable {
private Long id;
/**
* 名称
*/
private String name;
/**
* 描述
*/
private String desc;
/**
* 赛季ID
*/
private Long seasonId;
/**
* 创建者的ID
*/
private Long creatorId;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新者的ID
*/
private Long updaterId;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/**
* module配置
*/
private byte[] configs;
private static final long serialVersionUID = 1L;
}

View File

@ -1,723 +0,0 @@
package club.joylink.rtss.entity.racetr;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class RacetrPaperExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public RacetrPaperExample() {
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 andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andDescIsNull() {
addCriterion("`desc` is null");
return (Criteria) this;
}
public Criteria andDescIsNotNull() {
addCriterion("`desc` is not null");
return (Criteria) this;
}
public Criteria andDescEqualTo(String value) {
addCriterion("`desc` =", value, "desc");
return (Criteria) this;
}
public Criteria andDescNotEqualTo(String value) {
addCriterion("`desc` <>", value, "desc");
return (Criteria) this;
}
public Criteria andDescGreaterThan(String value) {
addCriterion("`desc` >", value, "desc");
return (Criteria) this;
}
public Criteria andDescGreaterThanOrEqualTo(String value) {
addCriterion("`desc` >=", value, "desc");
return (Criteria) this;
}
public Criteria andDescLessThan(String value) {
addCriterion("`desc` <", value, "desc");
return (Criteria) this;
}
public Criteria andDescLessThanOrEqualTo(String value) {
addCriterion("`desc` <=", value, "desc");
return (Criteria) this;
}
public Criteria andDescLike(String value) {
addCriterion("`desc` like", value, "desc");
return (Criteria) this;
}
public Criteria andDescNotLike(String value) {
addCriterion("`desc` not like", value, "desc");
return (Criteria) this;
}
public Criteria andDescIn(List<String> values) {
addCriterion("`desc` in", values, "desc");
return (Criteria) this;
}
public Criteria andDescNotIn(List<String> values) {
addCriterion("`desc` not in", values, "desc");
return (Criteria) this;
}
public Criteria andDescBetween(String value1, String value2) {
addCriterion("`desc` between", value1, value2, "desc");
return (Criteria) this;
}
public Criteria andDescNotBetween(String value1, String value2) {
addCriterion("`desc` not between", value1, value2, "desc");
return (Criteria) this;
}
public Criteria andSeasonIdIsNull() {
addCriterion("season_id is null");
return (Criteria) this;
}
public Criteria andSeasonIdIsNotNull() {
addCriterion("season_id is not null");
return (Criteria) this;
}
public Criteria andSeasonIdEqualTo(Long value) {
addCriterion("season_id =", value, "seasonId");
return (Criteria) this;
}
public Criteria andSeasonIdNotEqualTo(Long value) {
addCriterion("season_id <>", value, "seasonId");
return (Criteria) this;
}
public Criteria andSeasonIdGreaterThan(Long value) {
addCriterion("season_id >", value, "seasonId");
return (Criteria) this;
}
public Criteria andSeasonIdGreaterThanOrEqualTo(Long value) {
addCriterion("season_id >=", value, "seasonId");
return (Criteria) this;
}
public Criteria andSeasonIdLessThan(Long value) {
addCriterion("season_id <", value, "seasonId");
return (Criteria) this;
}
public Criteria andSeasonIdLessThanOrEqualTo(Long value) {
addCriterion("season_id <=", value, "seasonId");
return (Criteria) this;
}
public Criteria andSeasonIdIn(List<Long> values) {
addCriterion("season_id in", values, "seasonId");
return (Criteria) this;
}
public Criteria andSeasonIdNotIn(List<Long> values) {
addCriterion("season_id not in", values, "seasonId");
return (Criteria) this;
}
public Criteria andSeasonIdBetween(Long value1, Long value2) {
addCriterion("season_id between", value1, value2, "seasonId");
return (Criteria) this;
}
public Criteria andSeasonIdNotBetween(Long value1, Long value2) {
addCriterion("season_id not between", value1, value2, "seasonId");
return (Criteria) this;
}
public Criteria andCreatorIdIsNull() {
addCriterion("creator_id is null");
return (Criteria) this;
}
public Criteria andCreatorIdIsNotNull() {
addCriterion("creator_id is not null");
return (Criteria) this;
}
public Criteria andCreatorIdEqualTo(Long value) {
addCriterion("creator_id =", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotEqualTo(Long value) {
addCriterion("creator_id <>", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdGreaterThan(Long value) {
addCriterion("creator_id >", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdGreaterThanOrEqualTo(Long value) {
addCriterion("creator_id >=", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdLessThan(Long value) {
addCriterion("creator_id <", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdLessThanOrEqualTo(Long value) {
addCriterion("creator_id <=", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdIn(List<Long> values) {
addCriterion("creator_id in", values, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotIn(List<Long> values) {
addCriterion("creator_id not in", values, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdBetween(Long value1, Long value2) {
addCriterion("creator_id between", value1, value2, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotBetween(Long value1, Long value2) {
addCriterion("creator_id not between", value1, value2, "creatorId");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdaterIdIsNull() {
addCriterion("updater_id is null");
return (Criteria) this;
}
public Criteria andUpdaterIdIsNotNull() {
addCriterion("updater_id is not null");
return (Criteria) this;
}
public Criteria andUpdaterIdEqualTo(Long value) {
addCriterion("updater_id =", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdNotEqualTo(Long value) {
addCriterion("updater_id <>", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdGreaterThan(Long value) {
addCriterion("updater_id >", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdGreaterThanOrEqualTo(Long value) {
addCriterion("updater_id >=", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdLessThan(Long value) {
addCriterion("updater_id <", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdLessThanOrEqualTo(Long value) {
addCriterion("updater_id <=", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdIn(List<Long> values) {
addCriterion("updater_id in", values, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdNotIn(List<Long> values) {
addCriterion("updater_id not in", values, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdBetween(Long value1, Long value2) {
addCriterion("updater_id between", value1, value2, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdNotBetween(Long value1, Long value2) {
addCriterion("updater_id not between", value1, value2, "updaterId");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
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);
}
}
}

View File

@ -1,67 +0,0 @@
package club.joylink.rtss.entity.racetr;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import lombok.Data;
/**
* @author
*/
@Data
public class RacetrScene implements Serializable {
private Long id;
/**
* 名称
*/
private String name;
/**
* 类型本地/链接
*/
private String type;
/**
* 地图id
*/
private Long mapId;
/**
* 场景对应的线路功能ID
*/
private Long functionId;
/**
* 发布场景关联实训
*/
private Long draftTrainingId;
/**
* 创建者的ID
*/
private Long creatorId;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新者的ID
*/
private Long updaterId;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/**
* 场景数据proto
*/
private byte[] proto;
private static final long serialVersionUID = 1L;
}

View File

@ -1,843 +0,0 @@
package club.joylink.rtss.entity.racetr;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class RacetrSceneExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public RacetrSceneExample() {
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 andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("`type` is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(String value) {
addCriterion("`type` =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(String value) {
addCriterion("`type` <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(String value) {
addCriterion("`type` >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(String value) {
addCriterion("`type` >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(String value) {
addCriterion("`type` <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(String value) {
addCriterion("`type` <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLike(String value) {
addCriterion("`type` like", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotLike(String value) {
addCriterion("`type` not like", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<String> values) {
addCriterion("`type` in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<String> values) {
addCriterion("`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(String value1, String value2) {
addCriterion("`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(String value1, String value2) {
addCriterion("`type` not between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andMapIdIsNull() {
addCriterion("map_id is null");
return (Criteria) this;
}
public Criteria andMapIdIsNotNull() {
addCriterion("map_id is not null");
return (Criteria) this;
}
public Criteria andMapIdEqualTo(Long value) {
addCriterion("map_id =", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotEqualTo(Long value) {
addCriterion("map_id <>", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdGreaterThan(Long value) {
addCriterion("map_id >", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdGreaterThanOrEqualTo(Long value) {
addCriterion("map_id >=", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdLessThan(Long value) {
addCriterion("map_id <", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdLessThanOrEqualTo(Long value) {
addCriterion("map_id <=", value, "mapId");
return (Criteria) this;
}
public Criteria andMapIdIn(List<Long> values) {
addCriterion("map_id in", values, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotIn(List<Long> values) {
addCriterion("map_id not in", values, "mapId");
return (Criteria) this;
}
public Criteria andMapIdBetween(Long value1, Long value2) {
addCriterion("map_id between", value1, value2, "mapId");
return (Criteria) this;
}
public Criteria andMapIdNotBetween(Long value1, Long value2) {
addCriterion("map_id not between", value1, value2, "mapId");
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 andDraftTrainingIdIsNull() {
addCriterion("draft_training_id is null");
return (Criteria) this;
}
public Criteria andDraftTrainingIdIsNotNull() {
addCriterion("draft_training_id is not null");
return (Criteria) this;
}
public Criteria andDraftTrainingIdEqualTo(Long value) {
addCriterion("draft_training_id =", value, "draftTrainingId");
return (Criteria) this;
}
public Criteria andDraftTrainingIdNotEqualTo(Long value) {
addCriterion("draft_training_id <>", value, "draftTrainingId");
return (Criteria) this;
}
public Criteria andDraftTrainingIdGreaterThan(Long value) {
addCriterion("draft_training_id >", value, "draftTrainingId");
return (Criteria) this;
}
public Criteria andDraftTrainingIdGreaterThanOrEqualTo(Long value) {
addCriterion("draft_training_id >=", value, "draftTrainingId");
return (Criteria) this;
}
public Criteria andDraftTrainingIdLessThan(Long value) {
addCriterion("draft_training_id <", value, "draftTrainingId");
return (Criteria) this;
}
public Criteria andDraftTrainingIdLessThanOrEqualTo(Long value) {
addCriterion("draft_training_id <=", value, "draftTrainingId");
return (Criteria) this;
}
public Criteria andDraftTrainingIdIn(List<Long> values) {
addCriterion("draft_training_id in", values, "draftTrainingId");
return (Criteria) this;
}
public Criteria andDraftTrainingIdNotIn(List<Long> values) {
addCriterion("draft_training_id not in", values, "draftTrainingId");
return (Criteria) this;
}
public Criteria andDraftTrainingIdBetween(Long value1, Long value2) {
addCriterion("draft_training_id between", value1, value2, "draftTrainingId");
return (Criteria) this;
}
public Criteria andDraftTrainingIdNotBetween(Long value1, Long value2) {
addCriterion("draft_training_id not between", value1, value2, "draftTrainingId");
return (Criteria) this;
}
public Criteria andCreatorIdIsNull() {
addCriterion("creator_id is null");
return (Criteria) this;
}
public Criteria andCreatorIdIsNotNull() {
addCriterion("creator_id is not null");
return (Criteria) this;
}
public Criteria andCreatorIdEqualTo(Long value) {
addCriterion("creator_id =", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotEqualTo(Long value) {
addCriterion("creator_id <>", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdGreaterThan(Long value) {
addCriterion("creator_id >", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdGreaterThanOrEqualTo(Long value) {
addCriterion("creator_id >=", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdLessThan(Long value) {
addCriterion("creator_id <", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdLessThanOrEqualTo(Long value) {
addCriterion("creator_id <=", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdIn(List<Long> values) {
addCriterion("creator_id in", values, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotIn(List<Long> values) {
addCriterion("creator_id not in", values, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdBetween(Long value1, Long value2) {
addCriterion("creator_id between", value1, value2, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotBetween(Long value1, Long value2) {
addCriterion("creator_id not between", value1, value2, "creatorId");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdaterIdIsNull() {
addCriterion("updater_id is null");
return (Criteria) this;
}
public Criteria andUpdaterIdIsNotNull() {
addCriterion("updater_id is not null");
return (Criteria) this;
}
public Criteria andUpdaterIdEqualTo(Long value) {
addCriterion("updater_id =", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdNotEqualTo(Long value) {
addCriterion("updater_id <>", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdGreaterThan(Long value) {
addCriterion("updater_id >", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdGreaterThanOrEqualTo(Long value) {
addCriterion("updater_id >=", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdLessThan(Long value) {
addCriterion("updater_id <", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdLessThanOrEqualTo(Long value) {
addCriterion("updater_id <=", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdIn(List<Long> values) {
addCriterion("updater_id in", values, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdNotIn(List<Long> values) {
addCriterion("updater_id not in", values, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdBetween(Long value1, Long value2) {
addCriterion("updater_id between", value1, value2, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdNotBetween(Long value1, Long value2) {
addCriterion("updater_id not between", value1, value2, "updaterId");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
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);
}
}
}

View File

@ -1,47 +0,0 @@
package club.joylink.rtss.entity.racetr;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import lombok.Data;
/**
* @author
*/
@Data
public class RacetrScoringRule implements Serializable {
private Long id;
/**
* 名称
*/
private String name;
/**
* 创建者的ID
*/
private Long creatorId;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新者的ID
*/
private Long updaterId;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/**
* 评分规则细则proto
*/
private byte[] rule;
private static final long serialVersionUID = 1L;
}

View File

@ -1,593 +0,0 @@
package club.joylink.rtss.entity.racetr;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class RacetrScoringRuleExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public RacetrScoringRuleExample() {
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 andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andCreatorIdIsNull() {
addCriterion("creator_id is null");
return (Criteria) this;
}
public Criteria andCreatorIdIsNotNull() {
addCriterion("creator_id is not null");
return (Criteria) this;
}
public Criteria andCreatorIdEqualTo(Long value) {
addCriterion("creator_id =", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotEqualTo(Long value) {
addCriterion("creator_id <>", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdGreaterThan(Long value) {
addCriterion("creator_id >", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdGreaterThanOrEqualTo(Long value) {
addCriterion("creator_id >=", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdLessThan(Long value) {
addCriterion("creator_id <", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdLessThanOrEqualTo(Long value) {
addCriterion("creator_id <=", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdIn(List<Long> values) {
addCriterion("creator_id in", values, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotIn(List<Long> values) {
addCriterion("creator_id not in", values, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdBetween(Long value1, Long value2) {
addCriterion("creator_id between", value1, value2, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotBetween(Long value1, Long value2) {
addCriterion("creator_id not between", value1, value2, "creatorId");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdaterIdIsNull() {
addCriterion("updater_id is null");
return (Criteria) this;
}
public Criteria andUpdaterIdIsNotNull() {
addCriterion("updater_id is not null");
return (Criteria) this;
}
public Criteria andUpdaterIdEqualTo(Long value) {
addCriterion("updater_id =", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdNotEqualTo(Long value) {
addCriterion("updater_id <>", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdGreaterThan(Long value) {
addCriterion("updater_id >", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdGreaterThanOrEqualTo(Long value) {
addCriterion("updater_id >=", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdLessThan(Long value) {
addCriterion("updater_id <", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdLessThanOrEqualTo(Long value) {
addCriterion("updater_id <=", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdIn(List<Long> values) {
addCriterion("updater_id in", values, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdNotIn(List<Long> values) {
addCriterion("updater_id not in", values, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdBetween(Long value1, Long value2) {
addCriterion("updater_id between", value1, value2, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdNotBetween(Long value1, Long value2) {
addCriterion("updater_id not between", value1, value2, "updaterId");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
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);
}
}
}

View File

@ -1,57 +0,0 @@
package club.joylink.rtss.entity.racetr;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import lombok.Data;
/**
* @author
*/
@Data
public class RacetrSeason implements Serializable {
private Long id;
/**
* 编号
*/
private String code;
/**
* 组别1=中职/2=高职
*/
private String group;
/**
* 年度
*/
private String term;
/**
* 创建者的ID
*/
private Long creatorId;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新者的ID
*/
private Long updaterId;
/**
* 更新时间
*/
private LocalDateTime udpateTime;
/**
* html文本信息
*/
private String detailHtmlContent;
private static final long serialVersionUID = 1L;
}

View File

@ -1,733 +0,0 @@
package club.joylink.rtss.entity.racetr;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class RacetrSeasonExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public RacetrSeasonExample() {
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 andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andCodeIsNull() {
addCriterion("code is null");
return (Criteria) this;
}
public Criteria andCodeIsNotNull() {
addCriterion("code is not null");
return (Criteria) this;
}
public Criteria andCodeEqualTo(String value) {
addCriterion("code =", value, "code");
return (Criteria) this;
}
public Criteria andCodeNotEqualTo(String value) {
addCriterion("code <>", value, "code");
return (Criteria) this;
}
public Criteria andCodeGreaterThan(String value) {
addCriterion("code >", value, "code");
return (Criteria) this;
}
public Criteria andCodeGreaterThanOrEqualTo(String value) {
addCriterion("code >=", value, "code");
return (Criteria) this;
}
public Criteria andCodeLessThan(String value) {
addCriterion("code <", value, "code");
return (Criteria) this;
}
public Criteria andCodeLessThanOrEqualTo(String value) {
addCriterion("code <=", value, "code");
return (Criteria) this;
}
public Criteria andCodeLike(String value) {
addCriterion("code like", value, "code");
return (Criteria) this;
}
public Criteria andCodeNotLike(String value) {
addCriterion("code not like", value, "code");
return (Criteria) this;
}
public Criteria andCodeIn(List<String> values) {
addCriterion("code in", values, "code");
return (Criteria) this;
}
public Criteria andCodeNotIn(List<String> values) {
addCriterion("code not in", values, "code");
return (Criteria) this;
}
public Criteria andCodeBetween(String value1, String value2) {
addCriterion("code between", value1, value2, "code");
return (Criteria) this;
}
public Criteria andCodeNotBetween(String value1, String value2) {
addCriterion("code not between", value1, value2, "code");
return (Criteria) this;
}
public Criteria andGroupIsNull() {
addCriterion("`group` is null");
return (Criteria) this;
}
public Criteria andGroupIsNotNull() {
addCriterion("`group` is not null");
return (Criteria) this;
}
public Criteria andGroupEqualTo(String value) {
addCriterion("`group` =", value, "group");
return (Criteria) this;
}
public Criteria andGroupNotEqualTo(String value) {
addCriterion("`group` <>", value, "group");
return (Criteria) this;
}
public Criteria andGroupGreaterThan(String value) {
addCriterion("`group` >", value, "group");
return (Criteria) this;
}
public Criteria andGroupGreaterThanOrEqualTo(String value) {
addCriterion("`group` >=", value, "group");
return (Criteria) this;
}
public Criteria andGroupLessThan(String value) {
addCriterion("`group` <", value, "group");
return (Criteria) this;
}
public Criteria andGroupLessThanOrEqualTo(String value) {
addCriterion("`group` <=", value, "group");
return (Criteria) this;
}
public Criteria andGroupLike(String value) {
addCriterion("`group` like", value, "group");
return (Criteria) this;
}
public Criteria andGroupNotLike(String value) {
addCriterion("`group` not like", value, "group");
return (Criteria) this;
}
public Criteria andGroupIn(List<String> values) {
addCriterion("`group` in", values, "group");
return (Criteria) this;
}
public Criteria andGroupNotIn(List<String> values) {
addCriterion("`group` not in", values, "group");
return (Criteria) this;
}
public Criteria andGroupBetween(String value1, String value2) {
addCriterion("`group` between", value1, value2, "group");
return (Criteria) this;
}
public Criteria andGroupNotBetween(String value1, String value2) {
addCriterion("`group` not between", value1, value2, "group");
return (Criteria) this;
}
public Criteria andTermIsNull() {
addCriterion("term is null");
return (Criteria) this;
}
public Criteria andTermIsNotNull() {
addCriterion("term is not null");
return (Criteria) this;
}
public Criteria andTermEqualTo(String value) {
addCriterion("term =", value, "term");
return (Criteria) this;
}
public Criteria andTermNotEqualTo(String value) {
addCriterion("term <>", value, "term");
return (Criteria) this;
}
public Criteria andTermGreaterThan(String value) {
addCriterion("term >", value, "term");
return (Criteria) this;
}
public Criteria andTermGreaterThanOrEqualTo(String value) {
addCriterion("term >=", value, "term");
return (Criteria) this;
}
public Criteria andTermLessThan(String value) {
addCriterion("term <", value, "term");
return (Criteria) this;
}
public Criteria andTermLessThanOrEqualTo(String value) {
addCriterion("term <=", value, "term");
return (Criteria) this;
}
public Criteria andTermLike(String value) {
addCriterion("term like", value, "term");
return (Criteria) this;
}
public Criteria andTermNotLike(String value) {
addCriterion("term not like", value, "term");
return (Criteria) this;
}
public Criteria andTermIn(List<String> values) {
addCriterion("term in", values, "term");
return (Criteria) this;
}
public Criteria andTermNotIn(List<String> values) {
addCriterion("term not in", values, "term");
return (Criteria) this;
}
public Criteria andTermBetween(String value1, String value2) {
addCriterion("term between", value1, value2, "term");
return (Criteria) this;
}
public Criteria andTermNotBetween(String value1, String value2) {
addCriterion("term not between", value1, value2, "term");
return (Criteria) this;
}
public Criteria andCreatorIdIsNull() {
addCriterion("creator_id is null");
return (Criteria) this;
}
public Criteria andCreatorIdIsNotNull() {
addCriterion("creator_id is not null");
return (Criteria) this;
}
public Criteria andCreatorIdEqualTo(Long value) {
addCriterion("creator_id =", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotEqualTo(Long value) {
addCriterion("creator_id <>", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdGreaterThan(Long value) {
addCriterion("creator_id >", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdGreaterThanOrEqualTo(Long value) {
addCriterion("creator_id >=", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdLessThan(Long value) {
addCriterion("creator_id <", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdLessThanOrEqualTo(Long value) {
addCriterion("creator_id <=", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdIn(List<Long> values) {
addCriterion("creator_id in", values, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotIn(List<Long> values) {
addCriterion("creator_id not in", values, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdBetween(Long value1, Long value2) {
addCriterion("creator_id between", value1, value2, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotBetween(Long value1, Long value2) {
addCriterion("creator_id not between", value1, value2, "creatorId");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdaterIdIsNull() {
addCriterion("updater_id is null");
return (Criteria) this;
}
public Criteria andUpdaterIdIsNotNull() {
addCriterion("updater_id is not null");
return (Criteria) this;
}
public Criteria andUpdaterIdEqualTo(Long value) {
addCriterion("updater_id =", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdNotEqualTo(Long value) {
addCriterion("updater_id <>", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdGreaterThan(Long value) {
addCriterion("updater_id >", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdGreaterThanOrEqualTo(Long value) {
addCriterion("updater_id >=", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdLessThan(Long value) {
addCriterion("updater_id <", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdLessThanOrEqualTo(Long value) {
addCriterion("updater_id <=", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdIn(List<Long> values) {
addCriterion("updater_id in", values, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdNotIn(List<Long> values) {
addCriterion("updater_id not in", values, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdBetween(Long value1, Long value2) {
addCriterion("updater_id between", value1, value2, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdNotBetween(Long value1, Long value2) {
addCriterion("updater_id not between", value1, value2, "updaterId");
return (Criteria) this;
}
public Criteria andUdpateTimeIsNull() {
addCriterion("udpate_time is null");
return (Criteria) this;
}
public Criteria andUdpateTimeIsNotNull() {
addCriterion("udpate_time is not null");
return (Criteria) this;
}
public Criteria andUdpateTimeEqualTo(Date value) {
addCriterion("udpate_time =", value, "udpateTime");
return (Criteria) this;
}
public Criteria andUdpateTimeNotEqualTo(Date value) {
addCriterion("udpate_time <>", value, "udpateTime");
return (Criteria) this;
}
public Criteria andUdpateTimeGreaterThan(Date value) {
addCriterion("udpate_time >", value, "udpateTime");
return (Criteria) this;
}
public Criteria andUdpateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("udpate_time >=", value, "udpateTime");
return (Criteria) this;
}
public Criteria andUdpateTimeLessThan(Date value) {
addCriterion("udpate_time <", value, "udpateTime");
return (Criteria) this;
}
public Criteria andUdpateTimeLessThanOrEqualTo(Date value) {
addCriterion("udpate_time <=", value, "udpateTime");
return (Criteria) this;
}
public Criteria andUdpateTimeIn(List<Date> values) {
addCriterion("udpate_time in", values, "udpateTime");
return (Criteria) this;
}
public Criteria andUdpateTimeNotIn(List<Date> values) {
addCriterion("udpate_time not in", values, "udpateTime");
return (Criteria) this;
}
public Criteria andUdpateTimeBetween(Date value1, Date value2) {
addCriterion("udpate_time between", value1, value2, "udpateTime");
return (Criteria) this;
}
public Criteria andUdpateTimeNotBetween(Date value1, Date value2) {
addCriterion("udpate_time not between", value1, value2, "udpateTime");
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);
}
}
}

View File

@ -1,69 +0,0 @@
package club.joylink.rtss.entity.racetr;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import lombok.Data;
/**
* @author
*/
@Data
public class RacetrTask implements Serializable {
private Long id;
private String name;
/**
* 基础描述文本
*/
private String desc;
/**
* 考核内容文本
*/
private String content;
/**
* 评价标准文本
*/
private String standards;
/**
* 任务场景
*/
private Long sceneId;
/**
* 评分规则
*/
private Long scoreRuleId;
/**
* 父任务ID
*/
private Long parentId;
/**
* 创建者的ID
*/
private Long creatorId;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新者的ID
*/
private Long updaterId;
/**
* 更新时间
*/
private LocalDateTime updateTime;
private static final long serialVersionUID = 1L;
}

View File

@ -1,983 +0,0 @@
package club.joylink.rtss.entity.racetr;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class RacetrTaskExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public RacetrTaskExample() {
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 andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andDescIsNull() {
addCriterion("`desc` is null");
return (Criteria) this;
}
public Criteria andDescIsNotNull() {
addCriterion("`desc` is not null");
return (Criteria) this;
}
public Criteria andDescEqualTo(String value) {
addCriterion("`desc` =", value, "desc");
return (Criteria) this;
}
public Criteria andDescNotEqualTo(String value) {
addCriterion("`desc` <>", value, "desc");
return (Criteria) this;
}
public Criteria andDescGreaterThan(String value) {
addCriterion("`desc` >", value, "desc");
return (Criteria) this;
}
public Criteria andDescGreaterThanOrEqualTo(String value) {
addCriterion("`desc` >=", value, "desc");
return (Criteria) this;
}
public Criteria andDescLessThan(String value) {
addCriterion("`desc` <", value, "desc");
return (Criteria) this;
}
public Criteria andDescLessThanOrEqualTo(String value) {
addCriterion("`desc` <=", value, "desc");
return (Criteria) this;
}
public Criteria andDescLike(String value) {
addCriterion("`desc` like", value, "desc");
return (Criteria) this;
}
public Criteria andDescNotLike(String value) {
addCriterion("`desc` not like", value, "desc");
return (Criteria) this;
}
public Criteria andDescIn(List<String> values) {
addCriterion("`desc` in", values, "desc");
return (Criteria) this;
}
public Criteria andDescNotIn(List<String> values) {
addCriterion("`desc` not in", values, "desc");
return (Criteria) this;
}
public Criteria andDescBetween(String value1, String value2) {
addCriterion("`desc` between", value1, value2, "desc");
return (Criteria) this;
}
public Criteria andDescNotBetween(String value1, String value2) {
addCriterion("`desc` not between", value1, value2, "desc");
return (Criteria) this;
}
public Criteria andContentIsNull() {
addCriterion("content is null");
return (Criteria) this;
}
public Criteria andContentIsNotNull() {
addCriterion("content is not null");
return (Criteria) this;
}
public Criteria andContentEqualTo(String value) {
addCriterion("content =", value, "content");
return (Criteria) this;
}
public Criteria andContentNotEqualTo(String value) {
addCriterion("content <>", value, "content");
return (Criteria) this;
}
public Criteria andContentGreaterThan(String value) {
addCriterion("content >", value, "content");
return (Criteria) this;
}
public Criteria andContentGreaterThanOrEqualTo(String value) {
addCriterion("content >=", value, "content");
return (Criteria) this;
}
public Criteria andContentLessThan(String value) {
addCriterion("content <", value, "content");
return (Criteria) this;
}
public Criteria andContentLessThanOrEqualTo(String value) {
addCriterion("content <=", value, "content");
return (Criteria) this;
}
public Criteria andContentLike(String value) {
addCriterion("content like", value, "content");
return (Criteria) this;
}
public Criteria andContentNotLike(String value) {
addCriterion("content not like", value, "content");
return (Criteria) this;
}
public Criteria andContentIn(List<String> values) {
addCriterion("content in", values, "content");
return (Criteria) this;
}
public Criteria andContentNotIn(List<String> values) {
addCriterion("content not in", values, "content");
return (Criteria) this;
}
public Criteria andContentBetween(String value1, String value2) {
addCriterion("content between", value1, value2, "content");
return (Criteria) this;
}
public Criteria andContentNotBetween(String value1, String value2) {
addCriterion("content not between", value1, value2, "content");
return (Criteria) this;
}
public Criteria andStandardsIsNull() {
addCriterion("standards is null");
return (Criteria) this;
}
public Criteria andStandardsIsNotNull() {
addCriterion("standards is not null");
return (Criteria) this;
}
public Criteria andStandardsEqualTo(String value) {
addCriterion("standards =", value, "standards");
return (Criteria) this;
}
public Criteria andStandardsNotEqualTo(String value) {
addCriterion("standards <>", value, "standards");
return (Criteria) this;
}
public Criteria andStandardsGreaterThan(String value) {
addCriterion("standards >", value, "standards");
return (Criteria) this;
}
public Criteria andStandardsGreaterThanOrEqualTo(String value) {
addCriterion("standards >=", value, "standards");
return (Criteria) this;
}
public Criteria andStandardsLessThan(String value) {
addCriterion("standards <", value, "standards");
return (Criteria) this;
}
public Criteria andStandardsLessThanOrEqualTo(String value) {
addCriterion("standards <=", value, "standards");
return (Criteria) this;
}
public Criteria andStandardsLike(String value) {
addCriterion("standards like", value, "standards");
return (Criteria) this;
}
public Criteria andStandardsNotLike(String value) {
addCriterion("standards not like", value, "standards");
return (Criteria) this;
}
public Criteria andStandardsIn(List<String> values) {
addCriterion("standards in", values, "standards");
return (Criteria) this;
}
public Criteria andStandardsNotIn(List<String> values) {
addCriterion("standards not in", values, "standards");
return (Criteria) this;
}
public Criteria andStandardsBetween(String value1, String value2) {
addCriterion("standards between", value1, value2, "standards");
return (Criteria) this;
}
public Criteria andStandardsNotBetween(String value1, String value2) {
addCriterion("standards not between", value1, value2, "standards");
return (Criteria) this;
}
public Criteria andSceneIdIsNull() {
addCriterion("scene_id is null");
return (Criteria) this;
}
public Criteria andSceneIdIsNotNull() {
addCriterion("scene_id is not null");
return (Criteria) this;
}
public Criteria andSceneIdEqualTo(Long value) {
addCriterion("scene_id =", value, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdNotEqualTo(Long value) {
addCriterion("scene_id <>", value, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdGreaterThan(Long value) {
addCriterion("scene_id >", value, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdGreaterThanOrEqualTo(Long value) {
addCriterion("scene_id >=", value, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdLessThan(Long value) {
addCriterion("scene_id <", value, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdLessThanOrEqualTo(Long value) {
addCriterion("scene_id <=", value, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdIn(List<Long> values) {
addCriterion("scene_id in", values, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdNotIn(List<Long> values) {
addCriterion("scene_id not in", values, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdBetween(Long value1, Long value2) {
addCriterion("scene_id between", value1, value2, "sceneId");
return (Criteria) this;
}
public Criteria andSceneIdNotBetween(Long value1, Long value2) {
addCriterion("scene_id not between", value1, value2, "sceneId");
return (Criteria) this;
}
public Criteria andScoreRuleIdIsNull() {
addCriterion("score_rule_id is null");
return (Criteria) this;
}
public Criteria andScoreRuleIdIsNotNull() {
addCriterion("score_rule_id is not null");
return (Criteria) this;
}
public Criteria andScoreRuleIdEqualTo(Long value) {
addCriterion("score_rule_id =", value, "scoreRuleId");
return (Criteria) this;
}
public Criteria andScoreRuleIdNotEqualTo(Long value) {
addCriterion("score_rule_id <>", value, "scoreRuleId");
return (Criteria) this;
}
public Criteria andScoreRuleIdGreaterThan(Long value) {
addCriterion("score_rule_id >", value, "scoreRuleId");
return (Criteria) this;
}
public Criteria andScoreRuleIdGreaterThanOrEqualTo(Long value) {
addCriterion("score_rule_id >=", value, "scoreRuleId");
return (Criteria) this;
}
public Criteria andScoreRuleIdLessThan(Long value) {
addCriterion("score_rule_id <", value, "scoreRuleId");
return (Criteria) this;
}
public Criteria andScoreRuleIdLessThanOrEqualTo(Long value) {
addCriterion("score_rule_id <=", value, "scoreRuleId");
return (Criteria) this;
}
public Criteria andScoreRuleIdIn(List<Long> values) {
addCriterion("score_rule_id in", values, "scoreRuleId");
return (Criteria) this;
}
public Criteria andScoreRuleIdNotIn(List<Long> values) {
addCriterion("score_rule_id not in", values, "scoreRuleId");
return (Criteria) this;
}
public Criteria andScoreRuleIdBetween(Long value1, Long value2) {
addCriterion("score_rule_id between", value1, value2, "scoreRuleId");
return (Criteria) this;
}
public Criteria andScoreRuleIdNotBetween(Long value1, Long value2) {
addCriterion("score_rule_id not between", value1, value2, "scoreRuleId");
return (Criteria) this;
}
public Criteria andParentIdIsNull() {
addCriterion("parent_id is null");
return (Criteria) this;
}
public Criteria andParentIdIsNotNull() {
addCriterion("parent_id is not null");
return (Criteria) this;
}
public Criteria andParentIdEqualTo(Long value) {
addCriterion("parent_id =", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdNotEqualTo(Long value) {
addCriterion("parent_id <>", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdGreaterThan(Long value) {
addCriterion("parent_id >", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdGreaterThanOrEqualTo(Long value) {
addCriterion("parent_id >=", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdLessThan(Long value) {
addCriterion("parent_id <", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdLessThanOrEqualTo(Long value) {
addCriterion("parent_id <=", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdIn(List<Long> values) {
addCriterion("parent_id in", values, "parentId");
return (Criteria) this;
}
public Criteria andParentIdNotIn(List<Long> values) {
addCriterion("parent_id not in", values, "parentId");
return (Criteria) this;
}
public Criteria andParentIdBetween(Long value1, Long value2) {
addCriterion("parent_id between", value1, value2, "parentId");
return (Criteria) this;
}
public Criteria andParentIdNotBetween(Long value1, Long value2) {
addCriterion("parent_id not between", value1, value2, "parentId");
return (Criteria) this;
}
public Criteria andCreatorIdIsNull() {
addCriterion("creator_id is null");
return (Criteria) this;
}
public Criteria andCreatorIdIsNotNull() {
addCriterion("creator_id is not null");
return (Criteria) this;
}
public Criteria andCreatorIdEqualTo(Long value) {
addCriterion("creator_id =", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotEqualTo(Long value) {
addCriterion("creator_id <>", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdGreaterThan(Long value) {
addCriterion("creator_id >", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdGreaterThanOrEqualTo(Long value) {
addCriterion("creator_id >=", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdLessThan(Long value) {
addCriterion("creator_id <", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdLessThanOrEqualTo(Long value) {
addCriterion("creator_id <=", value, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdIn(List<Long> values) {
addCriterion("creator_id in", values, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotIn(List<Long> values) {
addCriterion("creator_id not in", values, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdBetween(Long value1, Long value2) {
addCriterion("creator_id between", value1, value2, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotBetween(Long value1, Long value2) {
addCriterion("creator_id not between", value1, value2, "creatorId");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdaterIdIsNull() {
addCriterion("updater_id is null");
return (Criteria) this;
}
public Criteria andUpdaterIdIsNotNull() {
addCriterion("updater_id is not null");
return (Criteria) this;
}
public Criteria andUpdaterIdEqualTo(Long value) {
addCriterion("updater_id =", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdNotEqualTo(Long value) {
addCriterion("updater_id <>", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdGreaterThan(Long value) {
addCriterion("updater_id >", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdGreaterThanOrEqualTo(Long value) {
addCriterion("updater_id >=", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdLessThan(Long value) {
addCriterion("updater_id <", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdLessThanOrEqualTo(Long value) {
addCriterion("updater_id <=", value, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdIn(List<Long> values) {
addCriterion("updater_id in", values, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdNotIn(List<Long> values) {
addCriterion("updater_id not in", values, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdBetween(Long value1, Long value2) {
addCriterion("updater_id between", value1, value2, "updaterId");
return (Criteria) this;
}
public Criteria andUpdaterIdNotBetween(Long value1, Long value2) {
addCriterion("updater_id not between", value1, value2, "updaterId");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
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);
}
}
}

View File

@ -1,19 +0,0 @@
package club.joylink.rtss.exception;
import lombok.Getter;
@Getter
public enum RacetrExceptionAssert implements BusinessExceptionAssert {
publishSceneNotForce(12000, "发布重复的场景,是否强制替换"),
;
int code;
String message;
private RacetrExceptionAssert(int code, String message) {
this.code = code;
this.message = message;
}
}

View File

@ -6,24 +6,17 @@ import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.UserQueryVO; import club.joylink.rtss.vo.UserQueryVO;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.org.OrgVO; import club.joylink.rtss.vo.client.org.OrgVO;
import club.joylink.rtss.vo.client.user.MobileInfoVO; import club.joylink.rtss.vo.client.user.*;
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.AccountCreateVO;
import club.joylink.rtss.vo.user.AccountRegisterVO; import club.joylink.rtss.vo.user.AccountRegisterVO;
import club.joylink.rtss.vo.wx.WmUserSession; import club.joylink.rtss.vo.wx.WmUserSession;
import java.util.List;
import java.util.Map;
import javax.validation.constraints.NotEmpty;
import lombok.NonNull; import lombok.NonNull;
import java.util.List;
public interface ISysUserService { public interface ISysUserService {
AccountVO queryUserByAccountForMaster(String account); AccountVO queryUserByAccountForMaster(String account);
AccountVO queryUserByAccount(String account); AccountVO queryUserByAccount(String account);
/** /**
@ -317,8 +310,6 @@ public interface ISysUserService {
List<SysAccount> findEntities(List<Long> ids, String orderBy); List<SysAccount> findEntities(List<Long> ids, String orderBy);
Map<Long, SysAccount> findEntitiesForMap(List<Long> ids);
/** /**
* 确认该用户存在 * 确认该用户存在
*/ */
@ -342,7 +333,7 @@ public interface ISysUserService {
*/ */
List<AccountVO> queryAdminsAndSuperAdmins(); List<AccountVO> queryAdminsAndSuperAdmins();
AccountVO queryOrCreateThirdAccount(String parentAccount, String account, @NotEmpty String name); AccountVO queryOrCreateThirdAccount(String parentAccount, String account);
AccountVO getThirdAccount(String account); AccountVO getThirdAccount(String account);
@ -363,8 +354,4 @@ public interface ISysUserService {
boolean isSameMobileExist(String mobile); boolean isSameMobileExist(String mobile);
boolean isSameEmailExist(String email); boolean isSameEmailExist(String email);
List<AccountVO> listByIds(List<Long> ids);
List<AccountVO> listAll();
} }

View File

@ -6,25 +6,14 @@ import club.joylink.rtss.constants.SystemEnv;
import club.joylink.rtss.dao.LearnCommentDAO; import club.joylink.rtss.dao.LearnCommentDAO;
import club.joylink.rtss.dao.LearnMessageDAO; import club.joylink.rtss.dao.LearnMessageDAO;
import club.joylink.rtss.dao.LearnPostDAO; import club.joylink.rtss.dao.LearnPostDAO;
import club.joylink.rtss.entity.LearnComment; import club.joylink.rtss.entity.*;
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.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException; import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import club.joylink.rtss.vo.AccountVO; import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageQueryVO; import club.joylink.rtss.vo.client.PageQueryVO;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.learn.LearnCommentUpdateVO; import club.joylink.rtss.vo.client.learn.*;
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.LearnMessageCreateVO;
import club.joylink.rtss.vo.client.post.LearnMessagePagedQueryVO; import club.joylink.rtss.vo.client.post.LearnMessagePagedQueryVO;
import club.joylink.rtss.vo.client.post.LearnMessageVO; import club.joylink.rtss.vo.client.post.LearnMessageVO;
@ -33,23 +22,18 @@ import club.joylink.rtss.wechat.MiniProgramService;
import club.joylink.rtss.wechat.vo.WxError; import club.joylink.rtss.wechat.vo.WxError;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; 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 lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; 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 @Slf4j
@Service @Service
@ -64,6 +48,9 @@ public class LearnService implements ILearnService {
@Autowired @Autowired
private ISysUserService iSysUserService; private ISysUserService iSysUserService;
@Autowired
private RestTemplate restTemplate;
@Autowired @Autowired
private WeChatConfig weChatConfig; private WeChatConfig weChatConfig;
@ -84,8 +71,7 @@ public class LearnService implements ILearnService {
example.createCriteria().andProjectEqualTo(queryVO.getProject()); example.createCriteria().andProjectEqualTo(queryVO.getProject());
} }
Page<LearnPost> page = (Page<LearnPost>) learnPostDAO.selectByExample(example); Page<LearnPost> page = (Page<LearnPost>) learnPostDAO.selectByExample(example);
List<LearnPostVO> vos = page.getResult().stream().map(LearnPostVO::new) List<LearnPostVO> vos = page.getResult().stream().map(LearnPostVO::new).collect(Collectors.toList());
.collect(Collectors.toList());
return PageVO.convert(page, vos); return PageVO.convert(page, vos);
} }
@ -175,13 +161,11 @@ public class LearnService implements ILearnService {
} }
// 回复的用户的昵称 // 回复的用户的昵称
if (comment.getParentId() != null) { if (comment.getParentId() != null) {
commentVO.setReplyUserNickName( commentVO.setReplyUserNickName(iSysUserService.findUserById(comment.getParentId()).getNickname());
iSysUserService.findUserById(comment.getParentId()).getNickname());
} }
// 回复数 // 回复数
LearnCommentExample learnCommentExample = new LearnCommentExample(); LearnCommentExample learnCommentExample = new LearnCommentExample();
learnCommentExample.createCriteria().andMessageIdEqualTo(comment.getMessageId()) learnCommentExample.createCriteria().andMessageIdEqualTo(comment.getMessageId()).andRootIdEqualTo(comment.getId());
.andRootIdEqualTo(comment.getId());
commentVO.setCommentCount(learnCommentDAO.countByExample(learnCommentExample)); commentVO.setCommentCount(learnCommentDAO.countByExample(learnCommentExample));
return commentVO; return commentVO;
} }
@ -201,8 +185,7 @@ public class LearnService implements ILearnService {
} }
@Override @Override
public void addComment(Long messageId, Long commentId, LearnCreateVO postCreateVO, public void addComment(Long messageId, Long commentId, LearnCreateVO postCreateVO, AccountVO accountVO) {
AccountVO accountVO) {
checkMessageExist(messageId); checkMessageExist(messageId);
if (SystemEnv.isPrdEnv(otherConfig.getEnv())) { if (SystemEnv.isPrdEnv(otherConfig.getEnv())) {
this.checkContent(postCreateVO.getContent()); this.checkContent(postCreateVO.getContent());
@ -258,8 +241,7 @@ public class LearnService implements ILearnService {
//删除留言 //删除留言
LearnMessageExample messageExample = new LearnMessageExample(); LearnMessageExample messageExample = new LearnMessageExample();
messageExample.createCriteria().andPostIdEqualTo(postId); messageExample.createCriteria().andPostIdEqualTo(postId);
List<Long> messageIds = learnMessageDAO.selectByExample(messageExample).stream() List<Long> messageIds = learnMessageDAO.selectByExample(messageExample).stream().map(LearnMessage::getId).collect(Collectors.toList());
.map(LearnMessage::getId).collect(Collectors.toList());
learnMessageDAO.deleteByExample(messageExample); learnMessageDAO.deleteByExample(messageExample);
//删除评论 //删除评论
LearnCommentExample commentExample = new LearnCommentExample(); LearnCommentExample commentExample = new LearnCommentExample();
@ -286,8 +268,7 @@ public class LearnService implements ILearnService {
@Override @Override
public long createMessage(LearnMessageCreateVO messageCreateVO, AccountVO user) { public long createMessage(LearnMessageCreateVO messageCreateVO, AccountVO user) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue( BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(StringUtils.hasText(messageCreateVO.getContent()),
StringUtils.hasText(messageCreateVO.getContent()),
"内容不能空白"); "内容不能空白");
if (SystemEnv.isPrdEnv(otherConfig.getEnv())) { if (SystemEnv.isPrdEnv(otherConfig.getEnv())) {
this.checkContent(messageCreateVO.getContent()); this.checkContent(messageCreateVO.getContent());
@ -300,8 +281,7 @@ public class LearnService implements ILearnService {
} }
@Override @Override
public PageVO<LearnMessageVO> pagedQueryMessageByPostId(Long postId, public PageVO<LearnMessageVO> pagedQueryMessageByPostId(Long postId, LearnMessagePagedQueryVO queryVO) {
LearnMessagePagedQueryVO queryVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize()); PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
Page<LearnMessageVO> page = (Page<LearnMessageVO>) learnMessageDAO.select(postId, queryVO); Page<LearnMessageVO> page = (Page<LearnMessageVO>) learnMessageDAO.select(postId, queryVO);
for (LearnMessageVO vo : page.getResult()) { for (LearnMessageVO vo : page.getResult()) {
@ -338,8 +318,7 @@ public class LearnService implements ILearnService {
} }
@Override @Override
public PageVO<LearnMessageVO> pagedQueryMessageByProject(String project, public PageVO<LearnMessageVO> pagedQueryMessageByProject(String project, LearnMessagePagedQueryVO queryVO) {
LearnMessagePagedQueryVO queryVO) {
LearnPostVO post = queryPost(project); LearnPostVO post = queryPost(project);
if (post == null) { if (post == null) {
log.error(String.format("项目[%s]的留言板不存在", project)); log.error(String.format("项目[%s]的留言板不存在", project));
@ -352,17 +331,15 @@ public class LearnService implements ILearnService {
public void updatePost(Long postId, LearnPostUpdateVO updateVO, AccountVO user) { public void updatePost(Long postId, LearnPostUpdateVO updateVO, AccountVO user) {
iSysUserService.confirmAdmin(user); iSysUserService.confirmAdmin(user);
LearnPost entity = getPostEntity(postId); LearnPost entity = getPostEntity(postId);
if (Objects.equals(updateVO.getTitle(), entity.getTitle())) { if (Objects.equals(updateVO.getTitle(), entity.getTitle()))
return; return;
}
entity.setTitle(updateVO.getTitle()); entity.setTitle(updateVO.getTitle());
learnPostDAO.updateByPrimaryKey(entity); learnPostDAO.updateByPrimaryKey(entity);
} }
@Override @Override
public long cgyCreateMessage(LearnMessageCreateVO messageCreateVO) { public long cgyCreateMessage(LearnMessageCreateVO messageCreateVO) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue( BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(StringUtils.hasText(messageCreateVO.getContent()),
StringUtils.hasText(messageCreateVO.getContent()),
"内容不能空白"); "内容不能空白");
LearnMessage message = messageCreateVO.convert2DB(1L); LearnMessage message = messageCreateVO.convert2DB(1L);
message.setCreatorId(null); message.setCreatorId(null);
@ -430,13 +407,10 @@ public class LearnService implements ILearnService {
example.createCriteria().andPostIdEqualTo(27L); example.createCriteria().andPostIdEqualTo(27L);
List<LearnMessage> allMessage = learnMessageDAO.selectByExample(example); List<LearnMessage> allMessage = learnMessageDAO.selectByExample(example);
//删重复数据 //删重复数据
List<LearnMessage> list = allMessage.stream().collect( List<LearnMessage> list = allMessage.stream().collect(Collectors.toMap(LearnMessage::getContent, Function.identity(), (old, newValue) -> old))
Collectors.toMap(LearnMessage::getContent, Function.identity(), (old, newValue) -> old)) .values().stream().sorted(Comparator.comparingLong(LearnMessage::getId)).collect(Collectors.toList());
.values().stream().sorted(Comparator.comparingLong(LearnMessage::getId))
.collect(Collectors.toList());
HashSet<LearnMessage> distinctSet = new HashSet<>(list); HashSet<LearnMessage> distinctSet = new HashSet<>(list);
List<Long> deleteIds = allMessage.stream().filter(message -> !distinctSet.contains(message)) List<Long> deleteIds = allMessage.stream().filter(message -> !distinctSet.contains(message)).map(LearnMessage::getId).collect(Collectors.toList());
.map(LearnMessage::getId).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(deleteIds)) { if (!CollectionUtils.isEmpty(deleteIds)) {
example.clear(); example.clear();
example.createCriteria().andIdIn(deleteIds); example.createCriteria().andIdIn(deleteIds);
@ -450,8 +424,7 @@ public class LearnService implements ILearnService {
dayOffsetList.add(random.nextInt(day)); dayOffsetList.add(random.nextInt(day));
} }
dayOffsetList.sort((i1, i2) -> i2 - i1); dayOffsetList.sort((i1, i2) -> i2 - i1);
Map<Integer, Long> dayCountMap = dayOffsetList.stream().collect( Map<Integer, Long> dayCountMap = dayOffsetList.stream().collect(Collectors.groupingBy(Function.identity(), LinkedHashMap::new, Collectors.counting()));
Collectors.groupingBy(Function.identity(), LinkedHashMap::new, Collectors.counting()));
int startIndex = 0; int startIndex = 0;
LocalDateTime now = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0); LocalDateTime now = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0);
for (Integer dayOffset : dayCountMap.keySet()) { for (Integer dayOffset : dayCountMap.keySet()) {
@ -463,8 +436,7 @@ public class LearnService implements ILearnService {
} }
for (int i = startIndex; i < startIndex + dayCount; i++) { for (int i = startIndex; i < startIndex + dayCount; i++) {
LearnMessage message = list.get(i); LearnMessage message = list.get(i);
message.setCreateTime( message.setCreateTime(now.minusDays(dayOffset).plusSeconds(secondsOffsetList.get(i - startIndex)));
now.minusDays(dayOffset).plusSeconds(secondsOffsetList.get(i - startIndex)));
learnMessageDAO.updateByPrimaryKey(message); learnMessageDAO.updateByPrimaryKey(message);
} }
startIndex += dayCount; startIndex += dayCount;
@ -547,8 +519,7 @@ public class LearnService implements ILearnService {
private LearnMessage getMessageEntity(Long messageId) { private LearnMessage getMessageEntity(Long messageId) {
LearnMessage message = findMessageEntity(messageId); LearnMessage message = findMessageEntity(messageId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(message, BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(message, String.format("id为[%s]的留言不存在", messageId));
String.format("id为[%s]的留言不存在", messageId));
return message; return message;
} }
@ -568,8 +539,7 @@ public class LearnService implements ILearnService {
private void confirmPostIsNotExist(String project) { private void confirmPostIsNotExist(String project) {
LearnPostExample example = new LearnPostExample(); LearnPostExample example = new LearnPostExample();
example.createCriteria().andProjectEqualTo(project); example.createCriteria().andProjectEqualTo(project);
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertTrue( BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertTrue(learnPostDAO.countByExample(example) == 0,
learnPostDAO.countByExample(example) == 0,
String.format("项目[%s]下留言板已存在", project)); String.format("项目[%s]下留言板已存在", project));
} }
} }

View File

@ -256,9 +256,7 @@ public class MapService implements IMapService, ApplicationRunner {
@Override @Override
public MapVO getMapDetail(Long id) { public MapVO getMapDetail(Long id) {
Objects.requireNonNull(id, "id不能为空"); Objects.requireNonNull(id, "id不能为空");
if (id < 0) { if (id < 0) return null;
return null;
}
MapVO mapVO = (MapVO) this.iCacheService.get(BusinessConsts.CachePrefix.Map + id); MapVO mapVO = (MapVO) this.iCacheService.get(BusinessConsts.CachePrefix.Map + id);
if (Objects.isNull(mapVO)) { // 缓存不存在查询数据库 if (Objects.isNull(mapVO)) { // 缓存不存在查询数据库
synchronized (this) { synchronized (this) {
@ -439,9 +437,8 @@ public class MapService implements IMapService, ApplicationRunner {
/** /**
* 创建地图信息 * 创建地图信息
* <p>
* 所有参数的正确性需调用方保证这里不做任何校验
* *
* 所有参数的正确性需调用方保证这里不做任何校验
* @return 创建的实体 * @return 创建的实体
*/ */
private MapInfo createMapInfo(String name, String cityCode, String lineCode) { private MapInfo createMapInfo(String name, String cityCode, String lineCode) {

View File

@ -6,12 +6,7 @@ import club.joylink.rtss.constants.StatusEnum;
import club.joylink.rtss.dao.OrgDAO; import club.joylink.rtss.dao.OrgDAO;
import club.joylink.rtss.dao.SysAccountDAO; import club.joylink.rtss.dao.SysAccountDAO;
import club.joylink.rtss.dao.UserSubscribeMapper; import club.joylink.rtss.dao.UserSubscribeMapper;
import club.joylink.rtss.entity.Org; import club.joylink.rtss.entity.*;
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.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.cache.ICacheService; import club.joylink.rtss.services.cache.ICacheService;
import club.joylink.rtss.services.org.IOrgProjectService; import club.joylink.rtss.services.org.IOrgProjectService;
@ -19,19 +14,10 @@ import club.joylink.rtss.services.org.IOrgService;
import club.joylink.rtss.services.org.IOrgUserService; import club.joylink.rtss.services.org.IOrgUserService;
import club.joylink.rtss.util.EncryptUtil; import club.joylink.rtss.util.EncryptUtil;
import club.joylink.rtss.util.RandomGenerator; import club.joylink.rtss.util.RandomGenerator;
import club.joylink.rtss.vo.AccountVO; import club.joylink.rtss.vo.*;
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.PageVO;
import club.joylink.rtss.vo.client.org.OrgVO; import club.joylink.rtss.vo.client.org.OrgVO;
import club.joylink.rtss.vo.client.user.MobileInfoVO; import club.joylink.rtss.vo.client.user.*;
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.map.MapVO;
import club.joylink.rtss.vo.user.AccountCreateVO; import club.joylink.rtss.vo.user.AccountCreateVO;
import club.joylink.rtss.vo.user.AccountRegisterVO; import club.joylink.rtss.vo.user.AccountRegisterVO;
@ -39,18 +25,6 @@ import club.joylink.rtss.vo.wx.WmUserSession;
import club.joylink.rtss.vo.wx.WxUserGet; import club.joylink.rtss.vo.wx.WxUserGet;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; 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.NonNull;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -60,10 +34,16 @@ import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; 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 @Service
@Slf4j @Slf4j
public class SysUserService implements ISysUserService { public class SysUserService implements ISysUserService {
/** /**
* 默认中国码 * 默认中国码
*/ */
@ -167,9 +147,7 @@ public class SysUserService implements ISysUserService {
SysAccountExample example = new SysAccountExample(); SysAccountExample example = new SysAccountExample();
example.createCriteria().andAccountEqualTo(account).andTypeEqualTo(AccountVO.Type_2); example.createCriteria().andAccountEqualTo(account).andTypeEqualTo(AccountVO.Type_2);
List<SysAccount> sysUsers = this.sysAccountDAO.selectByExample(example); List<SysAccount> sysUsers = this.sysAccountDAO.selectByExample(example);
if (CollectionUtils.isEmpty(sysUsers)) { if (CollectionUtils.isEmpty(sysUsers)) return null;
return null;
}
return new AccountVO(sysUsers.get(0)); return new AccountVO(sysUsers.get(0));
} }
@ -178,9 +156,7 @@ public class SysUserService implements ISysUserService {
SysAccountExample example = new SysAccountExample(); SysAccountExample example = new SysAccountExample();
example.createCriteria().andAccountEqualTo(account); example.createCriteria().andAccountEqualTo(account);
List<SysAccount> sysUsers = this.sysAccountDAO.selectByExample(example); List<SysAccount> sysUsers = this.sysAccountDAO.selectByExample(example);
if (CollectionUtils.isEmpty(sysUsers)) { if (CollectionUtils.isEmpty(sysUsers)) return null;
return null;
}
return new AccountVO(sysUsers.get(0)); return new AccountVO(sysUsers.get(0));
} }
@ -379,8 +355,7 @@ public class SysUserService implements ISysUserService {
BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotHasText(account.getWmOpenId(), BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotHasText(account.getWmOpenId(),
String.format("用户[%s]已经绑定微信小程序", account.getNickname())); String.format("用户[%s]已经绑定微信小程序", account.getNickname()));
// 如果之前已经存在绑定解除之前的绑定 // 如果之前已经存在绑定解除之前的绑定
WmUserSession userSession = this.iWxApiService.getWmUserSession(WxApiService.MiniApp.JoyLink, WmUserSession userSession = this.iWxApiService.getWmUserSession(WxApiService.MiniApp.JoyLink, code);
code);
String openid = userSession.getOpenid(); String openid = userSession.getOpenid();
SysAccountExample example = new SysAccountExample(); SysAccountExample example = new SysAccountExample();
example.createCriteria() example.createCriteria()
@ -412,8 +387,7 @@ public class SysUserService implements ISysUserService {
@Transactional @Transactional
public OrgVO userScanCodeBindCompanyManager(Long userId, Long companyId) { public OrgVO userScanCodeBindCompanyManager(Long userId, Long companyId) {
SysAccount sysAccount = sysAccountDAO.selectByPrimaryKey(userId); SysAccount sysAccount = sysAccountDAO.selectByPrimaryKey(userId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(sysAccount, BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(sysAccount, String.format("id为[%s]的用户不存在", userId));
String.format("id为[%s]的用户不存在", userId));
AccountVO accountVO = new AccountVO(sysAccount); AccountVO accountVO = new AccountVO(sysAccount);
OrgVO orgVO = iOrgUserService.userBindCompanyManager(accountVO, companyId); OrgVO orgVO = iOrgUserService.userBindCompanyManager(accountVO, companyId);
this.loginSessionManager.updateLoginUser(accountVO); this.loginSessionManager.updateLoginUser(accountVO);
@ -676,8 +650,7 @@ public class SysUserService implements ISysUserService {
@Override @Override
public void updateMobile(Long id, UpdateMobileVO updateMobileVO) { public void updateMobile(Long id, UpdateMobileVO updateMobileVO) {
Objects.requireNonNull(id, "用户id不能为空"); Objects.requireNonNull(id, "用户id不能为空");
validateMobileVerificationCode(updateMobileVO.getNationCode(), updateMobileVO.getMobile(), validateMobileVerificationCode(updateMobileVO.getNationCode(), updateMobileVO.getMobile(), updateMobileVO.getValidCode());
updateMobileVO.getValidCode());
SysAccount account = this.sysAccountDAO.selectByPrimaryKey(id); SysAccount account = this.sysAccountDAO.selectByPrimaryKey(id);
if (Objects.nonNull(account)) { if (Objects.nonNull(account)) {
account.setNationcode(updateMobileVO.getNationCode()); account.setNationcode(updateMobileVO.getNationCode());
@ -688,8 +661,7 @@ public class SysUserService implements ISysUserService {
} }
} }
private void validateMobileVerificationCode(String nationCode, String mobile, private void validateMobileVerificationCode(String nationCode, String mobile, String verificationCode) {
String verificationCode) {
VdCode vdCode = (VdCode) this.iCacheService.get(nationCode + mobile); VdCode vdCode = (VdCode) this.iCacheService.get(nationCode + mobile);
// 验证验证码 // 验证验证码
BusinessExceptionAssertEnum.INCORRECT_VERIFICATION_CODE.assertNotNull(vdCode); BusinessExceptionAssertEnum.INCORRECT_VERIFICATION_CODE.assertNotNull(vdCode);
@ -728,20 +700,16 @@ public class SysUserService implements ISysUserService {
@Override @Override
public String sendMobileValidCode(MobileInfoVO mobileInfoVO) { public String sendMobileValidCode(MobileInfoVO mobileInfoVO) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(mobileInfoVO.validate(), BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(mobileInfoVO.validate(), "发送验证码请求未通过");
"发送验证码请求未通过");
String code = RandomGenerator.getByLen(4); String code = RandomGenerator.getByLen(4);
long ts = System.currentTimeMillis(); long ts = System.currentTimeMillis();
List<String> params = new ArrayList<>(); List<String> params = new ArrayList<>();
params.add(code); params.add(code);
params.add(VdCode.CODE_TIMEOUT + ""); params.add(VdCode.CODE_TIMEOUT + "");
SmsResponse resp = this.iSmsService.sendValidateCode(mobileInfoVO.getMobile(), SmsResponse resp = this.iSmsService.sendValidateCode(mobileInfoVO.getMobile(), mobileInfoVO.getNationCode(), params, ts);
mobileInfoVO.getNationCode(), params, ts);
BusinessExceptionAssertEnum.THIRD_SERVICE_CALL_EXCEPTION.assertTrue(resp.getResult() == 0, BusinessExceptionAssertEnum.THIRD_SERVICE_CALL_EXCEPTION.assertTrue(resp.getResult() == 0,
String.format("短信发送服务调用异常:[result: %s, errmsg: %s]", resp.getResult(), String.format("短信发送服务调用异常:[result: %s, errmsg: %s]", resp.getResult(), resp.getErrmsg()));
resp.getErrmsg())); iCacheService.putExpired(mobileInfoVO.buildUp(), new VdCode(code, ts), VdCode.CODE_TIMEOUT, TimeUnit.MINUTES);
iCacheService.putExpired(mobileInfoVO.buildUp(), new VdCode(code, ts), VdCode.CODE_TIMEOUT,
TimeUnit.MINUTES);
log.debug(String.format("短息发送手机%s验证码[%s]", mobileInfoVO.buildUp(), code)); log.debug(String.format("短息发送手机%s验证码[%s]", mobileInfoVO.buildUp(), code));
return EncryptUtil.md5(code); return EncryptUtil.md5(code);
} }
@ -756,8 +724,7 @@ public class SysUserService implements ISysUserService {
private void updatePwdByMobileVdCode(UpdatePasswordVO updatePasswordVO, SysAccount account) { private void updatePwdByMobileVdCode(UpdatePasswordVO updatePasswordVO, SysAccount account) {
if (Objects.nonNull(account)) { if (Objects.nonNull(account)) {
VdCode vdCode = (VdCode) this.iCacheService.get( VdCode vdCode = (VdCode) this.iCacheService.get(account.getNationcode() + account.getMobile());
account.getNationcode() + account.getMobile());
BusinessExceptionAssertEnum.INCORRECT_VERIFICATION_CODE.assertNotNull(vdCode); BusinessExceptionAssertEnum.INCORRECT_VERIFICATION_CODE.assertNotNull(vdCode);
// 验证验证码 // 验证验证码
vdCode.isValidCode(updatePasswordVO.getVfCode()); vdCode.isValidCode(updatePasswordVO.getVfCode());
@ -815,8 +782,7 @@ public class SysUserService implements ISysUserService {
SysAccountExample example = new SysAccountExample(); SysAccountExample example = new SysAccountExample();
example.createCriteria().andNameLike(String.format("%%%s%%", name)); example.createCriteria().andNameLike(String.format("%%%s%%", name));
List<SysAccount> users = sysAccountDAO.selectByExample(example); List<SysAccount> users = sysAccountDAO.selectByExample(example);
List<AccountVO> voList = users.stream().map(account -> new AccountVO(account)) List<AccountVO> voList = users.stream().map(account -> new AccountVO(account)).collect(Collectors.toList());
.collect(Collectors.toList());
return voList; return voList;
} }
@ -829,8 +795,7 @@ public class SysUserService implements ISysUserService {
@Override @Override
public List<AccountVO> getUsersWithEmail() { public List<AccountVO> getUsersWithEmail() {
SysAccountExample example = new SysAccountExample(); SysAccountExample example = new SysAccountExample();
example.createCriteria().andMobileIsNotNull().andNationcodeIsNotNull() example.createCriteria().andMobileIsNotNull().andNationcodeIsNotNull().andStatusEqualTo(BusinessConsts.STATUS_USE);
.andStatusEqualTo(BusinessConsts.STATUS_USE);
List<SysAccount> sysUsers = sysAccountDAO.selectByExample(example); List<SysAccount> sysUsers = sysAccountDAO.selectByExample(example);
List<AccountVO> users = sysUsers.stream().map(AccountVO::new).collect(Collectors.toList()); List<AccountVO> users = sysUsers.stream().map(AccountVO::new).collect(Collectors.toList());
return users; return users;
@ -868,15 +833,6 @@ public class SysUserService implements ISysUserService {
} }
} }
@Override
public Map<Long, SysAccount> findEntitiesForMap(List<Long> ids) {
List<SysAccount> accounts = this.findEntities(ids, null);
if (Objects.isNull(accounts)) {
return Collections.emptyMap();
}
return accounts.stream().collect(Collectors.toMap(SysAccount::getId, Function.identity()));
}
@Override @Override
public void confirmExist(Long id) { public void confirmExist(Long id) {
getEntity(id); getEntity(id);
@ -912,8 +868,7 @@ public class SysUserService implements ISysUserService {
private SysAccount getEntity(Long id) { private SysAccount getEntity(Long id) {
SysAccount account = sysAccountDAO.selectByPrimaryKey(id); SysAccount account = sysAccountDAO.selectByPrimaryKey(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(account, BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(account, String.format("id为[%s]的用户不存在", id));
String.format("id为[%s]的用户不存在", id));
return account; return account;
} }
@ -924,8 +879,7 @@ public class SysUserService implements ISysUserService {
@Override @Override
public void register(AccountCreateVO accountCreateVO) { public void register(AccountCreateVO accountCreateVO) {
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue( BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(this.isSameEmailExist(accountCreateVO.getEmail()));
this.isSameEmailExist(accountCreateVO.getEmail()));
SysAccount account = accountCreateVO.toDB(); SysAccount account = accountCreateVO.toDB();
account.setRoles(BusinessConsts.ROLE_01); account.setRoles(BusinessConsts.ROLE_01);
account.setCreateTime(LocalDateTime.now()); account.setCreateTime(LocalDateTime.now());
@ -950,7 +904,7 @@ public class SysUserService implements ISysUserService {
} }
@Override @Override
public AccountVO queryOrCreateThirdAccount(String parentAccount, String account, String name) { public AccountVO queryOrCreateThirdAccount(String parentAccount, String account) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(parentAccount); BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(parentAccount);
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(account); BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(account);
String key = parentAccount + account; String key = parentAccount + account;
@ -971,14 +925,9 @@ public class SysUserService implements ISysUserService {
SysAccount sysAccount = new SysAccount(); SysAccount sysAccount = new SysAccount();
sysAccount.setAccount(account); sysAccount.setAccount(account);
sysAccount.setParentAccount(parentAccount); sysAccount.setParentAccount(parentAccount);
if (StringUtils.hasText(name)) {
sysAccount.setName(name);
sysAccount.setNickname(name);
} else {
sysAccount.setNickname(String.format("第三方账户%s", account)); sysAccount.setNickname(String.format("第三方账户%s", account));
}
sysAccount.setType(AccountVO.Type_3); sysAccount.setType(AccountVO.Type_3);
String initPassword = EncryptUtil.md5(BusinessConsts.DEFAULT_PASSWORD); String initPassword = EncryptUtil.md5("123456");
sysAccount.setPassword(initPassword); sysAccount.setPassword(initPassword);
sysAccount.setStatus(BusinessConsts.STATUS_USE); sysAccount.setStatus(BusinessConsts.STATUS_USE);
sysAccount.setRoles(BusinessConsts.ROLE_01); sysAccount.setRoles(BusinessConsts.ROLE_01);
@ -1054,13 +1003,10 @@ public class SysUserService implements ISysUserService {
@Override @Override
public void register2(AccountRegisterVO registerVO) { public void register2(AccountRegisterVO registerVO) {
if (StringUtils.hasText(registerVO.getMobile())) { if (StringUtils.hasText(registerVO.getMobile())) {
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue( BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(isSameMobileExist(registerVO.getMobile()));
isSameMobileExist(registerVO.getMobile())); validateMobileVerificationCode(registerVO.getNationCode(), registerVO.getMobile(), registerVO.getVerificationCode());
validateMobileVerificationCode(registerVO.getNationCode(), registerVO.getMobile(),
registerVO.getVerificationCode());
} else if (StringUtils.hasText(registerVO.getEmail())) { } else if (StringUtils.hasText(registerVO.getEmail())) {
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue( BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(isSameEmailExist(registerVO.getEmail()));
isSameEmailExist(registerVO.getEmail()));
validateEmailVerificationCode(registerVO.getEmail(), registerVO.getVerificationCode()); validateEmailVerificationCode(registerVO.getEmail(), registerVO.getVerificationCode());
} }
SysAccount sysAccount = registerVO.toDB(); SysAccount sysAccount = registerVO.toDB();
@ -1112,20 +1058,6 @@ public class SysUserService implements ISysUserService {
return sysAccountDAO.countByExample(example) > 0; 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);
}
/** /**
* 查询包含组织信息的用户信息 * 查询包含组织信息的用户信息
*/ */
@ -1151,8 +1083,7 @@ public class SysUserService implements ISysUserService {
* @param account * @param account
*/ */
private void updateLoginUserInfoWithOrgInfo(SysAccount account) { private void updateLoginUserInfoWithOrgInfo(SysAccount account) {
List<LoginUserInfoVO> loginUserInfoVOS = loginSessionManager.queryLoginInfoByUserId( List<LoginUserInfoVO> loginUserInfoVOS = loginSessionManager.queryLoginInfoByUserId(account.getId());
account.getId());
if (!CollectionUtils.isEmpty(loginUserInfoVOS)) { if (!CollectionUtils.isEmpty(loginUserInfoVOS)) {
for (LoginUserInfoVO loginInfo : loginUserInfoVOS) { for (LoginUserInfoVO loginInfo : loginUserInfoVOS) {
AccountVO oldAccountVO = loginInfo.getAccountVO(); AccountVO oldAccountVO = loginInfo.getAccountVO();

View File

@ -3,7 +3,6 @@ package club.joylink.rtss.services.auth;
import club.joylink.rtss.configuration.configProp.OtherConfig; import club.joylink.rtss.configuration.configProp.OtherConfig;
import club.joylink.rtss.configuration.configProp.WeChatConfig; import club.joylink.rtss.configuration.configProp.WeChatConfig;
import club.joylink.rtss.constants.Client; import club.joylink.rtss.constants.Client;
import club.joylink.rtss.constants.ProjectCode;
import club.joylink.rtss.dao.SysAccountLoginDAO; import club.joylink.rtss.dao.SysAccountLoginDAO;
import club.joylink.rtss.entity.SysAccountLogin; import club.joylink.rtss.entity.SysAccountLogin;
import club.joylink.rtss.entity.project.Project; import club.joylink.rtss.entity.project.Project;
@ -23,7 +22,6 @@ import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.LoginStatusVO; import club.joylink.rtss.vo.client.LoginStatusVO;
import club.joylink.rtss.vo.client.LoginUserVO; import club.joylink.rtss.vo.client.LoginUserVO;
import club.joylink.rtss.vo.client.SocketMessageVO; 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.factory.SocketMessageFactory;
import club.joylink.rtss.vo.client.project.ProjectDeviceVO; import club.joylink.rtss.vo.client.project.ProjectDeviceVO;
import club.joylink.rtss.vo.client.project.RelationLoginConfigVO; import club.joylink.rtss.vo.client.project.RelationLoginConfigVO;
@ -241,24 +239,6 @@ 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 去除设置组织信息 * @update 20221019 去除设置组织信息
*/ */
@ -404,7 +384,8 @@ public class AuthenticateService implements IAuthenticateService {
.assertTrue(this.iSysUserService.isThirdParentAccountExist(loginInfo.getParentAccount()), .assertTrue(this.iSysUserService.isThirdParentAccountExist(loginInfo.getParentAccount()),
String.format("第三方企业账号不存在: %s", loginInfo.getParentAccount())); String.format("第三方企业账号不存在: %s", loginInfo.getParentAccount()));
AccountVO accountVO = this.iSysUserService.queryOrCreateThirdAccount( AccountVO accountVO = this.iSysUserService.queryOrCreateThirdAccount(
loginInfo.getParentAccount(), loginInfo.getAccount(), null); loginInfo.getParentAccount(),
loginInfo.getAccount());
Client client = Client.getByIdAndSecret(loginInfo.getClientId(), loginInfo.getSecret()); Client client = Client.getByIdAndSecret(loginInfo.getClientId(), loginInfo.getSecret());
ProjectVO projectVO = projectService.queryLoginProjectByCode(loginInfo.getProject()); ProjectVO projectVO = projectService.queryLoginProjectByCode(loginInfo.getProject());
// 构造登陆用户信息 // 构造登陆用户信息
@ -497,8 +478,6 @@ public class AuthenticateService implements IAuthenticateService {
case ILW: case ILW:
case PIS_STAND: case PIS_STAND:
case PIS_TRAIN: case PIS_TRAIN:
case PIS:
case TMS:
case VR_IBP: { case VR_IBP: {
RelationLoginConfigVO config = deviceVO.buildRelationLoginConfig(); RelationLoginConfigVO config = deviceVO.buildRelationLoginConfig();
if (Objects.nonNull(config) && Objects.nonNull(config.getDeviceCode())) { if (Objects.nonNull(config) && Objects.nonNull(config.getDeviceCode())) {

View File

@ -5,7 +5,6 @@ import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.LoginStatusVO; import club.joylink.rtss.vo.client.LoginStatusVO;
import club.joylink.rtss.vo.client.LoginUserVO; import club.joylink.rtss.vo.client.LoginUserVO;
import club.joylink.rtss.vo.client.cgy.CgyThirdPartyLoginInfoVO;
public interface IAuthenticateService { public interface IAuthenticateService {
@ -65,8 +64,7 @@ public interface IAuthenticateService {
* <p> * <p>
* 测试文档后删除相关注释 * 测试文档后删除相关注释
*/ */
LoginStatusVO getWmLoginUrl(String clientId, String secret, String projectCode, LoginStatusVO getWmLoginUrl(String clientId, String secret, String projectCode, String deviceCode);
String deviceCode);
/** /**
* 微信小程序确认登陆 * 微信小程序确认登陆
@ -123,9 +121,4 @@ public interface IAuthenticateService {
* @param token * @param token
*/ */
void preLogout(String token); void preLogout(String token);
/**
* 成工业虚仿平台跳转登录接口
*/
String cgyThirdPartyLogin(CgyThirdPartyLoginInfoVO loginInfo);
} }

View File

@ -1,171 +0,0 @@
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)); //实训时长
}
}

View File

@ -77,11 +77,9 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
public CiGenerateResultVO generate(Long mapId) { public CiGenerateResultVO generate(Long mapId) {
// 先校验地图基础数据 // 先校验地图基础数据
MapVO mapVO = this.draftMapService.getDraftMapData(mapId); MapVO mapVO = this.draftMapService.getDraftMapData(mapId);
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildBasicMapData( SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildBasicMapData(mapVO);
mapVO);
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(), BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
String.format("地图基础数据有错误: %s", String.format("地图基础数据有错误: %s", JsonUtils.writeValueAsString(buildResult.getErrMsgList())));
JsonUtils.writeValueAsString(buildResult.getErrMsgList())));
MapCiGenerateConfig generateConfig = mapVO.getGraphDataNew().getGenerateConfig(); MapCiGenerateConfig generateConfig = mapVO.getGraphDataNew().getGenerateConfig();
Map<String, MapElement> deviceMap = buildResult.getDeviceMap(); Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
// 联锁关系数据生成 // 联锁关系数据生成
@ -123,8 +121,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
autoReentryVOList.add(MapAutoReentryVO.fromBO(cycle)); autoReentryVOList.add(MapAutoReentryVO.fromBO(cycle));
} }
// 目的地码 // 目的地码
List<MapDestinationCodeDefinitionVO> destinationCodeDefinitionVOList = result.getDestinationCodeDefinitionList() List<MapDestinationCodeDefinitionVO> destinationCodeDefinitionVOList = result.getDestinationCodeDefinitionList().stream()
.stream()
.map(MapDestinationCodeDefinitionVO::fromBO).collect(Collectors.toList()); .map(MapDestinationCodeDefinitionVO::fromBO).collect(Collectors.toList());
// 删除旧联锁数据保存新联锁数据 // 删除旧联锁数据保存新联锁数据
@ -140,11 +137,9 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
public int generateDepot(Long mapId, String stationCode) { public int generateDepot(Long mapId, String stationCode) {
// 先校验地图基础数据 // 先校验地图基础数据
MapVO mapVO = this.draftMapService.getDraftMapData(mapId); MapVO mapVO = this.draftMapService.getDraftMapData(mapId);
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildBasicMapData( SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildBasicMapData(mapVO);
mapVO);
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(), BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
String.format("地图基础数据有错误: %s", String.format("地图基础数据有错误: %s", JsonUtils.writeValueAsString(buildResult.getErrMsgList())));
JsonUtils.writeValueAsString(buildResult.getErrMsgList())));
MapCiGenerateConfig generateConfig = mapVO.getGraphDataNew().getGenerateConfig(); MapCiGenerateConfig generateConfig = mapVO.getGraphDataNew().getGenerateConfig();
Map<String, MapElement> deviceMap = buildResult.getDeviceMap(); Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
// 处理旧数据 // 处理旧数据
@ -177,17 +172,13 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
// 列车兼调车信号机调车信号机 // 列车兼调车信号机调车信号机
if (signal.getType().equals(Signal.SignalType.SHUNTING2)) { if (signal.getType().equals(Signal.SignalType.SHUNTING2)) {
signal.setType(Signal.SignalType.SHUNTING); signal.setType(Signal.SignalType.SHUNTING);
generatedRouteList.addAll( generatedRouteList.addAll(this.generateRouteDepot(signal, routeCodeGenerator, generateConfig, errorList));
this.generateRouteDepot(signal, routeCodeGenerator, generateConfig, errorList));
signal.setType(Signal.SignalType.SHUNTING2); signal.setType(Signal.SignalType.SHUNTING2);
generatedRouteList.addAll( generatedRouteList.addAll(this.generateRouteDepot(signal, routeCodeGenerator, generateConfig, errorList));
this.generateRouteDepot(signal, routeCodeGenerator, generateConfig, errorList));
} else if (signal.getType().equals(Signal.SignalType.SHUNTING)) { } else if (signal.getType().equals(Signal.SignalType.SHUNTING)) {
generatedRouteList.addAll( generatedRouteList.addAll(this.generateRouteDepot(signal, routeCodeGenerator, generateConfig, errorList));
this.generateRouteDepot(signal, routeCodeGenerator, generateConfig, errorList));
} else if (signal.getType().equals(Signal.SignalType.INBOUND)) { } else if (signal.getType().equals(Signal.SignalType.INBOUND)) {
generatedRouteList.addAll( generatedRouteList.addAll(this.generateRouteDepot(signal, routeCodeGenerator, generateConfig, errorList));
this.generateRouteDepot(signal, routeCodeGenerator, generateConfig, errorList));
} }
} }
log.info(String.format("生成一般进路[%s]条", generatedRouteList.size())); log.info(String.format("生成一般进路[%s]条", generatedRouteList.size()));
@ -210,7 +201,6 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
* 唯一编码生成器 * 唯一编码生成器
*/ */
public static class CodeGenerator { public static class CodeGenerator {
public static final String Prefix_Route = "Route"; public static final String Prefix_Route = "Route";
public static final String Prefix_Overlap = "Overlap"; public static final String Prefix_Overlap = "Overlap";
public static final String Prefix_Fls = "Fls"; public static final String Prefix_Fls = "Fls";
@ -262,7 +252,6 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
@Getter @Getter
private class CiGenerateResult { private class CiGenerateResult {
private List<String> errMsgList; private List<String> errMsgList;
private List<Signal> approachList; private List<Signal> approachList;
@ -275,10 +264,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
List<MapRoutingDataVO> routingList; List<MapRoutingDataVO> routingList;
public CiGenerateResult(List<String> errMsgList, List<Signal> approachList, public CiGenerateResult(List<String> errMsgList, List<Signal> approachList, List<AutoSignal> autoSignalList, List<Route> routeList,
List<AutoSignal> autoSignalList, List<Route> routeList, List<RouteOverlap> overlapList, List<RouteFls> flsList, List<Cycle> generateCycleList, List<MapRoutingDataVO> routingList,
List<RouteOverlap> overlapList, List<RouteFls> flsList, List<Cycle> generateCycleList,
List<MapRoutingDataVO> routingList,
List<DestinationCodeDefinition> destinationCodeDefinitionList) { List<DestinationCodeDefinition> destinationCodeDefinitionList) {
this.errMsgList = errMsgList; this.errMsgList = errMsgList;
this.approachList = approachList; this.approachList = approachList;
@ -313,8 +300,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
} }
private CiGenerateResult generate(Long mapId, Map<String, MapElement> deviceMap, private CiGenerateResult generate(Long mapId, Map<String, MapElement> deviceMap, MapCiGenerateConfig config) {
MapCiGenerateConfig config) {
List<String> errorList = new ArrayList<>(); List<String> errorList = new ArrayList<>();
List<AutoSignal> autoSignalList = new ArrayList<>(); List<AutoSignal> autoSignalList = new ArrayList<>();
List<Route> generatedRouteList = new ArrayList<>(); List<Route> generatedRouteList = new ArrayList<>();
@ -326,7 +312,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
List<Signal> signalList = deviceMap.values().stream() List<Signal> signalList = deviceMap.values().stream()
.filter(mapElement -> mapElement.getDeviceType().equals(MapElement.DeviceType.SIGNAL)) .filter(mapElement -> mapElement.getDeviceType().equals(MapElement.DeviceType.SIGNAL))
.map(mapElement -> ((Signal) mapElement)) .map(mapElement -> ((Signal) mapElement))
.filter(signal -> !signal.getInterlockStation().isDepot()) // .filter(signal -> !signal.getInterlockStation().isDepot())
.collect(Collectors.toList()); .collect(Collectors.toList());
// 获取所有道岔 // 获取所有道岔
List<Switch> switchList = deviceMap.values().stream() List<Switch> switchList = deviceMap.values().stream()
@ -363,11 +349,10 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if (Objects.nonNull(autoSignal)) { if (Objects.nonNull(autoSignal)) {
autoSignalList.add(autoSignal); autoSignalList.add(autoSignal);
} }
} else if (signal.isProtectionSignal()) { } else if (signal.isProtectionSignal() || signal.isShunting2()) {
// 防护信号机生成进路 // 防护信号机生成进路
if (config.isLikeHa1()) { if (config.isLikeHa1()) {
generatedRouteList.addAll( generatedRouteList.addAll(this.generateRouteLikeHa1(signal, routeCodeGenerator, overlapMap,
this.generateRouteLikeHa1(signal, routeCodeGenerator, overlapMap,
overlapCodeGenerator, config, errorList)); overlapCodeGenerator, config, errorList));
} else { } else {
generatedRouteList.addAll(this.generateRoute(signal, generatedRouteList.addAll(this.generateRoute(signal,
@ -422,8 +407,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
} }
// 根据配置生成折返进路 // 根据配置生成折返进路
if (config.isGenerateTbRoute()) { if (config.isGenerateTbRoute()) {
List<Route> tbRouteList = this.generateTurnBackRoute(generatedRouteList, routeCodeGenerator, List<Route> tbRouteList = this.generateTurnBackRoute(generatedRouteList, routeCodeGenerator, config);
config);
generatedRouteList.addAll(tbRouteList); generatedRouteList.addAll(tbRouteList);
} }
// 清除不需要的基本进路 // 清除不需要的基本进路
@ -458,8 +442,15 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
} }
// 生成交路数据 // 生成交路数据
List<MapRoutingDataVO> generateRoutingList = this.routingGenerator.generateAllRouting(deviceMap, List<MapRoutingDataVO> generateRoutingList = this.routingGenerator.generateAllRouting(deviceMap, errorList);
errorList);
//站间运行等级生成
// List<MapStationRunLevelVO> generatedStationRunLevelList =
// this.runLevelGenerator.generateRunLevels(
// generateRoutingList, deviceMap, errorList
// );
// 停站时间生成
// List<MapStationParkingTimeVO> parkTimeList = this.parkTimeGenerator.generate(deviceMap, errorList);
//目的地码生成 //目的地码生成
List<DestinationCodeDefinition> destinationCodeDefinitionList List<DestinationCodeDefinition> destinationCodeDefinitionList
@ -470,8 +461,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
generateCycleList, generateRoutingList, destinationCodeDefinitionList); generateCycleList, generateRoutingList, destinationCodeDefinitionList);
} }
private List<DestinationCodeDefinition> generateDestinationCodeDefinition( private List<DestinationCodeDefinition> generateDestinationCodeDefinition(MapCiGenerateConfig config, List<Section> sectionList, List<Station> stationList) {
MapCiGenerateConfig config, List<Section> sectionList, List<Station> stationList) {
List<DestinationCodeDefinition> destinationCodeDefinitionList = new ArrayList<>(); List<DestinationCodeDefinition> destinationCodeDefinitionList = new ArrayList<>();
if (config.isGenerateDestination()) { if (config.isGenerateDestination()) {
String code = null; String code = null;
@ -491,12 +481,9 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
for (int i = 0; i < stationList.size(); i++) { for (int i = 0; i < stationList.size(); i++) {
leftStation = stationList.get(i); leftStation = stationList.get(i);
if (CollectionUtils.isEmpty(leftStation.getTurnBackList())) //没有折返轨的略过 if (CollectionUtils.isEmpty(leftStation.getTurnBackList())) //没有折返轨的略过
{
continue; continue;
} if (i == stationList.size() - 1)
if (i == stationList.size() - 1) {
break; break;
}
List<Section> leftTbSections = queryAfterTurnBackList(leftStation, false); List<Section> leftTbSections = queryAfterTurnBackList(leftStation, false);
leftTbSections.addAll(queryFrontTurnBackList(stationList, leftStation, false)); leftTbSections.addAll(queryFrontTurnBackList(stationList, leftStation, false));
@ -516,10 +503,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
leftFrontTurnBack = startTbSection.isNormalStandTrack(); leftFrontTurnBack = startTbSection.isNormalStandTrack();
rightFrontTurnBack = endTbSection.isNormalStandTrack(); rightFrontTurnBack = endTbSection.isNormalStandTrack();
destinationCodeDefinitionList.add( destinationCodeDefinitionList.add(
new DestinationCodeDefinition(code, type, description, null, null, right, new DestinationCodeDefinition(code, type, description, null, null, right, necessarySections,
necessarySections, leftStation, leftFrontTurnBack, rightStation, rightFrontTurnBack, null, null, null)
leftStation, leftFrontTurnBack, rightStation, rightFrontTurnBack, null, null,
null)
); );
} }
} }
@ -532,9 +517,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if (!StringUtils.hasText(destinationCode)) { if (!StringUtils.hasText(destinationCode)) {
continue; continue;
} }
destinationCodeDefinitionList.add( destinationCodeDefinitionList.add(new DestinationCodeDefinition(destinationCode, DestinationCodeDefinition.Type.OTHER, section));
new DestinationCodeDefinition(destinationCode, DestinationCodeDefinition.Type.OTHER,
section));
} }
} }
} }
@ -547,11 +530,9 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
* @param stations 所有车站 * @param stations 所有车站
* @param right 是否是右端车站 * @param right 是否是右端车站
*/ */
private List<Section> queryFrontTurnBackList(List<Station> stations, Station station, private List<Section> queryFrontTurnBackList(List<Station> stations, Station station, boolean right) {
boolean right) {
List<Section> turnBackList = station.getTurnBackList(); List<Section> turnBackList = station.getTurnBackList();
if (CollectionUtils.isEmpty(turnBackList) || CollectionUtils.isEmpty( if (CollectionUtils.isEmpty(turnBackList) || CollectionUtils.isEmpty(station.getAllNormalStands())) {
station.getAllNormalStands())) {
return new ArrayList<>(); return new ArrayList<>();
} }
int sn; int sn;
@ -571,28 +552,20 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
List<Section> tbSections = new ArrayList<>(); List<Section> tbSections = new ArrayList<>();
if (right) { if (right) {
if (rightStandTrack.isTurnBackTrack() if (rightStandTrack.isTurnBackTrack()
&& !CollectionUtils.isEmpty( && !CollectionUtils.isEmpty(CalculateService.queryRoutePathsOnDirection(rightStandTrack, adjacentLeftStandTrack, false, 10))) {
CalculateService.queryRoutePathsOnDirection(rightStandTrack, adjacentLeftStandTrack,
false, 10))) {
tbSections.add(rightStandTrack); tbSections.add(rightStandTrack);
} }
if (leftStandTrack.isTurnBackTrack() if (leftStandTrack.isTurnBackTrack()
&& !CollectionUtils.isEmpty( && !CollectionUtils.isEmpty(CalculateService.queryRoutePathsOnDirection(adjacentRightStandTrack, leftStandTrack, true, 10))) {
CalculateService.queryRoutePathsOnDirection(adjacentRightStandTrack, leftStandTrack, true,
10))) {
tbSections.add(leftStandTrack); tbSections.add(leftStandTrack);
} }
} else { } else {
if (rightStandTrack.isTurnBackTrack() if (rightStandTrack.isTurnBackTrack()
&& !CollectionUtils.isEmpty( && !CollectionUtils.isEmpty(CalculateService.queryRoutePathsOnDirection(adjacentLeftStandTrack, rightStandTrack, false, 10))) {
CalculateService.queryRoutePathsOnDirection(adjacentLeftStandTrack, rightStandTrack,
false, 10))) {
tbSections.add(rightStandTrack); tbSections.add(rightStandTrack);
} }
if (leftStandTrack.isTurnBackTrack() if (leftStandTrack.isTurnBackTrack()
&& !CollectionUtils.isEmpty( && !CollectionUtils.isEmpty(CalculateService.queryRoutePathsOnDirection(leftStandTrack, adjacentRightStandTrack, true, 10))) {
CalculateService.queryRoutePathsOnDirection(leftStandTrack, adjacentRightStandTrack, true,
10))) {
tbSections.add(leftStandTrack); tbSections.add(leftStandTrack);
} }
} }
@ -611,20 +584,17 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
} }
Section standTrack = station.getNormalStand(right).get(0).getSection(); Section standTrack = station.getNormalStand(right).get(0).getSection();
return turnBackList.stream().filter(section -> !section.isNormalStandTrack()) return turnBackList.stream().filter(section -> !section.isNormalStandTrack())
.filter(section -> !CollectionUtils.isEmpty( .filter(section -> !CollectionUtils.isEmpty(CalculateService.queryRoutePathsOnDirection(standTrack, section, right, 10)))
CalculateService.queryRoutePathsOnDirection(standTrack, section, right, 10)))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
private Collection<? extends Route> generateRouteLikeHa1(Signal signal, private Collection<? extends Route> generateRouteLikeHa1(Signal signal, CodeGenerator routeCodeGenerator,
CodeGenerator routeCodeGenerator,
Map<String, List<RouteOverlap>> overlapMap, Map<String, List<RouteOverlap>> overlapMap,
CodeGenerator overlapCodeGenerator, CodeGenerator overlapCodeGenerator,
MapCiGenerateConfig config, List<String> errorList) { MapCiGenerateConfig config, List<String> errorList) {
// 生成ATP信号 // 生成ATP信号
List<Route> routeList = new ArrayList<>(); List<Route> routeList = new ArrayList<>();
List<Route> atpRouteList = this.generateRoute(signal, routeCodeGenerator, overlapMap, List<Route> atpRouteList = this.generateRoute(signal, routeCodeGenerator, overlapMap, overlapCodeGenerator, config, errorList);
overlapCodeGenerator, config, errorList);
if (!CollectionUtils.isEmpty(atpRouteList)) { if (!CollectionUtils.isEmpty(atpRouteList)) {
for (Route route : atpRouteList) { for (Route route : atpRouteList) {
route.setAtp(true); route.setAtp(true);
@ -636,8 +606,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
} }
} }
// 生成地面信号 // 生成地面信号
List<Route> groundRouteList = this.generateGroundRoute(signal, routeCodeGenerator, overlapMap, List<Route> groundRouteList = this.generateGroundRoute(signal, routeCodeGenerator, overlapMap, overlapCodeGenerator, config, errorList);
overlapCodeGenerator, config, errorList);
if (!CollectionUtils.isEmpty(groundRouteList)) { if (!CollectionUtils.isEmpty(groundRouteList)) {
for (Route ground : groundRouteList) { for (Route ground : groundRouteList) {
ground.setGround(true); ground.setGround(true);
@ -648,16 +617,14 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
// 生成引导信号 // 生成引导信号
if (!CollectionUtils.isEmpty(groundRouteList)) { if (!CollectionUtils.isEmpty(groundRouteList)) {
for (Route route : groundRouteList) { for (Route route : groundRouteList) {
Route guide = this.buildGuideRouteFromGroundRoute(route, routeCodeGenerator, Route guide = this.buildGuideRouteFromGroundRoute(route, routeCodeGenerator, config.isRouteInterlockDoNotIncludeStandHoldTrain());
config.isRouteInterlockDoNotIncludeStandHoldTrain());
routeList.add(guide); routeList.add(guide);
} }
} }
return routeList; return routeList;
} }
private Route buildGuideRouteFromGroundRoute(Route route, CodeGenerator routeCodeGenerator, private Route buildGuideRouteFromGroundRoute(Route route, CodeGenerator routeCodeGenerator, boolean noStandHold) {
boolean noStandHold) {
Route clone = new Route(routeCodeGenerator.next(), route.getName()); Route clone = new Route(routeCodeGenerator.next(), route.getName());
clone.setArs(false); clone.setArs(false);
clone.setGuide(true); clone.setGuide(true);
@ -688,8 +655,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
List<SectionPath> routePathList = new ArrayList<>(); List<SectionPath> routePathList = new ArrayList<>();
getRoutePathOf(signal, startSection, true, getRoutePathOf(signal, startSection, true,
new SectionPath(right), routePathList, config, errorList); new SectionPath(right), routePathList, config, errorList);
List<Route> routeList = this.buildRouteFromPath(signal, routeCodeGenerator, routePathList, List<Route> routeList = this.buildRouteFromPath(signal, routeCodeGenerator, routePathList, overlapMap,
overlapMap,
overlapCodeGenerator, config, errorList); overlapCodeGenerator, config, errorList);
return routeList; return routeList;
} }
@ -718,8 +684,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
return routeList; return routeList;
} }
private List<Route> buildRouteFromPath(Signal start, CodeGenerator routeCodeGenerator, private List<Route> buildRouteFromPath(Signal start, CodeGenerator routeCodeGenerator, List<SectionPath> routePathList,
List<SectionPath> routePathList,
Map<String, List<RouteOverlap>> overlapMap, Map<String, List<RouteOverlap>> overlapMap,
CodeGenerator overlapCodeGenerator, CodeGenerator overlapCodeGenerator,
MapCiGenerateConfig config, List<String> errorList) { MapCiGenerateConfig config, List<String> errorList) {
@ -728,8 +693,6 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if (!CollectionUtils.isEmpty(routePathList)) { if (!CollectionUtils.isEmpty(routePathList)) {
for (SectionPath sectionPath : routePathList) { for (SectionPath sectionPath : routePathList) {
Section lastSection = sectionPath.getLastSection(); Section lastSection = sectionPath.getLastSection();
//最后一个区段是轨道尽头则认为是单列车进路
boolean singleTrain = lastSection.getNextSection(sectionPath.isRight()) == null;
Signal end = lastSection.getSignalOf(right); Signal end = lastSection.getSignalOf(right);
List<RouteOverlap> overlapList = overlapMap.get(end.getCode()); List<RouteOverlap> overlapList = overlapMap.get(end.getCode());
// 根据配置是否有延续保护生成 // 根据配置是否有延续保护生成
@ -759,41 +722,36 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
clickEnd = this.queryNearlySignalOf(start, sectionPath); clickEnd = this.queryNearlySignalOf(start, sectionPath);
} }
// 构建进路 // 构建进路
if (config.isRouteApartByOverlap() && !CollectionUtils.isEmpty(overlapList)) { if (config.isRouteApartByOverlap() && overlapList != null && overlapList.size() > 1) {
int index = 1; int index = 1;
for (RouteOverlap routeOverlap : overlapList) { for (RouteOverlap routeOverlap : overlapList) {
String code = routeCodeGenerator.next(); String code = routeCodeGenerator.next();
String name = String.format("%s-%s_%s", start.getName(), endName, index); String name = String.format("%s-%s_%s", start.getName(), endName, index);
Route route = this.buildRoute(code, name, start, end, clickEnd, sectionPath, Route route = this.buildRoute(code, name, start, end, clickEnd, sectionPath,
routeOverlap, routeOverlap, config.isRouteSignalAlwaysGreen(), config.isRouteInterlockDoNotIncludeStandHoldTrain());
config.isRouteSignalAlwaysGreen(),
config.isRouteInterlockDoNotIncludeStandHoldTrain(), singleTrain);
routeList.add(route); routeList.add(route);
++index; ++index;
} }
} else if (config.isOverlapSettingByTrigger()) { // 触发建立进路不绑定延续保护 } else if (config.isOverlapSettingByTrigger()) { // 触发建立进路不绑定延续保护
String code = routeCodeGenerator.next(); String code = routeCodeGenerator.next();
String name = String.format("%s-%s", start.getName(), endName); String name = String.format("%s-%s", start.getName(), endName);
Route route = this.buildRoute(code, name, start, end, clickEnd, sectionPath, null, Route route = this.buildRoute(code, name, start, end, clickEnd, sectionPath,
config.isRouteSignalAlwaysGreen(), null, config.isRouteSignalAlwaysGreen(), config.isRouteInterlockDoNotIncludeStandHoldTrain());
config.isRouteInterlockDoNotIncludeStandHoldTrain(), singleTrain);
routeList.add(route); routeList.add(route);
} else { } else {
String code = routeCodeGenerator.next(); String code = routeCodeGenerator.next();
String name = String.format("%s-%s", start.getName(), endName); String name = String.format("%s-%s", start.getName(), endName);
RouteOverlap overlap = null; RouteOverlap overlap = null;
if (!CollectionUtils.isEmpty(overlapList)) { if (!CollectionUtils.isEmpty(overlapList) && overlapList.size() > 0) {
overlap = overlapList.get(0); overlap = overlapList.get(0);
} }
Route route = this.buildRoute(code, name, start, end, clickEnd, sectionPath, overlap, Route route = this.buildRoute(code, name, start, end, clickEnd, sectionPath,
config.isRouteSignalAlwaysGreen(), overlap, config.isRouteSignalAlwaysGreen(), config.isRouteInterlockDoNotIncludeStandHoldTrain());
config.isRouteInterlockDoNotIncludeStandHoldTrain(), singleTrain);
routeList.add(route); routeList.add(route);
} }
} }
} else { } else {
errorList.add( errorList.add(String.format("以[%s(%s)]为始端信号的进路未搜索到", start.getName(), start.getCode()));
String.format("以[%s(%s)]为始端信号的进路未搜索到", start.getName(), start.getCode()));
} }
return routeList; return routeList;
} }
@ -803,13 +761,11 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
boolean right = start.isRight(); boolean right = start.isRight();
Section startSection = start.getSection().getSectionOf(right); Section startSection = start.getSection().getSectionOf(right);
List<SectionPath> routePathList = new ArrayList<>(); List<SectionPath> routePathList = new ArrayList<>();
getRoutePathOfDepot(start, startSection, new SectionPath(right), routePathList, config, getRoutePathOfDepot(start, startSection, new SectionPath(right), routePathList, config, errorList);
errorList);
return buildRouteFromPathDepot(start, routeCodeGenerator, routePathList, config, errorList); return buildRouteFromPathDepot(start, routeCodeGenerator, routePathList, config, errorList);
} }
private List<Route> buildRouteFromPathDepot(Signal startSignal, CodeGenerator routeCodeGenerator, private List<Route> buildRouteFromPathDepot(Signal startSignal, CodeGenerator routeCodeGenerator, List<SectionPath> routePathList,
List<SectionPath> routePathList,
MapCiGenerateConfig config, List<String> errorList) { MapCiGenerateConfig config, List<String> errorList) {
boolean right = startSignal.isRight(); boolean right = startSignal.isRight();
List<Route> routeList = new ArrayList<>(); List<Route> routeList = new ArrayList<>();
@ -822,20 +778,16 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
Signal.SignalType endSignalType = Objects.nonNull(endSignal) ? endSignal.getType() : null; Signal.SignalType endSignalType = Objects.nonNull(endSignal) ? endSignal.getType() : null;
// 反向信号机 // 反向信号机
Signal endOpSignal = lastSection.getSignalOf(!right); Signal endOpSignal = lastSection.getSignalOf(!right);
Signal.SignalType endOpSignalType = Signal.SignalType endOpSignalType = Objects.nonNull(endOpSignal) ? endOpSignal.getType() : null;
Objects.nonNull(endOpSignal) ? endOpSignal.getType() : null;
Section nextSection = lastSection.getSectionOf(right); Section nextSection = lastSection.getSectionOf(right);
// 下个区段反向信号机 // 下个区段反向信号机
Signal nextOpSignal = Objects.nonNull(nextSection) ? nextSection.getSignalOf(!right) : null; Signal nextOpSignal = Objects.nonNull(nextSection) ? nextSection.getSignalOf(!right) : null;
Signal clickEnd; Signal clickEnd;
SignalAspect signalAspect; SignalAspect signalAspect;
if ((Signal.SignalType.SHUNTING2.equals(endSignalType) if ((Signal.SignalType.SHUNTING2.equals(endSignalType) && Signal.SignalType.SHUNTING2.equals(startSignalType))
&& Signal.SignalType.SHUNTING2.equals(startSignalType)) || (Signal.SignalType.SHUNTING2.equals(endSignalType) && Signal.SignalType.INBOUND.equals(startSignalType))
|| (Signal.SignalType.SHUNTING2.equals(endSignalType) || (Signal.SignalType.OUTBOUND.equals(endSignalType) && Signal.SignalType.SHUNTING2.equals(startSignalType))) {
&& Signal.SignalType.INBOUND.equals(startSignalType))
|| (Signal.SignalType.OUTBOUND.equals(endSignalType)
&& Signal.SignalType.SHUNTING2.equals(startSignalType))) {
// 列车进路 // 列车进路
signalAspect = SignalAspect.Y; signalAspect = SignalAspect.Y;
if (Objects.nonNull(endOpSignal) && (Signal.SignalType.SHUNTING2.equals(endOpSignalType) if (Objects.nonNull(endOpSignal) && (Signal.SignalType.SHUNTING2.equals(endOpSignalType)
@ -859,18 +811,15 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
} }
} }
String endName = String endName = Objects.nonNull(endSignal) ? endSignal.getShowName() : lastSection.getName();
Objects.nonNull(endSignal) ? endSignal.getShowName() : lastSection.getName();
// 构建进路 // 构建进路
String code = routeCodeGenerator.next(); String code = routeCodeGenerator.next();
String name = String.format("%s-%s", startSignal.getShowName(), endName); String name = String.format("%s-%s", startSignal.getShowName(), endName);
Route route = this.buildRouteDepot(code, name, startSignal, endSignal, clickEnd, Route route = this.buildRouteDepot(code, name, startSignal, endSignal, clickEnd, sectionPath, signalAspect);
sectionPath, signalAspect);
routeList.add(route); routeList.add(route);
} }
} else { } else {
errorList.add( errorList.add(String.format("以[%s(%s)]为始端信号(%s)的进路未搜索到", startSignal.getShowName(),
String.format("以[%s(%s)]为始端信号(%s)的进路未搜索到", startSignal.getShowName(),
startSignal.getCode(), startSignal.getType())); startSignal.getCode(), startSignal.getType()));
} }
return routeList; return routeList;
@ -912,8 +861,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
* @param generatedRouteList * @param generatedRouteList
*/ */
private void deleteBaseRoute(List<Signal> signalList, List<Route> generatedRouteList) { private void deleteBaseRoute(List<Signal> signalList, List<Route> generatedRouteList) {
Map<String, Signal> signalMap = signalList.stream() Map<String, Signal> signalMap = signalList.stream().collect(Collectors.toMap(Signal::getCode, Function.identity()));
.collect(Collectors.toMap(Signal::getCode, Function.identity()));
List<Route> removeList = new ArrayList<>(); List<Route> removeList = new ArrayList<>();
for (Route route : generatedRouteList) { for (Route route : generatedRouteList) {
if (route.isTurnBack()) { // 折返进路不处理 if (route.isTurnBack()) { // 折返进路不处理
@ -963,8 +911,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
Switch linkedSwitch = aSwitch.queryLinkedSwitch(); Switch linkedSwitch = aSwitch.queryLinkedSwitch();
if (Objects.nonNull(linkedSwitch)) { if (Objects.nonNull(linkedSwitch)) {
// 联动道岔存在联动道岔定位即为一级侧防 // 联动道岔存在联动道岔定位即为一级侧防
RouteFls.FlsElement flsElement = new RouteFls.FlsElement( RouteFls.FlsElement flsElement = new RouteFls.FlsElement(new SwitchElement(linkedSwitch, true));
new SwitchElement(linkedSwitch, true));
fls.addLevel1(flsElement); fls.addLevel1(flsElement);
} else { } else {
// 无联动道岔则从道岔C区段向外查询第一个反向信号机和经过的路径道岔位置构成一级侧防 // 无联动道岔则从道岔C区段向外查询第一个反向信号机和经过的路径道岔位置构成一级侧防
@ -973,10 +920,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
// 尽头区段不需构成侧防 // 尽头区段不需构成侧防
return null; return null;
} }
BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue( BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue(c.getLeftSection() != null && c.getRightSection() != null,
c.getLeftSection() != null && c.getRightSection() != null, String.format("道岔区段[%s]关联区段关系异常,只能最多一边关联,实际两边都关联了区段", c.debugStr()));
String.format("道岔区段[%s]关联区段关系异常,只能最多一边关联,实际两边都关联了区段",
c.debugStr()));
boolean right = true; boolean right = true;
Section startSection = c.getRightSection(); Section startSection = c.getRightSection();
if (c.getLeftSection() != null) { // 左向区段存在方向向左 if (c.getLeftSection() != null) { // 左向区段存在方向向左
@ -1002,8 +947,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
relSwitch.isC(firstSection) && relSwitch.isA(pre))) { relSwitch.isC(firstSection) && relSwitch.isA(pre))) {
normal = false; normal = false;
} }
flsElement = new RouteFls.FlsElement(oppositeSignal, flsElement = new RouteFls.FlsElement(oppositeSignal, new SwitchElement(relSwitch, normal));
new SwitchElement(relSwitch, normal));
} else { } else {
flsElement = new RouteFls.FlsElement(oppositeSignal); flsElement = new RouteFls.FlsElement(oppositeSignal);
} }
@ -1014,8 +958,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if (next != null) { if (next != null) {
if (next.isSwitchTrack() && next.getRelSwitch().isC(next)) { if (next.isSwitchTrack() && next.getRelSwitch().isC(next)) {
// C区段一级侧防为此道岔定位 // C区段一级侧防为此道岔定位
RouteFls.FlsElement flsElement = new RouteFls.FlsElement( RouteFls.FlsElement flsElement = new RouteFls.FlsElement(new SwitchElement(next.getRelSwitch(), true));
new SwitchElement(next.getRelSwitch(), true));
fls.addLevel1(flsElement); fls.addLevel1(flsElement);
pre = null; pre = null;
} else { } else {
@ -1060,10 +1003,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
// 尽头区段不需构成侧防 // 尽头区段不需构成侧防
return null; return null;
} }
BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue( BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue(b.getLeftSection() != null && b.getRightSection() != null,
b.getLeftSection() != null && b.getRightSection() != null, String.format("道岔区段[%s]关联区段关系异常,只能最多一边关联,实际两边都关联了区段", b.debugStr()));
String.format("道岔区段[%s]关联区段关系异常,只能最多一边关联,实际两边都关联了区段",
b.debugStr()));
boolean right = true; boolean right = true;
Section startSection = b.getRightSection(); Section startSection = b.getRightSection();
if (b.getLeftSection() != null) { // 左向区段存在方向向左 if (b.getLeftSection() != null) { // 左向区段存在方向向左
@ -1086,11 +1027,9 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
!Objects.equals(aSwitch.queryAxleRelatedOtherSwitch(), relSwitch)) { !Objects.equals(aSwitch.queryAxleRelatedOtherSwitch(), relSwitch)) {
Switch remoteSwitch = relSwitch.queryAxleRelatedOtherSwitch(); Switch remoteSwitch = relSwitch.queryAxleRelatedOtherSwitch();
if (Objects.nonNull(remoteSwitch)) { if (Objects.nonNull(remoteSwitch)) {
flsElement = new RouteFls.FlsElement(oppositeSignal, flsElement = new RouteFls.FlsElement(oppositeSignal, new SwitchElement(remoteSwitch, true));
new SwitchElement(remoteSwitch, true));
} else { } else {
flsElement = new RouteFls.FlsElement(oppositeSignal, flsElement = new RouteFls.FlsElement(oppositeSignal, new SwitchElement(relSwitch, true));
new SwitchElement(relSwitch, true));
} }
} else { } else {
flsElement = new RouteFls.FlsElement(oppositeSignal); flsElement = new RouteFls.FlsElement(oppositeSignal);
@ -1101,8 +1040,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if (next != null) { if (next != null) {
if (next.isSwitchTrack() && next.getRelSwitch().isC(next)) { if (next.isSwitchTrack() && next.getRelSwitch().isC(next)) {
// C区段一级侧防为此道岔定位 // C区段一级侧防为此道岔定位
RouteFls.FlsElement flsElement = new RouteFls.FlsElement( RouteFls.FlsElement flsElement = new RouteFls.FlsElement(new SwitchElement(next.getRelSwitch(), true));
new SwitchElement(next.getRelSwitch(), true));
fls.addLevel1(flsElement); fls.addLevel1(flsElement);
} else { } else {
sectionStack.push(next); sectionStack.push(next);
@ -1162,18 +1100,13 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if (station.getSn() > min && station.getSn() < max) { if (station.getSn() > min && station.getSn() < max) {
BusinessExceptionAssertEnum.CI_GENERATE_ERROR BusinessExceptionAssertEnum.CI_GENERATE_ERROR
.assertTrue(station.isDepot() || station.isNoDepotAndNoNormalStand(), .assertTrue(station.isDepot() || station.isNoDepotAndNoNormalStand(),
String.format( String.format("交路[%s]下的站间运行等级[%s]数据间隔车站大于1且间隔中的车站[%s]是正常可停靠车站",
"交路[%s]下的站间运行等级[%s]数据间隔车站大于1且间隔中的车站[%s]是正常可停靠车站",
String.format("%s(%s)->%s(%s)", String.format("%s(%s)->%s(%s)",
routingStartSection.getStation().getName(), routingStartSection.getStation().getName(), routingStartSection.getName(),
routingStartSection.getName(), routingEndSection.getStation().getName(), routingEndSection.getName()),
routingEndSection.getStation().getName(),
routingEndSection.getName()),
String.format("%s(%s(%s))->%s(%s(%s))", String.format("%s(%s(%s))->%s(%s(%s))",
startSection.getStation().getName(), startSection.getName(), startSection.getStation().getName(), startSection.getName(), startSection.getCode(),
startSection.getCode(), endSection.getStation().getName(), endSection.getName(), endSection.getCode()),
endSection.getStation().getName(), endSection.getName(),
endSection.getCode()),
station.getName())); station.getName()));
} }
} }
@ -1185,17 +1118,14 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
runLevelVO.setEndSectionCode(endSection.getCode()); runLevelVO.setEndSectionCode(endSection.getCode());
runLevelVO.setEndStationCode(endSection.getStation().getCode()); runLevelVO.setEndStationCode(endSection.getStation().getCode());
runLevelVO.setRight(right); runLevelVO.setRight(right);
List<RoutePath> routePaths = CalculateService.queryRoutePathsOnDirection(startSection, List<RoutePath> routePaths = CalculateService.queryRoutePathsOnDirection(startSection, endSection, right, 10);
endSection, right, 10);
if (CollectionUtils.isEmpty(routePaths)) { if (CollectionUtils.isEmpty(routePaths)) {
// 未找到反方向再找 // 未找到反方向再找
routePaths = CalculateService.queryRoutePathsOnDirection(startSection, endSection, !right, routePaths = CalculateService.queryRoutePathsOnDirection(startSection, endSection, !right, 10);
10);
if (!CollectionUtils.isEmpty(routePaths)) { if (!CollectionUtils.isEmpty(routePaths)) {
log.info(String.format("站间运行等级[%s]与交路[%s]方向相反,实际为[%s]", log.info(String.format("站间运行等级[%s]与交路[%s]方向相反,实际为[%s]",
String.format("%s(%s(%s))->%s(%s(%s))", String.format("%s(%s(%s))->%s(%s(%s))",
startSection.getStation().getName(), startSection.getName(), startSection.getStation().getName(), startSection.getName(), startSection.getCode(),
startSection.getCode(),
endSection.getStation().getName(), endSection.getName(), endSection.getCode()), endSection.getStation().getName(), endSection.getName(), endSection.getCode()),
String.format("%s(%s)->%s(%s)", String.format("%s(%s)->%s(%s)",
routingStartSection.getStation().getName(), routingStartSection.getName(), routingStartSection.getStation().getName(), routingStartSection.getName(),
@ -1205,10 +1135,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
} }
} }
if (CollectionUtils.isEmpty(routePaths)) { if (CollectionUtils.isEmpty(routePaths)) {
log.warn(String.format( log.warn(String.format("站间运行等级数据生成失败:没有找到[%s(%s) ——> %s(%s)]对应方向[%s]的站间",
"站间运行等级数据生成失败:没有找到[%s(%s) ——> %s(%s)]对应方向[%s]的站间", startSection.getStation().getName(), startSection.getName(), endSection.getStation().getName(), endSection.getName(), right ? "右向" : "左向"));
startSection.getStation().getName(), startSection.getName(),
endSection.getStation().getName(), endSection.getName(), right ? "右向" : "左向"));
// errorList.add(String.format("站间运行等级数据生成失败:没有找到[%s(%s) ——> %s(%s)]对应方向[%s]的站间", // errorList.add(String.format("站间运行等级数据生成失败:没有找到[%s(%s) ——> %s(%s)]对应方向[%s]的站间",
// startSection.getStation().getName(), startSection.getName(), endSection.getStation().getName(), endSection.getName(), right ? "右向" : "左向")); // startSection.getStation().getName(), startSection.getName(), endSection.getStation().getName(), endSection.getName(), right ? "右向" : "左向"));
continue; continue;
@ -1226,8 +1154,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
} }
} }
private void buildAutoSignalRouteConflict(List<AutoSignal> autoSignalList, private void buildAutoSignalRouteConflict(List<AutoSignal> autoSignalList, List<Route> generatedRouteList) {
List<Route> generatedRouteList) {
if (CollectionUtils.isEmpty(autoSignalList)) { if (CollectionUtils.isEmpty(autoSignalList)) {
// 自动信号为空返回 // 自动信号为空返回
return; return;
@ -1305,8 +1232,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
} }
} }
if (Objects.isNull(basicRoute)) { if (Objects.isNull(basicRoute)) {
errorList.add( errorList.add(String.format("自动折返数据生成失败:折返进路[%s(%s)]的反向基本进路不存在",
String.format("自动折返数据生成失败:折返进路[%s(%s)]的反向基本进路不存在",
tbRoute.getName(), tbRoute.getCode())); tbRoute.getName(), tbRoute.getCode()));
continue; continue;
} }
@ -1421,12 +1347,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
String code = routeCodeGenerator.next(); String code = routeCodeGenerator.next();
Route tbRoute = new Route(code, name); Route tbRoute = new Route(code, name);
// 拷贝进路其他属性 // 拷贝进路其他属性
this.copyToTurnBackRoute(route, tbRoute, this.copyToTurnBackRoute(route, tbRoute, config.isRouteInterlockDoNotIncludeStandHoldTrain());
config.isRouteInterlockDoNotIncludeStandHoldTrain());
tbRoute.setTurnBack(true); tbRoute.setTurnBack(true);
if (config.isTbRouteNameUseEndOppositeSignalName()) {
tbRoute.setDestinationButtonSignal(endOppositeSignal);
}
// 如果生成进路按钮折返进路按钮默认为终端信号机 // 如果生成进路按钮折返进路按钮默认为终端信号机
if (config.isRouteButton()) { if (config.isRouteButton()) {
tbRoute.setDestinationButtonSignal(route.getDestination()); tbRoute.setDestinationButtonSignal(route.getDestination());
@ -1534,13 +1456,11 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
* @param routeOverlap * @param routeOverlap
* @param alwaysGreen 进路始端信号是否总是开绿灯 * @param alwaysGreen 进路始端信号是否总是开绿灯
* @param noStandHold * @param noStandHold
* @param singleTrain
* @return * @return
*/ */
private Route buildRoute(String code, String name, private Route buildRoute(String code, String name,
Signal start, Signal end, Signal endButton, Signal start, Signal end, Signal endButton,
SectionPath sectionPath, RouteOverlap routeOverlap, boolean alwaysGreen, boolean noStandHold, SectionPath sectionPath, RouteOverlap routeOverlap, boolean alwaysGreen, boolean noStandHold) {
boolean singleTrain) {
Route route = new Route(code, name); Route route = new Route(code, name);
route.setInterlockStation(start.getInterlockStation()); route.setInterlockStation(start.getInterlockStation());
route.setStart(start); route.setStart(start);
@ -1549,7 +1469,6 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
route.setSectionList(sectionPath.getSectionList()); route.setSectionList(sectionPath.getSectionList());
route.setSwitchList(sectionPath.getSwitchList()); route.setSwitchList(sectionPath.getSwitchList());
route.setOverlap(routeOverlap); route.setOverlap(routeOverlap);
route.setSingleTrain(singleTrain);
SignalModel signalModel = start.getSignalModel(); SignalModel signalModel = start.getSignalModel();
switch (signalModel) { switch (signalModel) {
case RGY:{ case RGY:{
@ -1562,9 +1481,11 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
case BW: case BW:
route.setAspect(SignalAspect.W); route.setAspect(SignalAspect.W);
break; break;
case YRW:
route.setAspect(SignalAspect.W);
break;
default: default:
throw BusinessExceptionAssertEnum.DATA_ERROR.exception( throw BusinessExceptionAssertEnum.DATA_ERROR.exception(String.format("信号机[%s]型号[%s]不正确",
String.format("信号机[%s]型号[%s]不正确",
start.debugStr(), start.getSignalModel())); start.debugStr(), start.getSignalModel()));
} }
route.setTurnBack(false); route.setTurnBack(false);
@ -1577,22 +1498,10 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
ars = false; ars = false;
} }
} }
RouteOverlap overlap = route.getOverlap();
if (overlap != null && !overlap.isStraight()) { //如果延续保护不是直向没有联锁自动触发
ars = false;
}
for (Section section : route.getSectionList()) {
//进路中的区段类型与进路方向相反说明不是常规运行进路没有联锁自动触发
if (section.isLeftLine() && route.isRight() || section.isRightLine() && !route.isRight()) {
ars = false;
break;
}
}
if (start.isSameDirectionToSection() && end.isSameDirectionToSection() && route.isStraight()) { if (start.isSameDirectionToSection() && end.isSameDirectionToSection() && route.isStraight()) {
// 进路始端终端信号机都是常规运行方向且进路是直向进路则为车队进路 // 进路始端终端信号机都是常规运行方向且进路是直向进路则为车队进路
flt = true; flt = true;
} }
route.setArs(ars); route.setArs(ars);
route.setFlt(flt); route.setFlt(flt);
// 根据区段设置进路联锁站台相关元素 // 根据区段设置进路联锁站台相关元素
@ -1758,8 +1667,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
List<SectionPath> triggerPathList = new ArrayList<>(); List<SectionPath> triggerPathList = new ArrayList<>();
Section section = signalSection; Section section = signalSection;
// 反方向找触发区段 // 反方向找触发区段
this.getOverlapTriggerPathOf(end, section, !right, new SectionPath(!right), this.getOverlapTriggerPathOf(end, section, !right, new SectionPath(!right), triggerPathList);
triggerPathList);
routeOverlap.setTriggerPathList(triggerPathList); routeOverlap.setTriggerPathList(triggerPathList);
} }
overlapList.add(routeOverlap); overlapList.add(routeOverlap);
@ -1832,8 +1740,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
getOverlapTriggerPathOf(end, relSwitch.getA().getSectionOf(right), right, getOverlapTriggerPathOf(end, relSwitch.getA().getSectionOf(right), right,
tempPath, triggerPathList); tempPath, triggerPathList);
} else { } else {
log.error(String.format( log.error(String.format("地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段",
"地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段",
section.getName(), section.getCode(), section.getName(), section.getCode(),
relSwitch.getName(), relSwitch.getCode())); relSwitch.getName(), relSwitch.getCode()));
return; return;
@ -1872,8 +1779,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
} }
} else if (Objects.isNull(section)) { // 如果区段不存在就没有延续保护区段 } else if (Objects.isNull(section)) { // 如果区段不存在就没有延续保护区段
return; return;
} else if (config.isOverlapOnlySwitch() } else if (config.isOverlapOnlySwitch() && !section.isSwitchTrack()) { // 如果只构建道岔延续保护不是道岔区段不构建返回
&& !section.isSwitchTrack()) { // 如果只构建道岔延续保护不是道岔区段不构建返回
return; return;
} }
tempPath.addSection(section); tempPath.addSection(section);
@ -1905,8 +1811,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
// if (config.isCoupleSwitch()) { // if (config.isCoupleSwitch()) {
// 如果是同一道岔计轴添加另一道岔定位 // 如果是同一道岔计轴添加另一道岔定位
Switch otherSwitch = relSwitch.queryAxleRelatedOtherSwitch(); Switch otherSwitch = relSwitch.queryAxleRelatedOtherSwitch();
if (!config.isGenerateFls() && Objects.nonNull(otherSwitch) && relSwitch.isBConnectTo( if (!config.isGenerateFls() && Objects.nonNull(otherSwitch) && relSwitch.isBConnectTo(otherSwitch)) {
otherSwitch)) {
rpPath.addSwitchElement(new SwitchElement(otherSwitch, true)); rpPath.addSwitchElement(new SwitchElement(otherSwitch, true));
} }
// } // }
@ -1936,15 +1841,13 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
getOverlapPathOf(relSwitch.getA().getSectionOf(right), right, getOverlapPathOf(relSwitch.getA().getSectionOf(right), right,
tempPath, overlapPathList, config, errorList); tempPath, overlapPathList, config, errorList);
} else { } else {
errorList.add(String.format( errorList.add(String.format("地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段",
"地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段",
section.getName(), section.getCode(), section.getName(), section.getCode(),
relSwitch.getName(), relSwitch.getCode())); relSwitch.getName(), relSwitch.getCode()));
return; return;
} }
} else { } else {
getOverlapPathOf(section.getSectionOf(right), right, tempPath, overlapPathList, config, getOverlapPathOf(section.getSectionOf(right), right, tempPath, overlapPathList, config, errorList);
errorList);
} }
} }
@ -2006,8 +1909,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if (!config.isGenerateFls() && Objects.nonNull(linkedSwitch)) { if (!config.isGenerateFls() && Objects.nonNull(linkedSwitch)) {
npPath.addSwitchElement(new SwitchElement(linkedSwitch, true)); npPath.addSwitchElement(new SwitchElement(linkedSwitch, true));
} }
getRoutePathOf(startSignal, relSwitch.getB().getSectionOf(right), ground, npPath, getRoutePathOf(startSignal, relSwitch.getB().getSectionOf(right), ground, npPath, routePathList, config, errorList);
routePathList, config, errorList);
SectionPath rpPath = tempPath.cloneNew();// 反位路径 SectionPath rpPath = tempPath.cloneNew();// 反位路径
rpPath.addSection(relSwitch.getC()); rpPath.addSection(relSwitch.getC());
rpPath.addSwitchElement(new SwitchElement(relSwitch, false)); rpPath.addSwitchElement(new SwitchElement(relSwitch, false));
@ -2016,8 +1918,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
// } // }
// 如果是同一道岔计轴添加另一道岔定位 // 如果是同一道岔计轴添加另一道岔定位
Switch otherSwitch = relSwitch.queryAxleRelatedOtherSwitch(); Switch otherSwitch = relSwitch.queryAxleRelatedOtherSwitch();
if (!config.isGenerateFls() && Objects.nonNull(otherSwitch) && relSwitch.isBConnectTo( if (!config.isGenerateFls() && Objects.nonNull(otherSwitch) && relSwitch.isBConnectTo(otherSwitch)) {
otherSwitch)) {
rpPath.addSwitchElement(new SwitchElement(otherSwitch, true)); rpPath.addSwitchElement(new SwitchElement(otherSwitch, true));
// 另一道岔联动道岔也需要 // 另一道岔联动道岔也需要
Switch otherLinkSwitch = otherSwitch.queryLinkedSwitch(); Switch otherLinkSwitch = otherSwitch.queryLinkedSwitch();
@ -2025,8 +1926,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
rpPath.addSwitchElement(new SwitchElement(otherLinkSwitch, true)); rpPath.addSwitchElement(new SwitchElement(otherLinkSwitch, true));
} }
} }
getRoutePathOf(startSignal, relSwitch.getC().getSectionOf(right), ground, rpPath, getRoutePathOf(startSignal, relSwitch.getC().getSectionOf(right), ground, rpPath, routePathList, config, errorList);
routePathList, config, errorList);
} else if (relSwitch.isB(section)) { } else if (relSwitch.isB(section)) {
// 只有一条路径从B->A道岔定位 // 只有一条路径从B->A道岔定位
tempPath.addSection(relSwitch.getA()); tempPath.addSection(relSwitch.getA());
@ -2035,8 +1935,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if (!config.isGenerateFls() && Objects.nonNull(linkedSwitch)) { if (!config.isGenerateFls() && Objects.nonNull(linkedSwitch)) {
tempPath.addSwitchElement(new SwitchElement(linkedSwitch, true)); tempPath.addSwitchElement(new SwitchElement(linkedSwitch, true));
} }
getRoutePathOf(startSignal, relSwitch.getA().getSectionOf(right), ground, tempPath, getRoutePathOf(startSignal, relSwitch.getA().getSectionOf(right), ground, tempPath, routePathList, config, errorList);
routePathList, config, errorList);
} else if (relSwitch.isC(section)) { } else if (relSwitch.isC(section)) {
// 只有一条路径从C->A道岔反位 // 只有一条路径从C->A道岔反位
tempPath.addSection(relSwitch.getA()); tempPath.addSection(relSwitch.getA());
@ -2054,11 +1953,9 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
tempPath.addSwitchElement(new SwitchElement(otherLinkSwitch, true)); tempPath.addSwitchElement(new SwitchElement(otherLinkSwitch, true));
} }
} }
getRoutePathOf(startSignal, relSwitch.getA().getSectionOf(right), ground, tempPath, getRoutePathOf(startSignal, relSwitch.getA().getSectionOf(right), ground, tempPath, routePathList, config, errorList);
routePathList, config, errorList);
} else { } else {
errorList.add(String.format( errorList.add(String.format("地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段",
"地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段",
section.getName(), section.getCode(), section.getName(), section.getCode(),
relSwitch.getName(), relSwitch.getCode())); relSwitch.getName(), relSwitch.getCode()));
return; return;
@ -2086,8 +1983,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
} }
if (Objects.isNull(section)) { if (Objects.isNull(section)) {
Signal lastSignal = tempPath.getLastSection().getSignalOf(!right); Signal lastSignal = tempPath.getLastSection().getSignalOf(!right);
if (Objects.nonNull(lastSignal) && lastSignal.getType() if (Objects.nonNull(lastSignal) && lastSignal.getType().equals(Signal.SignalType.SHUNTING2)) {
.equals(Signal.SignalType.SHUNTING2)) {
routePathList.add(tempPath); routePathList.add(tempPath);
} }
return; return;
@ -2127,8 +2023,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if (Objects.nonNull(linkedSwitch)) { if (Objects.nonNull(linkedSwitch)) {
npPath.addSwitchElement(new SwitchElement(linkedSwitch, true)); npPath.addSwitchElement(new SwitchElement(linkedSwitch, true));
} }
getRoutePathOfDepot(startSignal, relSwitch.getB().getSectionOf(right), npPath, getRoutePathOfDepot(startSignal, relSwitch.getB().getSectionOf(right), npPath, routePathList, config, errorList);
routePathList, config, errorList);
SectionPath rpPath = tempPath.cloneNew();// 反位路径 SectionPath rpPath = tempPath.cloneNew();// 反位路径
rpPath.addSection(relSwitch.getC()); rpPath.addSection(relSwitch.getC());
rpPath.addSwitchElement(new SwitchElement(relSwitch, false)); rpPath.addSwitchElement(new SwitchElement(relSwitch, false));
@ -2142,8 +2037,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
rpPath.addSwitchElement(new SwitchElement(otherLinkSwitch, true)); rpPath.addSwitchElement(new SwitchElement(otherLinkSwitch, true));
} }
} }
getRoutePathOfDepot(startSignal, relSwitch.getC().getSectionOf(right), rpPath, getRoutePathOfDepot(startSignal, relSwitch.getC().getSectionOf(right), rpPath, routePathList, config, errorList);
routePathList, config, errorList);
} else if (relSwitch.isB(section)) { } else if (relSwitch.isB(section)) {
// 只有一条路径从B->A道岔定位 // 只有一条路径从B->A道岔定位
tempPath.addSection(relSwitch.getA()); tempPath.addSection(relSwitch.getA());
@ -2152,8 +2046,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
if (Objects.nonNull(linkedSwitch)) { if (Objects.nonNull(linkedSwitch)) {
tempPath.addSwitchElement(new SwitchElement(linkedSwitch, true)); tempPath.addSwitchElement(new SwitchElement(linkedSwitch, true));
} }
getRoutePathOfDepot(startSignal, relSwitch.getA().getSectionOf(right), tempPath, getRoutePathOfDepot(startSignal, relSwitch.getA().getSectionOf(right), tempPath, routePathList, config, errorList);
routePathList, config, errorList);
} else if (relSwitch.isC(section)) { } else if (relSwitch.isC(section)) {
// 只有一条路径从C->A道岔反位 // 只有一条路径从C->A道岔反位
tempPath.addSection(relSwitch.getA()); tempPath.addSection(relSwitch.getA());
@ -2168,11 +2061,9 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
tempPath.addSwitchElement(new SwitchElement(otherLinkSwitch, true)); tempPath.addSwitchElement(new SwitchElement(otherLinkSwitch, true));
} }
} }
getRoutePathOfDepot(startSignal, relSwitch.getA().getSectionOf(right), tempPath, getRoutePathOfDepot(startSignal, relSwitch.getA().getSectionOf(right), tempPath, routePathList, config, errorList);
routePathList, config, errorList);
} else { } else {
errorList.add(String.format( errorList.add(String.format("地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段",
"地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段",
section.getName(), section.getCode(), section.getName(), section.getCode(),
relSwitch.getName(), relSwitch.getCode())); relSwitch.getName(), relSwitch.getCode()));
return; return;
@ -2205,9 +2096,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
List<Section> logicApproachList = new ArrayList<>(); List<Section> logicApproachList = new ArrayList<>();
List<Section> sectionList = sectionPath.getSectionList(); List<Section> sectionList = sectionPath.getSectionList();
for (Section phySection : sectionList) { for (Section phySection : sectionList) {
if (len >= 600) { if (len >= 600) break;
break;
}
if (phySection.isSwitchTrack()) { if (phySection.isSwitchTrack()) {
len += phySection.getLen(); len += phySection.getLen();
logicApproachList.add(phySection); logicApproachList.add(phySection);
@ -2226,9 +2115,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
for (Section logic : sortedList) { for (Section logic : sortedList) {
logicApproachList.add(logic); logicApproachList.add(logic);
len += logic.getLen(); len += logic.getLen();
if (len >= 600) { if (len >= 600) break;
break;
}
} }
} }
sectionPath.setLogicList(logicApproachList); sectionPath.setLogicList(logicApproachList);
@ -2237,8 +2124,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
signal.setRouteReleaseTime(config.getRouteReleaseTime()); signal.setRouteReleaseTime(config.getRouteReleaseTime());
} }
public void getApproachPathOf(Section section, boolean right, Float distance, public void getApproachPathOf(Section section, boolean right, Float distance, SectionPath tempPath, MapCiGenerateConfig config, List<SectionPath> results) {
SectionPath tempPath, MapCiGenerateConfig config, List<SectionPath> results) {
if (!CollectionUtils.isEmpty(tempPath.getSectionList())) { if (!CollectionUtils.isEmpty(tempPath.getSectionList())) {
// 已经有区段了 // 已经有区段了
if (Objects.isNull(section)) { if (Objects.isNull(section)) {
@ -2250,8 +2136,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
return; return;
} }
} }
if (config.isSignalApproachNotPassPreSignal() && Objects.nonNull( if (config.isSignalApproachNotPassPreSignal() && Objects.nonNull(section.getSignalOf(!right))) {
section.getSignalOf(!right))) {
results.add(tempPath); results.add(tempPath);
return; return;
} }
@ -2272,39 +2157,33 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
SectionPath npPath = tempPath.cloneNew();// 定位路径 SectionPath npPath = tempPath.cloneNew();// 定位路径
npPath.addSection(relSwitch.getB()); npPath.addSection(relSwitch.getB());
npPath.addSwitchElement(new SwitchElement(relSwitch, true)); npPath.addSwitchElement(new SwitchElement(relSwitch, true));
getApproachPathOf(relSwitch.getB().getSectionOf(right), right, distance, npPath, config, getApproachPathOf(relSwitch.getB().getSectionOf(right), right, distance, npPath, config, results);
results);
if (!config.isSignalApproachOnlyNpSwitch()) { if (!config.isSignalApproachOnlyNpSwitch()) {
SectionPath rpPath = tempPath.cloneNew();// 反位路径 SectionPath rpPath = tempPath.cloneNew();// 反位路径
rpPath.addSection(relSwitch.getC()); rpPath.addSection(relSwitch.getC());
rpPath.addSwitchElement(new SwitchElement(relSwitch, false)); rpPath.addSwitchElement(new SwitchElement(relSwitch, false));
getApproachPathOf(relSwitch.getC().getSectionOf(right), right, distance, rpPath, config, getApproachPathOf(relSwitch.getC().getSectionOf(right), right, distance, rpPath, config, results);
results);
} }
} else if (relSwitch.isB(section)) { } else if (relSwitch.isB(section)) {
// 只有一条路径从B->A道岔定位 // 只有一条路径从B->A道岔定位
tempPath.addSection(section); tempPath.addSection(section);
tempPath.addSection(relSwitch.getA()); tempPath.addSection(relSwitch.getA());
tempPath.addSwitchElement(new SwitchElement(relSwitch, true)); tempPath.addSwitchElement(new SwitchElement(relSwitch, true));
getApproachPathOf(relSwitch.getA().getSectionOf(right), right, distance, tempPath, config, getApproachPathOf(relSwitch.getA().getSectionOf(right), right, distance, tempPath, config, results);
results);
} else if (relSwitch.isC(section)) { } else if (relSwitch.isC(section)) {
if (!config.isSignalApproachOnlyNpSwitch() || CollectionUtils.isEmpty( if (!config.isSignalApproachOnlyNpSwitch() || CollectionUtils.isEmpty(tempPath.getSectionList())) {
tempPath.getSectionList())) {
// 只有一条路径从C->A道岔反位 // 只有一条路径从C->A道岔反位
tempPath.addSection(section); tempPath.addSection(section);
tempPath.addSection(relSwitch.getA()); tempPath.addSection(relSwitch.getA());
tempPath.addSwitchElement(new SwitchElement(relSwitch, false)); tempPath.addSwitchElement(new SwitchElement(relSwitch, false));
getApproachPathOf(relSwitch.getA().getSectionOf(right), right, distance, tempPath, config, getApproachPathOf(relSwitch.getA().getSectionOf(right), right, distance, tempPath, config, results);
results);
} else { } else {
results.add(tempPath); results.add(tempPath);
return; return;
} }
} else { } else {
throw BusinessExceptionAssertEnum.DATA_ERROR.exception( throw BusinessExceptionAssertEnum.DATA_ERROR.exception(
String.format( String.format("地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段",
"地图基础数据有错误:区段[%s(%s)]关联了道岔[%s(%s)],却不是此道岔的关联区段",
section.getName(), section.getCode(), section.getName(), section.getCode(),
relSwitch.getName(), relSwitch.getCode())); relSwitch.getName(), relSwitch.getCode()));
} }
@ -2322,8 +2201,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
* @param autoSignalGenerator * @param autoSignalGenerator
* @param errorList * @param errorList
*/ */
private AutoSignal generateAutoSignal(Signal signal, CodeGenerator autoSignalGenerator, private AutoSignal generateAutoSignal(Signal signal, CodeGenerator autoSignalGenerator, List<String> errorList) {
List<String> errorList) {
AutoSignal autoSignal = new AutoSignal(autoSignalGenerator.next()); AutoSignal autoSignal = new AutoSignal(autoSignalGenerator.next());
autoSignal.setSignal(signal); autoSignal.setSignal(signal);
List<Section> sectionList = new ArrayList<>(); List<Section> sectionList = new ArrayList<>();
@ -2351,12 +2229,10 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
} }
sectionList.add(nextSwitchSection); sectionList.add(nextSwitchSection);
Section next2 = nextSwitchSection.getSectionOf(right); Section next2 = nextSwitchSection.getSectionOf(right);
if (Objects.nonNull(next2) && Objects.equals(next2.getParent(), if (Objects.nonNull(next2) && Objects.equals(next2.getParent(), nextSwitchSection.getParent())) {
nextSwitchSection.getParent())) {
// 是同一计轴区段添加下一个道岔区段 // 是同一计轴区段添加下一个道岔区段
sectionList.add(next2); sectionList.add(next2);
sectionList.add( sectionList.add(next2.getRelSwitch().getNextSectionOnBaseSectionAndPosition(next2, true));
next2.getRelSwitch().getNextSectionOnBaseSectionAndPosition(next2, true));
} }
} }
break; break;

View File

@ -1,14 +1,26 @@
package club.joylink.rtss.services.draftData; package club.joylink.rtss.services.draftData;
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.MapElement;
import club.joylink.rtss.simulation.cbtc.data.map.Route;
import club.joylink.rtss.simulation.cbtc.data.map.Routing;
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.Station;
import club.joylink.rtss.vo.map.logic.MapRoutingDataVO; import club.joylink.rtss.vo.map.logic.MapRoutingDataVO;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.stream.Collectors;
/** /**
* 交路生成 * 交路生成
*/ */
@ -122,7 +134,7 @@ public class RoutingGenerator {
if (signal == null) { if (signal == null) {
Section base = section; Section base = section;
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
Section next = base.getSectionOf(right); Section next = base.findNextRunningSectionBaseRealSwitch(right);
if (next == null) { // 可能到尽头了 if (next == null) { // 可能到尽头了
return; return;
} }

View File

@ -15,14 +15,6 @@ import java.util.Collection;
import java.util.List; import java.util.List;
public interface IOrgService { public interface IOrgService {
/**
* 查找默认组织
*
* @return
*/
Org findDefaultOrg();
OrgVO createTopOrg(TopOrgCreateVO topOrgCreateVO, AccountVO user); OrgVO createTopOrg(TopOrgCreateVO topOrgCreateVO, AccountVO user);
List<OrgVO> queryAllTopOrg(); List<OrgVO> queryAllTopOrg();
@ -99,7 +91,8 @@ public interface IOrgService {
Org findTopOrgOfUser(long userId); Org findTopOrgOfUser(long userId);
/** /**
* 查询该组织下的所有班级 目前组织结构仅有两级非顶级的就是班级 * 查询该组织下的所有班级
* 目前组织结构仅有两级非顶级的就是班级
*/ */
List<OrgVO> listQueryCls(long topOrgId); List<OrgVO> listQueryCls(long topOrgId);

View File

@ -1,13 +1,11 @@
package club.joylink.rtss.services.org; package club.joylink.rtss.services.org;
import club.joylink.rtss.constants.BusinessConsts; import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.constants.Project;
import club.joylink.rtss.dao.OrgDAO; import club.joylink.rtss.dao.OrgDAO;
import club.joylink.rtss.entity.*; import club.joylink.rtss.entity.*;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.ISysUserService; import club.joylink.rtss.services.ISysUserService;
import club.joylink.rtss.services.QRCodeManager; import club.joylink.rtss.services.QRCodeManager;
import club.joylink.rtss.services.cache.ICacheService;
import club.joylink.rtss.vo.AccountVO; import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.ExamDefinitionVO; import club.joylink.rtss.vo.client.ExamDefinitionVO;
@ -16,8 +14,6 @@ import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.org.*; import club.joylink.rtss.vo.client.org.*;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import java.util.concurrent.TimeUnit;
import javax.annotation.PostConstruct;
import lombok.NonNull; import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -32,7 +28,6 @@ import java.util.stream.Collectors;
@Service @Service
public class OrgService implements IOrgService { public class OrgService implements IOrgService {
@Autowired @Autowired
private OrgDAO orgDAO; private OrgDAO orgDAO;
@ -48,29 +43,6 @@ public class OrgService implements IOrgService {
@Autowired @Autowired
private IOrgProjectService orgProjectService; private IOrgProjectService orgProjectService;
@Autowired
private ICacheService cacheService;
@Override
public Org findDefaultOrg() {
String defName = String.format("%s-org-default", Project.DEFAULT.name());
Object obj = this.cacheService.get(defName);
if (Objects.nonNull(obj)) {
return (Org) obj;
}
OrgExample orgExample = new OrgExample();
orgExample.createCriteria().andProjectCodeEqualTo(Project.DEFAULT.name());
List<Org> orgs = this.orgDAO.selectByExample(orgExample);
if (!CollectionUtils.isEmpty(orgs)) {
Org org = orgs.get(0);
this.cacheService.putExpired(defName, org, 600, TimeUnit.SECONDS);
return org;
}
return null;
}
@Transactional @Transactional
@Override @Override
public OrgVO createTopOrg(TopOrgCreateVO topOrgCreateVO, AccountVO user) { public OrgVO createTopOrg(TopOrgCreateVO topOrgCreateVO, AccountVO user) {
@ -267,9 +239,8 @@ public class OrgService implements IOrgService {
@Override @Override
public Org getTopOrgEntity(Long orgId) { public Org getTopOrgEntity(Long orgId) {
Org entity = getEntity(orgId); Org entity = getEntity(orgId);
if (isTopOrg(entity)) { if (isTopOrg(entity))
return entity; return entity;
}
return getEntity(entity.getRootId()); return getEntity(entity.getRootId());
} }
@ -395,9 +366,8 @@ public class OrgService implements IOrgService {
@Override @Override
public Org findTopOrgOfUser(long userId) { public Org findTopOrgOfUser(long userId) {
List<OrgUser> orgUsers = iOrgUserService.findEntitiesByUserId(userId, null); List<OrgUser> orgUsers = iOrgUserService.findEntitiesByUserId(userId, null);
if (CollectionUtils.isEmpty(orgUsers)) { if (CollectionUtils.isEmpty(orgUsers))
return null; return null;
}
Long orgId = orgUsers.stream() Long orgId = orgUsers.stream()
.filter(orgUser -> BusinessConsts.OrgRole.Admin.name().equals(orgUser.getRole())) //目前有管理员的一定是顶级组织 .filter(orgUser -> BusinessConsts.OrgRole.Admin.name().equals(orgUser.getRole())) //目前有管理员的一定是顶级组织
.findAny().orElse(orgUsers.get(0)).getOrgId(); .findAny().orElse(orgUsers.get(0)).getOrgId();

View File

@ -2,12 +2,10 @@ package club.joylink.rtss.services.paper;
import club.joylink.rtss.constants.BusinessConsts; import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.dao.paper.PaperQuestionDAO; import club.joylink.rtss.dao.paper.PaperQuestionDAO;
import club.joylink.rtss.entity.Org;
import club.joylink.rtss.entity.paper.question.PaperQuestion; import club.joylink.rtss.entity.paper.question.PaperQuestion;
import club.joylink.rtss.entity.paper.question.PaperQuestionExample; import club.joylink.rtss.entity.paper.question.PaperQuestionExample;
import club.joylink.rtss.entity.paper.question.PaperQuestionWithBLOBs; import club.joylink.rtss.entity.paper.question.PaperQuestionWithBLOBs;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.org.OrgService;
import club.joylink.rtss.vo.AccountVO; import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
@ -39,24 +37,11 @@ import java.util.stream.Collectors;
@Service @Service
@Slf4j @Slf4j
public class PagerQuestionService { public class PagerQuestionService {
@Resource @Resource
private PaperQuestionDAO questionDAO; private PaperQuestionDAO questionDAO;
@Resource
private OrgService orgService;
public List<Long> queryAllDefaultOrgPaperIds() {
Org org = this.orgService.findDefaultOrg();
if (Objects.isNull(org)) {
return Collections.emptyList();
}
return this.questionDAO.findAllId(org.getId());
}
/** /**
* 创建对应的查询example * 创建对应的查询example
*
* @param queryVO 查询对象 * @param queryVO 查询对象
* @param orgIdCanNull orgId是否可以为空 * @param orgIdCanNull orgId是否可以为空
* @param queryLabelIsNull 当查询对象labels属性为空时 是否查询 tags is null * @param queryLabelIsNull 当查询对象labels属性为空时 是否查询 tags is null
@ -134,7 +119,6 @@ public class PagerQuestionService {
/** /**
* 查询对应的类型标签对应的数量 * 查询对应的类型标签对应的数量
*
* @param orgId 用户组织id * @param orgId 用户组织id
* @param type 类型 * @param type 类型
* @param labels 逗号隔开的标签 * @param labels 逗号隔开的标签
@ -157,9 +141,8 @@ public class PagerQuestionService {
/** /**
* 获取题库分页列表 * 获取题库分页列表
* * @param queryVO  
* @param queryVO * @param companyIdCanNull  
* @param companyIdCanNull
* @return * @return
*/ */
public PageVO<PaperQuestionVO> pagingQueryQuestions(QuestionQueryVO queryVO,boolean companyIdCanNull) { public PageVO<PaperQuestionVO> pagingQueryQuestions(QuestionQueryVO queryVO,boolean companyIdCanNull) {
@ -175,9 +158,8 @@ public class PagerQuestionService {
/** /**
* 获取题型列表 * 获取题型列表
* * @param queryVO  
* @param queryVO * @param companyIdCanNull  
* @param companyIdCanNull
* @return * @return
*/ */
public List<PaperQuestionVO> queryQuestions(QuestionQueryVO queryVO,boolean companyIdCanNull) { public List<PaperQuestionVO> queryQuestions(QuestionQueryVO queryVO,boolean companyIdCanNull) {
@ -192,8 +174,7 @@ public class PagerQuestionService {
/** /**
* 获取题型所有数据 * 获取题型所有数据
* * @param questionId  
* @param questionId
* @param doNotCheckDel 是否检测数据状态是否删除 true = 不检测false=检测 * @param doNotCheckDel 是否检测数据状态是否删除 true = 不检测false=检测
* @return * @return
*/ */
@ -214,7 +195,6 @@ public class PagerQuestionService {
/** /**
* 检测题目是否正确 * 检测题目是否正确
*
* @param questionId 题目id * @param questionId 题目id
* @param answerIds 检测的答案Id * @param answerIds 检测的答案Id
* @return * @return
@ -241,6 +221,7 @@ public class PagerQuestionService {
/** /**
* 获取所有公司组织下的标签 * 获取所有公司组织下的标签
*
*/ */
public Collection<String> findAllLable(Long orgId,String type){ public Collection<String> findAllLable(Long orgId,String type){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId),"组织id不能为空"); BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId),"组织id不能为空");
@ -265,9 +246,8 @@ public class PagerQuestionService {
/** /**
* 根据公司id和标签或类型查询 * 根据公司id和标签或类型查询
* * @param companyId  
* @param companyId * @param queryVO  
* @param queryVO
* @return * @return
*/ */
public List<PaperQuestionVO> queryQuestionsForRaceLable(Long companyId, PagerLableQueryVO queryVO) { public List<PaperQuestionVO> queryQuestionsForRaceLable(Long companyId, PagerLableQueryVO queryVO) {
@ -287,9 +267,8 @@ public class PagerQuestionService {
/** /**
* 添加修改 * 添加修改
* * @param questionVO  
* @param questionVO * @param accountVO  
* @param accountVO
*/ */
public void saveOrUpdate(PaperQuestionVO questionVO, AccountVO accountVO) { public void saveOrUpdate(PaperQuestionVO questionVO, AccountVO accountVO) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(questionVO.getOrgId()),"组织id不能为空"); BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(questionVO.getOrgId()),"组织id不能为空");
@ -381,7 +360,6 @@ public class PagerQuestionService {
/** /**
* 删除 逻辑删除 * 删除 逻辑删除
*
* @param questionId 文本id * @param questionId 文本id
*/ */
public void deleteQuestion(List<Long> questionId) { public void deleteQuestion(List<Long> questionId) {

View File

@ -15,7 +15,6 @@ import club.joylink.rtss.exception.PaperExceptionAssert;
import club.joylink.rtss.vo.AccountVO; import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.paper.*; 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.PaperCompositionConvertor;
import club.joylink.rtss.vo.paper.convertor.PaperRuleConvertor; import club.joylink.rtss.vo.paper.convertor.PaperRuleConvertor;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
@ -38,7 +37,6 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
@Service @Service
public class PaperCompositionService { public class PaperCompositionService {
@Autowired @Autowired
private PaperCompositionDAO compositionDAO; private PaperCompositionDAO compositionDAO;
@Autowired @Autowired
@ -50,22 +48,15 @@ public class PaperCompositionService {
* 创建试卷蓝图包括规则定义 * 创建试卷蓝图包括规则定义
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public CreatePaperCompositionRspVo createPaperCompositionWithRule(PaperCompositionWithRuleVo req, public CreatePaperCompositionRspVo createPaperCompositionWithRule(PaperCompositionWithRuleVo req, AccountVO user) {
AccountVO user) {
//根据项目和名称来查如果存在则结束 //根据项目和名称来查如果存在则结束
PaperExceptionAssert.PcNotExisted.assertTrue(Objects.nonNull(req.getMapId()), PaperExceptionAssert.PcNotExisted.assertTrue(Objects.nonNull(req.getMapId()), "请选择对应的线路");
"请选择对应的线路"); List<PaperComposition> pcList = this.findCompositionByCompanyIdAndName(req.getOrgId(), req.getName());
List<PaperComposition> pcList = this.findCompositionByCompanyIdAndName(req.getOrgId(), PaperExceptionAssert.PcNotExisted.assertTrue(CollectionUtils.isEmpty(pcList), "试卷定义已经存在orgId=" + req.getOrgId() + " name=" + req.getName());
req.getName()); Optional<PaperCompositionWithRuleVo.PaperRuleVo> optionalRule = req.getRuleList().stream().filter(d->d.getSubtype() == PaperQType.SubType.Single
PaperExceptionAssert.PcNotExisted.assertTrue(CollectionUtils.isEmpty(pcList), && (Objects.isNull(d.getSubTypeParam()) || Objects.isNull(d.getSubTypeParam().getClient()))).findAny();
"试卷定义已经存在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); PaperComposition newPc = PaperCompositionConvertor.convertToBean(req);
newPc.setCreateTime(LocalDateTime.now()); newPc.setCreateTime(LocalDateTime.now());
@ -89,34 +80,23 @@ public class PaperCompositionService {
} }
private String ruleMapKey(PaperCompositionWithRuleVo.PaperRuleVo vo){ private String ruleMapKey(PaperCompositionWithRuleVo.PaperRuleVo vo){
String key = String.format("%s-%s-%s", vo.getType(), vo.getSubtype(), String key = String.format("%s-%s-%s",vo.getType(),vo.getSubtype(), CollectionUtils.isEmpty(vo.getTags())? "" : Joiner.on(",").join(vo.getTags()));
CollectionUtils.isEmpty(vo.getTags()) ? "" : Joiner.on(",").join(vo.getTags()));
return key; return key;
} }
/** /**
* 试卷蓝图添加规则 * 试卷蓝图添加规则
*/ */
private void createPaperCompositionRule(Long pcId, private void createPaperCompositionRule(Long pcId, List<PaperCompositionWithRuleVo.PaperRuleVo> reqList) {
List<PaperCompositionWithRuleVo.PaperRuleVo> reqList) { Map<String,List<PaperCompositionWithRuleVo.PaperRuleVo>> tmpList = reqList.stream().collect(Collectors.groupingBy(this::ruleMapKey));
Map<String, List<PaperCompositionWithRuleVo.PaperRuleVo>> tmpList = reqList.stream()
.collect(Collectors.groupingBy(this::ruleMapKey));
for (PaperCompositionWithRuleVo.PaperRuleVo req : reqList) { for (PaperCompositionWithRuleVo.PaperRuleVo req : reqList) {
req.setPcId(pcId); req.setPcId(pcId);
PaperQType.assertPaperSubTypeMatchGroupType(req.getSubtype(), req.getType()); PaperQType.assertPaperSubTypeMatchGroupType(req.getSubtype(), req.getType());
String key = this.ruleMapKey(req); String key = this.ruleMapKey(req);
List<PaperCompositionWithRuleVo.PaperRuleVo> voList = tmpList.get(key); List<PaperCompositionWithRuleVo.PaperRuleVo> voList = tmpList.get(key);
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue( BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(!CollectionUtils.isEmpty(voList) && voList.size() <= 1 ,String.format("试题规则类型[%s],规则类型[%s] 规则只能有一个", PaperQType.GroupType.getTypeName(req.getType()), PaperQType.SubType.getItemName(req.getSubtype())));
!CollectionUtils.isEmpty(voList) && voList.size() <= 1, 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()));
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); PaperRule rule = PaperRuleConvertor.convert(req);
ruleDAO.insertSelective(rule); ruleDAO.insertSelective(rule);
} }
@ -127,24 +107,18 @@ public class PaperCompositionService {
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updatePaperCompositionWithRule(PaperCompositionWithRuleVo req, AccountVO user) { public void updatePaperCompositionWithRule(PaperCompositionWithRuleVo req, AccountVO user) {
PaperExceptionAssert.PcNotExisted.assertTrue(Objects.nonNull(req.getMapId()), PaperExceptionAssert.PcNotExisted.assertTrue(Objects.nonNull(req.getMapId()), "请选择对应的线路");
"请选择对应的线路"); Optional<PaperCompositionWithRuleVo.PaperRuleVo> optionalRule = req.getRuleList().stream().filter(d->d.getSubtype() == PaperQType.SubType.Single
Optional<PaperCompositionWithRuleVo.PaperRuleVo> optionalRule = req.getRuleList().stream() && (Objects.isNull(d.getSubTypeParam()) || Objects.isNull(d.getSubTypeParam().getClient()))).findAny();
.filter(d -> d.getSubtype() == PaperQType.SubType.Single PaperExceptionAssert.PcNotHavePr.assertTrue(optionalRule.isEmpty(), "试卷规则-单操缺少客户端的定义");
&& (Objects.isNull(d.getSubTypeParam()) || Objects.isNull(
d.getSubTypeParam().getClient()))).findAny();
PaperExceptionAssert.PcNotHavePr.assertTrue(optionalRule.isEmpty(),
"试卷规则-单操缺少客户端的定义");
PaperComposition curPc = compositionDAO.selectByPrimaryKey(req.getId()); PaperComposition curPc = compositionDAO.selectByPrimaryKey(req.getId());
assertPaperCompositionCanModify(curPc); assertPaperCompositionCanModify(curPc);
// //
List<PaperComposition> pcList = this.findCompositionByCompanyIdAndName(req.getOrgId(), List<PaperComposition> pcList = this.findCompositionByCompanyIdAndName(req.getOrgId(), req.getName());
req.getName());
if (!CollectionUtils.isEmpty(pcList)) { if (!CollectionUtils.isEmpty(pcList)) {
boolean exist = pcList.stream().anyMatch(c ->c.getId().compareTo(curPc.getId()) != 0); boolean exist = pcList.stream().anyMatch(c ->c.getId().compareTo(curPc.getId()) != 0);
PaperExceptionAssert.PcExisted.assertNotTrue(exist, PaperExceptionAssert.PcExisted.assertNotTrue(exist, "试卷定义已经存在orgId=" + req.getOrgId() + " name=" + req.getName());
"试卷定义已经存在orgId=" + req.getOrgId() + " name=" + req.getName());
} }
PaperComposition newPc = PaperCompositionConvertor.convertToBean(req); PaperComposition newPc = PaperCompositionConvertor.convertToBean(req);
newPc.setId(curPc.getId()); newPc.setId(curPc.getId());
@ -155,8 +129,7 @@ public class PaperCompositionService {
this.updateCompositionRule(req.getRuleList(), req.getId()); this.updateCompositionRule(req.getRuleList(), req.getId());
} }
private void updateCompositionRule(List<PaperCompositionWithRuleVo.PaperRuleVo> updateRuleList, private void updateCompositionRule(List<PaperCompositionWithRuleVo.PaperRuleVo> updateRuleList, Long pcId) {
Long pcId) {
PaperRuleExample ruleExample = new PaperRuleExample(); PaperRuleExample ruleExample = new PaperRuleExample();
ruleExample.createCriteria().andPcIdEqualTo(pcId); ruleExample.createCriteria().andPcIdEqualTo(pcId);
this.ruleDAO.deleteByExample(ruleExample); this.ruleDAO.deleteByExample(ruleExample);
@ -169,11 +142,8 @@ public class PaperCompositionService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void lockPaperComposition(Long pcId, AccountVO user) { public void lockPaperComposition(Long pcId, AccountVO user) {
PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId); PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId);
PaperExceptionAssert.PcCanModify.assertTrue( PaperExceptionAssert.PcCanModify.assertTrue(null != curPc && PaperCompositionState.Editing.equals(PaperCompositionState.getItem(curPc.getState())), "试卷定义不存在或非编辑中");
null != curPc && PaperCompositionState.Editing.equals( PaperExceptionAssert.PcScore.assertTrue(this.checkRulesScoreEqualFull(curPc.getId()), "规则总分值不等于试卷总分值");
PaperCompositionState.getItem(curPc.getState())), "试卷定义不存在或非编辑中");
PaperExceptionAssert.PcScore.assertTrue(this.checkRulesScoreEqualFull(curPc.getId()),
"规则总分值不等于试卷总分值");
// //
PaperComposition nPc = new PaperComposition(); PaperComposition nPc = new PaperComposition();
nPc.setId(curPc.getId()); nPc.setId(curPc.getId());
@ -188,9 +158,7 @@ public class PaperCompositionService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void unlockPaperComposition(Long pcId, AccountVO user) { public void unlockPaperComposition(Long pcId, AccountVO user) {
PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId); PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId);
PaperExceptionAssert.PcCanModify.assertTrue( PaperExceptionAssert.PcCanModify.assertTrue(null != curPc && PaperCompositionState.Locked.equals(PaperCompositionState.getItem(curPc.getState())), "试卷定义不存在或非封存中");
null != curPc && PaperCompositionState.Locked.equals(
PaperCompositionState.getItem(curPc.getState())), "试卷定义不存在或非封存中");
// //
PaperComposition nPc = new PaperComposition(); PaperComposition nPc = new PaperComposition();
nPc.setId(curPc.getId()); nPc.setId(curPc.getId());
@ -245,17 +213,12 @@ public class PaperCompositionService {
* 断言试卷蓝图可以修改 * 断言试卷蓝图可以修改
*/ */
public void assertPaperCompositionCanModify(PaperComposition curPc) { public void assertPaperCompositionCanModify(PaperComposition curPc) {
PaperExceptionAssert.PcCanModify.assertTrue( PaperExceptionAssert.PcCanModify.assertTrue(null != curPc && PaperCompositionState.Editing.equals(PaperCompositionState.getItem(curPc.getState())), "试卷定义不存在或状态非编辑中不能修改pcId = " + curPc.getId());
null != curPc && PaperCompositionState.Editing.equals(
PaperCompositionState.getItem(curPc.getState())),
"试卷定义不存在或状态非编辑中不能修改pcId = " + curPc.getId());
} }
@Transactional(readOnly = true) @Transactional(readOnly = true)
public PageVO<PaperCompositionWithRuleVo> findPaperCompositionByPageForAccount( public PageVO<PaperCompositionWithRuleVo> findPaperCompositionByPageForAccount(FindPaperCompositionByAccountReqVo req) {
FindPaperCompositionByAccountReqVo req) { PaperExceptionAssert.PpValid.assertTrue(null != req.getAccount() || null != req.getUserId(), "账号和用户id不能同时为空");
PaperExceptionAssert.PpValid.assertTrue(null != req.getAccount() || null != req.getUserId(),
"账号和用户id不能同时为空");
Long userId = req.getUserId(); Long userId = req.getUserId();
if (null == userId) { if (null == userId) {
SysAccountExample accountExample = new SysAccountExample(); SysAccountExample accountExample = new SysAccountExample();
@ -279,8 +242,7 @@ public class PaperCompositionService {
} }
// //
List<SysAccount> users = this.sysAccountDAO.selectByExample(accountExample); 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(); userId = users.get(0).getId();
} }
// //
@ -334,8 +296,7 @@ public class PaperCompositionService {
/** /**
* 返回蓝图的列表基本信息 * 返回蓝图的列表基本信息
*/ */
public List<PaperCompositionWithRuleVo> findPaperCompositionList( public List<PaperCompositionWithRuleVo> findPaperCompositionList(FindPaperCompositionPageReqVo req){
FindPaperCompositionPageReqVo req) {
PaperCompositionExample pcEx = this.queryExample(req); PaperCompositionExample pcEx = this.queryExample(req);
pcEx.setOrderByClause(" create_time desc "); pcEx.setOrderByClause(" create_time desc ");
List<PaperComposition> sqlPage = compositionDAO.selectByExample(pcEx); List<PaperComposition> sqlPage = compositionDAO.selectByExample(pcEx);
@ -370,22 +331,17 @@ public class PaperCompositionService {
pcExCriteria.andProfileEqualTo(req.getProfile()); pcExCriteria.andProfileEqualTo(req.getProfile());
} }
} }
if (req.getCreatorId() != null) {
pcExCriteria.andCreatorIdEqualTo(req.getCreatorId());
}
List<PaperCompositionState> findStates = req.stateList(); List<PaperCompositionState> findStates = req.stateList();
pcExCriteria.andStateIn(findStates.stream().map(pcState -> { pcExCriteria.andStateIn(findStates.stream().map(pcState -> {
return pcState.getValue(); return pcState.getValue();
}).collect(Collectors.toList())); }).collect(Collectors.toList()));
return pcEx; return pcEx;
} }
/** /**
* 分页查找试卷蓝图 * 分页查找试卷蓝图
*/ */
@Transactional(readOnly = true) @Transactional(readOnly = true)
public PageVO<PaperCompositionWithRuleVo> findPaperCompositionByPage( public PageVO<PaperCompositionWithRuleVo> findPaperCompositionByPage(FindPaperCompositionPageReqVo req) {
FindPaperCompositionPageReqVo req) {
PaperCompositionExample pcEx = this.queryExample(req); PaperCompositionExample pcEx = this.queryExample(req);
// //
//1--创建时间 2--更新时间 3--名称默认值为1 //1--创建时间 2--更新时间 3--名称默认值为1
@ -431,11 +387,7 @@ public class PaperCompositionService {
if (null != sa) { if (null != sa) {
PaperCompositionWithRuleVo.CreatorBasic rt = new PaperCompositionWithRuleVo.CreatorBasic(); PaperCompositionWithRuleVo.CreatorBasic rt = new PaperCompositionWithRuleVo.CreatorBasic();
rt.setId(sa.getId()); rt.setId(sa.getId());
if (StringUtils.hasText(sa.getName())) {
rt.setName(sa.getName()); rt.setName(sa.getName());
} else {
rt.setName("昵称:" + sa.getNickname());
}
rt.setAccount(sa.getAccount()); rt.setAccount(sa.getAccount());
rt.setMobile(sa.getMobile()); rt.setMobile(sa.getMobile());
rt.setEmail(sa.getEmail()); rt.setEmail(sa.getEmail());
@ -483,13 +435,20 @@ public class PaperCompositionService {
return ruleDAO.selectByExample(example); return ruleDAO.selectByExample(example);
} }
public List<CreatorBasic> queryCreatorList(FindPaperCompositionPageReqVo req) { /**
List<CreatorBasic> creators = new ArrayList<>(); * 校验规则当前规定的总分值是否小于等于试卷蓝图中的满分
List<PaperCompositionWithRuleVo> rules = findPaperCompositionList(req); */
rules.stream().map(PaperCompositionWithRuleVo::getCreatorId) private boolean checkRulesScoreLessOrEqualFull(Long pcId) {
.distinct() PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId);
.forEach(creatorId -> creators.add(this.findCreatorInfo(creatorId))); PaperExceptionAssert.PcExisted.assertTrue(null != curPc, String.format("试卷定义[id = %s]不存在", pcId));
return creators; 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();
} }
/** /**
@ -497,8 +456,7 @@ public class PaperCompositionService {
*/ */
private boolean checkRulesScoreEqualFull(Long pcId) { private boolean checkRulesScoreEqualFull(Long pcId) {
PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId); PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId);
PaperExceptionAssert.PcExisted.assertTrue(null != curPc, PaperExceptionAssert.PcExisted.assertTrue(null != curPc, String.format("试卷定义[id = %s]不存在", pcId));
String.format("试卷定义[id = %s]不存在", pcId));
List<PaperRule> ruleList = findRuleByPcId(pcId); List<PaperRule> ruleList = findRuleByPcId(pcId);
int ruleScore = 0; int ruleScore = 0;
if (!CollectionUtils.isEmpty(ruleList)) { if (!CollectionUtils.isEmpty(ruleList)) {

View File

@ -231,7 +231,8 @@ public interface DeviceService {
void addOrUpdateThailandDeviceConfig(AccountVO accountVO, Long mapId); void addOrUpdateThailandDeviceConfig(AccountVO accountVO, Long mapId);
/**
* 所有沙盘项目通用接口
*/
void addOrUpdateNgyDeviceConfig(AccountVO accountVO, Long mapId); void addOrUpdateNgyDeviceConfig(AccountVO accountVO, Long mapId);
void addOrUpdateCdgxyDeviceConfig(AccountVO user);
} }

View File

@ -34,10 +34,6 @@ import club.joylink.rtss.vo.client.project.UDPClientConfigVO;
import club.joylink.rtss.vo.client.project.UDPLowConfigVO; import club.joylink.rtss.vo.client.project.UDPLowConfigVO;
import club.joylink.rtss.vo.client.project.VrIbpConfigVO; import club.joylink.rtss.vo.client.project.VrIbpConfigVO;
import club.joylink.rtss.vo.client.project.VrpsdConfigVO; 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; import club.joylink.rtss.vo.client.project.gzb.GzbSignalConfigVO;
import club.joylink.rtss.vo.client.project.gzb.GzbSwitchConfigVO; import club.joylink.rtss.vo.client.project.gzb.GzbSwitchConfigVO;
import club.joylink.rtss.vo.client.project.hhcj.HhcjIbpConfigVO; import club.joylink.rtss.vo.client.project.hhcj.HhcjIbpConfigVO;
@ -260,8 +256,7 @@ public class DeviceServiceImpl implements DeviceService {
ProjectDevice device = this.projectDeviceDAO.selectByPrimaryKey(id); ProjectDevice device = this.projectDeviceDAO.selectByPrimaryKey(id);
BusinessExceptionAssertEnum.INVALID_OPERATION.assertEquals( BusinessExceptionAssertEnum.INVALID_OPERATION.assertEquals(
ProjectDeviceType.valueOf(device.getType()), ProjectDeviceType.SANDBOX, ProjectDeviceType.valueOf(device.getType()), ProjectDeviceType.SANDBOX,
String.format("设备[%s(%s)]不是电子沙盘工作站,不能更新", device.getCode(), String.format("设备[%s(%s)]不是电子沙盘工作站,不能更新", device.getCode(), device.getType()));
device.getType()));
device.setConfig(configVO.toJson()); device.setConfig(configVO.toJson());
this.projectDeviceDAO.updateByPrimaryKeySelective(device); this.projectDeviceDAO.updateByPrimaryKeySelective(device);
} }
@ -271,8 +266,7 @@ public class DeviceServiceImpl implements DeviceService {
ProjectDevice device = this.projectDeviceDAO.selectByPrimaryKey(id); ProjectDevice device = this.projectDeviceDAO.selectByPrimaryKey(id);
BusinessExceptionAssertEnum.INVALID_OPERATION.assertEquals( BusinessExceptionAssertEnum.INVALID_OPERATION.assertEquals(
ProjectDeviceType.valueOf(device.getType()), ProjectDeviceType.ISCS_LW, ProjectDeviceType.valueOf(device.getType()), ProjectDeviceType.ISCS_LW,
String.format("设备[%s(%s)]不是现地综合监控工作站,不能更新", device.getCode(), String.format("设备[%s(%s)]不是现地综合监控工作站,不能更新", device.getCode(), device.getType()));
device.getType()));
device.setConfig(configVO.toJson()); device.setConfig(configVO.toJson());
this.projectDeviceDAO.updateByPrimaryKeySelective(device); this.projectDeviceDAO.updateByPrimaryKeySelective(device);
} }
@ -282,8 +276,7 @@ public class DeviceServiceImpl implements DeviceService {
ProjectDevice device = this.projectDeviceDAO.selectByPrimaryKey(id); ProjectDevice device = this.projectDeviceDAO.selectByPrimaryKey(id);
BusinessExceptionAssertEnum.INVALID_OPERATION.assertEquals( BusinessExceptionAssertEnum.INVALID_OPERATION.assertEquals(
ProjectDeviceType.valueOf(device.getType()), ProjectDeviceType.ISCS_CW, ProjectDeviceType.valueOf(device.getType()), ProjectDeviceType.ISCS_CW,
String.format("设备[%s(%s)]不是中心综合监控工作站,不能更新", device.getCode(), String.format("设备[%s(%s)]不是中心综合监控工作站,不能更新", device.getCode(), device.getType()));
device.getType()));
device.setConfig(configVO.toJson()); device.setConfig(configVO.toJson());
this.projectDeviceDAO.updateByPrimaryKeySelective(device); this.projectDeviceDAO.updateByPrimaryKeySelective(device);
} }
@ -293,8 +286,7 @@ public class DeviceServiceImpl implements DeviceService {
ProjectDevice device = this.projectDeviceDAO.selectByPrimaryKey(id); ProjectDevice device = this.projectDeviceDAO.selectByPrimaryKey(id);
BusinessExceptionAssertEnum.INVALID_OPERATION.assertEquals( BusinessExceptionAssertEnum.INVALID_OPERATION.assertEquals(
ProjectDeviceType.valueOf(device.getType()), ProjectDeviceType.VR_PSD, ProjectDeviceType.valueOf(device.getType()), ProjectDeviceType.VR_PSD,
String.format("设备[%s(%s)]不是虚拟屏蔽门工作站,不能更新", device.getCode(), String.format("设备[%s(%s)]不是虚拟屏蔽门工作站,不能更新", device.getCode(), device.getType()));
device.getType()));
device.setConfig(configVO.toJson()); device.setConfig(configVO.toJson());
this.projectDeviceDAO.updateByPrimaryKeySelective(device); this.projectDeviceDAO.updateByPrimaryKeySelective(device);
} }
@ -553,109 +545,6 @@ public class DeviceServiceImpl implements DeviceService {
} }
} }
@Override
public void addOrUpdateCdgxyDeviceConfig(AccountVO accountVO) {
// 删除旧配置
ProjectDeviceExample example = new ProjectDeviceExample();
example.createCriteria()
.andProjectCodeEqualTo(ProjectCode.CDGXY)
.andTypeIn(ProjectDeviceType.PlcDeviceList().stream().map(Enum::name)
.collect(Collectors.toList()));
this.projectDeviceDAO.deleteByExample(example);
// 保存新配置
List<ProjectDevice> list = this.buildCdgxyProjectDevices(accountVO);
for (ProjectDevice projectDevice : list) {
this.projectDeviceDAO.insert(projectDevice);
}
}
private List<ProjectDevice> buildCdgxyProjectDevices(AccountVO accountVO) {
LocalDateTime now = LocalDateTime.now();
List<ProjectDevice> list = new ArrayList<>();
String projectCode = ProjectCode.CDGXY;
String prefix = "cdgxy-";
// PLC网关
ProjectDevice plcGateway = new ProjectDevice();
plcGateway.setProjectCode(projectCode);
plcGateway.setCode(prefix + "gateway");
plcGateway.setType(ProjectDeviceType.PLC_GATEWAY.name());
plcGateway.setCreator(accountVO.getId());
plcGateway.setCreateTime(now);
PlcGatewayConfigVO plcGatewayConfigVO = new PlcGatewayConfigVO(0, 64);
plcGateway.setConfig(plcGatewayConfigVO.toJson());
list.add(plcGateway);
//SIGNAL
ProjectDevice signal1 = new ProjectDevice();
signal1.setProjectCode(projectCode);
signal1.setCode(prefix + "signal");
signal1.setType(ProjectDeviceType.SIGNAL.name());
signal1.setCreator(accountVO.getId());
signal1.setCreateTime(now);
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);
signal2.setCode(prefix + "signal");
signal2.setType(ProjectDeviceType.SIGNAL.name());
signal2.setCreator(accountVO.getId());
signal2.setCreateTime(now);
signal2.setConfig(new CgySignalConfigVO("X44854", 6, 7, 8, 9, 10, 11, 20, 21, 22, 23).toJson());
list.add(signal2);
//SWITCH
ProjectDevice aSwitch = new ProjectDevice();
aSwitch.setProjectCode(projectCode);
aSwitch.setCode(prefix + "switch");
aSwitch.setType(ProjectDeviceType.SWITCH.name());
aSwitch.setCreator(accountVO.getId());
aSwitch.setCreateTime(now);
aSwitch.setConfig(new CgySwitchConfigVO("W37779").toJson());
list.add(aSwitch);
//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;
}
private List<ProjectDevice> buildSayProjectDevices(AccountVO accountVO) { private List<ProjectDevice> buildSayProjectDevices(AccountVO accountVO) {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
List<ProjectDevice> list = new ArrayList<>(); List<ProjectDevice> list = new ArrayList<>();
@ -1299,8 +1188,8 @@ public class DeviceServiceImpl implements DeviceService {
section.setCreateTime(now); section.setCreateTime(now);
SandTableSectionConfigVO configVO = new SandTableSectionConfigVO(mapSectionNewVO.getCode(), SandTableSectionConfigVO configVO = new SandTableSectionConfigVO(mapSectionNewVO.getCode(),
mapSectionNewVO.getSrCode()); mapSectionNewVO.getSrCode());
section.setConfig(JsonUtils.writeValueAsString(configVO));
ngyFillTime(configVO, mapSectionNewVO); ngyFillTime(configVO, mapSectionNewVO);
section.setConfig(JsonUtils.writeValueAsString(configVO));
list.add(section); list.add(section);
} }
} }
@ -1324,7 +1213,8 @@ public class DeviceServiceImpl implements DeviceService {
private void ngyFillTime(SandTableSectionConfigVO configVO, MapSectionNewVO section) { private void ngyFillTime(SandTableSectionConfigVO configVO, MapSectionNewVO section) {
Float headDelayTime = null; Float headDelayTime = null;
Float tailDelayTime = null; Float tailDelayTime = null;
if (section.isStandTrack() || section.isReentryTrack() || section.isTransferTrack()) { if (section.isStandTrack() || section.isReentryTrack() || section.isTransferTrack()
|| section.isParkingTrack()) {
if (section.isStandTrack()) { if (section.isStandTrack()) {
tailDelayTime = 1f; tailDelayTime = 1f;
} else { } else {

View File

@ -12,13 +12,14 @@ import club.joylink.rtss.simulation.cbtc.data.map.Stand;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl;
import club.joylink.rtss.simulation.cbtc.event.SimulationPslStatusEvent; import club.joylink.rtss.simulation.cbtc.event.SimulationPslStatusEvent;
import club.joylink.rtss.vo.client.psl.PslStatus; 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.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.HashMap;
import java.util.Map;
@Service @Service
public class VirtualRealityPslService implements IVirtualRealityPslService { public class VirtualRealityPslService implements IVirtualRealityPslService {
@ -50,15 +51,13 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
} }
@Override @Override
public void pressTheButton(Simulation simulation, String standCode, public void pressTheButton(Simulation simulation, String standCode, VirtualRealityPsl.Button button) {
VirtualRealityPsl.Button button) {
Stand stand = simulation.getRepository().getByCode(standCode, Stand.class); Stand stand = simulation.getRepository().getByCode(standCode, Stand.class);
VirtualRealityPsl vrPsl = collectStatus(stand); VirtualRealityPsl vrPsl = collectStatus(stand);
theButtonIsPressed(simulation, vrPsl, button); theButtonIsPressed(simulation, vrPsl, button);
} }
private void theButtonIsPressed(Simulation simulation, VirtualRealityPsl vrPsl, private void theButtonIsPressed(Simulation simulation, VirtualRealityPsl vrPsl, VirtualRealityPsl.Button button) {
VirtualRealityPsl.Button button) {
Stand stand = vrPsl.getStand(); Stand stand = vrPsl.getStand();
switch (button) { switch (button) {
case YXJZ: case YXJZ:
@ -69,12 +68,10 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
ciApiService.setOrCancelInterlockRelease(simulation, stand, vrPsl.isHsjcKey()); ciApiService.setOrCancelInterlockRelease(simulation, stand, vrPsl.isHsjcKey());
break; break;
case KM: case KM:
ciApiService.openScreenDoor(simulation, stand.getCode(), ciApiService.openScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
CiStandService.PsdCommandSource.PSL);
break; break;
case GM: case GM:
ciApiService.closeScreenDoor(simulation, stand.getCode(), ciApiService.closeScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
CiStandService.PsdCommandSource.PSL);
break; break;
case SD: case SD:
vrPsl.setSdButton(!vrPsl.isSdButton()); vrPsl.setSdButton(!vrPsl.isSdButton());
@ -83,8 +80,7 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
} }
@Override @Override
public void updateStatus(Simulation simulation, VirtualRealityPsl vrPsl, public void updateStatus(Simulation simulation, VirtualRealityPsl vrPsl, VirtualRealityPsl.Button button, boolean on) {
VirtualRealityPsl.Button button, boolean on) {
switch (button) { switch (button) {
case YXJZ: case YXJZ:
vrPsl.setYxjzKey(on); vrPsl.setYxjzKey(on);
@ -93,10 +89,7 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
vrPsl.setHsjcKey(on); vrPsl.setHsjcKey(on);
break; break;
case KM: case KM:
vrPsl.setKmButton(on);
break;
case GM: case GM:
vrPsl.setGmButton(on);
break; break;
case SD: case SD:
vrPsl.setSdButton(on); vrPsl.setSdButton(on);
@ -105,8 +98,7 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
effective(simulation, vrPsl.getStand(), button, on); effective(simulation, vrPsl.getStand(), button, on);
} }
private void effective(Simulation simulation, Stand stand, VirtualRealityPsl.Button button, private void effective(Simulation simulation, Stand stand, VirtualRealityPsl.Button button, boolean on) {
boolean on) {
switch (button) { switch (button) {
case YXJZ: case YXJZ:
break; break;
@ -114,16 +106,12 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
ciApiService.setOrCancelInterlockRelease(simulation, stand, on); ciApiService.setOrCancelInterlockRelease(simulation, stand, on);
break; break;
case KM: case KM:
if (on) { if (on)
ciApiService.openScreenDoor(simulation, stand.getCode(), ciApiService.openScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
CiStandService.PsdCommandSource.PSL);
}
break; break;
case GM: case GM:
if (on) { if (on)
ciApiService.closeScreenDoor(simulation, stand.getCode(), ciApiService.closeScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
CiStandService.PsdCommandSource.PSL);
}
break; break;
case SD: case SD:
break; break;
@ -141,9 +129,8 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
Map<String, PslStatus> ibpStatusMap = repository.getPslStatusMap(); Map<String, PslStatus> ibpStatusMap = repository.getPslStatusMap();
Map<String, PslStatus> collectionMap = new HashMap<>(); Map<String, PslStatus> collectionMap = new HashMap<>();
for (Stand stand : repository.getStandList()) { for (Stand stand : repository.getStandList()) {
if (stand.getVrPsl() == null) { if (stand.getVrPsl() == null)
continue; continue;
}
VirtualRealityPsl vrPsl = this.collectStatus(stand); VirtualRealityPsl vrPsl = this.collectStatus(stand);
PslStatus pslStatus = ibpStatusMap.get(stand.getCode()); PslStatus pslStatus = ibpStatusMap.get(stand.getCode());
if (pslStatus == null) { if (pslStatus == null) {
@ -158,8 +145,7 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
} }
} }
if (!CollectionUtils.isEmpty(collectionMap)) { if (!CollectionUtils.isEmpty(collectionMap)) {
applicationContext.publishEvent( applicationContext.publishEvent(new SimulationPslStatusEvent(this, simulation, collectionMap));
new SimulationPslStatusEvent(this, simulation, collectionMap));
} }
} }

View File

@ -280,7 +280,13 @@ public class PublishMapDataHandler {
MapGraphDataNewVO data = JsonUtils.read(map.getGraphData(), MapGraphDataNewVO.class); MapGraphDataNewVO data = JsonUtils.read(map.getGraphData(), MapGraphDataNewVO.class);
for (MapSectionNewVO section : data.getSectionList()) { for (MapSectionNewVO section : data.getSectionList()) {
if (section.getLengthFact() != null && section.getLengthFact() != 0) { if (section.getLengthFact() != null && section.getLengthFact() != 0) {
section.setLengthFact(section.getLengthFact() * multiple); if (section.isStandTrack() || section.isParkingTrack()) {
section.setLengthFact(140f);
} else if (section.isSwitchSection()) {
section.setLengthFact(30f);
} else {
section.setLengthFact(1000f);
}
} }
} }
map.setGraphData(JsonUtils.writeValueAsString(data)); map.setGraphData(JsonUtils.writeValueAsString(data));

View File

@ -1,119 +0,0 @@
package club.joylink.rtss.services.race;
import club.joylink.rtss.bo.race.RaceContent;
import club.joylink.rtss.entity.racetr.RacetrScene;
import club.joylink.rtss.entity.training2.DraftTraining2WithBLOBs;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.training2.Training2Service;
import club.joylink.rtss.simulation.cbtc.training2.Training2.Type;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.paper.PaperTrainAnswerDetail;
import club.joylink.rtss.vo.race.RaceApplication.RacePracticeResult;
import club.joylink.rtss.vo.race.RaceApplication.ResultNode.Builder;
import club.joylink.rtss.vo.race.RaceSceneOuterClass;
import club.joylink.rtss.vo.race.RaceTask;
import club.joylink.rtss.vo.race.RaceTaskFinishParamDTO;
import com.google.protobuf.InvalidProtocolBufferException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service
@AllArgsConstructor
public class RaceApplicationService {
private RacePaperService racePaperService;
private Training2Service training2Service;
private RaceSceneService raceSceneService;
private static final Map<Long, RaceContent> raceContentMap = new HashMap<>();
/**
* 开始训练
*
* @return 模块任务树
*/
public RaceTask.RacePaperSingleModuleGroupTask start(long paperId, int moduleId, long userId) {
RaceContent content = new RaceContent(userId, paperId, moduleId,
racePaperService.singlePaperModuleTask(paperId, moduleId));
RaceContent oldContent = raceContentMap.put(userId, content);
if (oldContent != null) {
log.info("用户[%d]开始了[赛题:{}|模块:{}]的训练,并且覆盖了就训练", paperId, moduleId);
} else {
log.info("用户[%d]开始了[赛题:{}|模块:{}]的训练", paperId, moduleId);
}
return content.getTaskTree();
}
public void loadScene(String simulationId, long sceneId, LoginUserInfoVO loginInfo) {
//获取场景数据
RacetrScene scene = raceSceneService.findById(sceneId);
RaceSceneOuterClass.StorageSimulation sceneProto;
try {
sceneProto = RaceSceneOuterClass.Scene.parseFrom(scene.getProto()).getStorageSimulation();
} catch (InvalidProtocolBufferException e) {
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("场景数据解析出错", e);
}
//场景数据转实训数据
DraftTraining2WithBLOBs draftTraining2 = new DraftTraining2WithBLOBs();
draftTraining2.setName(scene.getName());
draftTraining2.setBgSceneJson(sceneProto.getBgSceneJson());
// draftTraining2.setOperaJson(sceneProto.get); operaJson没了
draftTraining2.setStepJson(sceneProto.getStepJson());
draftTraining2.setScoringRuleJson(sceneProto.getScoringRuleJson());
draftTraining2.setMemberJson(sceneProto.getMemberJson());
draftTraining2.setPlayerIdJson(JsonUtils.writeValueAsString(sceneProto.getPlayerIdsList()));
// draftTraining2.setClient(sceneProto); client没了
draftTraining2.setType(Type.SCENE.name()); //数据里没存暂时固定用此类型
training2Service.trainingDataValid(draftTraining2);
//加载实训
training2Service.simulationLoadTraining(simulationId, draftTraining2, loginInfo);
}
public List<PaperTrainAnswerDetail> finishTask(long taskId, RaceTaskFinishParamDTO paramDTO,
AccountVO user) {
if (paramDTO == null) {
return null;
}
RaceContent content = getContent(user.getId());
List<PaperTrainAnswerDetail> result = training2Service.finishTraining2(
paramDTO.getSimulationId(), user, paramDTO.getScoreList());
Builder resultNode = content.getResultNode(taskId);
float fullScore = 0;
float score = 0;
for (PaperTrainAnswerDetail paperTrainAnswerDetail : result) {
if (paperTrainAnswerDetail.getRuleScore() != null) {
fullScore += paperTrainAnswerDetail.getRuleScore();
}
if (paperTrainAnswerDetail.getScore() != null) {
score += paperTrainAnswerDetail.getScore();
}
}
resultNode.setFullScore(fullScore);
resultNode.setScore(score);
return result;
}
public RacePracticeResult finish(long userId) {
RaceContent content = getContent(userId);
RacePracticeResult result = content.getResult().build();
raceContentMap.remove(userId);
log.info("用户[{}]完成[赛题:{} | 模块:{}]", userId, content.getPaperId(),
content.getModuleId());
return result;
}
private RaceContent getContent(long userId) {
RaceContent content = raceContentMap.get(userId);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(content,
String.format("未找到用户[%d]的训练上下文", userId));
return content;
}
}

View File

@ -1,382 +0,0 @@
package club.joylink.rtss.services.race;
import club.joylink.rtss.dao.racetr.RacetrPaperDAO;
import club.joylink.rtss.dao.racetr.RacetrSeasonDAO;
import club.joylink.rtss.entity.racetr.RacetrPaper;
import club.joylink.rtss.entity.racetr.RacetrPaperExample;
import club.joylink.rtss.entity.racetr.RacetrSeason;
import club.joylink.rtss.entity.racetr.RacetrSeasonExample;
import club.joylink.rtss.entity.racetr.RacetrSeasonExample.Criteria;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.common.ModifyInfo.ModifyInfoVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperCreateVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperDetailVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperMenuVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperMenuVO.PaperMenu;
import club.joylink.rtss.vo.race.RacePaper.RacePaperMenuVO.SeasonMenu;
import club.joylink.rtss.vo.race.RacePaper.RacePaperModuleVO;
import club.joylink.rtss.vo.race.RacePaper.RacePaperModuleVO.PaperModule;
import club.joylink.rtss.vo.race.RacePaper.RacePaperVO;
import club.joylink.rtss.vo.race.RacePaperPageVO;
import club.joylink.rtss.vo.race.RacePaperQueryVO;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScene.Type;
import club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeason.Group;
import club.joylink.rtss.vo.race.RaceTask.RacePaperSingleModuleGroupTask;
import club.joylink.rtss.vo.race.RaceTask.RaceTaskChildVO;
import club.joylink.rtss.vo.race.RaceTask.RaceTaskChildVO.ChildNodeType;
import club.joylink.rtss.vo.race.RaceTaskDetailDTO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@Service
@Slf4j
public class RacePaperService {
@Autowired
private RacetrPaperDAO paperDAO;
@Autowired
private RaceTaskService taskService;
@Autowired
private RacetrSeasonDAO seasonDAO;
private RacetrPaper findId(Long id) {
RacetrPaper rp = this.paperDAO.selectByPrimaryKey(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(rp), "未找到对应的试卷");
return rp;
}
public void create(RacePaperCreateVO createVO, AccountVO user) {
LocalDateTime now = LocalDateTime.now();
RacetrPaper rp = new RacetrPaper();
rp.setName(createVO.getName());
rp.setDesc(createVO.getDesc());
rp.setSeasonId(createVO.getSeasonId());
rp.setCreateTime(now);
rp.setUpdateTime(now);
rp.setCreatorId(user.getId());
rp.setUpdaterId(user.getId());
this.paperDAO.insertSelective(rp);
}
public void update(Long id, RacePaperCreateVO updateVO, AccountVO user) {
RacetrPaper rp = this.findId(id);
rp.setName(updateVO.getName());
rp.setDesc(updateVO.getDesc());
rp.setSeasonId(updateVO.getSeasonId());
rp.setUpdateTime(LocalDateTime.now());
rp.setUpdaterId(user.getId());
this.paperDAO.updateByPrimaryKey(rp);
}
private List<RacetrSeason> findSeasonMenu(Group group) {
RacetrSeasonExample example = new RacetrSeasonExample();
Criteria c = example.createCriteria();
if (Objects.nonNull(group) && group != Group.Unknown) {
c.andGroupEqualTo(group.name());
}
List<RacetrSeason> seasons = this.seasonDAO.selectByExampleWithBLOBs(example);
return seasons;
}
public RacePaperMenuVO pageMenuQuery(RacePaperQueryVO query) {
Group group = Group.Unknown;
if (StringUtils.isNotEmpty(query.getGroup())) {
group = Group.valueOf(query.getGroup());
}
List<RacetrSeason> seasons = this.findSeasonMenu(group);
RacePaperMenuVO.Builder menuBuilder = RacePaperMenuVO.newBuilder();
if (CollectionUtils.isEmpty(seasons)) {
return menuBuilder.build();
}
List<Long> seasonIdList = seasons.stream().map(RacetrSeason::getId).collect(Collectors.toList());
RacetrPaperExample paperExample = new RacetrPaperExample();
paperExample.createCriteria().andSeasonIdIn(seasonIdList);
List<RacetrPaper> papers = this.paperDAO.selectByExample(paperExample);
Map<Long, List<RacetrPaper>> paperMapList = papers.stream().collect(Collectors.groupingBy(RacetrPaper::getSeasonId));
for (RacetrSeason season : seasons) {
SeasonMenu.Builder sm = SeasonMenu.newBuilder();
sm.setSeasonId(season.getId());
sm.setSeasonName(season.getTerm());
sm.setSeasonCode(season.getCode());
if (StringUtils.isNotEmpty(season.getDetailHtmlContent())) {
sm.setDetailHtmlContent(season.getDetailHtmlContent());
}
this.convertPaperMenu(sm, paperMapList);
menuBuilder.addMenu(sm);
}
return menuBuilder.build();
}
private void convertPaperMenu(SeasonMenu.Builder seasonBuild, Map<Long, List<RacetrPaper>> paperMapList) {
List<RacetrPaper> paperList = paperMapList.get(seasonBuild.getSeasonId());
if (!CollectionUtils.isEmpty(paperList)) {
for (RacetrPaper paper : paperList) {
PaperMenu.Builder pm = PaperMenu.newBuilder();
pm.setId(paper.getId());
pm.setName(paper.getName());
seasonBuild.addPapers(pm);
}
}
}
public PageVO<RacePaperVO> pageQuery(RacePaperQueryVO query) {
if (!StringUtils.equalsAny(query.getGroup(), Group.GZ.name(), Group.ZZ.name())) {
query.setGroup(null);
}
PageHelper.startPage(query.getPageNum(), query.getPageSize());
Page<RacePaperPageVO> page = (Page<RacePaperPageVO>) this.paperDAO.pages(query);
List<RacePaperVO> voList = this.convertEntity(page.getResult());
return PageVO.convert(page, voList);
}
private RacePaperVO convertGroupDTO(RacePaperPageVO rp) {
RacePaperVO.Builder builder = RacePaperVO.newBuilder();
ModifyInfoVO modifyInfoVO = RaceServiceUtil.createModifyInfo(rp.getCreatorId(), rp.getCreatorName(), rp.getUpdaterId(), rp.getUpdaterName(), rp.getCreateTime(), rp.getUpdateTime());
builder.setId(rp.getId());
builder.setName(rp.getName());
builder.setDesc(rp.getDesc());
builder.setModifyInfo(modifyInfoVO);
builder.setSeasonId(rp.getSeasonId());
builder.setSeasonName(Objects.isNull(rp.getSeasonName()) ? "" : rp.getSeasonName());
builder.setGroup(Group.Unknown);
if (Objects.nonNull(rp.getGroup())) {
builder.setGroup(Group.valueOf(rp.getGroup()));
}
return builder.build();
}
private List<RacePaperVO> convertEntity(List<RacePaperPageVO> rpList) {
if (CollectionUtils.isEmpty(rpList)) {
return Collections.emptyList();
}
List<RacePaperVO> voList = Lists.newArrayListWithCapacity(rpList.size());
for (RacePaperPageVO rp : rpList) {
voList.add(this.convertGroupDTO(rp));
}
return voList;
}
public void delete(long id) {
this.paperDAO.deleteByPrimaryKey(id);
}
public RacePaperDetailVO detail(Long id) {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(id), "请选择对应的试卷");
RacePaperPageVO paper = this.paperDAO.detail(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(paper), "未找到对应的试卷");
RacePaperDetailVO.Builder vo = RacePaperDetailVO.newBuilder();
vo.setId(paper.getId());
vo.setName(paper.getName());
vo.setDesc(paper.getDesc());
vo.setSupportCopy(!Objects.isNull(paper.getSupportCopy()) && paper.getSupportCopy());
vo.setModifyInfo(RaceServiceUtil.createModifyInfo(paper.getCreatorId(), paper.getCreatorName(), paper.getUpdaterId(), paper.getUpdaterName(), paper.getCreateTime(), paper.getUpdateTime()));
if (Objects.nonNull(paper.getSeasonId())) {
vo.setSeasonId(paper.getSeasonId());
vo.setSeasonName(paper.getSeasonName());
}
if (Objects.nonNull(paper.getConfigs())) {
try {
RacePaperModuleVO moduleVO = RacePaperModuleVO.parseFrom(paper.getConfigs());
vo.setModuleVo(moduleVO);
} catch (Exception e) {
log.error("试卷[{}][{}] 配置解析失败 msg:[{}]", paper.getName(), paper.getId(), e.getMessage());
BusinessExceptionAssertEnum.DATA_ERROR.fail("数据配置解析失败");
}
}
return vo.build();
}
public void configSeting(Long id, RacePaperModuleVO moduleVO, AccountVO user) {
RacetrPaper paper = this.findId(id);
paper.setUpdateTime(LocalDateTime.now());
paper.setUpdaterId(user.getId());
int customId = 1;
RacePaperModuleVO.Builder voBuild = moduleVO.toBuilder();
List<PaperModule> pmList = Lists.newArrayListWithExpectedSize(voBuild.getModulesList().size());
for (PaperModule pm : voBuild.getModulesList()) {
PaperModule.Builder pmBuild = pm.toBuilder();
pmBuild.setCustomModuleId(++customId);
pmList.add(pmBuild.build());
}
voBuild.clearModules();
voBuild.addAllModules(pmList);
paper.setConfigs(voBuild.build().toByteArray());
this.paperDAO.updateByPrimaryKeySelective(paper);
}
public void copy(Long id, AccountVO user) {
RacetrPaper paper = this.findId(id);
LocalDateTime now = LocalDateTime.now();
paper.setId(null);
paper.setName(String.format("%s_copy", paper.getName()));
paper.setCreatorId(user.getId());
paper.setUpdaterId(user.getId());
paper.setCreateTime(now);
paper.setUpdateTime(now);
this.paperDAO.insert(paper);
}
/**
* 试卷考试返回模块下所有的group和任务所有数据形成在一个""
*
* @param paperId
* @param moduleId
* @return
*/
public RacePaperSingleModuleGroupTask singlePaperModuleTask(Long paperId, Integer moduleId) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(moduleId), "请选择对应的模型");
RacePaperDetailVO detailVO = this.detail(paperId);
RacePaperModuleVO moduleVO = detailVO.getModuleVo();
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(!CollectionUtils.isEmpty(moduleVO.getModulesList()), "此试卷没有模块数据");
PaperModule pm = moduleVO.getModulesList().stream().filter(d -> d.getCustomModuleId() == moduleId).findFirst().orElse(null);
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(pm), "没有找到对应的模块");
List<Long> allGroupTaskIds = this.collectAllTaskIds(pm.getGroupList());
Map<Long, List<RaceTaskDetailDTO>> taskMapList = this.taskService.recursiveFindTask(allGroupTaskIds);
List<RaceTaskChildVO> childVOS = this.singleTreeConvertModuleGroup(pm.getGroupList(), taskMapList);
RacePaperSingleModuleGroupTask.Builder modultTask = RacePaperSingleModuleGroupTask.newBuilder();
modultTask.setCustomModuleId(moduleId);
modultTask.addAllChild(childVOS);
return modultTask.build();
}
/**
* 获取模块下的所有数据包括""
*
* @param groupList
* @param allTaskMapList
* @return
*/
private List<RaceTaskChildVO> singleTreeConvertModuleGroup(List<RacePaperModuleVO.Group> groupList, Map<Long, List<RaceTaskDetailDTO>> allTaskMapList) {
List<RaceTaskChildVO> groups = new ArrayList<>();
for (RacePaperModuleVO.Group group : groupList) {
RaceTaskChildVO.Builder childVOB = RaceTaskChildVO.newBuilder();
childVOB.setName(group.getName());
childVOB.setNodeType(ChildNodeType.MODULE_GROUP);
for (Long taskId : group.getTaskIdsList()) {
RaceTaskChildVO taskVO = this.findTask(taskId, allTaskMapList);
childVOB.addChildren(taskVO);
}
if (!CollectionUtils.isEmpty(group.getGroupList())) {
List<RaceTaskChildVO> childGroup = this.singleTreeConvertModuleGroup(group.getGroupList(), allTaskMapList);
childVOB.addAllChildren(childGroup);
}
groups.add(childVOB.build());
}
return groups;
}
/**
* 获取任务树的根节点
*
* @param taskId
* @param allTaskMapList
* @return
*/
private RaceTaskChildVO findTask(Long taskId, Map<Long, List<RaceTaskDetailDTO>> allTaskMapList) {
List<RaceTaskDetailDTO> dtoList = allTaskMapList.get(RaceTaskService.TASK_ROOT_ID);
RaceTaskDetailDTO taskDto = dtoList.stream().filter(d -> Objects.equals(d.getId(), taskId)).findFirst().orElse(null);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(taskDto), String.format("对应的任务没有找到[%s]", taskDto));
RaceTaskChildVO.Builder vo = this.convertGroupDTO(taskDto, ChildNodeType.TASK);
this.findChildTask(vo, allTaskMapList);
return vo.build();
}
/**
* 获取任务树的所有子节点
*
* @param vob
* @param allTaskMapList
*/
private void findChildTask(RaceTaskChildVO.Builder vob, Map<Long, List<RaceTaskDetailDTO>> allTaskMapList) {
List<RaceTaskDetailDTO> childDto = allTaskMapList.get(vob.getId());
if (!CollectionUtils.isEmpty(childDto)) {
for (RaceTaskDetailDTO ch : childDto) {
RaceTaskChildVO.Builder chvo = this.convertGroupDTO(ch, ChildNodeType.TASK);
vob.addChildren(chvo);
this.findChildTask(chvo, allTaskMapList);
}
}
}
private RaceTaskChildVO.Builder convertGroupDTO(RaceTaskDetailDTO dto, ChildNodeType nodeType) {
RaceTaskChildVO.Builder cb = RaceTaskChildVO.newBuilder();
if (ChildNodeType.TASK == nodeType) {
cb.setId(dto.getId());
cb.setDesc(dto.getDesc());
cb.setContent(dto.getContent());
cb.setStandards(dto.getStandards());
cb.setParentId(dto.getParentId());
}
if (Objects.nonNull(dto.getRuleId())) {
cb.setRuleId(dto.getRuleId());
}
if (StringUtils.isNotEmpty(dto.getSceneType())) {
cb.setSceneType(Type.valueOf(dto.getSceneType()));
}
if (Objects.nonNull(dto.getSceneId())) {
cb.setSceneId(dto.getSceneId());
}
cb.setNodeType(nodeType);
cb.setName(dto.getName());
return cb;
}
/**
* 收集模块及子模块所有的任务id
*
* @param groupList
* @return
*/
private List<Long> collectAllTaskIds(List<RacePaperModuleVO.Group> groupList) {
List<Long> allTaskIds = Lists.newArrayList();
for (RacePaperModuleVO.Group group : groupList) {
this.collectTaskIds(group, allTaskIds);
}
return allTaskIds.stream().distinct().collect(Collectors.toList());
}
/**
* 收集所有子级任务ID
*
* @param group
* @param collectorList
*/
private void collectTaskIds(RacePaperModuleVO.Group group, List<Long> collectorList) {
collectorList.addAll(group.getTaskIdsList());
if (!CollectionUtils.isEmpty(group.getGroupList())) {
for (RacePaperModuleVO.Group group1 : group.getGroupList()) {
this.collectTaskIds(group1, collectorList);
}
}
}
}

View File

@ -1,246 +0,0 @@
package club.joylink.rtss.services.race;
import club.joylink.rtss.dao.DraftTraining2DAO;
import club.joylink.rtss.dao.racetr.RacetrSceneDAO;
import club.joylink.rtss.dao.racetr.RacetrTaskDAO;
import club.joylink.rtss.entity.racetr.RacetrScene;
import club.joylink.rtss.entity.racetr.RacetrSceneExample;
import club.joylink.rtss.entity.racetr.RacetrTaskExample;
import club.joylink.rtss.entity.training2.DraftTraining2WithBLOBs;
import club.joylink.rtss.exception.BusinessExceptionAssert;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.exception.RacetrExceptionAssert;
import club.joylink.rtss.services.MinioService;
import club.joylink.rtss.simulation.cbtc.training2.Training2;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.common.ModifyInfo.ModifyInfoVO;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScene;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScene.Type;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceSceneListVO;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceScenePublishVO;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.RaceSceneVO;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.Scene;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.SceneCustomCreateVO;
import club.joylink.rtss.vo.race.RaceSceneOuterClass.StorageSimulation;
import club.joylink.rtss.vo.race.RaceScenePageVO;
import club.joylink.rtss.vo.race.RaceSceneQueryVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
import com.google.protobuf.InvalidProtocolBufferException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestAttribute;
@Service
@Slf4j
public class RaceSceneService {
@Autowired
private RacetrSceneDAO sceneDAO;
@Autowired
private RacetrTaskDAO taskDAO;
@Autowired
private DraftTraining2DAO trainingDao;
@Autowired
private MinioService minioService;
public RacetrScene findById(Long id) {
RacetrScene rs = this.sceneDAO.selectByPrimaryKey(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(rs), "没有找到对应的场景");
return rs;
}
public void customSave(SceneCustomCreateVO vo, AccountVO user) {
LocalDateTime now = LocalDateTime.now();
RacetrScene rs = new RacetrScene();
rs.setName(vo.getName());
rs.setType(vo.getType().name());
rs.setProto(vo.getScene().toByteArray());
rs.setCreatorId(user.getId());
rs.setUpdaterId(user.getId());
rs.setCreateTime(now);
rs.setUpdateTime(now);
this.sceneDAO.insert(rs);
}
public void customUpdate(Long id, SceneCustomCreateVO vo, AccountVO user) {
RacetrScene rs = this.findById(id);
this.removeObj(rs);
rs.setName(vo.getName());
rs.setType(vo.getType().name());
rs.setProto(vo.getScene().toByteArray());
rs.setUpdaterId(user.getId());
rs.setUpdateTime(LocalDateTime.now());
this.sceneDAO.updateByPrimaryKeySelective(rs);
}
private void removeObj(RacetrScene rs) {
byte[] protoData = rs.getProto();
if (ArrayUtils.isEmpty(protoData)) {
log.error("自定义删除场景附件proto数据不能为空 id:[{}]", rs.getId());
return;
}
try {
if (!Objects.equals(rs.getType(), Type.Video.name())) {
return;
}
Scene sceneProto = Scene.parseFrom(protoData);
this.minioService.removeMinioObject(rs.getType(), sceneProto.getFileName());
} catch (Exception e) {
log.error("场景附件处理失败 id:[{}] msg:[{}]", rs.getId(), e.getMessage(), e);
}
}
public PageVO<RaceSceneListVO> page(RaceSceneQueryVO query) {
PageHelper.startPage(query.getPageNum(), query.getPageSize());
Page<RaceScenePageVO> page = (Page<RaceScenePageVO>) this.sceneDAO.pages(query);
List<RaceSceneListVO> voList = this.convertDto(page.getResult());
return PageVO.convert(page, voList);
}
private RaceSceneListVO convertVO(RaceScenePageVO rs) {
RaceSceneListVO.Builder vo = RaceSceneListVO.newBuilder();
vo.setId(rs.getId());
vo.setName(rs.getName());
ModifyInfoVO modifyInfoVO = RaceServiceUtil.createModifyInfo(rs.getCreatorId(), rs.getCreatorName(), rs.getUpdaterId(), rs.getUpdaterName(), rs.getCreateTime(), rs.getUpdateTime());
vo.setModifyInfo(modifyInfoVO);
vo.setType(Type.valueOf(rs.getType()));
if (Objects.nonNull(rs.getMapId())) {
vo.setMapId(rs.getMapId());
vo.setMapName(rs.getMapName());
}
return vo.build();
}
public List<RaceSceneListVO> convertDto(List<RaceScenePageVO> list) {
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
List<RaceSceneListVO> voList = Lists.newArrayListWithCapacity(list.size());
for (RaceScenePageVO rs : list) {
voList.add(this.convertVO(rs));
}
return voList;
}
public void delete(Long id) {
RacetrTaskExample taskExample = new RacetrTaskExample();
taskExample.createCriteria().andSceneIdEqualTo(id);
long bindTaskCount = this.taskDAO.countByExample(taskExample);
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(bindTaskCount <= 0, "此场景已被任务绑定不能删除");
RacetrScene rs = this.findById(id);
this.removeObj(rs);
this.sceneDAO.deleteByPrimaryKey(id);
}
public void publishHere(RaceScenePublishVO vo, AccountVO user) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(StringUtils.hasText(vo.getName()), "请输入发布场景的名称");
String publishName = vo.getName().trim();
PublishHereVO phvo = this.createSceneProto(vo.getDafitid());
RacetrSceneExample sceneExample = new RacetrSceneExample();
sceneExample.createCriteria().andNameEqualTo(publishName);
// sceneExample.createCriteria().andDraftTrainingIdEqualTo(vo.getDafitid());
List<RacetrScene> rsList = this.sceneDAO.selectByExample(sceneExample);
if (!CollectionUtils.isEmpty(rsList) && Objects.equals(vo.getForcePublish(), false)) {
RacetrExceptionAssert.publishSceneNotForce.fail();
}
LocalDateTime now = LocalDateTime.now();
RacetrScene rs;
boolean sceneExist = false;
if (CollectionUtils.isEmpty(rsList)) {
rs = new RacetrScene();
rs.setCreatorId(user.getId());
rs.setCreateTime(now);
rs.setType(Type.Local.name());
rs.setDraftTrainingId(vo.getDafitid());
} else {
sceneExist = true;
rs = rsList.get(0);
}
rs.setUpdaterId(user.getId());
rs.setUpdateTime(now);
rs.setMapId(phvo.mapId);
rs.setName(publishName);
Scene.Builder sceneBu = Scene.newBuilder();
sceneBu.setStorageSimulation(phvo.getStorageSimulation());
rs.setProto(sceneBu.build().toByteArray());
if (sceneExist) {
this.sceneDAO.updateByPrimaryKeySelective(rs);
} else {
this.sceneDAO.insert(rs);
}
}
private PublishHereVO createSceneProto(Long TraningPublish) {
DraftTraining2WithBLOBs bs = this.trainingDao.selectByPrimaryKey(TraningPublish);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(bs), "没有找到对应的实训数据");
Training2.Type traingType = Training2.Type.valueOf(bs.getType());
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(traingType == Training2.Type.SCENE, "发布的实训类型只能位场景类型");
List<String> plays = JsonUtils.readCollection(bs.getPlayerIdJson(), ArrayList.class, String.class);
StorageSimulation.Builder ss = StorageSimulation.newBuilder();
ss.setBgSceneJson(bs.getBgSceneJson());
ss.setMemberJson(bs.getMemberJson());
ss.setStepJson(bs.getStepJson());
ss.addAllPlayerIds(plays);
ss.setScoringRuleJson(bs.getScoringRuleJson());
return new PublishHereVO(bs.getMapId(), ss.build());
}
public RaceSceneVO detail(Long id) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(id), "请选择对应的场景");
RaceScenePageVO rs = this.sceneDAO.detail(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(rs), "没有找到对应的场景");
RaceSceneVO.Builder builder = RaceSceneVO.newBuilder();
builder.setId(rs.getId());
builder.setName(rs.getName());
builder.setType(Type.valueOf(rs.getType()));
ModifyInfoVO modifyInfoVO = RaceServiceUtil.createModifyInfo(rs.getCreatorId(), rs.getCreatorName(), rs.getUpdaterId(), rs.getUpdaterName(), rs.getCreateTime(), rs.getUpdateTime());
builder.setModifyInfo(modifyInfoVO);
if (Objects.nonNull(rs.getMapId())) {
builder.setMapId(rs.getMapId());
builder.setMapName(rs.getName());
}
if (Objects.nonNull(rs.getProto())) {
try {
Scene scene = Scene.parseFrom(rs.getProto());
builder.setScene(scene);
} catch (Exception e) {
log.error("场景解析数据失败id[{}] msg:{}", id, e.getMessage());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.fail("数据获取失败");
}
}
return builder.build();
}
@Getter
private static class PublishHereVO {
private Long mapId;
private StorageSimulation storageSimulation;
public PublishHereVO(Long mapId, StorageSimulation storageSimulation) {
this.mapId = mapId;
this.storageSimulation = storageSimulation;
}
}
}

View File

@ -1,129 +0,0 @@
package club.joylink.rtss.services.race;
import club.joylink.rtss.dao.racetr.RacetrScoringRuleDAO;
import club.joylink.rtss.dao.racetr.RacetrTaskDAO;
import club.joylink.rtss.entity.racetr.RacetrScoringRule;
import club.joylink.rtss.entity.racetr.RacetrTaskExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.ISysUserService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.common.ModifyInfo.ModifyInfoVO;
import club.joylink.rtss.vo.race.RaceRuleListVO;
import club.joylink.rtss.vo.race.RaceScoringRule.RaceScoringRuleListVO;
import club.joylink.rtss.vo.race.RaceScoringRule.RaceScoringRuleVO;
import club.joylink.rtss.vo.race.RaceScoringRule.Rule;
import club.joylink.rtss.vo.race.TaskRuleQueryVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
@Service
@Slf4j
public class RaceScoreRuleService {
@Autowired
private RacetrScoringRuleDAO ruleDAO;
@Autowired
private RacetrTaskDAO taskDAO;
private RacetrScoringRule findId(Long id) {
RacetrScoringRule rule = this.ruleDAO.selectByPrimaryKey(id);
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(Objects.nonNull(rule), "没有找到该评分规则");
return rule;
}
public void saveBasic(String name, AccountVO user) {
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(StringUtils.hasText(name), "规则名称不能为空");
LocalDateTime now = LocalDateTime.now();
RacetrScoringRule rule = new RacetrScoringRule();
rule.setName(name);
rule.setCreatorId(user.getId());
rule.setUpdaterId(user.getId());
rule.setCreateTime(now);
rule.setUpdateTime(now);
ruleDAO.insertSelective(rule);
}
public void editRule(Long ruleId, Rule ruleProto, AccountVO user) {
RacetrScoringRule rule = this.findId(ruleId);
rule.setUpdaterId(user.getId());
rule.setUpdateTime(LocalDateTime.now());
rule.setRule(ruleProto.toByteArray());
ruleDAO.updateByPrimaryKeySelective(rule);
}
public PageVO<RaceScoringRuleListVO> page(TaskRuleQueryVO query) {
PageHelper.startPage(query.getPageNum(), query.getPageSize());
/*RacetrScoringRuleExample example = new RacetrScoringRuleExample();
if (StringUtils.hasText(query.getName())) {
example.createCriteria().andNameLike(String.format("%%%s%%", query.getName()));
}*/
// Page<RacetrScoringRule> page = (Page<RacetrScoringRule>) this.ruleDAO.selectByExample(example);
Page<RaceRuleListVO> page = (Page<RaceRuleListVO>) this.ruleDAO.pages(query);
List<RaceScoringRuleListVO> voList = this.convertEntity(page.getResult());
return PageVO.convert(page, voList);
}
private RaceScoringRuleListVO convertVO(RaceRuleListVO rule) {
ModifyInfoVO modifyInfoVO = RaceServiceUtil.createModifyInfo(rule.getCreatorId(), rule.getCreatorName(), rule.getUpdaterId(), rule.getUpdaterName(), rule.getCreateTime(), rule.getUpdateTime());
RaceScoringRuleListVO.Builder builder = RaceScoringRuleListVO.newBuilder();
builder.setId(rule.getId());
builder.setName(rule.getName());
builder.setModifyInfo(modifyInfoVO);
return builder.build();
}
private List<RaceScoringRuleListVO> convertEntity(List<RaceRuleListVO> list) {
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
List<RaceScoringRuleListVO> voList = Lists.newArrayListWithCapacity(list.size());
for (RaceRuleListVO rs : list) {
voList.add(this.convertVO(rs));
}
return voList;
}
public void delete(Long id) {
RacetrTaskExample taskExample = new RacetrTaskExample();
taskExample.createCriteria().andScoreRuleIdEqualTo(id);
long bindCount = this.taskDAO.countByExample(taskExample);
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(bindCount <= 0, "该规则已经绑定了对应方的任务,无法删除");
ruleDAO.deleteByPrimaryKey(id);
}
public RaceScoringRuleVO detail(Long id) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(id), "请选择对应的评分规则");
RaceRuleListVO detailVO = this.ruleDAO.detail(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(detailVO), "未找到对应的评分规则");
RaceScoringRuleVO.Builder builder = RaceScoringRuleVO.newBuilder();
builder.setId(detailVO.getId());
builder.setName(detailVO.getName());
ModifyInfoVO modifyInfoVO = RaceServiceUtil.createModifyInfo(detailVO.getCreatorId(), detailVO.getCreatorName(), detailVO.getUpdaterId(), detailVO.getUpdaterName(), detailVO.getCreateTime(),
detailVO.getUpdateTime());
builder.setModifyInfo(modifyInfoVO);
if (Objects.nonNull(detailVO.getRule())) {
try {
Rule rulePro = Rule.parseFrom(detailVO.getRule());
builder.setRule(rulePro);
} catch (Exception e) {
log.error("竞赛评分详情规则解析失败,msg:{} ", e.getMessage(), e);
BusinessExceptionAssertEnum.DATA_ERROR.fail("评分规则数据解析失败");
}
}
return builder.build();
}
}

View File

@ -1,152 +0,0 @@
package club.joylink.rtss.services.race;
import club.joylink.rtss.dao.racetr.RacetrPaperDAO;
import club.joylink.rtss.dao.racetr.RacetrSeasonDAO;
import club.joylink.rtss.entity.SysAccount;
import club.joylink.rtss.entity.racetr.RacetrPaperExample;
import club.joylink.rtss.entity.racetr.RacetrSeason;
import club.joylink.rtss.entity.racetr.RacetrSeasonExample;
import club.joylink.rtss.entity.racetr.RacetrSeasonExample.Criteria;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.ISysUserService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.common.ModifyInfo.ModifyInfoVO;
import club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeason.Group;
import club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeasonCreateVO;
import club.joylink.rtss.vo.race.RaceSeasonOuterClass.RaceSeasonVO;
import club.joylink.rtss.vo.race.RaceSeasonQueryVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@Service
public class RaceSeasonService {
@Autowired
private RacetrSeasonDAO seasonDAO;
@Autowired
private RacetrPaperDAO racePaperDAO;
@Autowired
private ISysUserService iSysUserService;
public RacetrSeason find(Long id) {
RacetrSeason rs = this.seasonDAO.selectByPrimaryKey(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(rs), "");
return rs;
}
public void updateHtmlContent(Long id, String htmlContent, AccountVO user) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(StringUtils.isNotEmpty(htmlContent), "请填写需要展示的内容");
LocalDateTime now = LocalDateTime.now();
RacetrSeason rr = this.find(id);
rr.setUpdaterId(user.getId());
rr.setUdpateTime(now);
rr.setDetailHtmlContent(htmlContent);
this.seasonDAO.updateByPrimaryKeySelective(rr);
}
public String queryHtmlContent(Long id) {
RacetrSeason rr = this.find(id);
return rr.getDetailHtmlContent();
}
public void save(RaceSeasonCreateVO dto, AccountVO user) {
LocalDateTime now = LocalDateTime.now();
RacetrSeason rs = new RacetrSeason();
rs.setCode(dto.getCode());
rs.setTerm(dto.getTerm());
rs.setGroup(dto.getGroup().name());
rs.setCreatorId(user.getId());
rs.setUpdaterId(user.getId());
rs.setCreateTime(now);
rs.setUdpateTime(now);
this.seasonDAO.insert(rs);
}
public void update(Long id, RaceSeasonCreateVO dto, AccountVO user) {
LocalDateTime now = LocalDateTime.now();
RacetrSeason rr = this.find(id);
rr.setUpdaterId(user.getId());
rr.setUdpateTime(now);
rr.setCode(dto.getCode());
rr.setTerm(dto.getTerm());
rr.setGroup(dto.getGroup().name());
this.seasonDAO.updateByPrimaryKeySelective(rr);
}
public PageVO<RaceSeasonVO> page(RaceSeasonQueryVO query) {
RacetrSeasonExample example = new RacetrSeasonExample();
Criteria c = example.createCriteria();
if (StringUtils.isNotEmpty(query.getCode())) {
c.andCodeLike(String.format("%%%s%%", query.getCode()));
}
if (StringUtils.isNotEmpty(query.getTerm())) {
c.andTermLike(String.format("%%%s%%", query.getTerm()));
}
if (Objects.nonNull(query.getGroup()) && query.getGroup() != Group.Unknown) {
c.andGroupEqualTo(query.getGroup().name());
}
PageHelper.startPage(query.getPageNum(), query.getPageSize());
Page<RacetrSeason> page = (Page<RacetrSeason>) this.seasonDAO.selectByExample(example);
PageHelper.clearPage();
List<RaceSeasonVO> voList = this.convertDTO(page.getResult());
return PageVO.convert(page, voList);
}
private RaceSeasonVO convertVO(RacetrSeason rs, Map<Long, SysAccount> accountMap) {
RaceSeasonVO.Builder voBuild = RaceSeasonVO.newBuilder();
voBuild.setId(rs.getId());
voBuild.setCode(rs.getCode());
voBuild.setGroup(Group.valueOf(rs.getGroup()));
voBuild.setTerm(rs.getTerm());
ModifyInfoVO modifyInfoVO = RaceServiceUtil.createModifyInfo(accountMap, rs.getCreatorId(), rs.getUpdaterId(), rs.getCreateTime(), rs.getUdpateTime());
voBuild.setModifyInfo(modifyInfoVO);
return voBuild.build();
}
private List<RaceSeasonVO> convertDTO(List<RacetrSeason> rsList) {
if (CollectionUtils.isEmpty(rsList)) {
return Collections.emptyList();
}
List<Long> userIdList = rsList.stream().map(d -> List.of(d.getCreatorId(), d.getUpdaterId())).flatMap(Collection::stream).distinct().collect(Collectors.toList());
Map<Long, SysAccount> accountMap = this.iSysUserService.findEntitiesForMap(userIdList);
List<RaceSeasonVO> voList = Lists.newArrayListWithCapacity(rsList.size());
for (RacetrSeason rs : rsList) {
voList.add(this.convertVO(rs, accountMap));
}
return voList;
}
/**
* 删除数据
*
* @param id
*/
public void delete(Long id) {
// this.find(id);
//检查数据确定没有被绑定过
RacetrPaperExample paperExample = new RacetrPaperExample();
RacetrPaperExample.Criteria c = paperExample.createCriteria();
c.andSeasonIdEqualTo(id);
Long exsitCounter = this.racePaperDAO.countByExample(paperExample);
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(exsitCounter <= 0, "该数据已经被试卷绑定,无法删除");
this.seasonDAO.deleteByPrimaryKey(id);
}
}

View File

@ -1,51 +0,0 @@
package club.joylink.rtss.services.race;
import club.joylink.rtss.entity.SysAccount;
import club.joylink.rtss.util.DateTimeUtil;
import club.joylink.rtss.vo.common.ModifyInfo.ModifyInfoVO;
import java.time.LocalDateTime;
import java.util.Map;
import java.util.Objects;
public class RaceServiceUtil {
public static ModifyInfoVO createModifyInfo(Map<Long, SysAccount> accountMap, Long createId, Long updateId, LocalDateTime createTime, LocalDateTime updateTime) {
SysAccount createAcc = accountMap.get(createId);
ModifyInfoVO.Builder builder = ModifyInfoVO.newBuilder();
if (Objects.nonNull(createAcc)) {
builder.setCreatorId(createId);
builder.setCreatorName(createAcc.getNickname());
}
SysAccount updateAcc = accountMap.get(updateId);
if (Objects.nonNull(updateAcc)) {
builder.setCreatorId(updateId);
builder.setCreatorName(updateAcc.getNickname());
}
if (Objects.nonNull(createTime)) {
builder.setCreateTime(createTime.format(DateTimeUtil.DATE_TIME_DTF));
}
if (Objects.nonNull(updateTime)) {
builder.setUpdateTime(updateTime.format(DateTimeUtil.DATE_TIME_DTF));
}
return builder.build();
}
public static ModifyInfoVO createModifyInfo(Long createId, String createName, Long updateId, String updateName, LocalDateTime createTime, LocalDateTime updateTime) {
ModifyInfoVO.Builder builder = ModifyInfoVO.newBuilder();
builder.setCreatorId(createId);
builder.setCreatorName(createName);
builder.setUpdaterId(updateId);
builder.setUpdaterName(updateName);
if (Objects.nonNull(createTime)) {
builder.setCreateTime(createTime.format(DateTimeUtil.DATE_TIME_DTF));
}
if (Objects.nonNull(updateTime)) {
builder.setUpdateTime(updateTime.format(DateTimeUtil.DATE_TIME_DTF));
}
return builder.build();
}
}

View File

@ -1,203 +0,0 @@
package club.joylink.rtss.services.race;
import club.joylink.rtss.dao.racetr.RacetrTaskDAO;
import club.joylink.rtss.entity.racetr.RacetrTask;
import club.joylink.rtss.entity.racetr.RacetrTaskExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.common.ModifyInfo.ModifyInfoVO;
import club.joylink.rtss.vo.race.RaceTask.RaceTaskBind;
import club.joylink.rtss.vo.race.RaceTask.RaceTaskBind.TaskBindType;
import club.joylink.rtss.vo.race.RaceTask.RaceTaskCreateVO;
import club.joylink.rtss.vo.race.RaceTask.RaceTaskDetailVO;
import club.joylink.rtss.vo.race.RaceTaskDetailDTO;
import club.joylink.rtss.vo.race.RaceTaskTreeVO;
import com.google.common.collect.Lists;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
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;
@Service
@Transactional
@Slf4j
public class RaceTaskService {
@Autowired
private RacetrTaskDAO raceTaskDAO;
protected final static Long TASK_ROOT_ID = 0L;
private RacetrTask findById(Long id) {
RacetrTask task = this.raceTaskDAO.selectByPrimaryKey(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(task),
"没有找到对应的任务");
return task;
}
public RaceTaskDetailVO detail(Long id) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(id),
"请选择对应的任务");
RaceTaskDetailDTO task = this.raceTaskDAO.details(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(task),
"未找到对应的任务数据");
RaceTaskDetailVO.Builder vo = RaceTaskDetailVO.newBuilder();
vo.setId(task.getId());
vo.setName(task.getName());
vo.setDesc(task.getDesc());
vo.setContent(task.getContent());
vo.setStandards(task.getStandards());
vo.setParentId(task.getParentId());
ModifyInfoVO modifyInfoVO = RaceServiceUtil.createModifyInfo(task.getCreatorId(),
task.getCreatorName(), task.getUpdaterId(), task.getUpdaterName(), task.getCreateTime(),
task.getUpdateTime());
vo.setModifyInfo(modifyInfoVO);
if (Objects.nonNull(task.getSceneId())) {
vo.setSceneId(task.getSceneId());
vo.setSceneName(task.getSceneName());
}
if (Objects.nonNull(task.getRuleId())) {
vo.setRuleId(task.getRuleId());
vo.setRuleName(task.getRuleName());
}
return vo.build();
}
public void save(RaceTaskCreateVO vo, AccountVO user) {
LocalDateTime now = LocalDateTime.now();
RacetrTask task = new RacetrTask();
task.setName(vo.getName());
task.setDesc(vo.getDesc());
task.setContent(vo.getContent());
task.setStandards(vo.getStandards());
task.setCreatorId(user.getId());
task.setUpdaterId(user.getId());
task.setCreateTime(now);
task.setUpdateTime(now);
task.setParentId(vo.getParentId());
this.raceTaskDAO.insert(task);
}
public void update(Long id, RaceTaskCreateVO vo, AccountVO user) {
RacetrTask task = this.findById(id);
task.setName(vo.getName());
task.setDesc(vo.getDesc());
task.setContent(vo.getContent());
task.setStandards(vo.getStandards());
task.setUpdaterId(user.getId());
task.setUpdateTime(LocalDateTime.now());
this.raceTaskDAO.updateByPrimaryKey(task);
}
public void bind(Long taskId, List<RaceTaskBind> bind, AccountVO user) {
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(!CollectionUtils.isEmpty(bind),
"请选择要绑定的数据");
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(bind.size() <= 2, "最多绑定只能选择2个类型");
if (bind.size() > 1) {
List<TaskBindType> bindTypes = bind.stream().map(RaceTaskBind::getBindType).distinct()
.collect(Collectors.toList());
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(bindTypes.size() != 1,
"最多绑定只能选择2个类型");
}
RacetrTask task = this.findById(taskId);
for (RaceTaskBind raceTaskBind : bind) {
if (raceTaskBind.getBindType() == TaskBindType.rule) {
task.setScoreRuleId(raceTaskBind.getBindId());
if (raceTaskBind.getStatus() == 1) {
task.setScoreRuleId(null);
}
} else if (raceTaskBind.getBindType() == TaskBindType.scene) {
task.setSceneId(raceTaskBind.getBindId());
if (raceTaskBind.getStatus() == 1) {
task.setSceneId(null);
}
} else {
log.error("未知任务绑定类型{}", raceTaskBind.getBindType().name());
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.fail("未知绑定类型");
}
}
task.setUpdaterId(user.getId());
task.setUpdateTime(LocalDateTime.now());
this.raceTaskDAO.updateByPrimaryKey(task);
}
public List<RaceTaskTreeVO> tree() {
List<RacetrTask> taskList = this.raceTaskDAO.selectByExample(null);
Map<Long, List<RaceTaskTreeVO>> mapList = taskList.stream().map(RaceTaskTreeVO::new)
.collect(Collectors.groupingBy(RaceTaskTreeVO::getParentId));
List<RaceTaskTreeVO> rootTaskList = mapList.get(TASK_ROOT_ID);
if (CollectionUtils.isEmpty(rootTaskList)) {
return Collections.emptyList();
}
for (RaceTaskTreeVO rootTask : rootTaskList) {
this.loopFind(rootTask, mapList);
}
return rootTaskList;
}
public List<RaceTaskTreeVO> findChildren(Long parentId) {
RacetrTaskExample example = new RacetrTaskExample();
example.createCriteria().andParentIdEqualTo(parentId);
List<RacetrTask> taskList = this.raceTaskDAO.selectByExample(example);
return taskList.stream().map(RaceTaskTreeVO::new).collect(Collectors.toList());
}
private void loopFind(RaceTaskTreeVO task, Map<Long, List<RaceTaskTreeVO>> mapList) {
List<RaceTaskTreeVO> children = mapList.get(task.getId());
if (Objects.nonNull(children)) {
task.setChildren(children);
for (RaceTaskTreeVO child : children) {
this.loopFind(child, mapList);
}
}
}
public void delete(Long id) {
RacetrTask rt = this.findById(id);
List<RaceTaskTreeVO> collection = Lists.newArrayList(new RaceTaskTreeVO(rt));
this.collectAllChildren(rt.getId(), collection);
List<Long> deleteIds = collection.stream().map(RaceTaskTreeVO::getId).distinct()
.collect(Collectors.toList());
log.info("删除任务[{}] 对应所有的子节点id[{}]", id, deleteIds);
RacetrTaskExample example = new RacetrTaskExample();
example.createCriteria().andIdIn(deleteIds);
this.raceTaskDAO.deleteByExample(example);
}
private void collectAllChildren(Long parentId, List<RaceTaskTreeVO> collection) {
List<RaceTaskTreeVO> list = this.findChildren(parentId);
if (!CollectionUtils.isEmpty(list)) {
for (RaceTaskTreeVO c : list) {
collection.add(c);
this.collectAllChildren(c.getId(), collection);
}
}
}
/**
* 递归查找taskId下相关的所有数据
*
* @param taskIds
* @return
*/
public Map<Long, List<RaceTaskDetailDTO>> recursiveFindTask(List<Long> taskIds) {
List<RaceTaskDetailDTO> taskDtoList = this.raceTaskDAO.recursiveFindTask(taskIds);
Map<Long, List<RaceTaskDetailDTO>> dtoMapList = taskDtoList.stream()
.collect(Collectors.groupingBy(RaceTaskDetailDTO::getParentId));
return dtoMapList;
}
}

View File

@ -18,10 +18,24 @@ import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.runplan.RunPlanTripVO; import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
import club.joylink.rtss.vo.client.runplan.RunPlanVO; import club.joylink.rtss.vo.client.runplan.RunPlanVO;
import club.joylink.rtss.vo.client.runplan.user.*; import club.joylink.rtss.vo.client.runplan.user.RunPlanParkingTimeVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingQueryVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingSection;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRunlevelVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanUserConfigVO;
import club.joylink.rtss.vo.map.MapVO; import club.joylink.rtss.vo.map.MapVO;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -29,9 +43,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
@Service @Service
@Slf4j @Slf4j
public class RunPlanRoutingService implements IRunPlanRoutingService { public class RunPlanRoutingService implements IRunPlanRoutingService {
@ -57,9 +68,11 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
@Transactional @Transactional
@Override @Override
public void createUserRouting(RunPlanRoutingVO routingVO) { public void createUserRouting(RunPlanRoutingVO routingVO) {
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(routingDataExist(routingVO), "交路数据重复"); BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(routingDataExist(routingVO),
"交路数据重复");
MapVO map = this.iMapService.getMapDetail(routingVO.getMapId()); MapVO map = this.iMapService.getMapDetail(routingVO.getMapId());
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map); SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(
map);
if (map.getCheckConfig().isCheck()) { if (map.getCheckConfig().isCheck()) {
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(), BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
"地图基础数据校验不通过"); "地图基础数据校验不通过");
@ -76,7 +89,9 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
} catch (BaseException e) { } catch (BaseException e) {
return; return;
} }
if (routingDataExist(routingDataLoop)) return; if (routingDataExist(routingDataLoop)) {
return;
}
Section endSection = (Section) deviceMap.get(routingDataLoop.getEndSectionCode()); Section endSection = (Section) deviceMap.get(routingDataLoop.getEndSectionCode());
routingDataLoop.setDestinationCode(endSection.getDestinationCode()); routingDataLoop.setDestinationCode(endSection.getDestinationCode());
runPlanRoutingDAO.insert(routingDataLoop.convert2Entity()); runPlanRoutingDAO.insert(routingDataLoop.convert2Entity());
@ -87,15 +102,20 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
@Override @Override
@Transactional @Transactional
public void createDefaultRoutings(List<RunPlanRoutingVO> defaultRoutings) { public void createDefaultRoutings(List<RunPlanRoutingVO> defaultRoutings) {
if (CollectionUtils.isEmpty(defaultRoutings)) return; if (CollectionUtils.isEmpty(defaultRoutings)) {
return;
}
MapVO map = this.iMapService.getMapDetail(defaultRoutings.get(0).getMapId()); MapVO map = this.iMapService.getMapDetail(defaultRoutings.get(0).getMapId());
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map); SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(
map);
// BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(), "地图基础数据校验不通过"); // BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(), "地图基础数据校验不通过");
if (CollectionUtils.isEmpty(buildResult.getErrMsgList())) { if (CollectionUtils.isEmpty(buildResult.getErrMsgList())) {
Map<String, MapElement> deviceMap = buildResult.getDeviceMap(); Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
defaultRoutings.forEach(routingVO -> { defaultRoutings.forEach(routingVO -> {
routingVO.setUserId(null); routingVO.setUserId(null);
if (routingDataExist(routingVO)) return; if (routingDataExist(routingVO)) {
return;
}
setRoutingType(routingVO, deviceMap); setRoutingType(routingVO, deviceMap);
RunPlanRouting routing = routingVO.convert2Entity(); RunPlanRouting routing = routingVO.convert2Entity();
runPlanRoutingDAO.insert(routing); runPlanRoutingDAO.insert(routing);
@ -107,9 +127,13 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
@Transactional @Transactional
public void syncDefaultRoutingRefData(Long userId, Long mapId) { public void syncDefaultRoutingRefData(Long userId, Long mapId) {
List<RunPlanRoutingVO> defaultRoutingVOs = getDefaultRoutings(mapId); List<RunPlanRoutingVO> defaultRoutingVOs = getDefaultRoutings(mapId);
if (CollectionUtils.isEmpty(defaultRoutingVOs)) return; if (CollectionUtils.isEmpty(defaultRoutingVOs)) {
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(this.iMapService.getMapDetail(mapId)); return;
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(), "地图基础数据校验不通过"); }
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(
this.iMapService.getMapDetail(mapId));
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
"地图基础数据校验不通过");
Map<String, MapElement> deviceMap = buildResult.getDeviceMap(); Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
//根据默认交路生成站间运行等级停站时间折返数据 //根据默认交路生成站间运行等级停站时间折返数据
Set<RunPlanRunlevelVO> levelList = new HashSet<>(100); Set<RunPlanRunlevelVO> levelList = new HashSet<>(100);
@ -136,7 +160,8 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
return true; return true;
}).collect(Collectors.toList())); }).collect(Collectors.toList()));
List<RunPlanParkingTimeVO> parkingTimeVOS = RunPlanParkingTimeVO.parkingTimeFromRouting(routingVO); List<RunPlanParkingTimeVO> parkingTimeVOS = RunPlanParkingTimeVO.parkingTimeFromRouting(
routingVO);
parkingTimeVOS.forEach(p -> { parkingTimeVOS.forEach(p -> {
if (((Section) deviceMap.get(p.getSectionCode())).isStandTrack()) { if (((Section) deviceMap.get(p.getSectionCode())).isStandTrack()) {
parkingTimeList.add(p); parkingTimeList.add(p);
@ -152,7 +177,8 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
levelList.forEach(l -> { levelList.forEach(l -> {
Section startSection = (Section) deviceMap.get(l.getStartSectionCode()); Section startSection = (Section) deviceMap.get(l.getStartSectionCode());
Section endSection = (Section) deviceMap.get(l.getEndSectionCode()); Section endSection = (Section) deviceMap.get(l.getEndSectionCode());
if ((startSection.isStandTrack() && endSection.isTransferTrack()) || (endSection.isStandTrack() && startSection.isTransferTrack())) { if ((startSection.isStandTrack() && endSection.isTransferTrack()) || (
endSection.isStandTrack() && startSection.isTransferTrack())) {
Float distance; Float distance;
try { try {
distance = CalculateService.calculateDistance(startSection, endSection, l.getRight()); distance = CalculateService.calculateDistance(startSection, endSection, l.getRight());
@ -177,14 +203,17 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
planConfigService.saveConfig(userId, mapId, userConfig.getConfig()); planConfigService.saveConfig(userId, mapId, userConfig.getConfig());
} }
private void setStationReentryTime(Map<String, MapElement> deviceMap, Map<String, RunPlanUserConfigVO.ReentryTime> reentryData, RunPlanRoutingVO routingVO) { private void setStationReentryTime(Map<String, MapElement> deviceMap,
Map<String, RunPlanUserConfigVO.ReentryTime> reentryData, RunPlanRoutingVO routingVO) {
Section startSection = (Section) deviceMap.get(routingVO.getStartSectionCode()); Section startSection = (Section) deviceMap.get(routingVO.getStartSectionCode());
if (startSection.isTurnBackTrack()) { if (startSection.isTurnBackTrack()) {
reentryData.putIfAbsent(routingVO.getStartStationCode(), new RunPlanUserConfigVO.ReentryTime(120, 210, 45, 45)); reentryData.putIfAbsent(routingVO.getStartStationCode(),
new RunPlanUserConfigVO.ReentryTime(120, 210, 45, 45));
} }
Section endSection = (Section) deviceMap.get(routingVO.getEndSectionCode()); Section endSection = (Section) deviceMap.get(routingVO.getEndSectionCode());
if (endSection.isTurnBackTrack()) { if (endSection.isTurnBackTrack()) {
reentryData.putIfAbsent(routingVO.getEndStationCode(), new RunPlanUserConfigVO.ReentryTime(120, 210, 45, 45)); reentryData.putIfAbsent(routingVO.getEndStationCode(),
new RunPlanUserConfigVO.ReentryTime(120, 210, 45, 45));
} }
} }
@ -197,7 +226,8 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
@Override @Override
public RunPlanRoutingVO generateUserRoutingData(RunPlanRoutingVO routingVO) { public RunPlanRoutingVO generateUserRoutingData(RunPlanRoutingVO routingVO) {
MapVO map = this.iMapService.getMapDetail(routingVO.getMapId()); MapVO map = this.iMapService.getMapDetail(routingVO.getMapId());
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map); SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(
map);
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(), BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
"地图基础数据校验不通过"); "地图基础数据校验不通过");
Map<String, MapElement> deviceMap = buildResult.getDeviceMap(); Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
@ -206,22 +236,31 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
} }
@Override @Override
public List<RunPlanRoutingVO> queryRoutes(Long mapId, RunPlanRoutingQueryVO queryVO, AccountVO user) { public List<RunPlanRoutingVO> queryRoutes(Long mapId, RunPlanRoutingQueryVO queryVO,
AccountVO user) {
return getUserRoutingBy(user.getId(), mapId).stream() return getUserRoutingBy(user.getId(), mapId).stream()
.filter(routing -> Objects.equals(routing.getDestinationCode(), queryVO.getDestinationCode())) .filter(
routing -> Objects.equals(routing.getDestinationCode(), queryVO.getDestinationCode()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
private void generateUserRoutingSections(RunPlanRoutingVO routingVO, Map<String, MapElement> deviceMap) { private void generateUserRoutingSections(RunPlanRoutingVO routingVO,
Map<String, MapElement> deviceMap) {
Section startSection = (Section) deviceMap.get(routingVO.getStartSectionCode()); Section startSection = (Section) deviceMap.get(routingVO.getStartSectionCode());
Section endSection = (Section) deviceMap.get(routingVO.getEndSectionCode()); Section endSection = (Section) deviceMap.get(routingVO.getEndSectionCode());
//中间经停所有站台轨 //中间经停所有站台轨
List<Section> passingStandTrack = CalculateService.findPassingStandTrack(startSection, endSection, routingVO.getRight()); List<Section> passingStandTrack = CalculateService.findPassingStandTrack(startSection,
endSection, routingVO.getRight());
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotNull(passingStandTrack, BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotNull(passingStandTrack,
String.format("没有找到线路方向[%s]的中间经停区段,是否需要更换方向/手动添加/直接保存交路", routingVO.getRight() ? "右向" : "左向")); String.format("没有找到线路方向[%s]的中间经停区段,是否需要更换方向/手动添加/直接保存交路",
LinkedList<RunPlanRoutingSection> parkSectionCodeList = passingStandTrack.stream().map(section -> new RunPlanRoutingSection(section.getStation().getCode(), section.getCode())).collect(Collectors.toCollection(LinkedList::new)); routingVO.getRight() ? "右向" : "左向"));
parkSectionCodeList.addFirst(new RunPlanRoutingSection(routingVO.getStartStationCode(), routingVO.getStartSectionCode())); LinkedList<RunPlanRoutingSection> parkSectionCodeList = passingStandTrack.stream().map(
parkSectionCodeList.addLast(new RunPlanRoutingSection(routingVO.getEndStationCode(), routingVO.getEndSectionCode())); section -> new RunPlanRoutingSection(section.getStation().getCode(), section.getCode()))
.collect(Collectors.toCollection(LinkedList::new));
parkSectionCodeList.addFirst(new RunPlanRoutingSection(routingVO.getStartStationCode(),
routingVO.getStartSectionCode()));
parkSectionCodeList.addLast(
new RunPlanRoutingSection(routingVO.getEndStationCode(), routingVO.getEndSectionCode()));
routingVO.setParkSectionCodeList(parkSectionCodeList); routingVO.setParkSectionCodeList(parkSectionCodeList);
} }
@ -235,7 +274,8 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
@Override @Override
public void updateUserRouting(Long routingId, RunPlanRoutingVO routingVO) { public void updateUserRouting(Long routingId, RunPlanRoutingVO routingVO) {
MapVO map = this.iMapService.getMapDetail(routingVO.getMapId()); MapVO map = this.iMapService.getMapDetail(routingVO.getMapId());
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map); SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(
map);
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(), BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
"地图基础数据校验不通过"); "地图基础数据校验不通过");
Map<String, MapElement> deviceMap = buildResult.getDeviceMap(); Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
@ -243,11 +283,13 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
RunPlanRouting newRouting = routingVO.convert2Entity(); RunPlanRouting newRouting = routingVO.convert2Entity();
newRouting.setId(routingId); newRouting.setId(routingId);
RunPlanRouting routing = getRunPlanRoutingData(routingId); RunPlanRouting routing = getRunPlanRoutingData(routingId);
if(Objects.equals(routing.getSectionData(),JsonUtils.writeValueAsString(routingVO.getParkSectionCodeList()))){ if (Objects.equals(routing.getSectionData(),
JsonUtils.writeValueAsString(routingVO.getParkSectionCodeList()))) {
runPlanRoutingDAO.updateByPrimaryKey(newRouting); runPlanRoutingDAO.updateByPrimaryKey(newRouting);
return; return;
} }
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(routingDataExist(routingVO), "交路数据重复"); BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(routingDataExist(routingVO),
"交路数据重复");
runPlanRoutingDAO.updateByPrimaryKeyWithBLOBs(newRouting); runPlanRoutingDAO.updateByPrimaryKeyWithBLOBs(newRouting);
generateUserRunlevels(routingVO, deviceMap); generateUserRunlevels(routingVO, deviceMap);
generateUserParktimes(routingVO, deviceMap); generateUserParktimes(routingVO, deviceMap);
@ -268,8 +310,10 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
} }
} }
private void generateUserParktimes(RunPlanRoutingVO routingVO, Map<String, MapElement> deviceMap) { private void generateUserParktimes(RunPlanRoutingVO routingVO,
List<RunPlanParkingTimeVO> parkingTimeVOS = RunPlanParkingTimeVO.parkingTimeFromRouting(routingVO); Map<String, MapElement> deviceMap) {
List<RunPlanParkingTimeVO> parkingTimeVOS = RunPlanParkingTimeVO.parkingTimeFromRouting(
routingVO);
parkingTimeVOS.forEach(p -> { parkingTimeVOS.forEach(p -> {
if (((Section) deviceMap.get(p.getSectionCode())).isStandTrack()) { if (((Section) deviceMap.get(p.getSectionCode())).isStandTrack()) {
planParktimeService.createUserParktime(p); planParktimeService.createUserParktime(p);
@ -277,7 +321,8 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
}); });
} }
private void generateUserRunlevels(RunPlanRoutingVO routingVO, Map<String, MapElement> deviceMap) { private void generateUserRunlevels(RunPlanRoutingVO routingVO,
Map<String, MapElement> deviceMap) {
List<RunPlanRunlevelVO> levels = RunPlanRunlevelVO.runLevelsFromRouting(routingVO); List<RunPlanRunlevelVO> levels = RunPlanRunlevelVO.runLevelsFromRouting(routingVO);
levels.forEach(l -> { levels.forEach(l -> {
Section startSection = (Section) deviceMap.get(l.getStartSectionCode()); Section startSection = (Section) deviceMap.get(l.getStartSectionCode());
@ -286,7 +331,8 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
|| (endSection.isTurnBackTrack() && !endSection.isStandTrack())) { || (endSection.isTurnBackTrack() && !endSection.isStandTrack())) {
return; return;
} }
if ((startSection.isStandTrack() && endSection.isTransferTrack()) || (endSection.isStandTrack() && startSection.isTransferTrack())) { if ((startSection.isStandTrack() && endSection.isTransferTrack()) || (
endSection.isStandTrack() && startSection.isTransferTrack())) {
Float distance; Float distance;
try { try {
distance = CalculateService.calculateDistance(startSection, endSection, l.getRight()); distance = CalculateService.calculateDistance(startSection, endSection, l.getRight());
@ -305,8 +351,10 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
}); });
} }
private void generateUserStationReentryTimes(RunPlanRoutingVO routingVO, Map<String, MapElement> deviceMap) { private void generateUserStationReentryTimes(RunPlanRoutingVO routingVO,
RunPlanUserConfigVO userConfig = planConfigService.getConfig(routingVO.getUserId(), routingVO.getMapId()); Map<String, MapElement> deviceMap) {
RunPlanUserConfigVO userConfig = planConfigService.getConfig(routingVO.getUserId(),
routingVO.getMapId());
Map<String, RunPlanUserConfigVO.ReentryTime> reentryData; Map<String, RunPlanUserConfigVO.ReentryTime> reentryData;
if (Objects.nonNull(userConfig)) { if (Objects.nonNull(userConfig)) {
reentryData = userConfig.getConfig().getReentryData(); reentryData = userConfig.getConfig().getReentryData();
@ -317,7 +365,8 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
} }
//交路是折返轨的一头 设置折返时间 //交路是折返轨的一头 设置折返时间
setStationReentryTime(deviceMap, reentryData, routingVO); setStationReentryTime(deviceMap, reentryData, routingVO);
planConfigService.saveConfig(routingVO.getUserId(), routingVO.getMapId(),userConfig.getConfig()); planConfigService.saveConfig(routingVO.getUserId(), routingVO.getMapId(),
userConfig.getConfig());
} }
@Override @Override
@ -334,7 +383,8 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
} }
@Override @Override
public PageVO<RunPlanRoutingVO> queryPagedUserRouting(Long userId, Long mapId, RunPlanRoutingQueryVO queryVO) { public PageVO<RunPlanRoutingVO> queryPagedUserRouting(Long userId, Long mapId,
RunPlanRoutingQueryVO queryVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize()); PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
RunPlanRoutingExample example = new RunPlanRoutingExample(); RunPlanRoutingExample example = new RunPlanRoutingExample();
example.setOrderByClause("user_id DESC,id"); example.setOrderByClause("user_id DESC,id");
@ -358,8 +408,10 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
criteria.andEndSectionCodeEqualTo(queryVO.getEndSectionCode()); criteria.andEndSectionCodeEqualTo(queryVO.getEndSectionCode());
or.andEndSectionCodeEqualTo(queryVO.getEndSectionCode()); or.andEndSectionCodeEqualTo(queryVO.getEndSectionCode());
} }
Page<RunPlanRouting> page = (Page<RunPlanRouting>) runPlanRoutingDAO.selectByExampleWithBLOBs(example); Page<RunPlanRouting> page = (Page<RunPlanRouting>) runPlanRoutingDAO.selectByExampleWithBLOBs(
List<RunPlanRoutingVO> routingVOList = page.getResult().stream().map(RunPlanRoutingVO::convert2VO).collect(Collectors.toList()); example);
List<RunPlanRoutingVO> routingVOList = page.getResult().stream()
.map(RunPlanRoutingVO::convert2VO).collect(Collectors.toList());
return PageVO.convert(page, routingVOList); return PageVO.convert(page, routingVOList);
} }
@ -381,9 +433,11 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
} }
@Override @Override
public List<RunPlanRoutingVO> getUserRoutingByType(Long userId, Long mapId, RunPlanRoutingVO.UserRoutingType routingType) { public List<RunPlanRoutingVO> getUserRoutingByType(Long userId, Long mapId,
RunPlanRoutingVO.UserRoutingType routingType) {
RunPlanRoutingExample example = new RunPlanRoutingExample(); RunPlanRoutingExample example = new RunPlanRoutingExample();
example.createCriteria().andMapIdEqualTo(mapId).andUserIdEqualTo(userId).andTypeEqualTo(routingType.name()); example.createCriteria().andMapIdEqualTo(mapId).andUserIdEqualTo(userId)
.andTypeEqualTo(routingType.name());
example.or().andMapIdEqualTo(mapId).andUserIdIsNull().andTypeEqualTo(routingType.name()); example.or().andMapIdEqualTo(mapId).andUserIdIsNull().andTypeEqualTo(routingType.name());
List<RunPlanRouting> runPlanRoutings = runPlanRoutingDAO.selectByExampleWithBLOBs(example); List<RunPlanRouting> runPlanRoutings = runPlanRoutingDAO.selectByExampleWithBLOBs(example);
return RunPlanRoutingVO.convert2VOList(runPlanRoutings, this.iMapService.getMapDetail(mapId)); return RunPlanRoutingVO.convert2VOList(runPlanRoutings, this.iMapService.getMapDetail(mapId));
@ -397,11 +451,18 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
.findFirst() .findFirst()
.orElseThrow(() -> BusinessExceptionAssertEnum.DATA_NOT_EXIST.exception()); .orElseThrow(() -> BusinessExceptionAssertEnum.DATA_NOT_EXIST.exception());
RunPlanRoutingExample example = new RunPlanRoutingExample(); RunPlanRoutingExample example = new RunPlanRoutingExample();
example.createCriteria().andMapIdEqualTo(planVO.getMapId()).andUserIdEqualTo(userId).andStartSectionCodeEqualTo(trip.getStartSectionCode()).andEndSectionCodeEqualTo(trip.getEndSectionCode()); example.createCriteria().andMapIdEqualTo(planVO.getMapId()).andUserIdEqualTo(userId)
example.or().andMapIdEqualTo(planVO.getMapId()).andUserIdIsNull().andStartSectionCodeEqualTo(trip.getStartSectionCode()).andEndSectionCodeEqualTo(trip.getEndSectionCode()); .andStartSectionCodeEqualTo(trip.getStartSectionCode())
.andEndSectionCodeEqualTo(trip.getEndSectionCode());
example.or().andMapIdEqualTo(planVO.getMapId()).andUserIdIsNull()
.andStartSectionCodeEqualTo(trip.getStartSectionCode())
.andEndSectionCodeEqualTo(trip.getEndSectionCode());
List<RunPlanRouting> runPlanRoutings = runPlanRoutingDAO.selectByExampleWithBLOBs(example); List<RunPlanRouting> runPlanRoutings = runPlanRoutingDAO.selectByExampleWithBLOBs(example);
if (CollectionUtils.isEmpty(runPlanRoutings)) return null; if (CollectionUtils.isEmpty(runPlanRoutings)) {
return RunPlanRoutingVO.convert2VO(runPlanRoutings.get(0), this.iMapService.getMapDetail(planVO.getMapId())); return null;
}
return RunPlanRoutingVO.convert2VO(runPlanRoutings.get(0),
this.iMapService.getMapDetail(planVO.getMapId()));
} }
@Override @Override
@ -413,18 +474,23 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
@Override @Override
public List<RunPlanRoutingSection> getRoutingSectionDataBy(Long userId, Long routingId) { public List<RunPlanRoutingSection> getRoutingSectionDataBy(Long userId, Long routingId) {
RunPlanRouting routing = runPlanRoutingDAO.selectByPrimaryKey(routingId); RunPlanRouting routing = runPlanRoutingDAO.selectByPrimaryKey(routingId);
if (Objects.isNull(routing)) return Collections.emptyList(); if (Objects.isNull(routing)) {
return Collections.emptyList();
}
return RunPlanRoutingVO.convert2VO(routing).getParkSectionCodeList(); return RunPlanRoutingVO.convert2VO(routing).getParkSectionCodeList();
} }
private boolean routingDataExist(RunPlanRoutingVO routingVO) { private boolean routingDataExist(RunPlanRoutingVO routingVO) {
return runPlanRoutingDAO.countUserRoutingBySectionData(routingVO.getUserId(), routingVO.getMapId(), JsonUtils.writeValueAsString(routingVO.getParkSectionCodeList())) > 0; return
runPlanRoutingDAO.countUserRoutingBySectionData(routingVO.getUserId(), routingVO.getMapId(),
JsonUtils.writeValueAsString(routingVO.getParkSectionCodeList())) > 0;
} }
private RunPlanRouting getRunPlanRoutingData(Long routingId) { private RunPlanRouting getRunPlanRoutingData(Long routingId) {
RunPlanRouting routing = runPlanRoutingDAO.selectByPrimaryKey(routingId); RunPlanRouting routing = runPlanRoutingDAO.selectByPrimaryKey(routingId);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(routing, String.format("交路[%s]不存在", routingId)); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(routing,
String.format("交路[%s]不存在", routingId));
return routing; return routing;
} }
@ -433,7 +499,8 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(runPlanDraft); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(runPlanDraft);
RunPlanVO runPlanVO = new RunPlanVO(runPlanDraft); RunPlanVO runPlanVO = new RunPlanVO(runPlanDraft);
if (StringUtils.hasText(runPlanDraft.getTrips())) { if (StringUtils.hasText(runPlanDraft.getTrips())) {
runPlanVO.setTripList(JsonUtils.read(runPlanDraft.getTrips(), JsonUtils.getCollectionType(List.class, RunPlanTripVO.class))); runPlanVO.setTripList(JsonUtils.read(runPlanDraft.getTrips(),
JsonUtils.getCollectionType(List.class, RunPlanTripVO.class)));
} else { } else {
runPlanVO.setTripList(new ArrayList<>()); runPlanVO.setTripList(new ArrayList<>());
} }

View File

@ -7,11 +7,12 @@ import club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs;
import club.joylink.rtss.vo.training2.draft.DraftTraining2InfoVo; import club.joylink.rtss.vo.training2.draft.DraftTraining2InfoVo;
import club.joylink.rtss.vo.training2.publish.PublishedTraining2InfoRspVo; import club.joylink.rtss.vo.training2.publish.PublishedTraining2InfoRspVo;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
public class Training2Convertor { public class Training2Convertor {
public static DraftTraining2InfoVo convertFrom(DraftTraining2 dt) { public static DraftTraining2InfoVo convertFrom(DraftTraining2 dt) {
DraftTraining2InfoVo ti = new DraftTraining2InfoVo(); DraftTraining2InfoVo ti = new DraftTraining2InfoVo();
ti.setCreateTime(dt.getCreateTime()); ti.setCreateTime(dt.getCreateTime());
@ -46,8 +47,7 @@ public class Training2Convertor {
pub.setPlayerIdJson(null == from.getPlayerIdJson() ? "" : from.getPlayerIdJson()); pub.setPlayerIdJson(null == from.getPlayerIdJson() ? "" : from.getPlayerIdJson());
pub.setScoringRuleJson(null == from.getScoringRuleJson() ? "" : from.getScoringRuleJson()); pub.setScoringRuleJson(null == from.getScoringRuleJson() ? "" : from.getScoringRuleJson());
pub.setStepJson(null == from.getStepJson() ? "" : from.getStepJson()); pub.setStepJson(null == from.getStepJson() ? "" : from.getStepJson());
pub.setFailureConditionJson( pub.setFailureConditionJson(null == from.getFailureConditionJson() ? "" : from.getFailureConditionJson());
null == from.getFailureConditionJson() ? "" : from.getFailureConditionJson());
pub.setLabelJson(null == from.getLabelJson() ? "" : from.getLabelJson()); pub.setLabelJson(null == from.getLabelJson() ? "" : from.getLabelJson());
pub.setMapId(from.getMapId()); pub.setMapId(from.getMapId());
pub.setMapLocationJson(null == from.getMapLocationJson() ? "" : from.getMapLocationJson()); pub.setMapLocationJson(null == from.getMapLocationJson() ? "" : from.getMapLocationJson());
@ -85,26 +85,4 @@ public class Training2Convertor {
rsp.setOrgId(from.getOrgId()); rsp.setOrgId(from.getOrgId());
return rsp; return rsp;
} }
public static DraftTraining2WithBLOBs convertFrom(PublishedTraining2WithBLOBs from) {
DraftTraining2WithBLOBs dtb = new DraftTraining2WithBLOBs();
dtb.setName(from.getName());
dtb.setMapId(from.getMapId());
// map_systemterminal
dtb.setDescription(from.getDescription());
dtb.setType(from.getType());
dtb.setLabelJson(from.getLabelJson());
dtb.setMapLocationJson(from.getMapLocationJson());
dtb.setBgSceneJson(from.getBgSceneJson());
dtb.setRunPlanId(from.getRunPlanId());
dtb.setOperaJson(from.getOperaJson());
dtb.setStepJson(from.getStepJson());
dtb.setScoringRuleJson(from.getScoringRuleJson());
dtb.setMemberJson(from.getMemberJson());
dtb.setPlayerIdJson(from.getPlayerIdJson());
dtb.setFailureConditionJson(from.getFailureConditionJson());
dtb.setClient(from.getClient());
return dtb;
}
} }

View File

@ -3,29 +3,22 @@ package club.joylink.rtss.services.training2;
import club.joylink.rtss.constants.BusinessConsts; import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.dao.DraftTraining2DAO; import club.joylink.rtss.dao.DraftTraining2DAO;
import club.joylink.rtss.dao.PublishedTraining2DAO; import club.joylink.rtss.dao.PublishedTraining2DAO;
import club.joylink.rtss.entity.training2.DraftTraining2; import club.joylink.rtss.entity.training2.*;
import club.joylink.rtss.entity.training2.DraftTraining2Example;
import club.joylink.rtss.entity.training2.DraftTraining2WithBLOBs;
import club.joylink.rtss.entity.training2.PublishedTraining2;
import club.joylink.rtss.entity.training2.PublishedTraining2Example;
import club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.training2.draft.TrainingDraftPublishReqVo; import club.joylink.rtss.vo.training2.draft.TrainingDraftPublishReqVo;
import java.time.LocalDateTime;
import java.util.List;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/** /**
* 实训草稿发布业务实现 * 实训草稿发布业务实现
*/ */
@Service @Service
@Slf4j @Slf4j
public class Training2DraftPublishService { public class Training2DraftPublishService {
@Autowired @Autowired
private DraftTraining2DAO trainingDao; private DraftTraining2DAO trainingDao;
@Autowired @Autowired
@ -42,8 +35,7 @@ public class Training2DraftPublishService {
DraftTraining2Example dtExample = new DraftTraining2Example(); DraftTraining2Example dtExample = new DraftTraining2Example();
dtExample.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(draftId); dtExample.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(draftId);
List<DraftTraining2WithBLOBs> dtFinds = this.trainingDao.selectByExampleWithBLOBs(dtExample); List<DraftTraining2WithBLOBs> dtFinds = this.trainingDao.selectByExampleWithBLOBs(dtExample);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != dtFinds && !dtFinds.isEmpty(), BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != dtFinds && !dtFinds.isEmpty(), "实训草稿不存在");
"实训草稿不存在");
DraftTraining2WithBLOBs draft = dtFinds.get(0); DraftTraining2WithBLOBs draft = dtFinds.get(0);
// //
PublishedTraining2WithBLOBs pub = Training2Convertor.convertFrom(draft); PublishedTraining2WithBLOBs pub = Training2Convertor.convertFrom(draft);
@ -77,7 +69,6 @@ public class Training2DraftPublishService {
final DraftTraining2 traceDraft = draft; final DraftTraining2 traceDraft = draft;
this.training2TraceService.addTrace(traceDraft,tracePub,userId); this.training2TraceService.addTrace(traceDraft,tracePub,userId);
} }
@Transactional(readOnly = true) @Transactional(readOnly = true)
public PublishedTraining2 findByNameAndMapId(String name,Long mapId){ public PublishedTraining2 findByNameAndMapId(String name,Long mapId){
PublishedTraining2Example ptExample = new PublishedTraining2Example(); PublishedTraining2Example ptExample = new PublishedTraining2Example();
@ -85,28 +76,9 @@ public class Training2DraftPublishService {
List<PublishedTraining2> ptFinds = this.publishedDao.selectByExample(ptExample); List<PublishedTraining2> ptFinds = this.publishedDao.selectByExample(ptExample);
// //
if(null!=ptFinds){ if(null!=ptFinds){
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(ptFinds.size() <= 1, BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(ptFinds.size()<=1, String.format("已发布实训[name=%s mapId=%s]不唯一!",name,mapId));
String.format("已发布实训[name=%s mapId=%s]不唯一!", name, mapId));
return ptFinds.get(0); return ptFinds.get(0);
} }
return null; return null;
} }
/**
* 发布信息保存为草稿
*
* @param trainingId 发布ID
* @param userInfoVO 用户
*/
@Transactional(rollbackFor = Exception.class)
public void saveAsDraft(Long trainingId, LoginUserInfoVO userInfoVO) {
PublishedTraining2WithBLOBs b = this.publishedDao.selectByPrimaryKey(trainingId);
DraftTraining2WithBLOBs dtb = Training2Convertor.convertFrom(b);
dtb.setCreateTime(LocalDateTime.now());
dtb.setUpdateTime(LocalDateTime.now());
dtb.setCreatorId(userInfoVO.getAccountVO().getId());
this.trainingDao.insert(dtb);
}
} }

View File

@ -19,29 +19,8 @@ import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.simulationv1.SimulationMemberVO; import club.joylink.rtss.vo.client.simulationv1.SimulationMemberVO;
import club.joylink.rtss.vo.client.training2.ScoringRuleVO; import club.joylink.rtss.vo.client.training2.ScoringRuleVO;
import club.joylink.rtss.vo.client.training2.Step2VO; import club.joylink.rtss.vo.client.training2.Step2VO;
import club.joylink.rtss.vo.training2.draft.CreateTraining2ReqVo; import club.joylink.rtss.vo.training2.draft.*;
import club.joylink.rtss.vo.training2.draft.CreateTraining2RspVo;
import club.joylink.rtss.vo.training2.draft.DeleteTraining2ReqVo;
import club.joylink.rtss.vo.training2.draft.DeleteTraining2RspVo;
import club.joylink.rtss.vo.training2.draft.DraftTraining2DetailRspVo;
import club.joylink.rtss.vo.training2.draft.DraftTraining2InfoPageReqVo;
import club.joylink.rtss.vo.training2.draft.DraftTraining2InfoVo;
import club.joylink.rtss.vo.training2.draft.ResetTraining2BackgroudReqVo;
import club.joylink.rtss.vo.training2.draft.UpdateDraftTraining2BlobReqVo;
import club.joylink.rtss.vo.training2.draft.UpdateDraftTraining2InfoReqVo;
import club.joylink.rtss.vo.training2.draft.UpdateStepReqVo;
import club.joylink.rtss.vo.training2.draft.UpdateTraining2BackgroudReqVo;
import club.joylink.rtss.vo.training2.draft.UpdateTraining2MapLocationReqVo;
import io.netty.util.internal.StringUtil; import io.netty.util.internal.StringUtil;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Function;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -49,6 +28,12 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Function;
import java.util.stream.Collectors;
/** /**
* 实训草稿业务实现 * 实训草稿业务实现
*/ */
@ -72,8 +57,7 @@ public class Training2DraftService {
public CreateTraining2RspVo createTraining(CreateTraining2ReqVo req, AccountVO user) { public CreateTraining2RspVo createTraining(CreateTraining2ReqVo req, AccountVO user) {
//校验是否已经有同名的实训 //校验是否已经有同名的实训
DraftTraining2Example example = new DraftTraining2Example(); DraftTraining2Example example = new DraftTraining2Example();
example.createCriteria().andCreatorIdEqualTo(user.getId()).andNameEqualTo(req.getName()) example.createCriteria().andCreatorIdEqualTo(user.getId()).andNameEqualTo(req.getName()).andMapIdEqualTo(req.getMapId());
.andMapIdEqualTo(req.getMapId());
List<DraftTraining2> check = this.trainingDao.selectByExample(example); List<DraftTraining2> check = this.trainingDao.selectByExample(example);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertCollectionEmpty(check, "实训已经存在"); BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertCollectionEmpty(check, "实训已经存在");
// //
@ -90,8 +74,7 @@ public class Training2DraftService {
this.trainingDao.insertSelective(dt); this.trainingDao.insertSelective(dt);
// //
List<DraftTraining2> created = this.trainingDao.selectByExample(example); List<DraftTraining2> created = this.trainingDao.selectByExample(example);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != created && created.size() == 1, BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != created && created.size() == 1, "创建实训异常");
"创建实训异常");
// //
DraftTraining2 tn = created.get(0); DraftTraining2 tn = created.get(0);
CreateTraining2RspVo rsp = new CreateTraining2RspVo(); CreateTraining2RspVo rsp = new CreateTraining2RspVo();
@ -146,8 +129,7 @@ public class Training2DraftService {
DraftTraining2Example example = new DraftTraining2Example(); DraftTraining2Example example = new DraftTraining2Example();
example.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(req.getId()); example.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(req.getId());
List<DraftTraining2> find = this.trainingDao.selectByExample(example); List<DraftTraining2> find = this.trainingDao.selectByExample(example);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != find && !find.isEmpty(), BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != find && !find.isEmpty(), "实训草稿不存在");
"实训草稿不存在");
// //
DraftTraining2WithBLOBs b = new DraftTraining2WithBLOBs(); DraftTraining2WithBLOBs b = new DraftTraining2WithBLOBs();
//构建背景 //构建背景
@ -156,8 +138,7 @@ public class Training2DraftService {
StorageSimulation scenesSaving = new StorageSimulation(simulation, true); StorageSimulation scenesSaving = new StorageSimulation(simulation, true);
//保存背景 //保存背景
String bgSceneJson = JsonUtils.writeValueAsString(scenesSaving); String bgSceneJson = JsonUtils.writeValueAsString(scenesSaving);
String memberJson = JsonUtils.writeValueAsString( String memberJson = JsonUtils.writeValueAsString(SimulationMemberVO.convert2VOList(simulation.getSimulationMembers()));
SimulationMemberVO.convert2VOList(simulation.getSimulationMembers()));
b.setBgSceneJson(bgSceneJson); b.setBgSceneJson(bgSceneJson);
b.setMemberJson(memberJson); b.setMemberJson(memberJson);
b.setUpdateTime(LocalDateTime.now()); b.setUpdateTime(LocalDateTime.now());
@ -175,8 +156,7 @@ public class Training2DraftService {
DraftTraining2Example example = new DraftTraining2Example(); DraftTraining2Example example = new DraftTraining2Example();
example.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(req.getId()); example.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(req.getId());
List<DraftTraining2> find = this.trainingDao.selectByExample(example); List<DraftTraining2> find = this.trainingDao.selectByExample(example);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != find && !find.isEmpty(), BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != find && !find.isEmpty(), "实训草稿不存在");
"实训草稿不存在");
// //
DraftTraining2WithBLOBs b = new DraftTraining2WithBLOBs(); DraftTraining2WithBLOBs b = new DraftTraining2WithBLOBs();
b.setBgSceneJson(""); b.setBgSceneJson("");
@ -197,8 +177,7 @@ public class Training2DraftService {
example.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(trainingId); example.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(trainingId);
List<DraftTraining2> find = this.trainingDao.selectByExample(example); List<DraftTraining2> find = this.trainingDao.selectByExample(example);
// //
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != find && !find.isEmpty(), BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != find && !find.isEmpty(), "实训草稿不存在");
"实训草稿不存在");
// //
DraftTraining2WithBLOBs b = new DraftTraining2WithBLOBs(); DraftTraining2WithBLOBs b = new DraftTraining2WithBLOBs();
b.setBgSceneJson(""); b.setBgSceneJson("");
@ -232,8 +211,7 @@ public class Training2DraftService {
DraftTraining2Example example = new DraftTraining2Example(); DraftTraining2Example example = new DraftTraining2Example();
example.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(req.getId()); example.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(req.getId());
List<DraftTraining2> find = this.trainingDao.selectByExample(example); List<DraftTraining2> find = this.trainingDao.selectByExample(example);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != find && !find.isEmpty(), BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != find && !find.isEmpty(), "实训草稿不存在");
"实训草稿不存在");
// //
DraftTraining2WithBLOBs b = new DraftTraining2WithBLOBs(); DraftTraining2WithBLOBs b = new DraftTraining2WithBLOBs();
// //
@ -251,11 +229,9 @@ public class Training2DraftService {
DraftTraining2Example example = new DraftTraining2Example(); DraftTraining2Example example = new DraftTraining2Example();
example.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(req.getId()); example.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(req.getId());
List<DraftTraining2> find = this.trainingDao.selectByExample(example); List<DraftTraining2> find = this.trainingDao.selectByExample(example);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != find && !find.isEmpty(), BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != find && !find.isEmpty(), "实训草稿不存在");
"实训草稿不存在");
boolean isExist = this.isExistDraft(userId, find.get(0).getMapId(), req.getId(), req.getName()); boolean isExist = this.isExistDraft(userId, find.get(0).getMapId(), req.getId(), req.getName());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotTrue(isExist, BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotTrue(isExist, "名称为 [" + req.getName() + "] 的草稿已经存在");
"名称为 [" + req.getName() + "] 的草稿已经存在");
// //
DraftTraining2WithBLOBs b = new DraftTraining2WithBLOBs(); DraftTraining2WithBLOBs b = new DraftTraining2WithBLOBs();
// //
@ -281,8 +257,7 @@ public class Training2DraftService {
DraftTraining2Example example = new DraftTraining2Example(); DraftTraining2Example example = new DraftTraining2Example();
example.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(req.getId()); example.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(req.getId());
List<DraftTraining2> find = this.trainingDao.selectByExample(example); List<DraftTraining2> find = this.trainingDao.selectByExample(example);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != find && !find.isEmpty(), BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != find && !find.isEmpty(), "实训草稿不存在");
"实训草稿不存在");
// //
DraftTraining2WithBLOBs b = new DraftTraining2WithBLOBs(); DraftTraining2WithBLOBs b = new DraftTraining2WithBLOBs();
// //
@ -332,9 +307,6 @@ public class Training2DraftService {
rsp.setRunPlanId(b.getRunPlanId()); rsp.setRunPlanId(b.getRunPlanId());
rsp.setScoringRuleJson(b.getScoringRuleJson()); rsp.setScoringRuleJson(b.getScoringRuleJson());
rsp.setClient(b.getClient()); rsp.setClient(b.getClient());
// 步骤不为且最终背景为空时
rsp.setNeedRunToFinalStep(
StringUtils.hasText(b.getStepJson()) && StringUtils.isEmpty(b.getFinalScenesJson()));
return rsp; return rsp;
} else { } else {
return null; return null;
@ -345,8 +317,7 @@ public class Training2DraftService {
* 分页获取当前用户草稿基础信息 * 分页获取当前用户草稿基础信息
*/ */
@Transactional(readOnly = true) @Transactional(readOnly = true)
public PageVO<DraftTraining2InfoVo> findTrainingsInfoByPage(DraftTraining2InfoPageReqVo req, public PageVO<DraftTraining2InfoVo> findTrainingsInfoByPage(DraftTraining2InfoPageReqVo req, Long userId) {
Long userId) {
PageVO<DraftTraining2InfoVo> page = new PageVO<>(); PageVO<DraftTraining2InfoVo> page = new PageVO<>();
// //
DraftTraining2Example example = new DraftTraining2Example(); DraftTraining2Example example = new DraftTraining2Example();
@ -377,11 +348,9 @@ public class Training2DraftService {
long startIndex = (req.getPageNum() - 1) * req.getPageSize(); long startIndex = (req.getPageNum() - 1) * req.getPageSize();
// //
if (req.getDesc()) { if (req.getDesc()) {
example.setOrderByClause( example.setOrderByClause(String.format("%s desc limit %s,%s", orderBy, startIndex, req.getPageSize()));
String.format("%s desc limit %s,%s", orderBy, startIndex, req.getPageSize()));
} else { } else {
example.setOrderByClause( example.setOrderByClause(String.format("%s limit %s,%s", orderBy, startIndex, req.getPageSize()));
String.format("%s limit %s,%s", orderBy, startIndex, req.getPageSize()));
} }
List<DraftTraining2> pContent = this.trainingDao.selectByExample(example); List<DraftTraining2> pContent = this.trainingDao.selectByExample(example);
if (null != pContent) { if (null != pContent) {
@ -445,8 +414,7 @@ public class Training2DraftService {
updateObj.setFinalScenesJson(JsonUtils.writeValueAsString(scenesSaving)); updateObj.setFinalScenesJson(JsonUtils.writeValueAsString(scenesSaving));
} }
// 成员信息 // 成员信息
List<SimulationMemberPO> simulationMemberPOList = SimulationMemberPO.convertFromBOList( List<SimulationMemberPO> simulationMemberPOList = SimulationMemberPO.convertFromBOList(simulation.getSimulationMembers());
simulation.getSimulationMembers());
updateObj.setMemberJson(JsonUtils.writeValueAsString(simulationMemberPOList)); updateObj.setMemberJson(JsonUtils.writeValueAsString(simulationMemberPOList));
trainingDao.updateByPrimaryKeySelective(updateObj); trainingDao.updateByPrimaryKeySelective(updateObj);
} }
@ -530,8 +498,7 @@ public class Training2DraftService {
if (!StringUtils.hasText(memberJson)) { if (!StringUtils.hasText(memberJson)) {
return new ArrayList<>(); return new ArrayList<>();
} }
List<SimulationMemberVO> members = JsonUtils.readCollection(memberJson, List.class, List<SimulationMemberVO> members = JsonUtils.readCollection(memberJson, List.class, SimulationMemberVO.class);
SimulationMemberVO.class);
Map<String, SimulationMemberVO> memberMap = members.stream() Map<String, SimulationMemberVO> memberMap = members.stream()
.collect(Collectors.toMap(SimulationMemberVO::getId, Function.identity())); .collect(Collectors.toMap(SimulationMemberVO::getId, Function.identity()));
List<String> playerIds = JsonUtils.readCollection(playerIdJson, List.class, String.class); List<String> playerIds = JsonUtils.readCollection(playerIdJson, List.class, String.class);
@ -548,32 +515,25 @@ public class Training2DraftService {
curStepId = 0L; curStepId = 0L;
} else { } else {
// 数据库中的步骤信息 // 数据库中的步骤信息
List<Step2VO> oldStep2VOS = JsonUtils.readCollection(draftTraining2.getStepJson(), List.class, List<Step2VO> oldStep2VOS = JsonUtils.readCollection(draftTraining2.getStepJson(), List.class, Step2VO.class);
Step2VO.class); curStepId = oldStep2VOS.stream().map(Step2VO::getId).max(Comparator.comparing(Long::intValue)).get();
curStepId = oldStep2VOS.stream().map(Step2VO::getId).max(Comparator.comparing(Long::intValue))
.get();
} }
AtomicLong atomicId = new AtomicLong(curStepId); AtomicLong atomicId = new AtomicLong(curStepId);
step2VOList.stream().filter(s -> s.getId() == null) step2VOList.stream().filter(s -> s.getId() == null).forEach(s -> s.setId(atomicId.incrementAndGet()));
.forEach(s -> s.setId(atomicId.incrementAndGet()));
} }
/** /**
* 处理已经保存的打分规则 * 处理已经保存的打分规则
*/ */
private String handleStepScoringRule(DraftTraining2WithBLOBs draftTraining2, private String handleStepScoringRule(DraftTraining2WithBLOBs draftTraining2, List<Step2VO> step2VOList) {
List<Step2VO> step2VOList) {
// 当前编辑后的步骤 // 当前编辑后的步骤
Map<String, List<String>> curStepIdMap = step2VOList.stream().filter(s -> s.getId() != null) Map<String, List<String>> curStepIdMap = step2VOList.stream().filter(s -> s.getId() != null)
.collect(Collectors.groupingBy(Step2VO::getMemberId, .collect(Collectors.groupingBy(Step2VO::getMemberId, Collectors.mapping(s -> s.getId().toString(), Collectors.toList())));
Collectors.mapping(s -> s.getId().toString(), Collectors.toList()))); if (StringUtils.isEmpty(draftTraining2.getScoringRuleJson()) || CollectionUtils.isEmpty(curStepIdMap)) {
if (StringUtils.isEmpty(draftTraining2.getScoringRuleJson()) || CollectionUtils.isEmpty(
curStepIdMap)) {
return StringUtil.EMPTY_STRING; return StringUtil.EMPTY_STRING;
} else { } else {
// 比对删除打分规则 // 比对删除打分规则
List<ScoringRuleVO> scoringRuleList = JsonUtils.readCollection( List<ScoringRuleVO> scoringRuleList = JsonUtils.readCollection(draftTraining2.getScoringRuleJson(), List.class, ScoringRuleVO.class);
draftTraining2.getScoringRuleJson(), List.class, ScoringRuleVO.class);
scoringRuleList.stream().filter(s -> curStepIdMap.containsKey(s.getMemberId())).map(s -> { scoringRuleList.stream().filter(s -> curStepIdMap.containsKey(s.getMemberId())).map(s -> {
List<ScoringRuleVO.DetailVO> details = s.getDetails().stream() List<ScoringRuleVO.DetailVO> details = s.getDetails().stream()
.filter(d -> curStepIdMap.get(s.getMemberId()).contains(d.getElementId())) .filter(d -> curStepIdMap.get(s.getMemberId()).contains(d.getElementId()))
@ -585,8 +545,7 @@ public class Training2DraftService {
return s; return s;
} }
}).filter(s -> s != null).collect(Collectors.toList()); }).filter(s -> s != null).collect(Collectors.toList());
return CollectionUtils.isEmpty(scoringRuleList) ? StringUtil.EMPTY_STRING return CollectionUtils.isEmpty(scoringRuleList) ? StringUtil.EMPTY_STRING : JsonUtils.writeValueAsString(scoringRuleList);
: JsonUtils.writeValueAsString(scoringRuleList);
} }
} }
} }

View File

@ -15,27 +15,9 @@ import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.map.MapVO; import club.joylink.rtss.vo.map.MapVO;
import club.joylink.rtss.vo.paper.FindCountForQuestionReqVo; import club.joylink.rtss.vo.paper.FindCountForQuestionReqVo;
import club.joylink.rtss.vo.paper.PaperQType; import club.joylink.rtss.vo.paper.PaperQType;
import club.joylink.rtss.vo.training2.publish.DeletePublishedTraining2ReqVo; import club.joylink.rtss.vo.training2.publish.*;
import club.joylink.rtss.vo.training2.publish.DeletePublishedTraining2RspVo;
import club.joylink.rtss.vo.training2.publish.PublishedTraining2DetailRspVo;
import club.joylink.rtss.vo.training2.publish.PublishedTraining2InfoPageReqVo;
import club.joylink.rtss.vo.training2.publish.PublishedTraining2InfoRspVo;
import club.joylink.rtss.vo.training2.publish.PublishedTrainingListRspVo;
import club.joylink.rtss.vo.training2.publish.PullOffPublishedTraining2ReqVo;
import club.joylink.rtss.vo.training2.publish.PullOffPublishedTraining2RspVo;
import club.joylink.rtss.vo.training2.publish.PutOnPublishedTraining2ReqVo;
import club.joylink.rtss.vo.training2.publish.PutOnPublishedTraining2RspVo;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -43,13 +25,16 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
/** /**
* 已发布实训管理业务实现 * 已发布实训管理业务实现
*/ */
@Service @Service
@Slf4j @Slf4j
public class Training2PublishService { public class Training2PublishService {
@Autowired @Autowired
private PublishedTraining2DAO publishedDao; private PublishedTraining2DAO publishedDao;
@Autowired @Autowired
@ -65,6 +50,7 @@ public class Training2PublishService {
/** /**
* 根据组织类型单操作实操标签获取对应的数量 * 根据组织类型单操作实操标签获取对应的数量
*/ */
public Long queryCountForLabel(FindCountForQuestionReqVo reqVo){ public Long queryCountForLabel(FindCountForQuestionReqVo reqVo){
if(Objects.isNull(reqVo.getTrainingClient())){ if(Objects.isNull(reqVo.getTrainingClient())){
@ -72,39 +58,30 @@ public class Training2PublishService {
return 0L; return 0L;
} }
PublishedTraining2Example example = new PublishedTraining2Example(); PublishedTraining2Example example = new PublishedTraining2Example();
PublishedTraining2Example.Criteria c = this.basicQueryCriteria(example, reqVo.getMapId(), PublishedTraining2Example.Criteria c = this.basicQueryCriteria(example,reqVo.getMapId(),reqVo.getOrgId(),reqVo.getSubType().name().toUpperCase(),Arrays.asList(reqVo.getTags()),reqVo.getTrainingClient());
reqVo.getOrgId(), reqVo.getSubType().name().toUpperCase(), Arrays.asList(reqVo.getTags()),
reqVo.getTrainingClient());
return this.publishedDao.countByExample(example); return this.publishedDao.countByExample(example);
} }
/** /**
* 根据 组织类型单操作实操 获取标签 * 根据 组织类型单操作实操 获取标签
*/ */
public Collection<String> findAllLabel(Long mapId, Long orgId, String type, public Collection<String> findAllLabel(Long mapId, Long orgId, String type, PaperQType.TrainingClient client){
PaperQType.TrainingClient client) {
PublishedTraining2Example example = new PublishedTraining2Example(); PublishedTraining2Example example = new PublishedTraining2Example();
PublishedTraining2Example.Criteria c = this.basicQueryCriteria(example, mapId, orgId, type, PublishedTraining2Example.Criteria c = this.basicQueryCriteria(example,mapId,orgId,type,null,client);
null, client);
List<PublishedTraining2> dataList = this.publishedDao.selectByExample(example); List<PublishedTraining2> dataList = this.publishedDao.selectByExample(example);
if(CollectionUtils.isEmpty(dataList)){ if(CollectionUtils.isEmpty(dataList)){
return Collections.emptyList(); return Collections.emptyList();
} }
return dataList.stream().map(PublishedTraining2::getLabelJson).filter(StringUtils::hasText) return dataList.stream().map(PublishedTraining2::getLabelJson).filter(StringUtils::hasText).map(d->{
.map(d -> {
List<String> l = JsonUtils.readCollection(d,List.class,String.class); List<String> l = JsonUtils.readCollection(d,List.class,String.class);
return l; return l;
}).flatMap(Collection::stream).collect(Collectors.toSet()); }).flatMap(Collection::stream).collect(Collectors.toSet());
} }
public PublishedTraining2Example.Criteria basicQueryCriteria(PublishedTraining2Example example, public PublishedTraining2Example.Criteria basicQueryCriteria(PublishedTraining2Example example, Long mapId, Long orgId, String type, List<String> lables, PaperQType.TrainingClient client){
Long mapId, Long orgId, String type, List<String> lables, PaperQType.TrainingClient client) { BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(mapId),"请关联对应的线路");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(mapId), BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId),"组织信息不能为空");
"请关联对应的线路"); BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(type),"查询类型信息不能为空");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId),
"组织信息不能为空");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(type),
"查询类型信息不能为空");
PublishedTraining2Example.Criteria criteria = example.createCriteria(); PublishedTraining2Example.Criteria criteria = example.createCriteria();
@ -140,8 +117,7 @@ public class Training2PublishService {
* 已发布实训分页列表 * 已发布实训分页列表
*/ */
@Transactional(readOnly = true) @Transactional(readOnly = true)
public PageVO<PublishedTraining2InfoRspVo> publishedTrainingsPage( public PageVO<PublishedTraining2InfoRspVo> publishedTrainingsPage(PublishedTraining2InfoPageReqVo req) {
PublishedTraining2InfoPageReqVo req) {
PageHelper.startPage(req.getPageNum(), req.getPageSize()); PageHelper.startPage(req.getPageNum(), req.getPageSize());
PublishedTraining2Example example = new PublishedTraining2Example(); PublishedTraining2Example example = new PublishedTraining2Example();
PublishedTraining2Example.Criteria c = example.createCriteria(); PublishedTraining2Example.Criteria c = example.createCriteria();
@ -184,8 +160,7 @@ public class Training2PublishService {
if (req.getDesc()) { if (req.getDesc()) {
example.setOrderByClause(String.format(" %s desc", orderBy)); example.setOrderByClause(String.format(" %s desc", orderBy));
} }
Page<PublishedTraining2> page = (Page<PublishedTraining2>) this.publishedDao.selectByExample( Page<PublishedTraining2> page = (Page<PublishedTraining2>) this.publishedDao.selectByExample(example);
example);
List<PublishedTraining2InfoRspVo> tmpList = Training2Convertor.convertFrom(page.getResult()); List<PublishedTraining2InfoRspVo> tmpList = Training2Convertor.convertFrom(page.getResult());
return PageVO.convert(page, tmpList); return PageVO.convert(page, tmpList);
@ -195,8 +170,7 @@ public class Training2PublishService {
* 已发布实训上架 * 已发布实训上架
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public PutOnPublishedTraining2RspVo putOnPublishedTrainings(PutOnPublishedTraining2ReqVo req, public PutOnPublishedTraining2RspVo putOnPublishedTrainings(PutOnPublishedTraining2ReqVo req,LoginUserInfoVO userInfoVO) {
LoginUserInfoVO userInfoVO) {
final PutOnPublishedTraining2RspVo rsp = new PutOnPublishedTraining2RspVo(); final PutOnPublishedTraining2RspVo rsp = new PutOnPublishedTraining2RspVo();
rsp.setIds(new ArrayList<>()); rsp.setIds(new ArrayList<>());
if(CollectionUtils.isEmpty(req.getIds())){ if(CollectionUtils.isEmpty(req.getIds())){
@ -217,25 +191,34 @@ public class Training2PublishService {
rsp.getIds().add(newId.toString()); rsp.getIds().add(newId.toString());
} }
} }
/* req.getIds().forEach(id -> {
PublishedTraining2WithBLOBs pub = new PublishedTraining2WithBLOBs();
pub.setId(Long.valueOf(id));
pub.setState(PublishedTraining2StateEnum.PutOn.getState());
pub.setUpdateTime(LocalDateTime.now());
//
PublishedTraining2Example example = new PublishedTraining2Example();
example.createCriteria().andIdEqualTo(pub.getId());
//
int urt = this.publishedDao.updateByExampleSelective(pub, example);
if (urt > 0) {//记录更新成功的
rsp.getIds().add(id);
}
});*/
return rsp; return rsp;
} }
public void changeSharedStatus(Long id ,Integer shared,LoginUserInfoVO userInfoVO){ public void changeSharedStatus(Long id ,Integer shared,LoginUserInfoVO userInfoVO){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(id),"id信息不能为空"); BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(id),"id信息不能为空");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(shared), BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(shared),"未知共享类型");
"未知共享类型"); BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(shared == BusinessConsts.STATUS_USE_INT || shared == BusinessConsts.STATUS_NOT_USE_INT,"未知共享类型");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
shared == BusinessConsts.STATUS_USE_INT || shared == BusinessConsts.STATUS_NOT_USE_INT,
"未知共享类型");
} }
/** /**
* 已发布实训下架 * 已发布实训下架
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public PullOffPublishedTraining2RspVo pullOffPublishedTrainings( public PullOffPublishedTraining2RspVo pullOffPublishedTrainings(PullOffPublishedTraining2ReqVo req,LoginUserInfoVO userInfoVO) {
PullOffPublishedTraining2ReqVo req, LoginUserInfoVO userInfoVO) {
final PullOffPublishedTraining2RspVo rsp = new PullOffPublishedTraining2RspVo(); final PullOffPublishedTraining2RspVo rsp = new PullOffPublishedTraining2RspVo();
rsp.setIds(new ArrayList<>()); rsp.setIds(new ArrayList<>());
if(CollectionUtils.isEmpty(req.getIds())){ if(CollectionUtils.isEmpty(req.getIds())){
@ -264,8 +247,7 @@ public class Training2PublishService {
* 删除已发布实训 * 删除已发布实训
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public DeletePublishedTraining2RspVo deletePublishedTrainings(DeletePublishedTraining2ReqVo req, public DeletePublishedTraining2RspVo deletePublishedTrainings(DeletePublishedTraining2ReqVo req, LoginUserInfoVO userInfoVO) {
LoginUserInfoVO userInfoVO) {
DeletePublishedTraining2RspVo rsp = new DeletePublishedTraining2RspVo(); DeletePublishedTraining2RspVo rsp = new DeletePublishedTraining2RspVo();
rsp.setIds(new ArrayList<>()); rsp.setIds(new ArrayList<>());
if(CollectionUtils.isEmpty(req.getIds())){ if(CollectionUtils.isEmpty(req.getIds())){
@ -278,6 +260,13 @@ public class Training2PublishService {
rsp.getIds().add(newId.toString()); rsp.getIds().add(newId.toString());
} }
} }
/*req.getIds().forEach(id -> {
int drt = this.publishedDao.deleteByPrimaryKey(Long.valueOf(id));
if (drt > 0) {
rsp.getIds().add(id);
}
});*/
//
return rsp; return rsp;
} }
@ -287,23 +276,17 @@ public class Training2PublishService {
List<Long> idLong = ids.stream().map(Long::valueOf).collect(Collectors.toList()); List<Long> idLong = ids.stream().map(Long::valueOf).collect(Collectors.toList());
criteria.andIdIn(idLong); criteria.andIdIn(idLong);
List<PublishedTraining2> t2 = this.publishedDao.selectByExample(example); List<PublishedTraining2> t2 = this.publishedDao.selectByExample(example);
List<PublishedTraining2> notExeList = t2.stream().filter( List<PublishedTraining2> notExeList = t2.stream().filter(d->Objects.equals(d.getOrgId(),userInfoVO.getTopOrgId())).collect(Collectors.toList());
d -> Objects.equals(d.getOrgId(), userInfoVO.getTopOrgId()) && !Objects.equals(
d.getCreatorId(), userInfoVO.getAccountVO().getId()))
.collect(Collectors.toList());
if(!CollectionUtils.isEmpty(notExeList)){ if(!CollectionUtils.isEmpty(notExeList)){
String names = notExeList.stream().map(d->d.getName()).collect(Collectors.joining(",")); String names = notExeList.stream().map(d->d.getName()).collect(Collectors.joining(","));
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(false, BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(false,String.format("共享数据[%s]不能删除",names));
String.format("共享数据[%s]不能删除", names));
} }
List<Long> findIds = t2.stream() List<Long> findIds = t2.stream()
.filter(d->Objects.equals(d.getOrgId(),userInfoVO.getTopOrgId())) .filter(d->Objects.equals(d.getOrgId(),userInfoVO.getTopOrgId()))
.map(d->d.getId()).collect(Collectors.toList()); .map(d->d.getId()).collect(Collectors.toList());
return findIds; return findIds;
} }
private PublishedTraining2Example.Criteria createQueryOrExample(PublishedTraining2Example example , PublishedTrainingListRspVo reqVO,List<Long> mapIdList){
private PublishedTraining2Example.Criteria createQueryOrExample(PublishedTraining2Example example,
PublishedTrainingListRspVo reqVO, List<Long> mapIdList) {
PublishedTraining2Example.Criteria criteria = example.createCriteria(); PublishedTraining2Example.Criteria criteria = example.createCriteria();
// PublishedTraining2Example.Criteria or = example.or(); // PublishedTraining2Example.Criteria or = example.or();
@ -332,19 +315,41 @@ public class Training2PublishService {
} }
return criteria; return criteria;
} }
/* private PublishedTraining2Example.Criteria createQueryExample(PublishedTraining2Example example ,PublishedTrainingListRspVo reqVO){
public PageVO<PublishedTraining2InfoRspVo> findTrainingInfoForPage( PublishedTraining2Example.Criteria criteria = example.createCriteria();
PublishedTrainingListRspVo reqVO, LoginUserInfoVO userInfoVO, boolean findSharedData) { if (reqVO.getMapId() != null) {
criteria.andMapIdEqualTo(reqVO.getMapId());
}
if (reqVO.getType() != null) {
criteria.andTypeEqualTo(reqVO.getType().value());
}
if(StringUtils.hasText(reqVO.getName())){
criteria.andNameLike(String.format("%%%s%%", reqVO.getName()));
}
if(Objects.nonNull(reqVO.getState())){
criteria.andStateEqualTo(reqVO.getState());
}
if(!CollectionUtils.isEmpty(reqVO.getLabels())){
for (String label : reqVO.getLabels()) {
criteria.andLabelJsonLike(String.format("%%%s%%", label));
}
}
if (reqVO.getOrgId() != null) {
criteria.andOrgIdEqualTo(reqVO.getOrgId());
}
return criteria;
}*/
public PageVO<PublishedTraining2InfoRspVo> findTrainingInfoForPage(PublishedTrainingListRspVo reqVO,LoginUserInfoVO userInfoVO,boolean findSharedData){
List<MapVO> mapVOS = this.mapService.listMapsOfUser(userInfoVO); List<MapVO> mapVOS = this.mapService.listMapsOfUser(userInfoVO);
List<Long> mapIdList = mapVOS.stream().map(d->d.getId()).collect(Collectors.toList()); List<Long> mapIdList = mapVOS.stream().map(d->d.getId()).collect(Collectors.toList());
PublishedTraining2Example example = new PublishedTraining2Example(); PublishedTraining2Example example = new PublishedTraining2Example();
PublishedTraining2Example.Criteria criteria = this.createQueryOrExample(example, reqVO, PublishedTraining2Example.Criteria criteria = this.createQueryOrExample(example,reqVO,mapIdList);
mapIdList);
if(findSharedData){ if(findSharedData){
PublishedTraining2Example.Criteria or = example.or(); PublishedTraining2Example.Criteria or = example.or();
or.andStateEqualTo(BusinessConsts.STATUS_USE_INT) or.andStateEqualTo(BusinessConsts.STATUS_USE_INT).andSharedEqualTo(BusinessConsts.STATUS_USE_INT);
.andSharedEqualTo(BusinessConsts.STATUS_USE_INT);
if (reqVO.getType() != null) { if (reqVO.getType() != null) {
or.andTypeEqualTo(reqVO.getType().value()); or.andTypeEqualTo(reqVO.getType().value());
} }
@ -353,10 +358,12 @@ public class Training2PublishService {
}else{ }else{
or.andMapIdEqualTo(reqVO.getMapId()); or.andMapIdEqualTo(reqVO.getMapId());
} }
// if(Objects.nonNull(reqVO.getOrgId())){
// or.andOrgIdNotEqualTo(reqVO.getOrgId());
// }
} }
PageHelper.startPage(reqVO.getPageNum(), reqVO.getPageSize()); PageHelper.startPage(reqVO.getPageNum(), reqVO.getPageSize());
Page<PublishedTraining2> page = (Page<PublishedTraining2>) this.publishedDao.selectByExample( Page<PublishedTraining2> page = (Page<PublishedTraining2>)this.publishedDao.selectByExample(example);
example);
if(page.isEmpty()){ if(page.isEmpty()){
return PageVO.convert(page,Collections.emptyList()); return PageVO.convert(page,Collections.emptyList());
} }
@ -366,21 +373,21 @@ public class Training2PublishService {
/** /**
* 根据地图ID和类型查询实训列表 * 根据地图ID和类型查询实训列表
*/ */
public List<PublishedTraining2InfoRspVo> findTrainingInfo(PublishedTrainingListRspVo reqVO, public List<PublishedTraining2InfoRspVo> findTrainingInfo(PublishedTrainingListRspVo reqVO,LoginUserInfoVO userInfoVO) {
LoginUserInfoVO userInfoVO) {
List<MapVO> mapVOS = this.mapService.listMapsOfUser(userInfoVO); List<MapVO> mapVOS = this.mapService.listMapsOfUser(userInfoVO);
List<Long> mapIdList = mapVOS.stream().map(d->d.getId()).collect(Collectors.toList()); List<Long> mapIdList = mapVOS.stream().map(d->d.getId()).collect(Collectors.toList());
PublishedTraining2Example example = new PublishedTraining2Example(); PublishedTraining2Example example = new PublishedTraining2Example();
this.createQueryOrExample(example,reqVO,mapIdList); this.createQueryOrExample(example,reqVO,mapIdList);
PublishedTraining2Example.Criteria or = example.or(); PublishedTraining2Example.Criteria or = example.or();
or.andStateEqualTo(BusinessConsts.STATUS_USE_INT) or.andStateEqualTo(BusinessConsts.STATUS_USE_INT).andSharedEqualTo(BusinessConsts.STATUS_USE_INT);
.andSharedEqualTo(BusinessConsts.STATUS_USE_INT);
or.andMapIdEqualTo(reqVO.getMapId()); or.andMapIdEqualTo(reqVO.getMapId());
if (reqVO.getType() != null) { if (reqVO.getType() != null) {
or.andTypeEqualTo(reqVO.getType().value()); or.andTypeEqualTo(reqVO.getType().value());
} }
example.setOrderByClause("id desc"); // if(reqVO.getOrgId() !=null){
// or.andOrgIdNotEqualTo(reqVO.getOrgId());
// }
List<PublishedTraining2> list = this.publishedDao.selectByExample(example); List<PublishedTraining2> list = this.publishedDao.selectByExample(example);
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
return List.of(); return List.of();
@ -437,8 +444,7 @@ public class Training2PublishService {
* 批量更新实训label * 批量更新实训label
*/ */
public void updateTrainingLabelList(List<PublishedTraining2> publishedTraining2List) { public void updateTrainingLabelList(List<PublishedTraining2> publishedTraining2List) {
List<PublishedTraining2> training2List = publishedTraining2List.stream() List<PublishedTraining2> training2List = publishedTraining2List.stream().filter(t -> t.getId() != null).collect(Collectors.toList());
.filter(t -> t.getId() != null).collect(Collectors.toList());
if (CollectionUtils.isEmpty(training2List)) { if (CollectionUtils.isEmpty(training2List)) {
return; return;
} }
@ -455,42 +461,23 @@ public class Training2PublishService {
publishedDao.updateByPrimaryKeySelective(blobs); publishedDao.updateByPrimaryKeySelective(blobs);
} }
/**
* 修改发布实训的基本信息名称描述等
*
* @param training2
*/
public void updateTrainingBaseInfo(PublishedTraining2 training2) {
PublishedTraining2WithBLOBs blobs = new PublishedTraining2WithBLOBs();
blobs.setId(training2.getId());
blobs.setName(training2.getName());
blobs.setDescription(training2.getDescription());
blobs.setLabelJson(training2.getLabelJson());
publishedDao.updateByPrimaryKeySelective(blobs);
}
/** /**
* 导出实训信息 * 导出实训信息
*
* @param tidList 实训列表 * @param tidList 实训列表
* @return 实训列表 * @return 实训列表
*/ */
public List<ExportTraining2> exportTraining(List<Long> tidList) { public List<ExportTraining2> exportTraining(List<Long> tidList) {
PublishedTraining2Example example = new PublishedTraining2Example(); PublishedTraining2Example example = new PublishedTraining2Example();
example.createCriteria().andIdIn(tidList); example.createCriteria().andIdIn(tidList);
List<PublishedTraining2WithBLOBs> training2WithBLOBsList = publishedDao.selectByExampleWithBLOBs( List<PublishedTraining2WithBLOBs> training2WithBLOBsList = publishedDao.selectByExampleWithBLOBs(example);
example); Map<Long, List<PublishedTraining2WithBLOBs>> mapTrainingMap = training2WithBLOBsList.stream().peek(t -> {
Map<Long, List<PublishedTraining2WithBLOBs>> mapTrainingMap = training2WithBLOBsList.stream()
.peek(t -> {
t.setId(null); t.setId(null);
t.setUpdateTime(null); t.setUpdateTime(null);
t.setCreateTime(null); t.setCreateTime(null);
}).collect(Collectors.groupingBy(PublishedTraining2WithBLOBs::getMapId)); }).collect(Collectors.groupingBy(PublishedTraining2WithBLOBs::getMapId));
// 地图基本信息列表 // 地图基本信息列表
List<MapInfo> mapInfoList = mapService.queryMapInfoList( List<MapInfo> mapInfoList = mapService.queryMapInfoList(new ArrayList<>(mapTrainingMap.keySet()));
new ArrayList<>(mapTrainingMap.keySet())); Map<Long, MapInfo> mapInfoMap = mapInfoList.stream().collect(Collectors.toMap(MapInfo::getId, m -> m, (o,n) -> n));
Map<Long, MapInfo> mapInfoMap = mapInfoList.stream()
.collect(Collectors.toMap(MapInfo::getId, m -> m, (o, n) -> n));
List<ExportTraining2> exportTraining2List = new ArrayList<>(mapTrainingMap.size()); List<ExportTraining2> exportTraining2List = new ArrayList<>(mapTrainingMap.size());
mapInfoMap.forEach((k, v) -> { mapInfoMap.forEach((k, v) -> {
ExportTraining2 exportData = new ExportTraining2(); ExportTraining2 exportData = new ExportTraining2();
@ -504,11 +491,9 @@ public class Training2PublishService {
/** /**
* 导入实训接口 * 导入实训接口
*
* @param trainingList 实训列表 * @param trainingList 实训列表
*/ */
public List<String> importTraining(List<ExportTraining2> trainingList, public List<String> importTraining(List<ExportTraining2> trainingList, LoginUserInfoVO userInfoVO) {
LoginUserInfoVO userInfoVO) {
List<String> msgList = new ArrayList<>(); List<String> msgList = new ArrayList<>();
trainingList.forEach(t -> { trainingList.forEach(t -> {
List<MapInfo> mapInfoList = mapService.queryMapInfo(t.getName(), t.getLineCode()); List<MapInfo> mapInfoList = mapService.queryMapInfo(t.getName(), t.getLineCode());
@ -522,8 +507,7 @@ public class Training2PublishService {
publishedDao.insertList(t.getList()); publishedDao.insertList(t.getList());
msgList.add(String.format("地图【%s】实训信息导入成功", t.getName())); msgList.add(String.format("地图【%s】实训信息导入成功", t.getName()));
} else { } else {
msgList.add(String.format("地图【%s】实训信息导入失败线路【%s】地图【%s】未上线", t.getName(), msgList.add(String.format("地图【%s】实训信息导入失败", t.getName()));
t.getLineCode(), t.getName()));
} }
}); });
return msgList; return msgList;

View File

@ -1,6 +1,8 @@
package club.joylink.rtss.services.training2; package club.joylink.rtss.services.training2;
import club.joylink.rtss.constants.MapStatus; import club.joylink.rtss.constants.MapStatus;
import club.joylink.rtss.constants.Project;
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
import club.joylink.rtss.dao.MapInfoDAO; import club.joylink.rtss.dao.MapInfoDAO;
import club.joylink.rtss.dao.PublishedTraining2DAO; import club.joylink.rtss.dao.PublishedTraining2DAO;
import club.joylink.rtss.dao.RtsMapFunctionDAO; import club.joylink.rtss.dao.RtsMapFunctionDAO;
@ -9,29 +11,36 @@ import club.joylink.rtss.entity.MapInfo;
import club.joylink.rtss.entity.MapInfoExample; import club.joylink.rtss.entity.MapInfoExample;
import club.joylink.rtss.entity.RtsMapFunction; import club.joylink.rtss.entity.RtsMapFunction;
import club.joylink.rtss.entity.RtsMapFunctionExample; import club.joylink.rtss.entity.RtsMapFunctionExample;
import club.joylink.rtss.entity.training2.PublishedTraining2Example; import club.joylink.rtss.entity.training2.*;
import club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs;
import club.joylink.rtss.entity.training2.RtsTraining2RuleExample;
import club.joylink.rtss.entity.training2.RtsTraining2RuleWithBLOBs;
import club.joylink.rtss.services.mapFunction.RtsMapFunctionService; import club.joylink.rtss.services.mapFunction.RtsMapFunctionService;
import club.joylink.rtss.services.project.ProjectService; import club.joylink.rtss.services.project.ProjectService;
import club.joylink.rtss.simulation.SimulationManager; import club.joylink.rtss.simulation.SimulationManager;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.SimulationService; import club.joylink.rtss.simulation.cbtc.SimulationService;
import club.joylink.rtss.simulation.cbtc.data.map.MapNamedElement; import club.joylink.rtss.simulation.cbtc.data.map.MapNamedElement;
import club.joylink.rtss.simulation.cbtc.data.map.Route;
import club.joylink.rtss.simulation.cbtc.data.map.Stand;
import club.joylink.rtss.simulation.cbtc.data.map.Switch;
import club.joylink.rtss.util.JsonUtils; import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.training2.ScoringRuleVO; import club.joylink.rtss.vo.client.training2.ScoringRuleVO;
import club.joylink.rtss.vo.project.ProjectVO;
import club.joylink.rtss.vo.training2.rule.BgSceneStatusRule;
import club.joylink.rtss.vo.training2.rule.MapLocationRule;
import club.joylink.rtss.vo.training2.rule.StepRule; import club.joylink.rtss.vo.training2.rule.StepRule;
import club.joylink.rtss.vo.training2.rule.Training2Rule; import club.joylink.rtss.vo.training2.rule.Training2Rule;
import com.fasterxml.jackson.core.JsonParseException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.util.BiConsumer; import org.apache.logging.log4j.util.BiConsumer;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.*; import java.util.*;
import java.util.function.Consumer;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -122,6 +131,7 @@ public class Training2RuleService {
} }
/** /**
*
* @param mapId * @param mapId
* @param functionId * @param functionId
* @return * @return
@ -245,7 +255,7 @@ public class Training2RuleService {
// 需要删除的列表 // 需要删除的列表
List<Long> delTrainingIdList = publishedTraining2DAO.selectTrainingIdByRuleNameAndMapId(ruleNameMapList, k); List<Long> delTrainingIdList = publishedTraining2DAO.selectTrainingIdByRuleNameAndMapId(ruleNameMapList, k);
try { try {
Simulation simulation = simulationService.createSimulation(entities.get(0).getId(), loginUserInfoVO, false); Simulation simulation = simulationService.createSimulationPojo(entities.get(0).getId(), loginUserInfoVO, false);
errorMsgList.addAll(generateTraining(simulation, ruleList, delTrainingIdList, delPublishTrainingByIds)); errorMsgList.addAll(generateTraining(simulation, ruleList, delTrainingIdList, delPublishTrainingByIds));
} catch (Exception e) { } catch (Exception e) {
log.error("创建仿真失败", e); log.error("创建仿真失败", e);
@ -292,7 +302,7 @@ public class Training2RuleService {
List<RtsMapFunction> entities = getRtsMapFunctions(mapInfo.getId()); List<RtsMapFunction> entities = getRtsMapFunctions(mapInfo.getId());
if (!CollectionUtils.isEmpty(entities) && !CollectionUtils.isEmpty(lineCodeRuleMap.get(mapInfo.getLineCode()))) { if (!CollectionUtils.isEmpty(entities) && !CollectionUtils.isEmpty(lineCodeRuleMap.get(mapInfo.getLineCode()))) {
try { try {
Simulation simulation = simulationService.createSimulation(entities.get(0).getId(), loginUserInfoVO, false); Simulation simulation = simulationService.createSimulationPojo(entities.get(0).getId(), loginUserInfoVO, false);
if (CollectionUtils.isEmpty(deleteTrainingIdMap)) { if (CollectionUtils.isEmpty(deleteTrainingIdMap)) {
errorMsgList.addAll(generateTraining(simulation, lineCodeRuleMap.get(mapInfo.getLineCode()), null, delPublishTrainingByMapId)); errorMsgList.addAll(generateTraining(simulation, lineCodeRuleMap.get(mapInfo.getLineCode()), null, delPublishTrainingByMapId));
} else { } else {
@ -308,7 +318,6 @@ public class Training2RuleService {
/** /**
* 生成实训方法 * 生成实训方法
*
* @param simulation 对应地图仿真 * @param simulation 对应地图仿真
* @param ruleList 生成规则 * @param ruleList 生成规则
* @param delTrainingIds 要删除已发布的实训ID * @param delTrainingIds 要删除已发布的实训ID

View File

@ -6,16 +6,10 @@ import club.joylink.rtss.entity.training2.DraftTraining2WithBLOBs;
import club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs; import club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.training2.index.IndexAlgorithmService; import club.joylink.rtss.services.training2.index.IndexAlgorithmService;
import club.joylink.rtss.services.voice.VoiceService;
import club.joylink.rtss.simulation.cbtc.ATS.ATSMessageCollectAndDispatcher; import club.joylink.rtss.simulation.cbtc.ATS.ATSMessageCollectAndDispatcher;
import club.joylink.rtss.simulation.cbtc.ATS.operation.AtsOperationDispatcher; import club.joylink.rtss.simulation.cbtc.ATS.operation.AtsOperationDispatcher;
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation; import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation.Type; import club.joylink.rtss.simulation.cbtc.*;
import club.joylink.rtss.simulation.cbtc.GroupSimulationCache;
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.data.map.Switch; 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.ConversationMessageVO;
import club.joylink.rtss.simulation.cbtc.data.vo.Training2MessageVO; import club.joylink.rtss.simulation.cbtc.data.vo.Training2MessageVO;
@ -28,10 +22,8 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import club.joylink.rtss.simulation.cbtc.member.MemberManager; import club.joylink.rtss.simulation.cbtc.member.MemberManager;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember; import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import club.joylink.rtss.simulation.cbtc.member.SimulationMemberPO;
import club.joylink.rtss.simulation.cbtc.script.ScriptBO; import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
import club.joylink.rtss.simulation.cbtc.training2.Operation2; import club.joylink.rtss.simulation.cbtc.training2.Operation2;
import club.joylink.rtss.simulation.cbtc.training2.Operation2.SimCommand2;
import club.joylink.rtss.simulation.cbtc.training2.Step2; import club.joylink.rtss.simulation.cbtc.training2.Step2;
import club.joylink.rtss.simulation.cbtc.training2.Training2; import club.joylink.rtss.simulation.cbtc.training2.Training2;
import club.joylink.rtss.simulation.cbtc.training2.index.Index; import club.joylink.rtss.simulation.cbtc.training2.index.Index;
@ -42,22 +34,8 @@ import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.SocketMessageVO; import club.joylink.rtss.vo.client.SocketMessageVO;
import club.joylink.rtss.vo.client.WebSocketMessageType; import club.joylink.rtss.vo.client.WebSocketMessageType;
import club.joylink.rtss.vo.client.factory.SocketMessageFactory; import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
import club.joylink.rtss.vo.client.voice.BaseVoiceSynthesisVO;
import club.joylink.rtss.vo.client.voice.VoiceCompose;
import club.joylink.rtss.vo.paper.PaperTrainAnswerDetail; import club.joylink.rtss.vo.paper.PaperTrainAnswerDetail;
import club.joylink.rtss.websocket.StompMessageService; import club.joylink.rtss.websocket.StompMessageService;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.Semaphore;
import java.util.concurrent.locks.ReentrantLock;
import java.util.function.Consumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
@ -66,12 +44,19 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestAttribute;
import java.util.*;
import java.util.concurrent.Semaphore;
import java.util.concurrent.locks.ReentrantLock;
import java.util.function.Consumer;
import java.util.stream.Collectors;
@Slf4j @Slf4j
@Service @Service
public class Training2Service { public class Training2Service {
public static final String EXECUTE_JOB_NAME = "Training2"; public static final String EXECUTE_JOB_NAME = "Training2";
public static final String SCORING_JOB_NAME = "Training2Scoring"; public static final String SCORING_JOB_NAME = "Training2Scoring";
public static final String INDEX_JOB_NAME = "Training2Index"; public static final String INDEX_JOB_NAME = "Training2Index";
@ -83,26 +68,16 @@ public class Training2Service {
private static final List<String> CONVERSATION_LIST = Arrays.asList( private static final List<String> CONVERSATION_LIST = Arrays.asList(
Operation.Type.Conversation_Chat_Audio.name(), Operation.Type.Conversation_Chat_Text.name(), Operation.Type.Conversation_Chat_Audio.name(), Operation.Type.Conversation_Chat_Text.name(),
Operation.Type.Conversation_Chat_Audio_Base64.name(), Operation.Type.Conversation_Chat_Audio_Base64.name(),
Operation.Type.Conversation_Group_Audio_Chat.name(), Operation.Type.Conversation_Group_Audio_Chat.name(), Operation.Type.Conversation_Group_Text_Chat.name(),
Operation.Type.Conversation_Group_Text_Chat.name(),
Operation.Type.Conversation_Group_Audio_Base64.name(), Operation.Type.Conversation_Group_Audio_Base64.name(),
Operation.Type.Conversation_Group_Private_Text_Chat.name(), Operation.Type.Conversation_Group_Private_Text_Chat.name(), Operation.Type.Conversation_Group_Private_Audio_Base64.name()
Operation.Type.Conversation_Group_Private_Audio_Base64.name(),
Type.Conversation_Group_Private_Audio_Chat.name()
); );
private static final List<String> CONVERSATION_TEXT_LIST = Arrays.asList( private static final List<String> CONVERSATION_TEXT_LIST = Arrays.asList(
Operation.Type.Conversation_Chat_Text.name(), Operation.Type.Conversation_Chat_Text.name(), Operation.Type.Conversation_Group_Text_Chat.name(),
Operation.Type.Conversation_Group_Text_Chat.name(),
Operation.Type.Conversation_Group_Private_Text_Chat.name() Operation.Type.Conversation_Group_Private_Text_Chat.name()
); );
private static final List<String> PRIVATE_CONVERSATION_LIST = Arrays.asList(
Type.Conversation_Group_Private_Audio_Base64.name(),
Type.Conversation_Group_Private_Text_Chat.name(),
Type.Conversation_Group_Private_Audio_Chat.name()
);
/** /**
* 实训步骤执行道岔联动元素存在当前步骤元素 * 实训步骤执行道岔联动元素存在当前步骤元素
*/ */
@ -144,8 +119,6 @@ public class Training2Service {
@Autowired @Autowired
private SimulationService simulationService; private SimulationService simulationService;
@Autowired
private VoiceService voiceService;
/** /**
* 完成步骤接口信号量 * 完成步骤接口信号量
@ -230,8 +203,7 @@ public class Training2Service {
if (publishedTraining2 == null) { if (publishedTraining2 == null) {
throw new SimulationException(SimulationExceptionType.Data_Not_Exist, "实训不存在"); throw new SimulationException(SimulationExceptionType.Data_Not_Exist, "实训不存在");
} }
DraftTraining2WithBLOBs draftTraining2 = JsonUtils.readCollection( DraftTraining2WithBLOBs draftTraining2 = JsonUtils.readCollection(JsonUtils.writeValueAsString(publishedTraining2)
JsonUtils.writeValueAsString(publishedTraining2)
, DraftTraining2WithBLOBs.class); , DraftTraining2WithBLOBs.class);
// 校验数据 // 校验数据
trainingDataValid.accept(draftTraining2); trainingDataValid.accept(draftTraining2);
@ -248,8 +220,7 @@ public class Training2Service {
if (publishedTraining2 == null) { if (publishedTraining2 == null) {
throw new SimulationException(SimulationExceptionType.Data_Not_Exist, "实训不存在"); throw new SimulationException(SimulationExceptionType.Data_Not_Exist, "实训不存在");
} }
DraftTraining2WithBLOBs draftTraining2 = JsonUtils.readCollection( DraftTraining2WithBLOBs draftTraining2 = JsonUtils.readCollection(JsonUtils.writeValueAsString(publishedTraining2)
JsonUtils.writeValueAsString(publishedTraining2)
, DraftTraining2WithBLOBs.class); , DraftTraining2WithBLOBs.class);
// 校验数据 // 校验数据
trainingDataValid.accept(draftTraining2); trainingDataValid.accept(draftTraining2);
@ -294,8 +265,7 @@ public class Training2Service {
* <p> * <p>
* 2022-08-30 完成实训后取消仿真暂停 * 2022-08-30 完成实训后取消仿真暂停
*/ */
public List<PaperTrainAnswerDetail> finishTraining2(String group, AccountVO user, public List<PaperTrainAnswerDetail> finishTraining2(String group, AccountVO user, List<PaperTrainAnswerDetail> scoreDetailList) {
List<PaperTrainAnswerDetail> scoreDetailList) {
Simulation simulation = groupSimulationCache.getSimulationByGroup(group); Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
if (simulation == null) { if (simulation == null) {
throw new SimulationException(SimulationExceptionType.Invalid_Operation, "仿真不存在"); throw new SimulationException(SimulationExceptionType.Invalid_Operation, "仿真不存在");
@ -315,36 +285,27 @@ public class Training2Service {
Map<Long, Float> scoreMap = new HashMap<>(); Map<Long, Float> scoreMap = new HashMap<>();
if (!CollectionUtils.isEmpty(training2.getScoringRules())) { if (!CollectionUtils.isEmpty(training2.getScoringRules())) {
training2.getScoringRules().stream() training2.getScoringRules().stream()
.flatMap(sr -> sr.getDetails().stream()) .filter(score -> Objects.equals(score.getMember().getId(), member.getId()))
.forEach(d -> scoreMap.put(d.getStep().getId(), d.getScore())); .findFirst().ifPresent(scoringRule2 -> scoringRule2.getDetails().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<>(); Map<Long, PaperTrainAnswerDetail> answerDetailMap = new HashMap<>();
if (!CollectionUtils.isEmpty(scoreDetailList)) { if (!CollectionUtils.isEmpty(scoreDetailList)) {
scoreDetailList.forEach(d -> answerDetailMap.put(d.getStepId(), d)); scoreDetailList.forEach(d -> answerDetailMap.put(d.getStepId(), d));
} }
return training2.getSteps().stream() return training2.getSteps().stream().filter(s -> Objects.equals(s.getSimulationMember().getId(), member.getId()))
// .filter(s -> Objects.equals(s.getSimulationMember().getId(), member.getId()))
.map(step -> { .map(step -> {
PaperTrainAnswerDetail detail = new PaperTrainAnswerDetail(); PaperTrainAnswerDetail detail = new PaperTrainAnswerDetail();
detail.setStepId(step.getId()); detail.setStepId(step.getId());
detail.setHaveRule(scoreMap.containsKey(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())) { if (answerDetailMap.containsKey(step.getId())) {
detail.setSuccess(answerDetailMap.get(step.getId()).isSuccess()); 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.setClientOperations(answerDetailMap.get(step.getId()).getClientOperations());
detail.setNotExistAppend(true); detail.setNotExistAppend(true);
} }
detail.setScore( if (detail.isHaveRule()) {
detail.isHaveRule() && detail.isSuccess() ? scoreMap.get(step.getId()) : 0F); detail.setRuleScore(scoreMap.get(step.getId()));
} }
return detail; return detail;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
@ -412,8 +373,7 @@ public class Training2Service {
if (!Objects.equals(String.valueOf(user.getId()), step.getSimulationMember().getUserId())) { if (!Objects.equals(String.valueOf(user.getId()), step.getSimulationMember().getUserId())) {
throw new SimulationException(SimulationExceptionType.Invalid_Operation, "无权限操作"); throw new SimulationException(SimulationExceptionType.Invalid_Operation, "无权限操作");
} }
Operation2.ClientOperation2 operation = step.getOperations().stream() Operation2.ClientOperation2 operation = step.getOperations().stream().filter(o -> Objects.equals(o.getId(), id))
.filter(o -> Objects.equals(o.getId(), id))
.findFirst().orElse(null); .findFirst().orElse(null);
if (operation == null) { if (operation == null) {
throw new SimulationException(SimulationExceptionType.Invalid_Operation, "不存在操作"); throw new SimulationException(SimulationExceptionType.Invalid_Operation, "不存在操作");
@ -462,12 +422,10 @@ public class Training2Service {
} }
// 为会话操作 // 为会话操作
boolean startFlag = Boolean.FALSE; boolean startFlag = Boolean.FALSE;
if (CONVERSATION_LIST.contains(simCommand2.getOperationType().name()) if (CONVERSATION_LIST.contains(simCommand2.getOperationType().name()) && CONVERSATION_LIST.contains(event.getOperate())) {
&& CONVERSATION_LIST.contains(event.getOperate())) {
checkSimOperationConversation(simCommand2, step, event); checkSimOperationConversation(simCommand2, step, event);
startFlag = Boolean.TRUE; startFlag = Boolean.TRUE;
} else if (simCommand2.getOperationType().name().equals(event.getOperate()) } else if (simCommand2.getOperationType().name().equals(event.getOperate()) && compareParams(event.getParams(), simCommand2.getParams())) {
&& compareParams(event.getParams(), simCommand2.getParams())) {
simCommand2.doOperated(); // 标识已操作过 simCommand2.doOperated(); // 标识已操作过
simCommand2.doCompletion(); simCommand2.doCompletion();
startFlag = Boolean.TRUE; startFlag = Boolean.TRUE;
@ -486,8 +444,7 @@ public class Training2Service {
// 检查是否要计算指标 // 检查是否要计算指标
if (!CollectionUtils.isEmpty(training2.getIndexList())) { if (!CollectionUtils.isEmpty(training2.getIndexList())) {
training2.getIndexList().stream() training2.getIndexList().stream()
.filter(index -> !index.isContinuity() && !CollectionUtils.isEmpty( .filter(index -> !index.isContinuity() && !CollectionUtils.isEmpty(index.getOperationType())
index.getOperationType())
&& index.getOperationType().contains(simCommand2.getOperationType()) && index.getOperationType().contains(simCommand2.getOperationType())
&& training2.getIndexAlgorithmMap().containsKey(index.name()) && training2.getIndexAlgorithmMap().containsKey(index.name())
) )
@ -545,14 +502,12 @@ public class Training2Service {
/** /**
* 实训语音消息完毕后匹配结果消息 * 实训语音消息完毕后匹配结果消息
*
* @param event * @param event
*/ */
@EventListener @EventListener
public void handle(SimulationTrainingAudioEvent event) { public void handle(SimulationTrainingAudioEvent event) {
Simulation simulation = event.getSimulation(); Simulation simulation = event.getSimulation();
Training2MessageVO messageVO = new Training2MessageVO(event.getOperation2(), event.getStep(), Training2MessageVO messageVO = new Training2MessageVO(event.getOperation2(), event.getStep(), String.valueOf(event.isMatchResult()));
String.valueOf(event.isMatchResult()));
SocketMessageVO<Training2MessageVO> message = SocketMessageFactory.build( SocketMessageVO<Training2MessageVO> message = SocketMessageFactory.build(
WebSocketMessageType.Simulation_Training_Audio_MATCH_RESULT, simulation.getId(), messageVO); WebSocketMessageType.Simulation_Training_Audio_MATCH_RESULT, simulation.getId(), messageVO);
stompMessageService.sendToUser(simulation.getSimulationUserIds(), message); stompMessageService.sendToUser(simulation.getSimulationUserIds(), message);
@ -570,9 +525,8 @@ public class Training2Service {
Simulation simulation = groupSimulationCache.getSimulationByGroup(group); Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
loadTrainingPre(simulation); loadTrainingPre(simulation);
// 重置仿真状态 // 重置仿真状态
// groupSimulationService.planOver(group);
simulationService.reset(group); simulationService.reset(group);
// 初始化实训人员
initTrainingMember(simulation, draftTraining2);
// 场景的时候加载最后背景 // 场景的时候加载最后背景
String bgSceneJson = StringUtils.isEmpty(draftTraining2.getFinalScenesJson()) String bgSceneJson = StringUtils.isEmpty(draftTraining2.getFinalScenesJson())
? draftTraining2.getBgSceneJson() : draftTraining2.getFinalScenesJson(); ? draftTraining2.getBgSceneJson() : draftTraining2.getFinalScenesJson();
@ -587,7 +541,6 @@ public class Training2Service {
/** /**
* 加载实训到第几步 * 加载实训到第几步
*
* @param group 仿真 * @param group 仿真
* @param stepId 实训步数ID * @param stepId 实训步数ID
*/ */
@ -607,14 +560,12 @@ public class Training2Service {
/** /**
* 实训准备开始 * 实训准备开始
*
* @param group 仿真号 * @param group 仿真号
* @param user 操作人 * @param user 操作人
*/ */
public void prepareStart(String group, AccountVO user, ScriptBO.Mode mode) { public void prepareStart(String group, AccountVO user, ScriptBO.Mode mode) {
Simulation simulation = groupSimulationCache.getSimulationByGroup(group); Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(simulation.getTraining2() != null, BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(simulation.getTraining2() != null, "未加载实训");
"未加载实训");
Map<String, Object> messageMap = new HashMap<>(); Map<String, Object> messageMap = new HashMap<>();
messageMap.put("id", simulation.getTraining2().getId()); messageMap.put("id", simulation.getTraining2().getId());
messageMap.put("mode", mode); messageMap.put("mode", mode);
@ -631,18 +582,17 @@ public class Training2Service {
private Simulation createSimulation(Long mapId, LoginUserInfoVO loginUserInfoVO private Simulation createSimulation(Long mapId, LoginUserInfoVO loginUserInfoVO
, Simulation.FunctionalType functionalType, DraftTraining2WithBLOBs draftTraining2) { , Simulation.FunctionalType functionalType, DraftTraining2WithBLOBs draftTraining2) {
// 构建仿真,加载背景, // 构建仿真,加载背景,
Simulation simulation = groupSimulationService.create(loginUserInfoVO, mapId, null, Simulation simulation = groupSimulationService.create(loginUserInfoVO, mapId, null, functionalType);
functionalType);
// 加载实训信息 // 加载实训信息
loadTraining(simulation, draftTraining2, loginUserInfoVO); loadTraining(simulation, draftTraining2, loginUserInfoVO);
return simulation; return simulation;
} }
/** /**
* 仿真加载实训 初始化仿真 - 替换实训信息 - 加载背景 * 仿真加载实训
* 初始化仿真 - 替换实训信息 - 加载背景
*/ */
public void simulationLoadTraining(String group, DraftTraining2WithBLOBs draftTraining2, private void simulationLoadTraining(String group, DraftTraining2WithBLOBs draftTraining2, LoginUserInfoVO loginUserInfoVO) {
LoginUserInfoVO loginUserInfoVO) {
Simulation simulation = groupSimulationCache.getSimulationByGroup(group); Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
// 重置仿真状态 // 重置仿真状态
simulationService.reset(group); simulationService.reset(group);
@ -653,11 +603,8 @@ public class Training2Service {
/** /**
* 加载实训数据 * 加载实训数据
*/ */
private void loadTraining(Simulation simulation, DraftTraining2WithBLOBs draftTraining2, private void loadTraining(Simulation simulation, DraftTraining2WithBLOBs draftTraining2, LoginUserInfoVO loginUserInfoVO) {
LoginUserInfoVO loginUserInfoVO) {
loadTrainingPre(simulation); loadTrainingPre(simulation);
// 初始化实训人员
initTrainingMember(simulation, draftTraining2);
// 没有背景不做加载加载的时候不做背景加载开始的时候重新加载背景即可 // 没有背景不做加载加载的时候不做背景加载开始的时候重新加载背景即可
if (!StringUtils.isEmpty(draftTraining2.getBgSceneJson())) { if (!StringUtils.isEmpty(draftTraining2.getBgSceneJson())) {
groupSimulationService.loadScenes(simulation.getId(), draftTraining2.getBgSceneJson()); groupSimulationService.loadScenes(simulation.getId(), draftTraining2.getBgSceneJson());
@ -680,7 +627,6 @@ public class Training2Service {
/** /**
* 仿真加载实训时前置清空方法 * 仿真加载实训时前置清空方法
*
* @param simulation 仿真 * @param simulation 仿真
*/ */
private void loadTrainingPre(Simulation simulation) { private void loadTrainingPre(Simulation simulation) {
@ -712,8 +658,7 @@ public class Training2Service {
if (nextStep == null) { // 步骤已经运行完毕 if (nextStep == null) { // 步骤已经运行完毕
training2.finish(); training2.finish();
// 发送实训完成消息 // 发送实训完成消息
applicationContext.publishEvent( applicationContext.publishEvent(new SimulationTrainingFinishEvent(this, simulation, training2));
new SimulationTrainingFinishEvent(this, simulation, training2));
return null; return null;
} }
return nextStep; return nextStep;
@ -763,8 +708,7 @@ public class Training2Service {
} }
// 操作是否已触发 // 操作是否已触发
// 没有触发则检查触发状态如果可以触发则继续不能触发则返回(同步骤) // 没有触发则检查触发状态如果可以触发则继续不能触发则返回(同步骤)
if (!Step2.StepStatus.isAlreadyTrigger(simCommand2.getStatus()) if (!Step2.StepStatus.isAlreadyTrigger(simCommand2.getStatus()) && !simCommand2.doTriggerVail()) {
&& !simCommand2.doTriggerVail()) {
return null; return null;
} }
return simCommand2; return simCommand2;
@ -773,8 +717,7 @@ public class Training2Service {
/** /**
* 尝试操作动作 * 尝试操作动作
*/ */
private boolean tryDoOperation(Simulation simulation, Step2 step, private boolean tryDoOperation(Simulation simulation, Step2 step, Operation2.SimCommand2 operation2) {
Operation2.SimCommand2 operation2) {
boolean isRobot = step.getSimulationMember().isRobot(); // 角色是否是机器人 boolean isRobot = step.getSimulationMember().isRobot(); // 角色是否是机器人
long simCurTime = simulation.getCorrectSystemTimeStamp(); long simCurTime = simulation.getCorrectSystemTimeStamp();
// 未操作过 // 未操作过
@ -784,9 +727,9 @@ public class Training2Service {
isExec = (simCurTime == operation2.getSimTime() || operation2.getSimTime() < simCurTime); isExec = (simCurTime == operation2.getSimTime() || operation2.getSimTime() < simCurTime);
} }
if (isExec) { if (isExec) {
if (isRobot || operation2.isSpecial() || simulation.getTraining2() if (isRobot || operation2.isSpecial() || simulation.getTraining2().isJumpStep(step)) { // 特殊操作直接执行
.isJumpStep(step)) { // 特殊操作直接执行 atsOperationDispatcher.execute(simulation, step.getSimulationMember(), operation2.getOperationType().name()
executeOperation(simulation, step, operation2); , operation2.getParams());
return true; return true;
} else { // 非机器人暂停仿真等待用户操作 } else { // 非机器人暂停仿真等待用户操作
simulation.onlyPause(); simulation.onlyPause();
@ -798,70 +741,6 @@ public class Training2Service {
return true; return true;
} }
private void executeOperation(Simulation simulation, Step2 step, SimCommand2 operation2) {
Type operateType = operation2.getOperationType();
Map<String, Object> params = operation2.getParams();
boolean isTextChat = false;
if (operateType.equals(Type.Conversation_Group_Private_Text_Chat)) {
operateType = Type.Conversation_Group_Private_Audio_Chat;
isTextChat = true;
} else if (operateType.equals(Type.Conversation_Group_Text_Chat)) {
operateType = Type.Conversation_Group_Audio_Chat;
isTextChat = true;
} else if (operateType.equals(Type.Conversation_Chat_Text)) {
operateType = Type.Conversation_Chat_Audio;
isTextChat = true;
}
if (isTextChat) {
//将车次号替换为标准读音
String content = (String) operation2.getParams().get("content");
Pattern pattern = Pattern.compile("([0-9]+)次");
Matcher matcher = pattern.matcher(content);
StringBuilder sb = new StringBuilder();
int index = 0;
while (matcher.find()) {
String group = matcher.group(1);
int start = matcher.start(1);
sb.append(content, index, start);
sb.append(convertPronunciation(group));
sb.append("");
index = sb.length();
}
sb.append(content.substring(index));
VoiceCompose compose = voiceService.synthesis(new BaseVoiceSynthesisVO(sb.toString()));
params = new HashMap<>(params);
params.put("audioPath", compose.getFilePath());
}
atsOperationDispatcher.execute(simulation,
step.getSimulationMember(), operateType.name(), params);
}
/**
* 文字转语音
*/
private String convertPronunciation(String content) {
StringBuilder sb = new StringBuilder();
for (String s : content.split("")) {
switch (s) {
case "0":
sb.append("");
break;
case "1":
sb.append("");
break;
case "2":
sb.append("");
break;
case "7":
sb.append("");
break;
default:
sb.append(s);
}
}
return sb.toString();
}
/** /**
* 尝试完成操作 * 尝试完成操作
*/ */
@ -935,25 +814,17 @@ public class Training2Service {
/** /**
* 检验实训数据是否合规 * 检验实训数据是否合规
*/ */
public Consumer<DraftTraining2WithBLOBs> trainingDataValid = (training) -> { private Consumer<DraftTraining2WithBLOBs> trainingDataValid = (training) -> {
if (!StringUtils.hasText(training.getPlayerIdJson())) { if (!StringUtils.hasText(training.getPlayerIdJson())) {
throw new SimulationException(SimulationExceptionType.Invalid_Operation throw new SimulationException(SimulationExceptionType.Invalid_Operation
, String.format("实训{id:[%s]}没有参训角色", training.getId())); , String.format("实训{id:[%s]}没有参训角色", training.getId()));
} }
}; };
/**
* 和上面的对象是相同作用将此Service注入其它Bean后上面的对象是null
*/
public void trainingDataValid(DraftTraining2WithBLOBs training) {
trainingDataValid.accept(training);
}
/** /**
* 检验语音输入是否正确 * 检验语音输入是否正确
*/ */
private void checkSimOperationConversation(Operation2.SimCommand2 simOperation2, Step2 step, private void checkSimOperationConversation(Operation2.SimCommand2 simOperation2, Step2 step, SimulationOperationEvent event) {
SimulationOperationEvent event) {
Simulation simulation = event.getSimulation(); Simulation simulation = event.getSimulation();
if (CollectionUtils.isEmpty(simOperation2.getParams()) || event.getResult() == null) { if (CollectionUtils.isEmpty(simOperation2.getParams()) || event.getResult() == null) {
return; return;
@ -974,50 +845,18 @@ public class Training2Service {
} }
// 发送步骤完成信息 // 发送步骤完成信息
if (!simulation.getTraining2().isJumpStep(step) && !step.getSimulationMember().isRobot()) { if (!simulation.getTraining2().isJumpStep(step) && !step.getSimulationMember().isRobot()) {
applicationContext.publishEvent( applicationContext.publishEvent(new SimulationTrainingAudioEvent(this, simulation, step, simOperation2, doCompletion));
new SimulationTrainingAudioEvent(this, simulation, step, simOperation2, doCompletion));
/*
取消 发送请重试语音
if (!doCompletion) {
Operation.Type operationType;
HashMap<String, Object> params = new HashMap<>(event.getParams());
SimulationMember member = null;
if (PRIVATE_CONVERSATION_LIST.contains(event.getOperate())) {
operationType = Type.Conversation_Group_Private_Audio_Chat;
Object memberId = params.put("memberId", event.getMember().getId());
member = simulation.getSimulationMemberById((String) memberId);
} else {
operationType = Type.Conversation_Group_Audio_Chat;
ConversationGroup cg = simulation.getConversationGroup(
Long.valueOf(params.get("id").toString()));
for (ConversationMember cm : cg.getMemberList()) {
if (!Objects.equals(cm.getMember(), event.getMember())) {
member = cm.getMember();
break;
}
}
}
if (member != null) {
VoiceCompose compose = voiceService.synthesis(new BaseVoiceSynthesisVO("请重复"));
params.put("audioPath", compose.getFilePath());
params.put("content", compose.getMessage());
atsOperationDispatcher.execute(simulation, member, operationType.name(), params);
}
}*/
} }
} }
/** /**
* 检查是否是道岔联动操作 * 检查是否是道岔联动操作
*
* @param simulation * @param simulation
* @param event * @param event
* @return * @return
*/ */
private boolean checkSwitchLinkOperation(Simulation simulation, private boolean checkSwitchLinkOperation(Simulation simulation, Operation2.SimCommand2 simCommand2, SimulationOperationEvent event) {
Operation2.SimCommand2 simCommand2, SimulationOperationEvent event) { boolean flag = CHECK_SWITCH_STATUS_LIST.contains(simCommand2.getOperationType().name()) && CHECK_SWITCH_STATUS_LIST.contains(event.getOperate());
boolean flag = CHECK_SWITCH_STATUS_LIST.contains(simCommand2.getOperationType().name())
&& CHECK_SWITCH_STATUS_LIST.contains(event.getOperate());
if (flag) { if (flag) {
flag = simCommand2.getParams() != null && event.getParams() != null; flag = simCommand2.getParams() != null && event.getParams() != null;
} }
@ -1037,8 +876,7 @@ public class Training2Service {
/** /**
* 对比事件与操作参数 * 对比事件与操作参数
*/ */
private boolean compareParams(Map<String, Object> eventParams, private boolean compareParams(Map<String, Object> eventParams, Map<String, Object> operationParams) {
Map<String, Object> operationParams) {
if (eventParams.size() < operationParams.size()) { // 事件参数小于存储的操作参数数目 if (eventParams.size() < operationParams.size()) { // 事件参数小于存储的操作参数数目
return false; return false;
} }
@ -1073,8 +911,7 @@ public class Training2Service {
v.getMessageList().forEach(message -> { v.getMessageList().forEach(message -> {
ConversationMessageVO conversationMessageVO = new ConversationMessageVO(message); ConversationMessageVO conversationMessageVO = new ConversationMessageVO(message);
SocketMessageVO<ConversationMessageVO> chatMessage = SocketMessageFactory.build( SocketMessageVO<ConversationMessageVO> chatMessage = SocketMessageFactory.build(
WebSocketMessageType.Simulation_Conversation_Operation, simulation.getId(), WebSocketMessageType.Simulation_Conversation_Operation, simulation.getId(), conversationMessageVO);
conversationMessageVO);
stompMessageService.sendToUser(finalUserIdSet, chatMessage); stompMessageService.sendToUser(finalUserIdSet, chatMessage);
}); });
} }
@ -1124,31 +961,11 @@ public class Training2Service {
/** /**
* 实训状态消息 * 实训状态消息
*
* @param simulation 仿真 * @param simulation 仿真
* @param status 状态 * @param status 状态
*/ */
private void trainingStatusMessage(Simulation simulation, int status) { private void trainingStatusMessage(Simulation simulation, int status) {
SocketMessageVO<Integer> message = SocketMessageFactory.build( SocketMessageVO<Integer> message = SocketMessageFactory.build(WebSocketMessageType.Simulation_Training_Status, simulation.getId(), status);
WebSocketMessageType.Simulation_Training_Status, simulation.getId(), status);
stompMessageService.sendToUser(simulation.getSimulationUserIds(), message); stompMessageService.sendToUser(simulation.getSimulationUserIds(), message);
} }
/**
* 初始化实训成员
*
* @param simulation 仿真
* @param draftTraining2 实训信息
*/
private void initTrainingMember(Simulation simulation, DraftTraining2WithBLOBs draftTraining2) {
if ("single".equals(draftTraining2.getType())) {// 单操不需要初始化成员
return;
}
if (StringUtils.hasText(draftTraining2.getMemberJson())) {
List<SimulationMemberPO> memberPOS = JsonUtils.readCollection(draftTraining2.getMemberJson(),
List.class, SimulationMemberPO.class);
memberManager.loadExtraMembers(simulation, memberPOS);
}
}
} }

View File

@ -5,7 +5,6 @@ import club.joylink.rtss.entity.RtsMapFunction;
import club.joylink.rtss.entity.SysAccount; import club.joylink.rtss.entity.SysAccount;
import club.joylink.rtss.entity.UserSimulationRecord; import club.joylink.rtss.entity.UserSimulationRecord;
import club.joylink.rtss.entity.UserSimulationRecordExample; import club.joylink.rtss.entity.UserSimulationRecordExample;
import club.joylink.rtss.entity.UserSimulationRecordExample.Criteria;
import club.joylink.rtss.event.UserSimulationRecordEvent; import club.joylink.rtss.event.UserSimulationRecordEvent;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.IMapService; import club.joylink.rtss.services.IMapService;
@ -14,7 +13,6 @@ import club.joylink.rtss.services.mapFunction.RtsMapFunctionService;
import club.joylink.rtss.simulation.cbtc.message.UserSimulationRecordManager; import club.joylink.rtss.simulation.cbtc.message.UserSimulationRecordManager;
import club.joylink.rtss.util.TimeUnit; import club.joylink.rtss.util.TimeUnit;
import club.joylink.rtss.vo.client.PageVO; 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.UserSimulationQueryVO;
import club.joylink.rtss.vo.client.simulationUsage.UserSimulationRecordVO; import club.joylink.rtss.vo.client.simulationUsage.UserSimulationRecordVO;
import club.joylink.rtss.vo.client.simulationUsage.UserSimulationStatsVO; import club.joylink.rtss.vo.client.simulationUsage.UserSimulationStatsVO;
@ -68,8 +66,7 @@ public class UserSimulationRecordService {
} }
public List<UserSimulationRecord> queryByMapAndUserIds(Long mapId, List<Long> userIds) { public List<UserSimulationRecord> queryByMapAndUserIds(Long mapId, List<Long> userIds) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(userIds, BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(userIds, "用户列表不能为空");
"用户列表不能为空");
UserSimulationRecordExample example = new UserSimulationRecordExample(); UserSimulationRecordExample example = new UserSimulationRecordExample();
example.createCriteria().andMapIdEqualTo(mapId).andUserIdIn(userIds); example.createCriteria().andMapIdEqualTo(mapId).andUserIdIn(userIds);
return userSimulationRecordDAO.selectByExample(example); return userSimulationRecordDAO.selectByExample(example);
@ -168,22 +165,6 @@ public class UserSimulationRecordService {
return statistic(startTime, endTime, timeUnit, list); 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);
}
/** /**
* 对使用记录按照时间单位开始结束时间分段统计 * 对使用记录按照时间单位开始结束时间分段统计
*/ */
@ -242,12 +223,9 @@ public class UserSimulationRecordService {
} }
private void checkParam(UserSimulationQueryVO queryVO) { private void checkParam(UserSimulationQueryVO queryVO) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getTimeUnit(), BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getTimeUnit(), "缺少时间单位");
"缺少时间单位"); BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getStartTime(), "缺少开始时间");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getStartTime(), BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getEndTime(), "缺少结束时间");
"缺少开始时间");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getEndTime(),
"缺少结束时间");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue( BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
!queryVO.getStartTime().isAfter(queryVO.getEndTime()), "开始时间不能晚于结束时间"); !queryVO.getStartTime().isAfter(queryVO.getEndTime()), "开始时间不能晚于结束时间");
} }

View File

@ -4,7 +4,6 @@ import club.joylink.rtss.vo.client.PageQueryVO;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.competition.VoiceErrorVO; import club.joylink.rtss.vo.client.competition.VoiceErrorVO;
import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult; import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult;
import club.joylink.rtss.vo.voice.VoiceVerifyResultVO;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
/** /**
@ -17,14 +16,4 @@ public interface IVoiceTrainingService {
VoiceRecognitionResult voiceRecognition(MultipartFile file); VoiceRecognitionResult voiceRecognition(MultipartFile file);
VoiceRecognitionResult voiceRecognition(byte[] bytes, String filePath); VoiceRecognitionResult voiceRecognition(byte[] bytes, String filePath);
/**
* 校验语音识别结果
*
* @param contentType
* @param file 需要校验的语音
* @param text 正确的文本
* @return 校验结果
*/
VoiceVerifyResultVO verifyVoice(String contentType, byte[] file, String text);
} }

View File

@ -35,7 +35,6 @@ public class VoiceService {
/** /**
* 语音识别 * 语音识别
*
* @param vo * @param vo
* @return * @return
*/ */
@ -49,7 +48,6 @@ public class VoiceService {
/** /**
* 语音合成 * 语音合成
*
* @param vo * @param vo
* @return * @return
*/ */
@ -57,8 +55,7 @@ public class VoiceService {
String md5Code = vo.md5Code(); String md5Code = vo.md5Code();
String fileName = String.format("%s.wav",md5Code); String fileName = String.format("%s.wav",md5Code);
if(Objects.equals(false,this.voiceSynthesisUtil.checkFileIsExist(fileName))){ if(Objects.equals(false,this.voiceSynthesisUtil.checkFileIsExist(fileName))){
byte[] bytes = voiceService.voiceSynthesis(vo); byte[] data = voiceService.voiceSynthesis(vo);
byte[] data = bytes;
this.uploadFile(voiceSynthesisUtil,data,fileName,SYNTHESIS_FOLDER); this.uploadFile(voiceSynthesisUtil,data,fileName,SYNTHESIS_FOLDER);
} }
String filePath = this.voiceSynthesisUtil.getDownLoadPath(fileName); String filePath = this.voiceSynthesisUtil.getDownLoadPath(fileName);
@ -67,7 +64,6 @@ public class VoiceService {
/** /**
* 语音合成返回原数据 * 语音合成返回原数据
*
* @param vo * @param vo
* @return * @return
*/ */

View File

@ -2,31 +2,22 @@ package club.joylink.rtss.services.voice;
import club.joylink.rtss.dao.CompetitionErrorSetDAO; import club.joylink.rtss.dao.CompetitionErrorSetDAO;
import club.joylink.rtss.entity.CompetitionErrorSet; import club.joylink.rtss.entity.CompetitionErrorSet;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.conversation.SimulationVoiceHandler; 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.PageQueryVO;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.competition.VoiceErrorVO; import club.joylink.rtss.vo.client.competition.VoiceErrorVO;
import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult; import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult;
import club.joylink.rtss.vo.client.voice.VoiceRecognitionVO; import club.joylink.rtss.vo.client.voice.VoiceRecognitionVO;
import club.joylink.rtss.vo.voice.VoiceVerifyResultVO;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;
import javax.sound.sampled.AudioFileFormat;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.UnsupportedAudioFileException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.stream.Collectors;
@Service @Service
public class VoiceTrainingService implements IVoiceTrainingService { public class VoiceTrainingService implements IVoiceTrainingService {
@ -56,64 +47,18 @@ public class VoiceTrainingService implements IVoiceTrainingService {
@Override @Override
public VoiceRecognitionResult voiceRecognition(MultipartFile file) { public VoiceRecognitionResult voiceRecognition(MultipartFile file) {
VoiceRecognitionVO vo = VoiceRecognitionVO.load(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(vo);
// VoiceRecognitionResult result = this.iVoiceService.voiceRecognition(file, ""); // VoiceRecognitionResult result = this.iVoiceService.voiceRecognition(file, "");
result.setResult(simulationVoiceHandler.handle(result.getResult())); result.setResult(simulationVoiceHandler.handle(result.getResult()));
return result; return result;
} }
private byte[] convertToMonoChannel(byte[] audioData) { @Override
try { public VoiceRecognitionResult voiceRecognition(byte[] bytes, String filePath) {
// 假设输入和输出音频都存储在字节数组中 VoiceRecognitionVO vo = new VoiceRecognitionVO(bytes);
byte[] outputAudioBytes; VoiceRecognitionResult result = this.iVoiceService.voiceRecognition(vo);
// VoiceRecognitionResult result = this.iVoiceService.voiceRecognition(bytes, filePath);
// 将输入音频字节数组转换为音频输入流 result.setResult(simulationVoiceHandler.handle(result.getResult()));
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(audioData); return result;
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(byteArrayInputStream);
AudioFormat format = audioInputStream.getFormat();
// 确保输入音频是立体声
if (format.getChannels() != 2) {
System.out.println("Input audio is not stereo.");
return audioData;
}
// 创建单声道格式
AudioFormat monoFormat = new AudioFormat(format.getEncoding(), format.getSampleRate(),
format.getSampleSizeInBits(), 1, format.getFrameSize() / 2, format.getFrameRate(), false);
// 从立体声转换为单声道
AudioInputStream monoInputStream = AudioSystem.getAudioInputStream(monoFormat,
audioInputStream);
// 将单声道音频写入字节数组输出流
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
AudioSystem.write(monoInputStream, AudioFileFormat.Type.WAVE, byteArrayOutputStream);
// 获取输出音频的字节数组
return byteArrayOutputStream.toByteArray();
} catch (UnsupportedAudioFileException | IOException e) {
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception(
String.format("音频转单声道失败:%s", e));
}
} }
} }

View File

@ -0,0 +1,78 @@
/*
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);
}
}
*/

View File

@ -0,0 +1,154 @@
//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));
// }
//}

View File

@ -9,15 +9,14 @@ import club.joylink.rtss.simulation.cbtc.data.map.Signal;
import club.joylink.rtss.simulation.cbtc.data.map.Switch; import club.joylink.rtss.simulation.cbtc.data.map.Switch;
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition; import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
/** /**
* 地面ATP逻辑循环 * 地面ATP逻辑循环
@ -38,9 +37,11 @@ public class AtpSectionService {
for (VirtualRealityTrain train : onlineTrainList) { for (VirtualRealityTrain train : onlineTrainList) {
List<Section> atpSectionList = trainAtpSectionMap.get(train.getGroupNumber()); List<Section> atpSectionList = trainAtpSectionMap.get(train.getGroupNumber());
List<Section> physicalList = this.convert2PhysicalSectionList(atpSectionList); List<Section> physicalList = this.convert2PhysicalSectionList(atpSectionList);
if (train.isCommunicable() && signal.containsApproachAtpSection(atpSectionList)) { //存在通信车接近继续 if (train.isCommunicable() && signal.containsApproachAtpSection(
atpSectionList)) { //存在通信车接近继续
a = 1; a = 1;
} else if (!train.isCommunicable() && signal.containsApproachPhysicalSection(physicalList)) { //存在非通信车接近结束 } else if (!train.isCommunicable() && signal.containsApproachPhysicalSection(
physicalList)) { //存在非通信车接近结束
a = 2; a = 2;
break; break;
} }
@ -88,7 +89,8 @@ public class AtpSectionService {
if (train.isCommunicable() || isRailway) { // 通信车占用 或者 大铁配置 if (train.isCommunicable() || isRailway) { // 通信车占用 或者 大铁配置
// 车尾位置追加不确定性距离(速度*2)m // 车尾位置追加不确定性距离(速度*2)m
SectionPosition trainTailPosition = CalculateService SectionPosition trainTailPosition = CalculateService
.calculateNextPositionByStartAndLen(trainHeadPosition, !right, train.getLen() + train.getSpeed() * 2, false); .calculateNextPositionByStartAndLen(trainHeadPosition, !right,
train.getLen() + train.getSpeed() * 2, false);
atpSectionList = CalculateService.getAtpSections(trainHeadPosition, trainTailPosition, atpSectionList = CalculateService.getAtpSections(trainHeadPosition, trainTailPosition,
right, switchSingleHandle); right, switchSingleHandle);
List<Section> removes = new ArrayList<>(); List<Section> removes = new ArrayList<>();
@ -98,7 +100,8 @@ public class AtpSectionService {
if (parent != null) { if (parent != null) {
axle = parent; axle = parent;
} }
if (axle.isAxleCounter() && (!axle.isNctOccupied() || Section.AxleFault.FAULT.equals(axle.getFault()))) { if (axle.isAxleCounter() && (!axle.isNctOccupied() || Section.AxleFault.FAULT.equals(
axle.getFault()))) {
removes.add(atpSection); removes.add(atpSection);
continue; continue;
} }
@ -138,22 +141,23 @@ public class AtpSectionService {
*/ */
public void sectionARBCheck(Simulation simulation, Section section, List<Section> sectionList) { public void sectionARBCheck(Simulation simulation, Section section, List<Section> sectionList) {
//目前ARB故障才会导致ARB判定 //目前ARB故障才会导致ARB判定
if (Section.AxleFault.ARB.equals(section.getFault()) && section.getVirtualAxleCounter().isOccupy()) { if (Section.AxleFault.ARB.equals(section.getFault()) && section.getVirtualAxleCounter()
.isOccupy()) {
if (!sectionList.contains(section)) { if (!sectionList.contains(section)) {
section.judgeAsARB(); section.judgeAsARB();
} else { } else {
section.setFault(Section.AxleFault.FAULT); section.setFault(Section.AxleFault.FAULT);
} }
} else if (Section.AxleFault.FAULT.equals(section.getFault()) && section.getVirtualAxleCounter().isOccupy()) { } else if (Section.AxleFault.FAULT.equals(section.getFault()) && section.getVirtualAxleCounter()
.isOccupy()) {
section.judgeAsNctOccupied(simulation); section.judgeAsNctOccupied(simulation);
} }
if (/*!section.isInvalid() &&*/ section.isNctOccupied()) { if (/*!section.isInvalid() &&*/ section.isNctOccupied()) {
if (!sectionList.contains(section)) {
section.judgeAsNctOccupied(simulation); section.judgeAsNctOccupied(simulation);
} }
}
//ARB故障恢复判断 //ARB故障恢复判断
if (Section.AxleFault.ARB.equals(section.getFault()) && !section.getVirtualAxleCounter().isOccupy()) { if (Section.AxleFault.ARB.equals(section.getFault()) && !section.getVirtualAxleCounter()
.isOccupy()) {
Section.AxleFault.ARB.fix(section); Section.AxleFault.ARB.fix(section);
} }
} }
@ -165,12 +169,14 @@ public class AtpSectionService {
* @param trainList * @param trainList
* @return * @return
*/ */
public List<Section> getTrainExistAxleSectionsUnderDelay(Simulation simulation, List<VirtualRealityTrain> trainList) { public List<Section> getTrainExistAxleSectionsUnderDelay(Simulation simulation,
List<VirtualRealityTrain> trainList) {
List<Section> list = new ArrayList<>(); List<Section> list = new ArrayList<>();
for (VirtualRealityTrain train : trainList) { for (VirtualRealityTrain train : trainList) {
//只统计非通信车 //只统计非通信车
if (train.isCommunicable()) if (train.isCommunicable()) {
continue; continue;
}
boolean right = train.isRight(); boolean right = train.isRight();
SectionPosition headPosition = train.getHeadPosition(); SectionPosition headPosition = train.getHeadPosition();
float offset = 50; float offset = 50;
@ -195,7 +201,8 @@ public class AtpSectionService {
return list; return list;
} }
public void removeOfflineTrainOccupySections(Simulation simulation, List<VirtualRealityTrain> onlineTrainList) { public void removeOfflineTrainOccupySections(Simulation simulation,
List<VirtualRealityTrain> onlineTrainList) {
// 移除已经下线的列车占用区段数据 // 移除已经下线的列车占用区段数据
SimulationDataRepository repository = simulation.getRepository(); SimulationDataRepository repository = simulation.getRepository();
Set<String> oldTOSKeyList = repository.queryTrainOccupySectionKeys(); Set<String> oldTOSKeyList = repository.queryTrainOccupySectionKeys();
@ -238,7 +245,8 @@ public class AtpSectionService {
do { do {
atpSectionList.add(0, nextSection); atpSectionList.add(0, nextSection);
nextSection = nextSection.getNextRunningSectionOf(!right); nextSection = nextSection.getNextRunningSectionOf(!right);
} while (nextSection.getRelSwitch() != null && relSwitchList.contains(nextSection.getRelSwitch())); } while (nextSection.getRelSwitch() != null && relSwitchList.contains(
nextSection.getRelSwitch()));
// 反位后区段列表 // 反位后区段列表
nextSection = relSwitch.getA().getNextRunningSectionOf(right); nextSection = relSwitch.getA().getNextRunningSectionOf(right);
while (nextSection != null && relSwitchList.contains(nextSection.getRelSwitch())) { while (nextSection != null && relSwitchList.contains(nextSection.getRelSwitch())) {

Some files were not shown because too many files have changed in this diff Show More