Compare commits
1 Commits
master
...
ngy_sand_t
Author | SHA1 | Date | |
---|---|---|---|
|
5634ab0a39 |
@ -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
|
@ -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"
|
@ -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
3
.gitmodules
vendored
@ -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
|
11
Dockerfile
11
Dockerfile
@ -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
|
@ -1,7 +0,0 @@
|
||||
# CI、CD说明
|
||||
- 分支主要为develop,local-test,master
|
||||
- 本地233服务器部署方式为push到local-test分支即可触发
|
||||
- 公网服务器发布方式:
|
||||
1. push到master(虽然可以用别的分支,但不建议)
|
||||
2. 在版本发布处发布新版本,触发构建docker镜像
|
||||
3. 待docker镜像构建完成后,点击Actions中CD_pub_deploy.yaml,进入第一个任务,点击重新运行所有任务,进行服务发布
|
395
pom.xml
395
pom.xml
@ -1,106 +1,106 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.3.5.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>club.joylink</groupId>
|
||||
<artifactId>rtss</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>rtss</name>
|
||||
<description>Rail transit simulation system</description>
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.3.5.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>club.joylink</groupId>
|
||||
<artifactId>rtss</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>rtss</name>
|
||||
<description> Rail transit simulation system</description>
|
||||
|
||||
<properties>
|
||||
<java.version>11</java.version>
|
||||
<pagehelper.version>4.1.1</pagehelper.version>
|
||||
</properties>
|
||||
<properties>
|
||||
<java.version>11</java.version>
|
||||
<pagehelper.version>4.1.1</pagehelper.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mail</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.1.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>1.3.0</version>
|
||||
</dependency>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mail</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.1.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>1.3.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- javax.validation -->
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
</dependency>
|
||||
<!-- javax.validation -->
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--spring切面aop依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
<!--spring切面aop依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-all</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.digitalpetri.modbus</groupId>
|
||||
<artifactId>modbus-codec</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-all</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.digitalpetri.modbus</groupId>
|
||||
<artifactId>modbus-codec</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 硬件检测依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.github.oshi</groupId>
|
||||
<artifactId>oshi-core-java11</artifactId>
|
||||
<version>5.7.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.junit.vintage</groupId>
|
||||
<artifactId>junit-vintage-engine</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.wechatpay-apiv3</groupId>
|
||||
<artifactId>wechatpay-apache-httpclient</artifactId>
|
||||
<version>0.2.1</version>
|
||||
</dependency>
|
||||
<!-- 硬件检测依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.github.oshi</groupId>
|
||||
<artifactId>oshi-core-java11</artifactId>
|
||||
<version>5.7.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.junit.vintage</groupId>
|
||||
<artifactId>junit-vintage-engine</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.wechatpay-apiv3</groupId>
|
||||
<artifactId>wechatpay-apache-httpclient</artifactId>
|
||||
<version>0.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.huawei.sis</groupId>-->
|
||||
@ -130,123 +130,98 @@
|
||||
<groupId>org.springframework.retry</groupId>
|
||||
<artifactId>spring-retry</artifactId>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>2.10.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.belerweb</groupId>
|
||||
<artifactId>pinyin4j</artifactId>
|
||||
<version>2.5.0</version>
|
||||
</dependency>
|
||||
<!-- iscs -->
|
||||
<dependency>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-java</artifactId>
|
||||
<version>3.23.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.hubspot.jackson</groupId>
|
||||
<artifactId>jackson-datatype-protobuf</artifactId>
|
||||
<version>0.9.12</version>
|
||||
</dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>com.chenlb.mmseg4j</groupId>
|
||||
<artifactId>mmseg4j-core</artifactId>
|
||||
<version>1.10.0</version>
|
||||
</dependency>-->
|
||||
<!-- <dependency>
|
||||
<groupId>org.ansj</groupId>
|
||||
<artifactId>ansj_seg</artifactId>
|
||||
<version>5.1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.reflections</groupId>
|
||||
<artifactId>reflections</artifactId>
|
||||
<version>0.9.11</version>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.12.0</version>
|
||||
</dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>info.debatty</groupId>
|
||||
<artifactId>java-string-similarity</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>2.10.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.belerweb</groupId>
|
||||
<artifactId>pinyin4j</artifactId>
|
||||
<version>2.5.0</version>
|
||||
</dependency>
|
||||
<!-- iscs -->
|
||||
<dependency>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-java</artifactId>
|
||||
<version>3.19.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-text</artifactId>
|
||||
<version>1.10.0</version>
|
||||
</dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>com.chenlb.mmseg4j</groupId>
|
||||
<artifactId>mmseg4j-core</artifactId>
|
||||
<version>1.10.0</version>
|
||||
</dependency>-->
|
||||
<!-- <dependency>
|
||||
<groupId>org.ansj</groupId>
|
||||
<artifactId>ansj_seg</artifactId>
|
||||
<version>5.1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.reflections</groupId>
|
||||
<artifactId>reflections</artifactId>
|
||||
<version>0.9.11</version>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.12.0</version>
|
||||
</dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>info.debatty</groupId>
|
||||
<artifactId>java-string-similarity</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</dependency>-->
|
||||
|
||||
</dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-text</artifactId>
|
||||
<version>1.10.0</version>
|
||||
</dependency>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>com.github.shalousun</groupId>
|
||||
<artifactId>smart-doc-maven-plugin</artifactId>
|
||||
<version>2.1.9</version>
|
||||
<configuration>
|
||||
<!--指定生成文档的使用的配置文件,配置文件放在自己的项目中-->
|
||||
<configFile>./src/main/resources/smart-doc.json</configFile>
|
||||
<!--smart-doc实现自动分析依赖树加载第三方依赖的源码,如果一些框架依赖库加载不到导致报错,这时请使用excludes排除掉-->
|
||||
<!-- <excludes>-->
|
||||
<!-- <!–格式为:groupId:artifactId;参考如下–>-->
|
||||
<!-- <exclude>com.alibaba:fastjson</exclude>-->
|
||||
<!-- </excludes>-->
|
||||
<!-- <!–自1.0.8版本开始,插件提供includes支持,配置了includes后插件会按照用户配置加载而不是自动加载,因此使用时需要注意–>-->
|
||||
<!-- <!–smart-doc能自动分析依赖树加载所有依赖源码,原则上会影响文档构建效率,因此你可以使用includes来让插件加载你配置的组件–>-->
|
||||
<!-- <includes>-->
|
||||
<!-- <!–格式为:groupId:artifactId;参考如下–>-->
|
||||
<!-- <include>com.alibaba:fastjson</include>-->
|
||||
<!-- </includes>-->
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<!--如果不需要在执行编译时启动smart-doc,则将phase注释掉-->
|
||||
<!-- <phase>compile</phase>-->
|
||||
<goals>
|
||||
<!--smart-doc提供了html、openapi、markdown等goal,可按需配置-->
|
||||
<goal>html</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<plugin>
|
||||
<groupId>com.github.shalousun</groupId>
|
||||
<artifactId>smart-doc-maven-plugin</artifactId>
|
||||
<version>2.1.9</version>
|
||||
<configuration>
|
||||
<!--指定生成文档的使用的配置文件,配置文件放在自己的项目中-->
|
||||
<configFile>./src/main/resources/smart-doc.json</configFile>
|
||||
<!--smart-doc实现自动分析依赖树加载第三方依赖的源码,如果一些框架依赖库加载不到导致报错,这时请使用excludes排除掉-->
|
||||
<!-- <excludes>-->
|
||||
<!-- <!–格式为:groupId:artifactId;参考如下–>-->
|
||||
<!-- <exclude>com.alibaba:fastjson</exclude>-->
|
||||
<!-- </excludes>-->
|
||||
<!-- <!–自1.0.8版本开始,插件提供includes支持,配置了includes后插件会按照用户配置加载而不是自动加载,因此使用时需要注意–>-->
|
||||
<!-- <!–smart-doc能自动分析依赖树加载所有依赖源码,原则上会影响文档构建效率,因此你可以使用includes来让插件加载你配置的组件–>-->
|
||||
<!-- <includes>-->
|
||||
<!-- <!–格式为:groupId:artifactId;参考如下–>-->
|
||||
<!-- <include>com.alibaba:fastjson</include>-->
|
||||
<!-- </includes>-->
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<!--如果不需要在执行编译时启动smart-doc,则将phase注释掉-->
|
||||
<!-- <phase>compile</phase>-->
|
||||
<goals>
|
||||
<!--smart-doc提供了html、openapi、markdown等goal,可按需配置-->
|
||||
<goal>html</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>aliyun-central</id>
|
||||
<url>https://maven.aliyun.com/repository/central</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>aliyun-snapshots</id>
|
||||
<url>https://maven.aliyun.com/repository/snapshots</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>aliyun-central</id>
|
||||
<url>https://maven.aliyun.com/repository/central</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</project>
|
||||
|
@ -1 +0,0 @@
|
||||
Subproject commit 5dd7fdb3d568c829356fa59b746b559d17da49b8
|
16
sql/20230206-zhou.sql
Normal file
16
sql/20230206-zhou.sql
Normal 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 '场景实训考试扮演的角色';
|
2
sql/20230215-thesai-mapFunction.sql
Normal file
2
sql/20230215-thesai-mapFunction.sql
Normal file
@ -0,0 +1,2 @@
|
||||
ALTER TABLE `joylink`.`rts_map_function`
|
||||
ADD COLUMN `bg_url` varchar(255) NULL COMMENT '背景图片的url' AFTER `desc`;
|
11
sql/20230220-thesai-mapFunctionTemplate.sql
Normal file
11
sql/20230220-thesai-mapFunctionTemplate.sql
Normal 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='地图功能模板';
|
3
sql/20230413-wei-training.sql
Normal file
3
sql/20230413-wei-training.sql
Normal 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 ;
|
14
sql/20230413-zhou-voice-config.sql
Normal file
14
sql/20230413-zhou-voice-config.sql
Normal 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;
|
13
sql/20230414-wei-conversation-group.sql
Normal file
13
sql/20230414-wei-conversation-group.sql
Normal 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='群组信息设置';
|
2
sql/20230418-wei-conversation-group.sql
Normal file
2
sql/20230418-wei-conversation-group.sql
Normal 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`;
|
10
sql/20230421-thesai-rts_alarm_tips.sql
Normal file
10
sql/20230421-thesai-rts_alarm_tips.sql
Normal 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报警信息提示';
|
1
sql/20230504-wei-training-rule.sql
Normal file
1
sql/20230504-wei-training-rule.sql
Normal file
@ -0,0 +1 @@
|
||||
ALTER TABLE `joylink`.`rts_training2_rule` ADD COLUMN `score_rule` text NULL COMMENT '得分规则' AFTER `location_rule`;
|
1
sql/20230520-zhou-paper-rule.sql
Normal file
1
sql/20230520-zhou-paper-rule.sql
Normal file
@ -0,0 +1 @@
|
||||
ALTER TABLE `rts_paper_rule` ADD COLUMN `sub_type_param` varchar(255) NULL COMMENT '规则参数';
|
9
sql/20230524-仿真记录数据转换.sql
Normal file
9
sql/20230524-仿真记录数据转换.sql
Normal 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';
|
@ -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());
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
@ -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);
|
||||
// }
|
||||
// }
|
||||
}
|
@ -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.LocalDateTimeSerializer;
|
||||
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.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@ -18,40 +17,36 @@ import java.time.format.DateTimeFormatter;
|
||||
|
||||
@Configuration
|
||||
public class LocalDateTimeSerializerConfig {
|
||||
/**
|
||||
* Date格式化字符串
|
||||
*/
|
||||
private static final String DATE_FORMAT = "yyyy-MM-dd";
|
||||
/**
|
||||
* DateTime格式化字符串
|
||||
*/
|
||||
private static final String DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
||||
/**
|
||||
* Time格式化字符串
|
||||
*/
|
||||
private static final String TIME_FORMAT = "HH:mm:ss";
|
||||
|
||||
/**
|
||||
* Date格式化字符串
|
||||
*/
|
||||
private static final String DATE_FORMAT = "yyyy-MM-dd";
|
||||
/**
|
||||
* DateTime格式化字符串
|
||||
*/
|
||||
private static final String DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
||||
/**
|
||||
* Time格式化字符串
|
||||
*/
|
||||
private static final String TIME_FORMAT = "HH:mm:ss";
|
||||
@Bean
|
||||
public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() {
|
||||
return builder -> {
|
||||
builder.serializerByType(LocalDateTime.class,
|
||||
new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DATETIME_FORMAT)));
|
||||
builder.deserializerByType(LocalDateTime.class,
|
||||
new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DATETIME_FORMAT)));
|
||||
|
||||
@Bean
|
||||
public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() {
|
||||
return builder -> {
|
||||
builder.modulesToInstall(ProtobufModule.class);
|
||||
builder.failOnUnknownProperties(false);
|
||||
builder.serializerByType(LocalDateTime.class,
|
||||
new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DATETIME_FORMAT)));
|
||||
builder.deserializerByType(LocalDateTime.class,
|
||||
new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(DATETIME_FORMAT)));
|
||||
builder.serializerByType(LocalDate.class,
|
||||
new LocalDateSerializer(DateTimeFormatter.ofPattern(DATE_FORMAT)));
|
||||
builder.deserializerByType(LocalDate.class,
|
||||
new LocalDateDeserializer(DateTimeFormatter.ofPattern(DATE_FORMAT)));
|
||||
|
||||
builder.serializerByType(LocalDate.class,
|
||||
new LocalDateSerializer(DateTimeFormatter.ofPattern(DATE_FORMAT)));
|
||||
builder.deserializerByType(LocalDate.class,
|
||||
new LocalDateDeserializer(DateTimeFormatter.ofPattern(DATE_FORMAT)));
|
||||
|
||||
builder.serializerByType(LocalTime.class,
|
||||
new LocalTimeSerializer(DateTimeFormatter.ofPattern(TIME_FORMAT)));
|
||||
builder.deserializerByType(LocalTime.class,
|
||||
new LocalTimeDeserializer(DateTimeFormatter.ofPattern(TIME_FORMAT)));
|
||||
};
|
||||
|
||||
}
|
||||
builder.serializerByType(LocalTime.class,
|
||||
new LocalTimeSerializer(DateTimeFormatter.ofPattern(TIME_FORMAT)));
|
||||
builder.deserializerByType(LocalTime.class,
|
||||
new LocalTimeDeserializer(DateTimeFormatter.ofPattern(TIME_FORMAT)));
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -70,8 +70,6 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
whiteList.add("/api/v2/paper/composition/oldData/handle");
|
||||
whiteList.add("/api/user/sync");
|
||||
whiteList.add("/dataHandle");
|
||||
//modbus测试
|
||||
whiteList.add("/api/test/modbus/writeCoil");
|
||||
|
||||
registry.addInterceptor(authenticateInterceptor).excludePathPatterns(whiteList);
|
||||
}
|
||||
|
@ -5,7 +5,5 @@ public interface ProjectCode {
|
||||
String THAILAND_SANDBOX = "THAILAND_SANDBOX";
|
||||
String SR_SANDBOX = "SR_SANDBOX";
|
||||
String NGY_SAND_TABLE = "NGY_SAND_TABLE";
|
||||
String CDGXY = "CDGXY";
|
||||
String CGY = "CGY";
|
||||
|
||||
}
|
||||
|
@ -121,8 +121,6 @@ public enum ProjectDeviceType {
|
||||
|
||||
PIS_STAND,
|
||||
PIS_TRAIN,
|
||||
PIS,
|
||||
TMS,
|
||||
/* -----------client device end---------- */
|
||||
/* -----------Other start---------- */
|
||||
/**
|
||||
|
@ -7,148 +7,136 @@ import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.client.LoginStatusVO;
|
||||
import club.joylink.rtss.vo.client.LoginUserVO;
|
||||
import club.joylink.rtss.vo.client.cgy.CgyThirdPartyLoginInfoVO;
|
||||
import club.joylink.rtss.vo.client.validGroup.LoginInfoCheck;
|
||||
import club.joylink.rtss.vo.client.validGroup.ThirdLoginInfoCheck;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/login")
|
||||
public class LoginController {
|
||||
|
||||
@Autowired
|
||||
private IAuthenticateService iAuthenticateService;
|
||||
@Autowired
|
||||
private IAuthenticateService iAuthenticateService;
|
||||
|
||||
@PostMapping("/cgy/third")
|
||||
public String cgyThirdPartyLogin(@RequestBody @Validated CgyThirdPartyLoginInfoVO loginInfo) {
|
||||
return this.iAuthenticateService.cgyThirdPartyLogin(loginInfo);
|
||||
}
|
||||
|
||||
@PostMapping(path = "/third")
|
||||
public String thirdPartyLogin(
|
||||
@RequestBody @Validated(ThirdLoginInfoCheck.class) LoginUserVO loginInfo) {
|
||||
return this.iAuthenticateService.thirdPartyLogin(loginInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取微信小程序登陆二维码
|
||||
*/
|
||||
@GetMapping(path = "/wmurl")
|
||||
public LoginStatusVO getWmLoginUrl(@NotBlank String clientId, @NotBlank String secret,
|
||||
String project, @RequestParam(required = false) String deviceCode) {
|
||||
try {
|
||||
return this.iAuthenticateService.getWmLoginUrl(clientId, secret, project, deviceCode);
|
||||
} catch (BaseException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("获取登录二维码失败");
|
||||
@PostMapping(path = "/third")
|
||||
public String thirdPartyLogin(@RequestBody @Validated(ThirdLoginInfoCheck.class) LoginUserVO loginInfo) {
|
||||
return this.iAuthenticateService.thirdPartyLogin(loginInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户微信小程序扫登陆二维码
|
||||
*/
|
||||
@GetMapping(path = "/scan/wmLoginUrl")
|
||||
public AccountVO scanWmLoginQrCode(String code, String state) {
|
||||
return this.iAuthenticateService.scanWmLoginQrCode(code, state);
|
||||
}
|
||||
/**
|
||||
* 获取微信小程序登陆二维码
|
||||
*/
|
||||
@GetMapping(path = "/wmurl")
|
||||
public LoginStatusVO getWmLoginUrl(@NotBlank String clientId, @NotBlank String secret,
|
||||
String project, @RequestParam(required = false) String deviceCode) {
|
||||
try {
|
||||
return this.iAuthenticateService.getWmLoginUrl(clientId, secret, project, deviceCode);
|
||||
} catch (BaseException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("获取登录二维码失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信小程序确认登陆接口
|
||||
*/
|
||||
@PostMapping(path = "/wm")
|
||||
public void wmConfirmLogin(String code, String state) {
|
||||
this.iAuthenticateService.wmConfirmClientLogin(code, state);
|
||||
}
|
||||
/**
|
||||
* 用户微信小程序扫登陆二维码
|
||||
*/
|
||||
@GetMapping(path = "/scan/wmLoginUrl")
|
||||
public AccountVO scanWmLoginQrCode(String code, String state) {
|
||||
return this.iAuthenticateService.scanWmLoginQrCode(code, state);
|
||||
}
|
||||
|
||||
@PostMapping()
|
||||
public String loginWithPwd(@RequestBody @Validated(LoginInfoCheck.class) LoginUserVO loginUser) {
|
||||
return iAuthenticateService.loginWithPwd(loginUser);
|
||||
}
|
||||
/**
|
||||
* 微信小程序确认登陆接口
|
||||
*/
|
||||
@PostMapping(path = "/wm")
|
||||
public void wmConfirmLogin(String code, String state) {
|
||||
this.iAuthenticateService.wmConfirmClientLogin(code, state);
|
||||
}
|
||||
|
||||
@GetMapping("/preLogout")
|
||||
public void preLogout(String token) {
|
||||
this.iAuthenticateService.preLogout(token);
|
||||
}
|
||||
@PostMapping()
|
||||
public String loginWithPwd(@RequestBody @Validated(LoginInfoCheck.class) LoginUserVO loginUser) {
|
||||
return iAuthenticateService.loginWithPwd(loginUser);
|
||||
}
|
||||
|
||||
@GetMapping(path = "/logout")
|
||||
public void logout(String token) {
|
||||
this.iAuthenticateService.logout(token);
|
||||
}
|
||||
@GetMapping("/preLogout")
|
||||
public void preLogout(String token) {
|
||||
this.iAuthenticateService.preLogout(token);
|
||||
}
|
||||
|
||||
@GetMapping(path = "/checkStatus")
|
||||
public LoginStatusVO checkStatus(@NotBlank String sessionId) {
|
||||
return iAuthenticateService.checkStatus(sessionId);
|
||||
}
|
||||
@GetMapping(path = "/logout")
|
||||
public void logout(String token) {
|
||||
this.iAuthenticateService.logout(token);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息 - 通过token
|
||||
*
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(path = "/getUserInfo")
|
||||
public AccountVO getUserInfo(String token) {
|
||||
LoginUserInfoVO loginUserInfoVO = this.iAuthenticateService.getLoginUserInfoByToken(token);
|
||||
return loginUserInfoVO.getAccountVO();
|
||||
}
|
||||
@GetMapping(path = "/checkStatus")
|
||||
public LoginStatusVO checkStatus(@NotBlank String sessionId) {
|
||||
return iAuthenticateService.checkStatus(sessionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户登录信息(包含登录的项目/客户端等)
|
||||
*
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/loginUserInfo")
|
||||
public LoginUserInfoVO getLoginUserInfo(String token) {
|
||||
return this.iAuthenticateService.getLoginUserInfoByToken(token);
|
||||
}
|
||||
/**
|
||||
* 获取用户信息 - 通过token
|
||||
*
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(path = "/getUserInfo")
|
||||
public AccountVO getUserInfo(String token) {
|
||||
LoginUserInfoVO loginUserInfoVO = this.iAuthenticateService.getLoginUserInfoByToken(token);
|
||||
return loginUserInfoVO.getAccountVO();
|
||||
}
|
||||
|
||||
/**
|
||||
* <玖琏科技>微信小程序code换取token
|
||||
*/
|
||||
@GetMapping(path = "/wm/token")
|
||||
public String getTokenByWmCode(String code) {
|
||||
return this.iAuthenticateService.getTokenByWmCode(code);
|
||||
}
|
||||
/**
|
||||
* 获取用户登录信息(包含登录的项目/客户端等)
|
||||
*
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/loginUserInfo")
|
||||
public LoginUserInfoVO getLoginUserInfo(String token) {
|
||||
return this.iAuthenticateService.getLoginUserInfoByToken(token);
|
||||
}
|
||||
|
||||
/**
|
||||
* 到那儿了小程序code换token
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(path = "/wm2/token")
|
||||
public String getTokenByWmCode2(String code) {
|
||||
return this.iAuthenticateService.getTokenByWmCode2(code);
|
||||
}
|
||||
/**
|
||||
* <玖琏科技>微信小程序code换取token
|
||||
*/
|
||||
@GetMapping(path = "/wm/token")
|
||||
public String getTokenByWmCode(String code) {
|
||||
return this.iAuthenticateService.getTokenByWmCode(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 郑州共赢小程序code换token
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(path = "/wm/zzww/token")
|
||||
public String getTokenByWmCode3(String code) {
|
||||
return this.iAuthenticateService.getTokenByWmCode3(code);
|
||||
}
|
||||
/**
|
||||
* 到那儿了小程序code换token
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(path = "/wm2/token")
|
||||
public String getTokenByWmCode2(String code) {
|
||||
return this.iAuthenticateService.getTokenByWmCode2(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* token是否过期
|
||||
*/
|
||||
@GetMapping(path = "/{token}/isExpired")
|
||||
public boolean isTokenExpired(@PathVariable String token) {
|
||||
return this.iAuthenticateService.isTokenExpired(token);
|
||||
}
|
||||
/**
|
||||
* 郑州共赢小程序code换token
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(path = "/wm/zzww/token")
|
||||
public String getTokenByWmCode3(String code) {
|
||||
return this.iAuthenticateService.getTokenByWmCode3(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* token是否过期
|
||||
*/
|
||||
@GetMapping(path = "/{token}/isExpired")
|
||||
public boolean isTokenExpired(@PathVariable String token) {
|
||||
return this.iAuthenticateService.isTokenExpired(token);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,79 +26,78 @@ import java.util.List;
|
||||
@Slf4j
|
||||
public class CommonResponseBody implements ResponseBodyAdvice {
|
||||
|
||||
@Override
|
||||
public boolean supports(MethodParameter returnType, Class converterType) {
|
||||
return returnType.getMethod() != null && !returnType.getMethod().getReturnType().getSimpleName().equals("CommonJsonResponse");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType,
|
||||
Class selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) {
|
||||
//byte[]
|
||||
if (body instanceof byte[]) {
|
||||
response.getHeaders().setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||
return body;
|
||||
@Override
|
||||
public boolean supports(MethodParameter returnType, Class converterType) {
|
||||
return returnType.getMethod() != null && !returnType.getMethod().getReturnType().getSimpleName().equals("CommonJsonResponse");
|
||||
}
|
||||
//byte[]
|
||||
/*if(body instanceof AbstractMessageLite){
|
||||
|
||||
@Override
|
||||
public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType,
|
||||
Class selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) {
|
||||
//byte[]
|
||||
if(body instanceof byte[]){
|
||||
response.getHeaders().setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||
return body;
|
||||
}
|
||||
//byte[]
|
||||
if(body instanceof AbstractMessageLite){
|
||||
response.getHeaders().setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||
final AbstractMessageLite proto = (AbstractMessageLite) body;
|
||||
return proto.toByteArray();
|
||||
}*/
|
||||
if (body instanceof CommonJsonResponse) {
|
||||
return body;
|
||||
}
|
||||
if (request.getURI().getPath().startsWith("/swagger")) {
|
||||
return body;
|
||||
}
|
||||
if (request.getURI().getPath().equals("/api/userinfo/ifRegisted")) {
|
||||
return body;
|
||||
}
|
||||
if (request.getURI().getPath().equals("/api/userinfo/identity")) {
|
||||
return body;
|
||||
}
|
||||
CommonJsonResponse commonJsonResponse = CommonJsonResponse.newSuccessResponse(body);
|
||||
if (returnType.getMethod().getReturnType().equals(String.class) || body instanceof String) {
|
||||
return commonJsonResponse.toJSONString();
|
||||
}
|
||||
return commonJsonResponse;
|
||||
}
|
||||
|
||||
@ExceptionHandler({PayException.class})
|
||||
@ResponseStatus
|
||||
public CommonJsonResponse handleException(PayException e) {
|
||||
log.error("【支付异常】", e);
|
||||
return CommonJsonResponse.newErrorResponse();
|
||||
}
|
||||
|
||||
@ExceptionHandler({Exception.class})
|
||||
@ResponseBody
|
||||
public CommonJsonResponse handleException(Exception e) {
|
||||
if (e instanceof MethodArgumentNotValidException) {
|
||||
// 参数验证异常处理
|
||||
MethodArgumentNotValidException validException = (MethodArgumentNotValidException) e;
|
||||
List<ObjectError> errorList = validException.getBindingResult().getAllErrors();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
errorList.forEach(error ->
|
||||
sb.append(error.getDefaultMessage()).append(";"));
|
||||
log.error("【参数校验异常】{}", e);
|
||||
return CommonJsonResponse.newErrorResponse(ResponseConsts.VALIDATE_ERROR.getCode(), sb.toString());
|
||||
}
|
||||
if (e instanceof BusinessException) {
|
||||
club.joylink.rtss.exception.BusinessException be = (club.joylink.rtss.exception.BusinessException) e;
|
||||
log.error("【业务异常】{}", e);
|
||||
return CommonJsonResponse.newErrorResponse(be.getCode(), be.getVoMessage());
|
||||
} else if (e instanceof MissingServletRequestParameterException) {
|
||||
log.error("【接口参数异常】", e);
|
||||
return CommonJsonResponse.newErrorResponse(ResponseConsts.VALIDATE_ERROR.getCode(), "接口参数异常");
|
||||
} else if (e instanceof SimulationException) {
|
||||
club.joylink.rtss.simulation.cbtc.exception.SimulationException simulationException = (club.joylink.rtss.simulation.cbtc.exception.SimulationException) e;
|
||||
log.error("【仿真系统异常】{}", e);
|
||||
return CommonJsonResponse.newErrorResponse(simulationException.getCode(), simulationException.getMessage());
|
||||
}
|
||||
if(body instanceof CommonJsonResponse) {
|
||||
return body;
|
||||
}
|
||||
if(request.getURI().getPath().startsWith("/swagger")) {
|
||||
return body;
|
||||
}
|
||||
if (request.getURI().getPath().equals("/api/userinfo/ifRegisted")) {
|
||||
return body;
|
||||
}
|
||||
if (request.getURI().getPath().equals("/api/userinfo/identity")) {
|
||||
return body;
|
||||
}
|
||||
CommonJsonResponse commonJsonResponse = CommonJsonResponse.newSuccessResponse(body);
|
||||
if(returnType.getMethod().getReturnType().equals(String.class) || body instanceof String) {
|
||||
return commonJsonResponse.toJSONString();
|
||||
}
|
||||
return commonJsonResponse;
|
||||
}
|
||||
|
||||
log.error("【系统异常】{}", e);
|
||||
return CommonJsonResponse.newErrorResponse();
|
||||
}
|
||||
@ExceptionHandler({PayException.class})
|
||||
@ResponseStatus
|
||||
public CommonJsonResponse handleException(PayException e) {
|
||||
log.error("【支付异常】", e);
|
||||
return CommonJsonResponse.newErrorResponse();
|
||||
}
|
||||
|
||||
@ExceptionHandler({Exception.class})
|
||||
@ResponseBody
|
||||
public CommonJsonResponse handleException(Exception e) {
|
||||
if(e instanceof MethodArgumentNotValidException) {
|
||||
// 参数验证异常处理
|
||||
MethodArgumentNotValidException validException = (MethodArgumentNotValidException) e;
|
||||
List<ObjectError> errorList = validException.getBindingResult().getAllErrors();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
errorList.forEach(error ->
|
||||
sb.append(error.getDefaultMessage()).append(";"));
|
||||
log.error("【参数校验异常】{}", e);
|
||||
return CommonJsonResponse.newErrorResponse(ResponseConsts.VALIDATE_ERROR.getCode(), sb.toString());
|
||||
} if(e instanceof BusinessException) {
|
||||
club.joylink.rtss.exception.BusinessException be = (club.joylink.rtss.exception.BusinessException) e;
|
||||
log.error("【业务异常】{}", e);
|
||||
return CommonJsonResponse.newErrorResponse(be.getCode(), be.getVoMessage());
|
||||
} else if(e instanceof MissingServletRequestParameterException) {
|
||||
log.error("【接口参数异常】", e);
|
||||
return CommonJsonResponse.newErrorResponse(ResponseConsts.VALIDATE_ERROR.getCode(), "接口参数异常");
|
||||
} else if (e instanceof SimulationException) {
|
||||
club.joylink.rtss.simulation.cbtc.exception.SimulationException simulationException = (club.joylink.rtss.simulation.cbtc.exception.SimulationException) e;
|
||||
log.error("【仿真系统异常】{}", e);
|
||||
return CommonJsonResponse.newErrorResponse(simulationException.getCode(), simulationException.getMessage());
|
||||
}
|
||||
|
||||
log.error("【系统异常】{}", e);
|
||||
return CommonJsonResponse.newErrorResponse();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import club.joylink.rtss.vo.paper.CreatePaperCompositionRspVo;
|
||||
import club.joylink.rtss.vo.paper.FindPaperCompositionByAccountReqVo;
|
||||
import club.joylink.rtss.vo.paper.FindPaperCompositionPageReqVo;
|
||||
import club.joylink.rtss.vo.paper.PaperCompositionWithRuleVo;
|
||||
import club.joylink.rtss.vo.paper.PaperCompositionWithRuleVo.CreatorBasic;
|
||||
import java.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -110,14 +109,6 @@ public class PaperCompositionController {
|
||||
return this.compositionService.findPaperCompositionByPage(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询试卷的创建者的信息
|
||||
*/
|
||||
@PostMapping("/list/creatorInfo")
|
||||
public List<CreatorBasic> queryCreatorList(@RequestBody FindPaperCompositionPageReqVo req) {
|
||||
return compositionService.queryCreatorList(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据mapId查询蓝图的基本信息
|
||||
*
|
||||
|
@ -67,7 +67,7 @@ public class DeviceController {
|
||||
@PostMapping("")
|
||||
public String create(@RequestBody @Validated ProjectDeviceVO deviceVO,
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY)
|
||||
LoginUserInfoVO userLoginInfo) {
|
||||
LoginUserInfoVO userLoginInfo) {
|
||||
return this.deviceService.create(deviceVO, userLoginInfo);
|
||||
}
|
||||
|
||||
@ -251,68 +251,63 @@ public class DeviceController {
|
||||
@PostMapping("/xty/addOrUpdate")
|
||||
public void addOrUpdateXtyDeviceConfig(
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO) {
|
||||
AccountVO accountVO) {
|
||||
this.deviceService.addOrUpdateXtyDeviceConfig(accountVO);
|
||||
}
|
||||
|
||||
@PostMapping("/gzb/addOrUpdate")
|
||||
public void addOrUpdateGzbDeviceConfig(
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO) {
|
||||
AccountVO accountVO) {
|
||||
this.deviceService.addOrUpdateGzbDeviceConfig(accountVO);
|
||||
}
|
||||
|
||||
@PostMapping("/sdy/addOrUpdate")
|
||||
public void addOrUpdateSdyDeviceConfig(
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO) {
|
||||
AccountVO accountVO) {
|
||||
this.deviceService.addOrUpdateSdyDeviceConfig(accountVO);
|
||||
}
|
||||
|
||||
@PostMapping("/zjd/addOrUpdate")
|
||||
public void addOrUpdateZjdDeviceConfig(
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO) {
|
||||
AccountVO accountVO) {
|
||||
this.deviceService.addOrUpdateRichorDeviceConfig(accountVO);
|
||||
}
|
||||
|
||||
@PostMapping("/sr/addOrUpdate/{mapId}")
|
||||
public void addOrUpdateSrDeviceConfig(
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO, @PathVariable Long mapId) {
|
||||
AccountVO accountVO, @PathVariable Long mapId) {
|
||||
this.deviceService.addOrUpdateSrDeviceConfig(accountVO, mapId);
|
||||
}
|
||||
|
||||
@PostMapping("/hhcj/addOrUpdate")
|
||||
public void addOrUpdateHhcjDeviceConfig(
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO) {
|
||||
AccountVO accountVO) {
|
||||
this.deviceService.addOrUpdateHhcjDeviceConfig(accountVO);
|
||||
}
|
||||
|
||||
@PostMapping("/say/addOrUpdate")
|
||||
public void addOrUpdateSayDeviceConfig(
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO) {
|
||||
AccountVO accountVO) {
|
||||
this.deviceService.addOrUpdateSayDeviceConfig(accountVO);
|
||||
}
|
||||
|
||||
@PostMapping("/thailand/addOrUpdate/{mapId}")
|
||||
public void addOrUpdateThailandDeviceConfig(
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO, @PathVariable Long mapId) {
|
||||
AccountVO accountVO, @PathVariable Long mapId) {
|
||||
this.deviceService.addOrUpdateThailandDeviceConfig(accountVO, mapId);
|
||||
}
|
||||
|
||||
@PostMapping("/ngy/addOrUpdate/{mapId}")
|
||||
public void addOrUpdateNgyDeviceConfig(
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO, @PathVariable Long mapId) {
|
||||
AccountVO accountVO, @PathVariable Long mapId) {
|
||||
this.deviceService.addOrUpdateNgyDeviceConfig(accountVO, mapId);
|
||||
}
|
||||
|
||||
@PostMapping("/cdgxy/addOrUpdate")
|
||||
public void addOrUpdateCdgxyDeviceConfig(@RequestAttribute AccountVO user) {
|
||||
this.deviceService.addOrUpdateCdgxyDeviceConfig(user);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
// }
|
||||
|
||||
}
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -6,33 +6,17 @@ import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
|
||||
import club.joylink.rtss.controller.advice.Role;
|
||||
import club.joylink.rtss.entity.training2.ExportTraining2;
|
||||
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.Training2TypeEnum;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.training2.publish.DeletePublishedTraining2ReqVo;
|
||||
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 club.joylink.rtss.vo.training2.publish.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.ModelAttribute;
|
||||
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;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 已发布实训管理接口
|
||||
@ -41,171 +25,123 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RestController
|
||||
@RequestMapping("/api/v2/training/published")
|
||||
public class TrainingV2PublishController {
|
||||
@Autowired
|
||||
private Training2PublishService publishService;
|
||||
|
||||
@Autowired
|
||||
private Training2PublishService publishService;
|
||||
/**
|
||||
* 已发布实训分页列表
|
||||
*/
|
||||
@PostMapping("/page")
|
||||
public PageVO<PublishedTraining2InfoRspVo> publishedTrainingsPage(@RequestBody PublishedTraining2InfoPageReqVo req){
|
||||
return this.publishService.publishedTrainingsPage(req);
|
||||
}
|
||||
/**
|
||||
* 已发布实训上架
|
||||
*/
|
||||
@PostMapping("/put/on")
|
||||
public PutOnPublishedTraining2RspVo putOnPublishedTrainings(@RequestBody PutOnPublishedTraining2ReqVo req,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
|
||||
return this.publishService.putOnPublishedTrainings(req,userInfoVO);
|
||||
}
|
||||
/**
|
||||
* 已发布实训下架
|
||||
*/
|
||||
@PostMapping("/pull/off")
|
||||
public PullOffPublishedTraining2RspVo pullOffPublishedTrainings(@RequestBody PullOffPublishedTraining2ReqVo req,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
|
||||
return this.publishService.pullOffPublishedTrainings(req,userInfoVO);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private Training2DraftPublishService training2DraftPublishService;
|
||||
|
||||
/**
|
||||
* 已发布实训分页列表
|
||||
*/
|
||||
@PostMapping("/page")
|
||||
public PageVO<PublishedTraining2InfoRspVo> publishedTrainingsPage(
|
||||
@RequestBody PublishedTraining2InfoPageReqVo req) {
|
||||
return this.publishService.publishedTrainingsPage(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 已发布实训上架
|
||||
*/
|
||||
@PostMapping("/put/on")
|
||||
public PutOnPublishedTraining2RspVo putOnPublishedTrainings(
|
||||
@RequestBody PutOnPublishedTraining2ReqVo req,
|
||||
@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
return this.publishService.putOnPublishedTrainings(req, userInfoVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 已发布实训下架
|
||||
*/
|
||||
@PostMapping("/pull/off")
|
||||
public PullOffPublishedTraining2RspVo pullOffPublishedTrainings(
|
||||
@RequestBody PullOffPublishedTraining2ReqVo req,
|
||||
@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
return this.publishService.pullOffPublishedTrainings(req, userInfoVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 变更共享状态
|
||||
*
|
||||
* @param id
|
||||
* @param shared
|
||||
* @param userInfoVO
|
||||
*/
|
||||
@GetMapping("/{id}/{shared}")
|
||||
public void changeSharedStatus(@PathVariable(name = "id") Long id,
|
||||
@PathVariable(name = "shared") Integer shared,
|
||||
@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
this.publishService.changeSharedStatus(id, shared, userInfoVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除已发布实训
|
||||
*/
|
||||
@DeleteMapping
|
||||
public DeletePublishedTraining2RspVo deletePublishedTrainings(
|
||||
@RequestBody DeletePublishedTraining2ReqVo req,
|
||||
@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
return this.publishService.deletePublishedTrainings(req, userInfoVO);
|
||||
}
|
||||
/**
|
||||
* 变更共享状态
|
||||
* @param id
|
||||
* @param shared
|
||||
* @param userInfoVO
|
||||
*/
|
||||
@GetMapping("/{id}/{shared}")
|
||||
public void changeSharedStatus(@PathVariable(name="id") Long id,@PathVariable(name="shared") Integer shared,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
|
||||
this.publishService.changeSharedStatus(id,shared,userInfoVO);
|
||||
}
|
||||
/**
|
||||
* 删除已发布实训
|
||||
*/
|
||||
@DeleteMapping
|
||||
public DeletePublishedTraining2RspVo deletePublishedTrainings(@RequestBody DeletePublishedTraining2ReqVo req,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
|
||||
return this.publishService.deletePublishedTrainings(req,userInfoVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 实训查询(用户)管理
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/manage/infos")
|
||||
public PageVO<PublishedTraining2InfoRspVo> findTrainingListManageInfosForPage(
|
||||
@RequestBody PublishedTrainingListRspVo vo,
|
||||
@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
vo.setOrgId(userInfoVO.getTopOrgId());
|
||||
return this.publishService.findTrainingInfoForPage(vo, userInfoVO, true);
|
||||
}
|
||||
/**
|
||||
* 实训查询(用户)管理
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/manage/infos")
|
||||
public PageVO<PublishedTraining2InfoRspVo> findTrainingListManageInfosForPage(@RequestBody PublishedTrainingListRspVo vo,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
|
||||
vo.setOrgId(userInfoVO.getTopOrgId());
|
||||
return this.publishService.findTrainingInfoForPage(vo,userInfoVO,true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 实训查询
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/infos")
|
||||
public List<PublishedTraining2InfoRspVo> findTrainingListInfos(
|
||||
@RequestBody PublishedTrainingListRspVo vo,
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO) {
|
||||
//只查询以上架
|
||||
vo.setState(BusinessConsts.STATUS_USE_INT);
|
||||
vo.setOrgId(loginUserInfoVO.getTopOrgId());
|
||||
return this.publishService.findTrainingInfo(vo, loginUserInfoVO);
|
||||
}
|
||||
/**
|
||||
* 实训查询
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/infos")
|
||||
public List<PublishedTraining2InfoRspVo> findTrainingListInfos(@RequestBody PublishedTrainingListRspVo vo
|
||||
,@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO){
|
||||
//只查询以上架
|
||||
vo.setState(BusinessConsts.STATUS_USE_INT);
|
||||
vo.setOrgId(loginUserInfoVO.getTopOrgId());
|
||||
return this.publishService.findTrainingInfo(vo,loginUserInfoVO);
|
||||
}
|
||||
/**
|
||||
* 查所有的已发布场景实训的基础信息
|
||||
*/
|
||||
@Role(value = RoleEnum.SuperAdmin)
|
||||
@GetMapping("/list")
|
||||
public PageVO<PublishedTraining2InfoRspVo> findTrainingList(@ModelAttribute PublishedTrainingListRspVo vo,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
|
||||
return this.publishService.findTrainingInfoForPage(vo,userInfoVO,false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查所有的已发布场景实训的基础信息
|
||||
*/
|
||||
@Role(value = RoleEnum.SuperAdmin)
|
||||
@GetMapping("/list")
|
||||
public PageVO<PublishedTraining2InfoRspVo> findTrainingList(
|
||||
@ModelAttribute PublishedTrainingListRspVo vo,
|
||||
@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
return this.publishService.findTrainingInfoForPage(vo, userInfoVO, false);
|
||||
}
|
||||
/**
|
||||
* 根据实训id查该已发布实训的所有信息
|
||||
*/
|
||||
@GetMapping("/{trainingId}")
|
||||
public PublishedTraining2DetailRspVo findTrainingAllInfo(@PathVariable("trainingId") Long trainingId){
|
||||
return this.publishService.findTrainingAllInfoById(trainingId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据实训id查该已发布实训的所有信息
|
||||
*/
|
||||
@GetMapping("/{trainingId}")
|
||||
public PublishedTraining2DetailRspVo findTrainingAllInfo(
|
||||
@PathVariable("trainingId") Long trainingId) {
|
||||
return this.publishService.findTrainingAllInfoById(trainingId);
|
||||
}
|
||||
/**
|
||||
* 更新实训label
|
||||
*/
|
||||
@PutMapping("/update/label")
|
||||
public void updateTrainingLabel(@RequestBody PublishedTraining2 training2) {
|
||||
publishService.updateTrainingLabel(training2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新实训label
|
||||
*/
|
||||
@PutMapping("/update/label")
|
||||
public void updateTrainingLabel(@RequestBody PublishedTraining2 training2) {
|
||||
publishService.updateTrainingLabel(training2);
|
||||
}
|
||||
/**
|
||||
* 批量更新实训label
|
||||
*/
|
||||
@PutMapping("/update/batch/label")
|
||||
public void updateTrainingLabelList(@RequestBody List<PublishedTraining2> publishedTraining2List) {
|
||||
publishService.updateTrainingLabelList(publishedTraining2List);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新发布实训信息
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public void updateTraining(@RequestBody PublishedTraining2 training2) {
|
||||
publishService.updateTrainingBaseInfo(training2);
|
||||
}
|
||||
/**
|
||||
* 导出所选实训
|
||||
* @param tidList 实训ID列表
|
||||
* @return 实训详情信息
|
||||
*/
|
||||
@PostMapping("/export")
|
||||
public List<ExportTraining2> exportTraining(@RequestBody List<Long> tidList) {
|
||||
return publishService.exportTraining(tidList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量更新实训label
|
||||
*/
|
||||
@PutMapping("/update/batch/label")
|
||||
public void updateTrainingLabelList(
|
||||
@RequestBody List<PublishedTraining2> publishedTraining2List) {
|
||||
publishService.updateTrainingLabelList(publishedTraining2List);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出所选实训
|
||||
*
|
||||
* @param tidList 实训ID列表
|
||||
* @return 实训详情信息
|
||||
*/
|
||||
@PostMapping("/export")
|
||||
public List<ExportTraining2> exportTraining(@RequestBody List<Long> tidList) {
|
||||
return publishService.exportTraining(tidList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入实训信息
|
||||
*
|
||||
* @return 导入结果
|
||||
*/
|
||||
@PostMapping("/import")
|
||||
public List<String> importTraining(@RequestBody List<ExportTraining2> trainingList,
|
||||
@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO 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);
|
||||
}
|
||||
/**
|
||||
* 导入实训信息
|
||||
* @return 导入结果
|
||||
*/
|
||||
@PostMapping("/import")
|
||||
public List<String> importTraining(@RequestBody List<ExportTraining2> trainingList, @RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
return publishService.importTraining(trainingList, userInfoVO);
|
||||
}
|
||||
}
|
||||
|
@ -4,25 +4,15 @@ import club.joylink.rtss.services.ISysUserService;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.UserQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.user.MobileInfoVO;
|
||||
import club.joylink.rtss.vo.client.user.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.*;
|
||||
import club.joylink.rtss.vo.user.AccountCreateVO;
|
||||
import club.joylink.rtss.vo.user.AccountRegisterVO;
|
||||
import club.joylink.rtss.vo.user.UserRegisterCheck;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统账户接口
|
||||
@ -31,186 +21,165 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RequestMapping("/api/userinfo")
|
||||
public class SysAccountController {
|
||||
|
||||
@Autowired
|
||||
private ISysUserService iSysUserService;
|
||||
@Autowired
|
||||
private ISysUserService iSysUserService;
|
||||
|
||||
@PostMapping("/register")
|
||||
public void register(
|
||||
@RequestBody @Validated(value = UserRegisterCheck.class) AccountCreateVO accountCreateVO) {
|
||||
this.iSysUserService.register(accountCreateVO);
|
||||
}
|
||||
@PostMapping("/register")
|
||||
public void register(@RequestBody @Validated(value = UserRegisterCheck.class) AccountCreateVO accountCreateVO) {
|
||||
this.iSysUserService.register(accountCreateVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新注册接口
|
||||
*/
|
||||
@PostMapping("/register2")
|
||||
public void register2(@RequestBody @Validated AccountRegisterVO registerVO) {
|
||||
this.iSysUserService.register2(registerVO);
|
||||
}
|
||||
/**
|
||||
* 新注册接口
|
||||
*/
|
||||
@PostMapping("/register2")
|
||||
public void register2(@RequestBody @Validated AccountRegisterVO registerVO) {
|
||||
this.iSysUserService.register2(registerVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据姓名或电话号查询用户
|
||||
*/
|
||||
@GetMapping(path = "/nameOrMobile")
|
||||
public List<AccountVO> queryUserByNameOrMobile(String query) {
|
||||
List<AccountVO> list = this.iSysUserService.queryUserByNameOrMobile(query);
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
*根据姓名或电话号查询用户
|
||||
*/
|
||||
@GetMapping(path="/nameOrMobile")
|
||||
public List<AccountVO> queryUserByNameOrMobile(String query) {
|
||||
List<AccountVO> list = this.iSysUserService.queryUserByNameOrMobile(query);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机号是否已经注册
|
||||
*/
|
||||
@GetMapping("/isExist/mobile")
|
||||
public boolean isMobileExist(String mobile) {
|
||||
return iSysUserService.isSameMobileExist(mobile);
|
||||
}
|
||||
/**
|
||||
* 手机号是否已经注册
|
||||
*/
|
||||
@GetMapping("/isExist/mobile")
|
||||
public boolean isMobileExist(String mobile) {
|
||||
return iSysUserService.isSameMobileExist(mobile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 邮箱是否已经注册
|
||||
*/
|
||||
@GetMapping("/isExist/email")
|
||||
public boolean isEmailExist(String email) {
|
||||
return iSysUserService.isSameEmailExist(email);
|
||||
}
|
||||
/**
|
||||
* 邮箱是否已经注册
|
||||
*/
|
||||
@GetMapping("/isExist/email")
|
||||
public boolean isEmailExist(String email) {
|
||||
return iSysUserService.isSameEmailExist(email);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户id获取用户信息
|
||||
*/
|
||||
@GetMapping(path = "/{id}")
|
||||
public AccountVO getUserBaseInfoById(@PathVariable Long id) {
|
||||
return this.iSysUserService.getUserBaseInfoById(id);
|
||||
}
|
||||
/**
|
||||
*根据用户id获取用户信息
|
||||
*/
|
||||
@GetMapping(path = "/{id}")
|
||||
public AccountVO getUserBaseInfoById(@PathVariable Long id) {
|
||||
return this.iSysUserService.getUserBaseInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
*/
|
||||
@PutMapping(path = "/{id}")
|
||||
public void modify(@PathVariable Long id, @RequestBody AccountVO userInfo, String vdcode) {
|
||||
this.iSysUserService.modify(id, userInfo, vdcode);
|
||||
}
|
||||
/**
|
||||
*修改用户信息
|
||||
*/
|
||||
@PutMapping(path = "/{id}")
|
||||
public void modify(@PathVariable Long id, @RequestBody AccountVO userInfo, String vdcode) {
|
||||
this.iSysUserService.modify(id, userInfo, vdcode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信关注事件
|
||||
*/
|
||||
@GetMapping(path = "/wxsubscribe")
|
||||
public void wxSubscribe(@RequestParam String wxId) {
|
||||
iSysUserService.wxSubscribeEventHandle(wxId);
|
||||
}
|
||||
/**
|
||||
*微信关注事件
|
||||
*/
|
||||
@GetMapping(path = "/wxsubscribe")
|
||||
public void wxSubscribe(@RequestParam String wxId) {
|
||||
iSysUserService.wxSubscribeEventHandle(wxId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改用户的openId为unionId
|
||||
*/
|
||||
@PutMapping(path = "/batchchange/unionid")
|
||||
public void batchChangeOpenId2UnionId() {
|
||||
this.iSysUserService.batchChangeOpenId2UnionId();
|
||||
}
|
||||
/**
|
||||
*批量修改用户的openId为unionId
|
||||
*/
|
||||
@PutMapping(path = "/batchchange/unionid")
|
||||
public void batchChangeOpenId2UnionId() {
|
||||
this.iSysUserService.batchChangeOpenId2UnionId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户真实姓名
|
||||
*/
|
||||
@PutMapping(path = "/{id}/name")
|
||||
public void updateName(@PathVariable Long id, String name) {
|
||||
this.iSysUserService.updateUserName(id, name);
|
||||
}
|
||||
/**
|
||||
*更新用户真实姓名
|
||||
*/
|
||||
@PutMapping(path = "/{id}/name")
|
||||
public void updateName(@PathVariable Long id, String name) {
|
||||
this.iSysUserService.updateUserName(id, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户昵称
|
||||
*/
|
||||
@PutMapping(path = "/{id}/nickname")
|
||||
public void updateNickname(@PathVariable Long id, String nickname) {
|
||||
this.iSysUserService.updateNickname(id, nickname);
|
||||
}
|
||||
/**
|
||||
*更新用户昵称
|
||||
*/
|
||||
@PutMapping(path = "/{id}/nickname")
|
||||
public void updateNickname(@PathVariable Long id, String nickname) {
|
||||
this.iSysUserService.updateNickname(id, nickname);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户上传头像
|
||||
*/
|
||||
@PostMapping(path = "/{id}/avatar")
|
||||
public void uploadAvatar(@PathVariable Long id, @RequestBody AccountVO accountVO) {
|
||||
this.iSysUserService.updateAvatar(id, accountVO.getAvatarPath());
|
||||
}
|
||||
/**
|
||||
*用户上传头像
|
||||
*/
|
||||
@PostMapping(path = "/{id}/avatar")
|
||||
public void uploadAvatar(@PathVariable Long id, @RequestBody AccountVO accountVO) {
|
||||
this.iSysUserService.updateAvatar(id, accountVO.getAvatarPath());
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送手机验证码
|
||||
*/
|
||||
@PostMapping(path = "/mobile/code")
|
||||
public String sendMobileValidCode(@RequestBody MobileInfoVO mobileInfoVO) {
|
||||
return this.iSysUserService.sendMobileValidCode(mobileInfoVO);
|
||||
}
|
||||
/**
|
||||
*发送手机验证码
|
||||
*/
|
||||
@PostMapping(path = "/mobile/code")
|
||||
public String sendMobileValidCode(@RequestBody MobileInfoVO mobileInfoVO) {
|
||||
return this.iSysUserService.sendMobileValidCode(mobileInfoVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送邮箱验证码
|
||||
*/
|
||||
@PostMapping(path = "/email/code")
|
||||
public String sendEmailValidCode(String email) {
|
||||
return this.iSysUserService.sendEmailValidCode(email);
|
||||
}
|
||||
/**
|
||||
*发送邮箱验证码
|
||||
*/
|
||||
@PostMapping(path = "/email/code")
|
||||
public String sendEmailValidCode(String email) {
|
||||
return this.iSysUserService.sendEmailValidCode(email);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户手机号
|
||||
*/
|
||||
@PutMapping(path = "/{id}/mobile")
|
||||
public void updateMobile(@PathVariable Long id,
|
||||
@RequestBody @Validated UpdateMobileVO updateMobileVO) {
|
||||
this.iSysUserService.updateMobile(id, updateMobileVO);
|
||||
}
|
||||
/**
|
||||
*更新用户手机号
|
||||
*/
|
||||
@PutMapping(path = "/{id}/mobile")
|
||||
public void updateMobile(@PathVariable Long id, @RequestBody @Validated UpdateMobileVO updateMobileVO) {
|
||||
this.iSysUserService.updateMobile(id, updateMobileVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户邮箱
|
||||
*/
|
||||
@PutMapping(path = "/{id}/email")
|
||||
public void updateEmail(@PathVariable Long id,
|
||||
@RequestBody @Validated UpdateEmailVO updateEmailVO) {
|
||||
this.iSysUserService.updateEmail(id, updateEmailVO);
|
||||
}
|
||||
/**
|
||||
*更新用户邮箱
|
||||
*/
|
||||
@PutMapping(path = "/{id}/email")
|
||||
public void updateEmail(@PathVariable Long id, @RequestBody @Validated UpdateEmailVO updateEmailVO) {
|
||||
this.iSysUserService.updateEmail(id, updateEmailVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户登陆密码
|
||||
*/
|
||||
@PutMapping(path = "/{id}/password")
|
||||
public void updatePassword(@PathVariable Long id,
|
||||
@RequestBody @Validated UpdatePasswordVO updatePasswordVO) {
|
||||
this.iSysUserService.updatePassword(id, updatePasswordVO);
|
||||
}
|
||||
/**
|
||||
*更新用户登陆密码
|
||||
*/
|
||||
@PutMapping(path = "/{id}/password")
|
||||
public void updatePassword(@PathVariable Long id, @RequestBody @Validated UpdatePasswordVO updatePasswordVO) {
|
||||
this.iSysUserService.updatePassword(id, updatePasswordVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按条件分页查询指定来源的账号
|
||||
*/
|
||||
@GetMapping("/page/criteria/{source}")
|
||||
public PageVO<AccountVO> queryPagedAccountOfTheSource(UserQueryVO queryVO,
|
||||
@PathVariable String source) {
|
||||
queryVO.setSource(source);
|
||||
return this.iSysUserService.queryPagedUser(queryVO);
|
||||
}
|
||||
/**
|
||||
* 按条件分页查询指定来源的账号
|
||||
*/
|
||||
@GetMapping("/page/criteria/{source}")
|
||||
public PageVO<AccountVO> queryPagedAccountOfTheSource(UserQueryVO queryVO, @PathVariable String source) {
|
||||
queryVO.setSource(source);
|
||||
return this.iSysUserService.queryPagedUser(queryVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 超管重置用户密码
|
||||
*/
|
||||
@PutMapping("/{id}/reset/pwd")
|
||||
public void resetPwd(@PathVariable long id) {
|
||||
iSysUserService.resetPwd(id);
|
||||
}
|
||||
/**
|
||||
* 超管重置用户密码
|
||||
*/
|
||||
@PutMapping("/{id}/reset/pwd")
|
||||
public void resetPwd(@PathVariable long id) {
|
||||
iSysUserService.resetPwd(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 找回密码
|
||||
*/
|
||||
@PutMapping("/retrieve/pwd")
|
||||
public void retrievePwd(@RequestBody @Validated RetrievePwdVO vo) {
|
||||
iSysUserService.retrievePwd(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户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();
|
||||
}
|
||||
/**
|
||||
* 找回密码
|
||||
*/
|
||||
@PutMapping("/retrieve/pwd")
|
||||
public void retrievePwd(@RequestBody @Validated RetrievePwdVO vo) {
|
||||
iSysUserService.retrievePwd(vo);
|
||||
}
|
||||
}
|
||||
|
@ -4,14 +4,11 @@ import club.joylink.rtss.services.voice.IVoiceTrainingService;
|
||||
import club.joylink.rtss.services.voice.baidu.TokenHolder;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.competition.VoiceErrorVO;
|
||||
import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult;
|
||||
import club.joylink.rtss.vo.voice.VoiceVerifyResultVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import club.joylink.rtss.vo.client.competition.VoiceErrorVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@ -23,46 +20,34 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
@RequestMapping("/api/voice")
|
||||
public class VoiceController {
|
||||
|
||||
@Autowired
|
||||
private IVoiceTrainingService iVoiceTrainingService;
|
||||
@Autowired
|
||||
private IVoiceTrainingService iVoiceTrainingService;
|
||||
|
||||
/**
|
||||
* 语音识别
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("recognition")
|
||||
public VoiceRecognitionResult voiceRecognition(MultipartFile file) {
|
||||
return iVoiceTrainingService.voiceRecognition(file);
|
||||
}
|
||||
/**
|
||||
* 语音识别
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("recognition")
|
||||
public VoiceRecognitionResult voiceRecognition(MultipartFile file) {
|
||||
return iVoiceTrainingService.voiceRecognition(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询语音识别错误集
|
||||
*
|
||||
* @param queryVO
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/errorSet/paged")
|
||||
public PageVO<VoiceErrorVO> pagedQueryErrorSet(PageQueryVO queryVO) {
|
||||
return iVoiceTrainingService.pagedQueryErrorSet(queryVO);
|
||||
}
|
||||
/**
|
||||
* 查询语音识别错误集
|
||||
* @param queryVO
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/errorSet/paged")
|
||||
public PageVO<VoiceErrorVO> pagedQueryErrorSet(PageQueryVO queryVO) {
|
||||
return iVoiceTrainingService.pagedQueryErrorSet(queryVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取百度语音识别token
|
||||
*/
|
||||
@GetMapping("/token/baidu")
|
||||
public String getBaiduToken() {
|
||||
return TokenHolder.getInstance().getToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验语音识别结果
|
||||
*/
|
||||
@PostMapping("/verify")
|
||||
public VoiceVerifyResultVO verifyVoice(HttpServletRequest request, @RequestBody byte[] fileData,
|
||||
String text) {
|
||||
String contentType = request.getHeader("Content-Type");
|
||||
return iVoiceTrainingService.verifyVoice(contentType, fileData, text);
|
||||
}
|
||||
/**
|
||||
* 获取百度语音识别token
|
||||
*/
|
||||
@GetMapping("/token/baidu")
|
||||
public String getBaiduToken() {
|
||||
return TokenHolder.getInstance().getToken();
|
||||
}
|
||||
}
|
||||
|
@ -2,55 +2,51 @@ package club.joylink.rtss.controller.voice;
|
||||
|
||||
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
|
||||
import club.joylink.rtss.services.voice.IVoiceDataConfigService;
|
||||
import club.joylink.rtss.services.voice.IVoiceTrainingService;
|
||||
import club.joylink.rtss.services.voice.baidu.TokenHolder;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.competition.VoiceErrorVO;
|
||||
import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult;
|
||||
import club.joylink.rtss.vo.voice.VoiceDiscriminateConfigVO;
|
||||
import club.joylink.rtss.vo.voice.VoiceQueryVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 语音管理接口
|
||||
* 语音AI接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/voice/manage")
|
||||
public class VoiceManageController {
|
||||
|
||||
@Autowired
|
||||
private IVoiceDataConfigService configService;
|
||||
@Autowired
|
||||
private IVoiceDataConfigService configService;
|
||||
|
||||
|
||||
@PostMapping("saveOrUpdate")
|
||||
public void saveOrUpdate(@RequestBody VoiceDiscriminateConfigVO configVO,
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
this.configService.saveOrUpdate(configVO, userInfoVO);
|
||||
}
|
||||
@PostMapping("saveOrUpdate")
|
||||
public void saveOrUpdate(@RequestBody VoiceDiscriminateConfigVO configVO, @RequestAttribute(name= AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
this.configService.saveOrUpdate(configVO,userInfoVO);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("find/{id}")
|
||||
public VoiceDiscriminateConfigVO find(@PathVariable(value = "id") Long id) {
|
||||
return this.configService.byId(id);
|
||||
}
|
||||
@GetMapping("find/{id}")
|
||||
public VoiceDiscriminateConfigVO find(@PathVariable(value = "id") Long id) {
|
||||
return this.configService.byId(id);
|
||||
}
|
||||
|
||||
@GetMapping("query")
|
||||
public PageVO<VoiceDiscriminateConfigVO> query(@ModelAttribute VoiceQueryVO queryVO) {
|
||||
return this.configService.query(queryVO);
|
||||
}
|
||||
@GetMapping("query")
|
||||
public PageVO<VoiceDiscriminateConfigVO> query(@ModelAttribute VoiceQueryVO queryVO){
|
||||
return this.configService.query(queryVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取百度语音识别token
|
||||
*/
|
||||
@GetMapping("{id}/{status}")
|
||||
public void changeStatus(@PathVariable(value = "id") Long id,
|
||||
@PathVariable(value = "status") Integer status,
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
this.configService.changeStatus(id, status, userInfoVO);
|
||||
}
|
||||
/**
|
||||
* 获取百度语音识别token
|
||||
*/
|
||||
@GetMapping("{id}/{status}")
|
||||
public void changeStatus(@PathVariable(value = "id") Long id,@PathVariable(value = "status")Integer status,@RequestAttribute(name= AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
this.configService.changeStatus(id,status,userInfoVO);
|
||||
}
|
||||
}
|
||||
|
@ -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> {
|
||||
}
|
12
src/main/java/club/joylink/rtss/dao/CompanyDAO.java
Normal file
12
src/main/java/club/joylink/rtss/dao/CompanyDAO.java
Normal 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> {
|
||||
////}
|
@ -14,9 +14,8 @@ import java.util.List;
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface PaperQuestionDAO {
|
||||
|
||||
@Select("<script>" +
|
||||
"select * from rts_paper_question where 1 = 1 " +
|
||||
@Select("<script>" +
|
||||
"select * from rts_paper_question where 1 = 1 " +
|
||||
// "<choose>" +
|
||||
// "<when test=\"projectCode == '"+ Project.DEFAULT_PROJECT_CODE +"'\">"+
|
||||
// " and project_code is null" +
|
||||
@ -25,54 +24,48 @@ public interface PaperQuestionDAO {
|
||||
// " and project_code = #{projectCode} "+
|
||||
// " </otherwise>" +
|
||||
// "</choose>" +
|
||||
" and org_id = #{companyId,jdbcType=BIGINT} " +
|
||||
" and org_id = #{companyId,jdbcType=BIGINT} " +
|
||||
// "<if test=\"companyIdList != null and companyIdList.size > 0\">"+
|
||||
// "<foreach collection=\"companyIdList\" open=\" and company_id in (\" close=\")\" item=\"d\" separator=\",\">"+
|
||||
// " #{d} "+
|
||||
// "</foreach></if>"+
|
||||
" and is_del= #{isDelete,jdbcType=INTEGER} " +
|
||||
"<if test=\"types != null and types.size > 0\">" +
|
||||
"<foreach collection=\"types\" open=\" and type in (\" close=\")\" item=\"d\" separator=\",\">" +
|
||||
" #{d} " +
|
||||
"</foreach></if>" +
|
||||
"<if test=\"lable != null and lable.size > 0\"> " +
|
||||
" <foreach collection=\"lable\" open=\" and (\" close=\")\" item=\"d\" separator=\" or \"> " +
|
||||
" find_in_set(#{d},race_lable) > 0 " +
|
||||
" </foreach>" +
|
||||
"</if>" +
|
||||
"</script>")
|
||||
List<PaperQuestionWithBLOBs> findFromAndRaceLable(Long companyId, int isDelete, List<String> lable, List<String> types);
|
||||
" and is_del= #{isDelete,jdbcType=INTEGER} " +
|
||||
"<if test=\"types != null and types.size > 0\">"+
|
||||
"<foreach collection=\"types\" open=\" and type in (\" close=\")\" item=\"d\" separator=\",\">"+
|
||||
" #{d} "+
|
||||
"</foreach></if>"+
|
||||
"<if test=\"lable != null and lable.size > 0\"> " +
|
||||
" <foreach collection=\"lable\" open=\" and (\" close=\")\" item=\"d\" separator=\" or \"> "+
|
||||
" find_in_set(#{d},race_lable) > 0 "+
|
||||
" </foreach>" +
|
||||
"</if>" +
|
||||
"</script>")
|
||||
List<PaperQuestionWithBLOBs> findFromAndRaceLable(Long companyId,int isDelete, List<String> lable, List<String> types);
|
||||
long countByExample(PaperQuestionExample example);
|
||||
|
||||
@Select("<script>" +
|
||||
"select id from rts_paper_question where org_id = #{orgId} "
|
||||
+ "</script>")
|
||||
List<Long> findAllId(@Param("orgId") Long id);
|
||||
int deleteByExample(PaperQuestionExample example);
|
||||
|
||||
long countByExample(PaperQuestionExample example);
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int deleteByExample(PaperQuestionExample example);
|
||||
int insert(PaperQuestionWithBLOBs record);
|
||||
|
||||
int deleteByPrimaryKey(Long id);
|
||||
int insertSelective(PaperQuestionWithBLOBs record);
|
||||
|
||||
int insert(PaperQuestionWithBLOBs record);
|
||||
List<PaperQuestionWithBLOBs> selectByExampleWithBLOBs(PaperQuestionExample example);
|
||||
|
||||
int insertSelective(PaperQuestionWithBLOBs record);
|
||||
List<PaperQuestion> selectByExample(PaperQuestionExample example);
|
||||
|
||||
List<PaperQuestionWithBLOBs> selectByExampleWithBLOBs(PaperQuestionExample example);
|
||||
PaperQuestionWithBLOBs selectByPrimaryKey(Long id);
|
||||
|
||||
List<PaperQuestion> selectByExample(PaperQuestionExample example);
|
||||
int updateByExampleSelective(@Param("record") PaperQuestionWithBLOBs record, @Param("example") PaperQuestionExample example);
|
||||
|
||||
PaperQuestionWithBLOBs selectByPrimaryKey(Long id);
|
||||
int updateByExampleWithBLOBs(@Param("record") PaperQuestionWithBLOBs record, @Param("example") PaperQuestionExample example);
|
||||
|
||||
int updateByExampleSelective(@Param("record") PaperQuestionWithBLOBs record, @Param("example") PaperQuestionExample example);
|
||||
int updateByExample(@Param("record") PaperQuestion record, @Param("example") PaperQuestionExample example);
|
||||
|
||||
int updateByExampleWithBLOBs(@Param("record") PaperQuestionWithBLOBs record, @Param("example") PaperQuestionExample example);
|
||||
int updateByPrimaryKeySelective(PaperQuestionWithBLOBs record);
|
||||
|
||||
int updateByExample(@Param("record") PaperQuestion record, @Param("example") PaperQuestionExample example);
|
||||
int updateByPrimaryKeyWithBLOBs(PaperQuestionWithBLOBs record);
|
||||
|
||||
int updateByPrimaryKeySelective(PaperQuestionWithBLOBs record);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(PaperQuestionWithBLOBs record);
|
||||
|
||||
int updateByPrimaryKey(PaperQuestion record);
|
||||
int updateByPrimaryKey(PaperQuestion record);
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
@ -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);
|
||||
}
|
@ -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);
|
||||
}
|
@ -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);
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -6,365 +6,352 @@ import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.UserQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.org.OrgVO;
|
||||
import club.joylink.rtss.vo.client.user.MobileInfoVO;
|
||||
import club.joylink.rtss.vo.client.user.RetrievePwdVO;
|
||||
import club.joylink.rtss.vo.client.user.UpdateEmailVO;
|
||||
import club.joylink.rtss.vo.client.user.UpdateMobileVO;
|
||||
import club.joylink.rtss.vo.client.user.UpdatePasswordVO;
|
||||
import club.joylink.rtss.vo.client.user.WeChatBindStatusVO;
|
||||
import club.joylink.rtss.vo.client.user.*;
|
||||
import club.joylink.rtss.vo.user.AccountCreateVO;
|
||||
import club.joylink.rtss.vo.user.AccountRegisterVO;
|
||||
import club.joylink.rtss.vo.wx.WmUserSession;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ISysUserService {
|
||||
|
||||
AccountVO queryUserByAccountForMaster(String account);
|
||||
|
||||
AccountVO queryUserByAccount(String account);
|
||||
|
||||
/**
|
||||
* 根据openId查询用户
|
||||
*
|
||||
* @param openid
|
||||
*/
|
||||
AccountVO getUserByWxOpenId(String openid);
|
||||
|
||||
/**
|
||||
* 根据userId 主键查询用户
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
AccountVO findUserById(Long id);
|
||||
|
||||
SysAccount findEntity(@NonNull String account, long orgId);
|
||||
|
||||
boolean isExist(@NonNull String account, long orgId);
|
||||
|
||||
/**
|
||||
* 通过用户姓名或手机号查询
|
||||
*
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<AccountVO> queryUserByNameOrMobile(String query);
|
||||
|
||||
/**
|
||||
* 判断用户是否已经注册
|
||||
*
|
||||
* @param wxId
|
||||
* @return
|
||||
*/
|
||||
Boolean ifRegistered(String wxId);
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
*/
|
||||
void modify(Long id, AccountVO userInfo, String vdcode);
|
||||
|
||||
/**
|
||||
* 分页获取用户数据
|
||||
*/
|
||||
PageVO<AccountVO> queryPagedUser(UserQueryVO queryVO);
|
||||
|
||||
/**
|
||||
* 修改用户角色
|
||||
*
|
||||
* @param id
|
||||
* @param userId
|
||||
* @param accountVO
|
||||
*/
|
||||
void updateUserRole(Long id, Long userId, AccountVO accountVO);
|
||||
|
||||
/**
|
||||
* 是否管理员
|
||||
*
|
||||
* @param accountVO
|
||||
* @return
|
||||
*/
|
||||
boolean isAdmin(AccountVO accountVO);
|
||||
|
||||
/**
|
||||
* 确认用户是管理员,否则,报错
|
||||
*/
|
||||
void confirmAdmin(AccountVO user);
|
||||
|
||||
/**
|
||||
* 根据地图id查询订阅人员
|
||||
*
|
||||
* @param mapId
|
||||
* @return
|
||||
*/
|
||||
List<Long> selectSubscribeUser(long mapId);
|
||||
|
||||
/**
|
||||
* 分页获取用户数据(模糊查询)
|
||||
*
|
||||
* @param fuzzyParam
|
||||
* @return
|
||||
*/
|
||||
List<AccountVO> fuzzyQueryPagedUser(String fuzzyParam);
|
||||
|
||||
/**
|
||||
* 根据名称模糊查询
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
List<AccountVO> fuzzyQueryByName(String name);
|
||||
|
||||
/**
|
||||
* 根据微信小程序openid查询用户
|
||||
*
|
||||
* @param wmOpenId
|
||||
* @return
|
||||
*/
|
||||
AccountVO findUserByWmOpenId(String wmOpenId);
|
||||
|
||||
/**
|
||||
* 根据微信小程序openid获取用户
|
||||
*
|
||||
* @param wmOpenId
|
||||
* @return
|
||||
*/
|
||||
AccountVO getUserByWmOpenId(String wmOpenId);
|
||||
|
||||
/**
|
||||
* 根据unionid查询用户
|
||||
*
|
||||
* @param unionid
|
||||
*/
|
||||
AccountVO findUserByUnionId(String unionid);
|
||||
|
||||
/**
|
||||
* 根据微信openId获取用户
|
||||
*
|
||||
* @param unionId
|
||||
*/
|
||||
AccountVO getUserByUnionId(String unionId);
|
||||
|
||||
/**
|
||||
* 创建微信小程序来的用户
|
||||
*
|
||||
* @param wmUserSession
|
||||
* @return
|
||||
*/
|
||||
AccountVO createUserOfWechatMicro(WmUserSession wmUserSession);
|
||||
|
||||
void createUser(SysAccount account);
|
||||
|
||||
String createAccount(AccountCreateVO accountCreateVO, AccountVO user);
|
||||
|
||||
/**
|
||||
* 更新用户微信小程序openid
|
||||
*
|
||||
* @param id
|
||||
* @param wmOpenId
|
||||
*/
|
||||
void updateUserWmOpenId(Long id, String wmOpenId);
|
||||
|
||||
void updateUserWX(Long userId, WmUserSession wmUserSession);
|
||||
|
||||
/**
|
||||
* 更新用户的unionId
|
||||
*
|
||||
* @param changeUserList
|
||||
*/
|
||||
void updateUserWxUnionId(List<AccountVO> changeUserList);
|
||||
|
||||
/**
|
||||
* 处理微信用户关注事件
|
||||
*
|
||||
* @param wxId
|
||||
* @return
|
||||
*/
|
||||
void wxSubscribeEventHandle(String wxId);
|
||||
|
||||
/**
|
||||
* 把注册用户的openId变为unionId
|
||||
*/
|
||||
void batchChangeOpenId2UnionId();
|
||||
|
||||
/**
|
||||
* 根据账号密码查询用户
|
||||
*
|
||||
* @param account
|
||||
* @param password
|
||||
* @return
|
||||
*/
|
||||
AccountVO findUserByAccountAndPassword(String account, String password, String project);
|
||||
|
||||
/**
|
||||
* 更新用户真实姓名
|
||||
*
|
||||
* @param id
|
||||
* @param name
|
||||
*/
|
||||
void updateUserName(Long id, String name);
|
||||
|
||||
/**
|
||||
* 更新用户昵称
|
||||
*
|
||||
* @param id
|
||||
* @param nickname
|
||||
*/
|
||||
void updateNickname(Long id, String nickname);
|
||||
|
||||
/**
|
||||
* 更新用户头像
|
||||
*
|
||||
* @param id
|
||||
* @param avatarPath
|
||||
*/
|
||||
void updateAvatar(Long id, String avatarPath);
|
||||
|
||||
/**
|
||||
* 更新用户手机号
|
||||
*
|
||||
* @param id
|
||||
* @param updateMobileVO
|
||||
*/
|
||||
void updateMobile(Long id, UpdateMobileVO updateMobileVO);
|
||||
|
||||
/**
|
||||
* 更新用户邮箱地址
|
||||
*
|
||||
* @param id
|
||||
* @param updateEmailVO
|
||||
*/
|
||||
void updateEmail(Long id, UpdateEmailVO updateEmailVO);
|
||||
|
||||
/**
|
||||
* 发送邮箱验证码
|
||||
*
|
||||
* @param email
|
||||
* @return
|
||||
*/
|
||||
String sendEmailValidCode(String email);
|
||||
|
||||
/**
|
||||
* 发送手机验证码
|
||||
*
|
||||
* @param mobileInfoVO
|
||||
* @return
|
||||
*/
|
||||
String sendMobileValidCode(MobileInfoVO mobileInfoVO);
|
||||
|
||||
/**
|
||||
* 查询用户总数量
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getUserAmount();
|
||||
|
||||
/**
|
||||
* 更新用户密码
|
||||
*
|
||||
* @param id
|
||||
* @param updatePasswordVO
|
||||
*/
|
||||
void updatePassword(Long id, UpdatePasswordVO updatePasswordVO);
|
||||
|
||||
/**
|
||||
* 客户端修改用户密码
|
||||
*
|
||||
* @param id
|
||||
* @param password
|
||||
*/
|
||||
void updateUserPassword(Long id, String password);
|
||||
|
||||
AccountVO getUserById(Long id);
|
||||
|
||||
List<AccountVO> findUserByName(String name);
|
||||
|
||||
/**
|
||||
* 是否是超级管理员
|
||||
*/
|
||||
boolean isSuperAdmin(Long id);
|
||||
AccountVO queryUserByAccountForMaster(String account);
|
||||
AccountVO queryUserByAccount(String account);
|
||||
|
||||
/**
|
||||
* 根据openId查询用户
|
||||
*
|
||||
* @param openid
|
||||
*/
|
||||
AccountVO getUserByWxOpenId(String openid);
|
||||
|
||||
/**
|
||||
* 根据userId 主键查询用户
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
AccountVO findUserById(Long id);
|
||||
|
||||
SysAccount findEntity(@NonNull String account, long orgId);
|
||||
|
||||
boolean isExist(@NonNull String account, long orgId);
|
||||
|
||||
/**
|
||||
* 通过用户姓名或手机号查询
|
||||
*
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<AccountVO> queryUserByNameOrMobile(String query);
|
||||
|
||||
/**
|
||||
* 判断用户是否已经注册
|
||||
*
|
||||
* @param wxId
|
||||
* @return
|
||||
*/
|
||||
Boolean ifRegistered(String wxId);
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
*/
|
||||
void modify(Long id, AccountVO userInfo, String vdcode);
|
||||
|
||||
/**
|
||||
* 分页获取用户数据
|
||||
*/
|
||||
PageVO<AccountVO> queryPagedUser(UserQueryVO queryVO);
|
||||
|
||||
/**
|
||||
* 修改用户角色
|
||||
*
|
||||
* @param id
|
||||
* @param userId
|
||||
* @param accountVO
|
||||
*/
|
||||
void updateUserRole(Long id, Long userId, AccountVO accountVO);
|
||||
|
||||
/**
|
||||
* 是否管理员
|
||||
*
|
||||
* @param accountVO
|
||||
* @return
|
||||
*/
|
||||
boolean isAdmin(AccountVO accountVO);
|
||||
|
||||
/**
|
||||
* 确认用户是管理员,否则,报错
|
||||
*/
|
||||
void confirmAdmin(AccountVO user);
|
||||
|
||||
/**
|
||||
* 根据地图id查询订阅人员
|
||||
*
|
||||
* @param mapId
|
||||
* @return
|
||||
*/
|
||||
List<Long> selectSubscribeUser(long mapId);
|
||||
|
||||
/**
|
||||
* 分页获取用户数据(模糊查询)
|
||||
*
|
||||
* @param fuzzyParam
|
||||
* @return
|
||||
*/
|
||||
List<AccountVO> fuzzyQueryPagedUser(String fuzzyParam);
|
||||
|
||||
/**
|
||||
* 根据名称模糊查询
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
List<AccountVO> fuzzyQueryByName(String name);
|
||||
|
||||
/**
|
||||
* 根据微信小程序openid查询用户
|
||||
*
|
||||
* @param wmOpenId
|
||||
* @return
|
||||
*/
|
||||
AccountVO findUserByWmOpenId(String wmOpenId);
|
||||
|
||||
/**
|
||||
* 根据微信小程序openid获取用户
|
||||
*
|
||||
* @param wmOpenId
|
||||
* @return
|
||||
*/
|
||||
AccountVO getUserByWmOpenId(String wmOpenId);
|
||||
|
||||
/**
|
||||
* 根据unionid查询用户
|
||||
*
|
||||
* @param unionid
|
||||
*/
|
||||
AccountVO findUserByUnionId(String unionid);
|
||||
|
||||
/**
|
||||
* 根据微信openId获取用户
|
||||
*
|
||||
* @param unionId
|
||||
*/
|
||||
AccountVO getUserByUnionId(String unionId);
|
||||
|
||||
/**
|
||||
* 创建微信小程序来的用户
|
||||
*
|
||||
* @param wmUserSession
|
||||
* @return
|
||||
*/
|
||||
AccountVO createUserOfWechatMicro(WmUserSession wmUserSession);
|
||||
|
||||
void createUser(SysAccount account);
|
||||
|
||||
String createAccount(AccountCreateVO accountCreateVO, AccountVO user);
|
||||
|
||||
/**
|
||||
* 更新用户微信小程序openid
|
||||
*
|
||||
* @param id
|
||||
* @param wmOpenId
|
||||
*/
|
||||
void updateUserWmOpenId(Long id, String wmOpenId);
|
||||
|
||||
void updateUserWX(Long userId, WmUserSession wmUserSession);
|
||||
|
||||
/**
|
||||
* 更新用户的unionId
|
||||
*
|
||||
* @param changeUserList
|
||||
*/
|
||||
void updateUserWxUnionId(List<AccountVO> changeUserList);
|
||||
|
||||
/**
|
||||
* 处理微信用户关注事件
|
||||
*
|
||||
* @param wxId
|
||||
* @return
|
||||
*/
|
||||
void wxSubscribeEventHandle(String wxId);
|
||||
|
||||
/**
|
||||
* 把注册用户的openId变为unionId
|
||||
*/
|
||||
void batchChangeOpenId2UnionId();
|
||||
|
||||
/**
|
||||
* 根据账号密码查询用户
|
||||
*
|
||||
* @param account
|
||||
* @param password
|
||||
* @return
|
||||
*/
|
||||
AccountVO findUserByAccountAndPassword(String account, String password, String project);
|
||||
|
||||
/**
|
||||
* 更新用户真实姓名
|
||||
*
|
||||
* @param id
|
||||
* @param name
|
||||
*/
|
||||
void updateUserName(Long id, String name);
|
||||
|
||||
/**
|
||||
* 更新用户昵称
|
||||
*
|
||||
* @param id
|
||||
* @param nickname
|
||||
*/
|
||||
void updateNickname(Long id, String nickname);
|
||||
|
||||
/**
|
||||
* 更新用户头像
|
||||
*
|
||||
* @param id
|
||||
* @param avatarPath
|
||||
*/
|
||||
void updateAvatar(Long id, String avatarPath);
|
||||
|
||||
/**
|
||||
* 更新用户手机号
|
||||
*
|
||||
* @param id
|
||||
* @param updateMobileVO
|
||||
*/
|
||||
void updateMobile(Long id, UpdateMobileVO updateMobileVO);
|
||||
|
||||
/**
|
||||
* 更新用户邮箱地址
|
||||
*
|
||||
* @param id
|
||||
* @param updateEmailVO
|
||||
*/
|
||||
void updateEmail(Long id, UpdateEmailVO updateEmailVO);
|
||||
|
||||
/**
|
||||
* 发送邮箱验证码
|
||||
*
|
||||
* @param email
|
||||
* @return
|
||||
*/
|
||||
String sendEmailValidCode(String email);
|
||||
|
||||
/**
|
||||
* 发送手机验证码
|
||||
*
|
||||
* @param mobileInfoVO
|
||||
* @return
|
||||
*/
|
||||
String sendMobileValidCode(MobileInfoVO mobileInfoVO);
|
||||
|
||||
/**
|
||||
* 查询用户总数量
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getUserAmount();
|
||||
|
||||
/**
|
||||
* 更新用户密码
|
||||
*
|
||||
* @param id
|
||||
* @param updatePasswordVO
|
||||
*/
|
||||
void updatePassword(Long id, UpdatePasswordVO updatePasswordVO);
|
||||
|
||||
/**
|
||||
* 客户端修改用户密码
|
||||
*
|
||||
* @param id
|
||||
* @param password
|
||||
*/
|
||||
void updateUserPassword(Long id, String password);
|
||||
|
||||
AccountVO getUserById(Long id);
|
||||
|
||||
List<AccountVO> findUserByName(String name);
|
||||
|
||||
/**
|
||||
* 是否是超级管理员
|
||||
*/
|
||||
boolean isSuperAdmin(Long id);
|
||||
|
||||
/**
|
||||
* 确认用户是超管
|
||||
*/
|
||||
void confirmSuperAdmin(Long userId);
|
||||
|
||||
boolean isExist(Long id);
|
||||
|
||||
/**
|
||||
* 获取微信小程序绑定url
|
||||
*/
|
||||
WeChatBindStatusVO getWeChatBindUrl(LoginUserInfoVO loginInfo);
|
||||
|
||||
/**
|
||||
* 确认用户是超管
|
||||
*/
|
||||
void confirmSuperAdmin(Long userId);
|
||||
/**
|
||||
* 用户绑定微信小程序
|
||||
*
|
||||
* @param code
|
||||
* @param userId
|
||||
*/
|
||||
void userBindWm(String code, Long userId);
|
||||
|
||||
boolean isExist(Long id);
|
||||
OrgVO userScanCodeBindCompanyManager(Long userId, Long companyId);
|
||||
|
||||
/**
|
||||
* 获取微信小程序绑定url
|
||||
*/
|
||||
WeChatBindStatusVO getWeChatBindUrl(LoginUserInfoVO loginInfo);
|
||||
AccountVO getUserBaseInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 用户绑定微信小程序
|
||||
*
|
||||
* @param code
|
||||
* @param userId
|
||||
*/
|
||||
void userBindWm(String code, Long userId);
|
||||
List<AccountVO> getUsersWithEmail();
|
||||
|
||||
OrgVO userScanCodeBindCompanyManager(Long userId, Long companyId);
|
||||
List<AccountVO> getUsersWithMobile();
|
||||
|
||||
AccountVO getUserBaseInfoById(Long id);
|
||||
List<AccountVO> getPlatformUsers();
|
||||
|
||||
List<AccountVO> getUsersWithEmail();
|
||||
List<SysAccount> findEntities(List<Long> ids, String orderBy);
|
||||
|
||||
List<AccountVO> getUsersWithMobile();
|
||||
/**
|
||||
* 确认该用户存在
|
||||
*/
|
||||
void confirmExist(Long id);
|
||||
|
||||
List<AccountVO> getPlatformUsers();
|
||||
void superAdminUpdateUserInfo(AccountVO updateUser, AccountVO superAdmin);
|
||||
|
||||
List<SysAccount> findEntities(List<Long> ids, String orderBy);
|
||||
/**
|
||||
* 查询所有的销售人员
|
||||
*/
|
||||
List<AccountVO> querySellers();
|
||||
|
||||
Map<Long, SysAccount> findEntitiesForMap(List<Long> ids);
|
||||
void deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 确认该用户存在
|
||||
*/
|
||||
void confirmExist(Long id);
|
||||
void register(AccountCreateVO accountCreateVO);
|
||||
|
||||
void superAdminUpdateUserInfo(AccountVO updateUser, AccountVO superAdmin);
|
||||
List<AccountVO> queryUsers(List<Long> userIds);
|
||||
|
||||
/**
|
||||
* 查询所有的销售人员
|
||||
*/
|
||||
List<AccountVO> querySellers();
|
||||
/**
|
||||
* 查询管理和超管
|
||||
*/
|
||||
List<AccountVO> queryAdminsAndSuperAdmins();
|
||||
|
||||
void deleteById(Long id);
|
||||
AccountVO queryOrCreateThirdAccount(String parentAccount, String account);
|
||||
|
||||
void register(AccountCreateVO accountCreateVO);
|
||||
AccountVO getThirdAccount(String account);
|
||||
|
||||
List<AccountVO> queryUsers(List<Long> userIds);
|
||||
void logicDelete(Long id);
|
||||
|
||||
/**
|
||||
* 查询管理和超管
|
||||
*/
|
||||
List<AccountVO> queryAdminsAndSuperAdmins();
|
||||
boolean isThirdParentAccountExist(String parentAccount);
|
||||
|
||||
AccountVO queryOrCreateThirdAccount(String parentAccount, String account, @NotEmpty String name);
|
||||
List<SysAccount> findEntitiesBySource(String source);
|
||||
|
||||
AccountVO getThirdAccount(String account);
|
||||
void resetPwd(long id);
|
||||
|
||||
void logicDelete(Long id);
|
||||
void retrievePwd(RetrievePwdVO vo);
|
||||
|
||||
boolean isThirdParentAccountExist(String parentAccount);
|
||||
void register2(AccountRegisterVO registerVO);
|
||||
|
||||
List<SysAccount> findEntitiesBySource(String source);
|
||||
SysAccount getEntityByMobile(String mobile);
|
||||
|
||||
void resetPwd(long id);
|
||||
boolean isSameMobileExist(String mobile);
|
||||
|
||||
void retrievePwd(RetrievePwdVO vo);
|
||||
|
||||
void register2(AccountRegisterVO registerVO);
|
||||
|
||||
SysAccount getEntityByMobile(String mobile);
|
||||
|
||||
boolean isSameMobileExist(String mobile);
|
||||
|
||||
boolean isSameEmailExist(String email);
|
||||
|
||||
List<AccountVO> listByIds(List<Long> ids);
|
||||
|
||||
List<AccountVO> listAll();
|
||||
boolean isSameEmailExist(String email);
|
||||
}
|
||||
|
@ -6,25 +6,14 @@ import club.joylink.rtss.constants.SystemEnv;
|
||||
import club.joylink.rtss.dao.LearnCommentDAO;
|
||||
import club.joylink.rtss.dao.LearnMessageDAO;
|
||||
import club.joylink.rtss.dao.LearnPostDAO;
|
||||
import club.joylink.rtss.entity.LearnComment;
|
||||
import club.joylink.rtss.entity.LearnCommentExample;
|
||||
import club.joylink.rtss.entity.LearnMessage;
|
||||
import club.joylink.rtss.entity.LearnMessageExample;
|
||||
import club.joylink.rtss.entity.LearnPost;
|
||||
import club.joylink.rtss.entity.LearnPostExample;
|
||||
import club.joylink.rtss.entity.*;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.learn.LearnCommentUpdateVO;
|
||||
import club.joylink.rtss.vo.client.learn.LearnCommentVO;
|
||||
import club.joylink.rtss.vo.client.learn.LearnCreateVO;
|
||||
import club.joylink.rtss.vo.client.learn.LearnMessageUpdateVO;
|
||||
import club.joylink.rtss.vo.client.learn.LearnPostCreateVO;
|
||||
import club.joylink.rtss.vo.client.learn.LearnPostUpdateVO;
|
||||
import club.joylink.rtss.vo.client.learn.LearnPostVO;
|
||||
import club.joylink.rtss.vo.client.learn.*;
|
||||
import club.joylink.rtss.vo.client.post.LearnMessageCreateVO;
|
||||
import club.joylink.rtss.vo.client.post.LearnMessagePagedQueryVO;
|
||||
import club.joylink.rtss.vo.client.post.LearnMessageVO;
|
||||
@ -33,374 +22,362 @@ import club.joylink.rtss.wechat.MiniProgramService;
|
||||
import club.joylink.rtss.wechat.vo.WxError;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class LearnService implements ILearnService {
|
||||
|
||||
@Autowired
|
||||
private LearnPostDAO learnPostDAO;
|
||||
@Autowired
|
||||
private LearnPostDAO learnPostDAO;
|
||||
|
||||
@Autowired
|
||||
private LearnCommentDAO learnCommentDAO;
|
||||
@Autowired
|
||||
private LearnCommentDAO learnCommentDAO;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService iSysUserService;
|
||||
@Autowired
|
||||
private ISysUserService iSysUserService;
|
||||
|
||||
@Autowired
|
||||
private WeChatConfig weChatConfig;
|
||||
@Autowired
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
@Autowired
|
||||
private MiniProgramService miniProgramService;
|
||||
@Autowired
|
||||
private WeChatConfig weChatConfig;
|
||||
|
||||
@Autowired
|
||||
private LearnMessageDAO learnMessageDAO;
|
||||
@Autowired
|
||||
private MiniProgramService miniProgramService;
|
||||
|
||||
@Autowired
|
||||
private OtherConfig otherConfig;
|
||||
@Autowired
|
||||
private LearnMessageDAO learnMessageDAO;
|
||||
|
||||
@Override
|
||||
public PageVO<LearnPostVO> queryPagedPost(LearnPostPagedQueryVO queryVO) {
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
LearnPostExample example = new LearnPostExample();
|
||||
if (queryVO.getProject() != null) {
|
||||
example.createCriteria().andProjectEqualTo(queryVO.getProject());
|
||||
@Autowired
|
||||
private OtherConfig otherConfig;
|
||||
|
||||
@Override
|
||||
public PageVO<LearnPostVO> queryPagedPost(LearnPostPagedQueryVO queryVO) {
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
LearnPostExample example = new LearnPostExample();
|
||||
if (queryVO.getProject() != null) {
|
||||
example.createCriteria().andProjectEqualTo(queryVO.getProject());
|
||||
}
|
||||
Page<LearnPost> page = (Page<LearnPost>) learnPostDAO.selectByExample(example);
|
||||
List<LearnPostVO> vos = page.getResult().stream().map(LearnPostVO::new).collect(Collectors.toList());
|
||||
return PageVO.convert(page, vos);
|
||||
}
|
||||
Page<LearnPost> page = (Page<LearnPost>) learnPostDAO.selectByExample(example);
|
||||
List<LearnPostVO> vos = page.getResult().stream().map(LearnPostVO::new)
|
||||
.collect(Collectors.toList());
|
||||
return PageVO.convert(page, vos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long createPost(LearnPostCreateVO createVO, AccountVO user) {
|
||||
//校验
|
||||
String title = createVO.getTitle();
|
||||
String project = createVO.getProject();
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(title, "名称不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(project, "所属项目不能为空");
|
||||
confirmPostIsNotExist(project);
|
||||
//添加
|
||||
LearnPost post = new LearnPost();
|
||||
post.setProject(project);
|
||||
post.setTitle(title);
|
||||
post.setCreatorId(user.getId());
|
||||
post.setCreateTime(LocalDateTime.now());
|
||||
post.setTopping(false);
|
||||
post.setLike(0);
|
||||
post.setUnlike(0);
|
||||
learnPostDAO.insert(post);
|
||||
return post.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void likePost(Long postId, AccountVO accountVO) {
|
||||
LearnPost post = getPostEntity(postId);
|
||||
post.setLike(post.getLike() + 1);
|
||||
learnPostDAO.updateByPrimaryKey(post);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void unlikePost(Long postId, AccountVO accountVO) {
|
||||
LearnPost post = getPostEntity(postId);
|
||||
post.setUnlike(post.getUnlike() + 1);
|
||||
learnPostDAO.updateByPrimaryKey(post);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LearnPostVO getPostInfo(Long postId) {
|
||||
LearnPost post = getPostEntity(postId);
|
||||
LearnPostVO postVO = new LearnPostVO(post);
|
||||
// 用户昵称
|
||||
AccountVO user = iSysUserService.findUserById(post.getCreatorId());
|
||||
postVO.setUserNickname(user.getNickname());
|
||||
postVO.setAvatarPath(user.getAvatarPath());
|
||||
return postVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageVO<LearnCommentVO> pagedQueryComment(Long messageId, PageQueryVO queryVO) {
|
||||
checkMessageExist(messageId);
|
||||
List<LearnCommentVO> commentVOList = new ArrayList<>();
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
LearnCommentExample commentExample = new LearnCommentExample();
|
||||
commentExample.setOrderByClause("id");
|
||||
commentExample.createCriteria().andMessageIdEqualTo(messageId);
|
||||
Page<LearnComment> page = (Page<LearnComment>) learnCommentDAO.selectByExample(commentExample);
|
||||
page.getResult().forEach(comment -> commentVOList.add(convertComment(comment)));
|
||||
return PageVO.convert(page, commentVOList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LearnCommentVO> queryCommentList(Long messageId) {
|
||||
LearnCommentExample commentExample = new LearnCommentExample();
|
||||
commentExample.createCriteria().andMessageIdEqualTo(messageId);
|
||||
List<LearnComment> comments = learnCommentDAO.selectByExample(commentExample);
|
||||
List<LearnCommentVO> commentVOList = new ArrayList<>();
|
||||
comments.forEach(comment -> commentVOList.add(convertComment(comment)));
|
||||
return commentVOList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 回复数据完善
|
||||
*
|
||||
* @param comment
|
||||
* @return
|
||||
*/
|
||||
private LearnCommentVO convertComment(LearnComment comment) {
|
||||
LearnCommentVO commentVO = new LearnCommentVO(comment);
|
||||
// 用户昵称
|
||||
if (comment.getCreatorId() != null) {
|
||||
String nickname = iSysUserService.findUserById(comment.getCreatorId()).getNickname();
|
||||
commentVO.setUserNickname(nickname);
|
||||
@Override
|
||||
public Long createPost(LearnPostCreateVO createVO, AccountVO user) {
|
||||
//校验
|
||||
String title = createVO.getTitle();
|
||||
String project = createVO.getProject();
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(title, "名称不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(project, "所属项目不能为空");
|
||||
confirmPostIsNotExist(project);
|
||||
//添加
|
||||
LearnPost post = new LearnPost();
|
||||
post.setProject(project);
|
||||
post.setTitle(title);
|
||||
post.setCreatorId(user.getId());
|
||||
post.setCreateTime(LocalDateTime.now());
|
||||
post.setTopping(false);
|
||||
post.setLike(0);
|
||||
post.setUnlike(0);
|
||||
learnPostDAO.insert(post);
|
||||
return post.getId();
|
||||
}
|
||||
// 回复的用户的昵称
|
||||
if (comment.getParentId() != null) {
|
||||
commentVO.setReplyUserNickName(
|
||||
iSysUserService.findUserById(comment.getParentId()).getNickname());
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void likePost(Long postId, AccountVO accountVO) {
|
||||
LearnPost post = getPostEntity(postId);
|
||||
post.setLike(post.getLike() + 1);
|
||||
learnPostDAO.updateByPrimaryKey(post);
|
||||
}
|
||||
// 回复数
|
||||
LearnCommentExample learnCommentExample = new LearnCommentExample();
|
||||
learnCommentExample.createCriteria().andMessageIdEqualTo(comment.getMessageId())
|
||||
.andRootIdEqualTo(comment.getId());
|
||||
commentVO.setCommentCount(learnCommentDAO.countByExample(learnCommentExample));
|
||||
return commentVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addComment(Long messageId, LearnCreateVO commentCreateVO, AccountVO accountVO) {
|
||||
checkMessageExist(messageId);
|
||||
if (SystemEnv.isPrdEnv(otherConfig.getEnv())) {
|
||||
this.checkContent(commentCreateVO.getContent());
|
||||
@Override
|
||||
@Transactional
|
||||
public void unlikePost(Long postId, AccountVO accountVO) {
|
||||
LearnPost post = getPostEntity(postId);
|
||||
post.setUnlike(post.getUnlike() + 1);
|
||||
learnPostDAO.updateByPrimaryKey(post);
|
||||
}
|
||||
LearnComment comment = new LearnComment();
|
||||
comment.setContent(commentCreateVO.getContent());
|
||||
comment.setMessageId(messageId);
|
||||
comment.setCreatorId(accountVO.getId());
|
||||
comment.setCreateTime(LocalDateTime.now());
|
||||
learnCommentDAO.insertSelective(comment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addComment(Long messageId, Long commentId, LearnCreateVO postCreateVO,
|
||||
AccountVO accountVO) {
|
||||
checkMessageExist(messageId);
|
||||
if (SystemEnv.isPrdEnv(otherConfig.getEnv())) {
|
||||
this.checkContent(postCreateVO.getContent());
|
||||
@Override
|
||||
public LearnPostVO getPostInfo(Long postId) {
|
||||
LearnPost post = getPostEntity(postId);
|
||||
LearnPostVO postVO = new LearnPostVO(post);
|
||||
// 用户昵称
|
||||
AccountVO user = iSysUserService.findUserById(post.getCreatorId());
|
||||
postVO.setUserNickname(user.getNickname());
|
||||
postVO.setAvatarPath(user.getAvatarPath());
|
||||
return postVO;
|
||||
}
|
||||
LearnComment comment = new LearnComment();
|
||||
comment.setContent(postCreateVO.getContent());
|
||||
comment.setMessageId(messageId);
|
||||
LearnComment parentComment = learnCommentDAO.selectByPrimaryKey(commentId);
|
||||
if (Objects.isNull(parentComment.getRootId())) { // 对评论的回复
|
||||
comment.setRootId(commentId);
|
||||
} else { // 对回复的回复
|
||||
comment.setRootId(parentComment.getRootId());
|
||||
|
||||
@Override
|
||||
public PageVO<LearnCommentVO> pagedQueryComment(Long messageId, PageQueryVO queryVO) {
|
||||
checkMessageExist(messageId);
|
||||
List<LearnCommentVO> commentVOList = new ArrayList<>();
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
LearnCommentExample commentExample = new LearnCommentExample();
|
||||
commentExample.setOrderByClause("id");
|
||||
commentExample.createCriteria().andMessageIdEqualTo(messageId);
|
||||
Page<LearnComment> page = (Page<LearnComment>) learnCommentDAO.selectByExample(commentExample);
|
||||
page.getResult().forEach(comment -> commentVOList.add(convertComment(comment)));
|
||||
return PageVO.convert(page, commentVOList);
|
||||
}
|
||||
comment.setParentId(parentComment.getCreatorId());
|
||||
comment.setCreatorId(accountVO.getId());
|
||||
comment.setCreateTime(LocalDateTime.now());
|
||||
learnCommentDAO.insertSelective(comment);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void likeComment(Long commentId, AccountVO accountVO) {
|
||||
LearnComment comment = getCommentEntity(commentId);
|
||||
comment.setLike(comment.getLike() + 1);
|
||||
learnCommentDAO.updateByPrimaryKey(comment);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void unlikeComment(Long commentId, AccountVO accountVO) {
|
||||
LearnComment comment = getCommentEntity(commentId);
|
||||
comment.setUnlike(comment.getUnlike() + 1);
|
||||
learnCommentDAO.updateByPrimaryKey(comment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void top(Long postId, AccountVO accountVO) {
|
||||
LearnPost post = topCheck(postId, accountVO);
|
||||
post.setTopping(true);
|
||||
learnPostDAO.updateByPrimaryKey(post);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unTop(Long postId, AccountVO accountVO) {
|
||||
LearnPost post = topCheck(postId, accountVO);
|
||||
post.setTopping(false);
|
||||
learnPostDAO.updateByPrimaryKey(post);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePost(Long postId, AccountVO accountVO) {
|
||||
topCheck(postId, accountVO);
|
||||
//删除留言
|
||||
LearnMessageExample messageExample = new LearnMessageExample();
|
||||
messageExample.createCriteria().andPostIdEqualTo(postId);
|
||||
List<Long> messageIds = learnMessageDAO.selectByExample(messageExample).stream()
|
||||
.map(LearnMessage::getId).collect(Collectors.toList());
|
||||
learnMessageDAO.deleteByExample(messageExample);
|
||||
//删除评论
|
||||
LearnCommentExample commentExample = new LearnCommentExample();
|
||||
commentExample.createCriteria().andMessageIdIn(messageIds);
|
||||
learnCommentDAO.deleteByExample(commentExample);
|
||||
learnPostDAO.deleteByPrimaryKey(postId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adminDeleteComment(Long commentId, AccountVO user) {
|
||||
iSysUserService.confirmAdmin(user);
|
||||
learnCommentDAO.deleteByPrimaryKey(commentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userDeleteComment(Long commentId, AccountVO user) {
|
||||
LearnComment comment = getCommentEntity(commentId);
|
||||
if (!comment.getCreatorId().equals(user.getId())) {
|
||||
log.error(String.format("用户[%s]意外尝试删除别人的评论[%s]", user.getId(), commentId));
|
||||
throw BusinessExceptionAssertEnum.INVALID_OPERATION.exception("无法删除非本人的评论");
|
||||
@Override
|
||||
public List<LearnCommentVO> queryCommentList(Long messageId) {
|
||||
LearnCommentExample commentExample = new LearnCommentExample();
|
||||
commentExample.createCriteria().andMessageIdEqualTo(messageId);
|
||||
List<LearnComment> comments = learnCommentDAO.selectByExample(commentExample);
|
||||
List<LearnCommentVO> commentVOList = new ArrayList<>();
|
||||
comments.forEach(comment -> commentVOList.add(convertComment(comment)));
|
||||
return commentVOList;
|
||||
}
|
||||
learnCommentDAO.deleteByPrimaryKey(commentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long createMessage(LearnMessageCreateVO messageCreateVO, AccountVO user) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
|
||||
StringUtils.hasText(messageCreateVO.getContent()),
|
||||
"内容不能空白");
|
||||
if (SystemEnv.isPrdEnv(otherConfig.getEnv())) {
|
||||
this.checkContent(messageCreateVO.getContent());
|
||||
/**
|
||||
* 回复数据完善
|
||||
*
|
||||
* @param comment
|
||||
* @return
|
||||
*/
|
||||
private LearnCommentVO convertComment(LearnComment comment) {
|
||||
LearnCommentVO commentVO = new LearnCommentVO(comment);
|
||||
// 用户昵称
|
||||
if (comment.getCreatorId() != null) {
|
||||
String nickname = iSysUserService.findUserById(comment.getCreatorId()).getNickname();
|
||||
commentVO.setUserNickname(nickname);
|
||||
}
|
||||
// 回复的用户的昵称
|
||||
if (comment.getParentId() != null) {
|
||||
commentVO.setReplyUserNickName(iSysUserService.findUserById(comment.getParentId()).getNickname());
|
||||
}
|
||||
// 回复数
|
||||
LearnCommentExample learnCommentExample = new LearnCommentExample();
|
||||
learnCommentExample.createCriteria().andMessageIdEqualTo(comment.getMessageId()).andRootIdEqualTo(comment.getId());
|
||||
commentVO.setCommentCount(learnCommentDAO.countByExample(learnCommentExample));
|
||||
return commentVO;
|
||||
}
|
||||
LearnMessage message = messageCreateVO.convert2DB(user.getId());
|
||||
learnMessageDAO.insert(message);
|
||||
LearnMessageExample example = new LearnMessageExample();
|
||||
example.createCriteria().andPostIdEqualTo(messageCreateVO.getPostId());
|
||||
return learnMessageDAO.countByExample(example);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageVO<LearnMessageVO> pagedQueryMessageByPostId(Long postId,
|
||||
LearnMessagePagedQueryVO queryVO) {
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
Page<LearnMessageVO> page = (Page<LearnMessageVO>) learnMessageDAO.select(postId, queryVO);
|
||||
for (LearnMessageVO vo : page.getResult()) {
|
||||
vo.setComments(pagedQueryComment(vo.getId(), new PageQueryVO(1, 3)));
|
||||
@Override
|
||||
public void addComment(Long messageId, LearnCreateVO commentCreateVO, AccountVO accountVO) {
|
||||
checkMessageExist(messageId);
|
||||
if (SystemEnv.isPrdEnv(otherConfig.getEnv())) {
|
||||
this.checkContent(commentCreateVO.getContent());
|
||||
}
|
||||
LearnComment comment = new LearnComment();
|
||||
comment.setContent(commentCreateVO.getContent());
|
||||
comment.setMessageId(messageId);
|
||||
comment.setCreatorId(accountVO.getId());
|
||||
comment.setCreateTime(LocalDateTime.now());
|
||||
learnCommentDAO.insertSelective(comment);
|
||||
}
|
||||
return PageVO.convert(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adminDeleteMessage(Long messageId, AccountVO user) {
|
||||
iSysUserService.confirmAdmin(user);
|
||||
deleteMessage(messageId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userDeleteMessage(Long messageId, AccountVO user) {
|
||||
LearnMessage message = getMessageEntity(messageId);
|
||||
if (!message.getCreatorId().equals(user.getId())) {
|
||||
log.error(String.format("用户[%s]意外尝试删除别人的留言[%s]", user.getId(), messageId));
|
||||
throw BusinessExceptionAssertEnum.INVALID_OPERATION.exception("无法删除非本人的留言");
|
||||
@Override
|
||||
public void addComment(Long messageId, Long commentId, LearnCreateVO postCreateVO, AccountVO accountVO) {
|
||||
checkMessageExist(messageId);
|
||||
if (SystemEnv.isPrdEnv(otherConfig.getEnv())) {
|
||||
this.checkContent(postCreateVO.getContent());
|
||||
}
|
||||
LearnComment comment = new LearnComment();
|
||||
comment.setContent(postCreateVO.getContent());
|
||||
comment.setMessageId(messageId);
|
||||
LearnComment parentComment = learnCommentDAO.selectByPrimaryKey(commentId);
|
||||
if (Objects.isNull(parentComment.getRootId())) { // 对评论的回复
|
||||
comment.setRootId(commentId);
|
||||
} else { // 对回复的回复
|
||||
comment.setRootId(parentComment.getRootId());
|
||||
}
|
||||
comment.setParentId(parentComment.getCreatorId());
|
||||
comment.setCreatorId(accountVO.getId());
|
||||
comment.setCreateTime(LocalDateTime.now());
|
||||
learnCommentDAO.insertSelective(comment);
|
||||
}
|
||||
deleteMessage(messageId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LearnPostVO queryPost(String project) {
|
||||
LearnPostExample example = new LearnPostExample();
|
||||
example.createCriteria().andProjectEqualTo(project);
|
||||
List<LearnPost> learnPosts = learnPostDAO.selectByExample(example);
|
||||
if (CollectionUtils.isEmpty(learnPosts)) {
|
||||
return null;
|
||||
@Override
|
||||
@Transactional
|
||||
public void likeComment(Long commentId, AccountVO accountVO) {
|
||||
LearnComment comment = getCommentEntity(commentId);
|
||||
comment.setLike(comment.getLike() + 1);
|
||||
learnCommentDAO.updateByPrimaryKey(comment);
|
||||
}
|
||||
return new LearnPostVO(learnPosts.get(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageVO<LearnMessageVO> pagedQueryMessageByProject(String project,
|
||||
LearnMessagePagedQueryVO queryVO) {
|
||||
LearnPostVO post = queryPost(project);
|
||||
if (post == null) {
|
||||
log.error(String.format("项目[%s]的留言板不存在", project));
|
||||
throw new SimulationException(SimulationExceptionType.System_Fault, "该项目的留言板不存在");
|
||||
@Override
|
||||
@Transactional
|
||||
public void unlikeComment(Long commentId, AccountVO accountVO) {
|
||||
LearnComment comment = getCommentEntity(commentId);
|
||||
comment.setUnlike(comment.getUnlike() + 1);
|
||||
learnCommentDAO.updateByPrimaryKey(comment);
|
||||
}
|
||||
return pagedQueryMessageByPostId(post.getId(), queryVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePost(Long postId, LearnPostUpdateVO updateVO, AccountVO user) {
|
||||
iSysUserService.confirmAdmin(user);
|
||||
LearnPost entity = getPostEntity(postId);
|
||||
if (Objects.equals(updateVO.getTitle(), entity.getTitle())) {
|
||||
return;
|
||||
@Override
|
||||
public void top(Long postId, AccountVO accountVO) {
|
||||
LearnPost post = topCheck(postId, accountVO);
|
||||
post.setTopping(true);
|
||||
learnPostDAO.updateByPrimaryKey(post);
|
||||
}
|
||||
entity.setTitle(updateVO.getTitle());
|
||||
learnPostDAO.updateByPrimaryKey(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long cgyCreateMessage(LearnMessageCreateVO messageCreateVO) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
|
||||
StringUtils.hasText(messageCreateVO.getContent()),
|
||||
"内容不能空白");
|
||||
LearnMessage message = messageCreateVO.convert2DB(1L);
|
||||
message.setCreatorId(null);
|
||||
message.setUserName(messageCreateVO.getUserName());
|
||||
learnMessageDAO.insert(message);
|
||||
LearnMessageExample example = new LearnMessageExample();
|
||||
example.createCriteria().andPostIdEqualTo(messageCreateVO.getPostId());
|
||||
return learnMessageDAO.countByExample(example);
|
||||
}
|
||||
@Override
|
||||
public void unTop(Long postId, AccountVO accountVO) {
|
||||
LearnPost post = topCheck(postId, accountVO);
|
||||
post.setTopping(false);
|
||||
learnPostDAO.updateByPrimaryKey(post);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cgyAddComment(Long messageId, LearnCreateVO commentCreateVO) {
|
||||
checkMessageExist(messageId);
|
||||
LearnComment comment = new LearnComment();
|
||||
comment.setContent(commentCreateVO.getContent());
|
||||
comment.setMessageId(messageId);
|
||||
comment.setCreateTime(LocalDateTime.now());
|
||||
comment.setUserName(commentCreateVO.getUserName());
|
||||
learnCommentDAO.insertSelective(comment);
|
||||
}
|
||||
@Override
|
||||
public void deletePost(Long postId, AccountVO accountVO) {
|
||||
topCheck(postId, accountVO);
|
||||
//删除留言
|
||||
LearnMessageExample messageExample = new LearnMessageExample();
|
||||
messageExample.createCriteria().andPostIdEqualTo(postId);
|
||||
List<Long> messageIds = learnMessageDAO.selectByExample(messageExample).stream().map(LearnMessage::getId).collect(Collectors.toList());
|
||||
learnMessageDAO.deleteByExample(messageExample);
|
||||
//删除评论
|
||||
LearnCommentExample commentExample = new LearnCommentExample();
|
||||
commentExample.createCriteria().andMessageIdIn(messageIds);
|
||||
learnCommentDAO.deleteByExample(commentExample);
|
||||
learnPostDAO.deleteByPrimaryKey(postId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adminUpdateMessage(LearnMessageUpdateVO messageUpdateVO) {
|
||||
LearnMessage messageEntity = getMessageEntity(messageUpdateVO.getId());
|
||||
messageEntity.setContent(messageUpdateVO.getContent());
|
||||
messageEntity.setCreateTime(messageUpdateVO.getCreateTime());
|
||||
learnMessageDAO.updateByPrimaryKey(messageEntity);
|
||||
}
|
||||
@Override
|
||||
public void adminDeleteComment(Long commentId, AccountVO user) {
|
||||
iSysUserService.confirmAdmin(user);
|
||||
learnCommentDAO.deleteByPrimaryKey(commentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adminUpdateComment(LearnCommentUpdateVO commentUpdateVO) {
|
||||
LearnComment commentEntity = getCommentEntity(commentUpdateVO.getId());
|
||||
commentEntity.setMessageId(commentUpdateVO.getMessageId());
|
||||
commentEntity.setContent(commentUpdateVO.getContent());
|
||||
commentEntity.setCreatorId(commentUpdateVO.getCreatorId());
|
||||
commentEntity.setCreateTime(commentUpdateVO.getCreateTime());
|
||||
learnCommentDAO.updateByPrimaryKey(commentEntity);
|
||||
}
|
||||
@Override
|
||||
public void userDeleteComment(Long commentId, AccountVO user) {
|
||||
LearnComment comment = getCommentEntity(commentId);
|
||||
if (!comment.getCreatorId().equals(user.getId())) {
|
||||
log.error(String.format("用户[%s]意外尝试删除别人的评论[%s]", user.getId(), commentId));
|
||||
throw BusinessExceptionAssertEnum.INVALID_OPERATION.exception("无法删除非本人的评论");
|
||||
}
|
||||
learnCommentDAO.deleteByPrimaryKey(commentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long createMessage(LearnMessageCreateVO messageCreateVO, AccountVO user) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(StringUtils.hasText(messageCreateVO.getContent()),
|
||||
"内容不能空白");
|
||||
if (SystemEnv.isPrdEnv(otherConfig.getEnv())) {
|
||||
this.checkContent(messageCreateVO.getContent());
|
||||
}
|
||||
LearnMessage message = messageCreateVO.convert2DB(user.getId());
|
||||
learnMessageDAO.insert(message);
|
||||
LearnMessageExample example = new LearnMessageExample();
|
||||
example.createCriteria().andPostIdEqualTo(messageCreateVO.getPostId());
|
||||
return learnMessageDAO.countByExample(example);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageVO<LearnMessageVO> pagedQueryMessageByPostId(Long postId, LearnMessagePagedQueryVO queryVO) {
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
Page<LearnMessageVO> page = (Page<LearnMessageVO>) learnMessageDAO.select(postId, queryVO);
|
||||
for (LearnMessageVO vo : page.getResult()) {
|
||||
vo.setComments(pagedQueryComment(vo.getId(), new PageQueryVO(1, 3)));
|
||||
}
|
||||
return PageVO.convert(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adminDeleteMessage(Long messageId, AccountVO user) {
|
||||
iSysUserService.confirmAdmin(user);
|
||||
deleteMessage(messageId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userDeleteMessage(Long messageId, AccountVO user) {
|
||||
LearnMessage message = getMessageEntity(messageId);
|
||||
if (!message.getCreatorId().equals(user.getId())) {
|
||||
log.error(String.format("用户[%s]意外尝试删除别人的留言[%s]", user.getId(), messageId));
|
||||
throw BusinessExceptionAssertEnum.INVALID_OPERATION.exception("无法删除非本人的留言");
|
||||
}
|
||||
deleteMessage(messageId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LearnPostVO queryPost(String project) {
|
||||
LearnPostExample example = new LearnPostExample();
|
||||
example.createCriteria().andProjectEqualTo(project);
|
||||
List<LearnPost> learnPosts = learnPostDAO.selectByExample(example);
|
||||
if (CollectionUtils.isEmpty(learnPosts)) {
|
||||
return null;
|
||||
}
|
||||
return new LearnPostVO(learnPosts.get(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageVO<LearnMessageVO> pagedQueryMessageByProject(String project, LearnMessagePagedQueryVO queryVO) {
|
||||
LearnPostVO post = queryPost(project);
|
||||
if (post == null) {
|
||||
log.error(String.format("项目[%s]的留言板不存在", project));
|
||||
throw new SimulationException(SimulationExceptionType.System_Fault, "该项目的留言板不存在");
|
||||
}
|
||||
return pagedQueryMessageByPostId(post.getId(), queryVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePost(Long postId, LearnPostUpdateVO updateVO, AccountVO user) {
|
||||
iSysUserService.confirmAdmin(user);
|
||||
LearnPost entity = getPostEntity(postId);
|
||||
if (Objects.equals(updateVO.getTitle(), entity.getTitle()))
|
||||
return;
|
||||
entity.setTitle(updateVO.getTitle());
|
||||
learnPostDAO.updateByPrimaryKey(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long cgyCreateMessage(LearnMessageCreateVO messageCreateVO) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(StringUtils.hasText(messageCreateVO.getContent()),
|
||||
"内容不能空白");
|
||||
LearnMessage message = messageCreateVO.convert2DB(1L);
|
||||
message.setCreatorId(null);
|
||||
message.setUserName(messageCreateVO.getUserName());
|
||||
learnMessageDAO.insert(message);
|
||||
LearnMessageExample example = new LearnMessageExample();
|
||||
example.createCriteria().andPostIdEqualTo(messageCreateVO.getPostId());
|
||||
return learnMessageDAO.countByExample(example);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cgyAddComment(Long messageId, LearnCreateVO commentCreateVO) {
|
||||
checkMessageExist(messageId);
|
||||
LearnComment comment = new LearnComment();
|
||||
comment.setContent(commentCreateVO.getContent());
|
||||
comment.setMessageId(messageId);
|
||||
comment.setCreateTime(LocalDateTime.now());
|
||||
comment.setUserName(commentCreateVO.getUserName());
|
||||
learnCommentDAO.insertSelective(comment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adminUpdateMessage(LearnMessageUpdateVO messageUpdateVO) {
|
||||
LearnMessage messageEntity = getMessageEntity(messageUpdateVO.getId());
|
||||
messageEntity.setContent(messageUpdateVO.getContent());
|
||||
messageEntity.setCreateTime(messageUpdateVO.getCreateTime());
|
||||
learnMessageDAO.updateByPrimaryKey(messageEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adminUpdateComment(LearnCommentUpdateVO commentUpdateVO) {
|
||||
LearnComment commentEntity = getCommentEntity(commentUpdateVO.getId());
|
||||
commentEntity.setMessageId(commentUpdateVO.getMessageId());
|
||||
commentEntity.setContent(commentUpdateVO.getContent());
|
||||
commentEntity.setCreatorId(commentUpdateVO.getCreatorId());
|
||||
commentEntity.setCreateTime(commentUpdateVO.getCreateTime());
|
||||
learnCommentDAO.updateByPrimaryKey(commentEntity);
|
||||
}
|
||||
|
||||
// @Transactional
|
||||
// @Override
|
||||
@ -423,55 +400,50 @@ public class LearnService implements ILearnService {
|
||||
// }
|
||||
// }
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void cgyUpdateMessageTime() {
|
||||
LearnMessageExample example = new LearnMessageExample();
|
||||
example.createCriteria().andPostIdEqualTo(27L);
|
||||
List<LearnMessage> allMessage = learnMessageDAO.selectByExample(example);
|
||||
//删重复数据
|
||||
List<LearnMessage> list = allMessage.stream().collect(
|
||||
Collectors.toMap(LearnMessage::getContent, Function.identity(), (old, newValue) -> old))
|
||||
.values().stream().sorted(Comparator.comparingLong(LearnMessage::getId))
|
||||
.collect(Collectors.toList());
|
||||
HashSet<LearnMessage> distinctSet = new HashSet<>(list);
|
||||
List<Long> deleteIds = allMessage.stream().filter(message -> !distinctSet.contains(message))
|
||||
.map(LearnMessage::getId).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(deleteIds)) {
|
||||
example.clear();
|
||||
example.createCriteria().andIdIn(deleteIds);
|
||||
learnMessageDAO.deleteByExample(example);
|
||||
@Transactional
|
||||
@Override
|
||||
public void cgyUpdateMessageTime() {
|
||||
LearnMessageExample example = new LearnMessageExample();
|
||||
example.createCriteria().andPostIdEqualTo(27L);
|
||||
List<LearnMessage> allMessage = learnMessageDAO.selectByExample(example);
|
||||
//删重复数据
|
||||
List<LearnMessage> list = allMessage.stream().collect(Collectors.toMap(LearnMessage::getContent, Function.identity(), (old, newValue) -> old))
|
||||
.values().stream().sorted(Comparator.comparingLong(LearnMessage::getId)).collect(Collectors.toList());
|
||||
HashSet<LearnMessage> distinctSet = new HashSet<>(list);
|
||||
List<Long> deleteIds = allMessage.stream().filter(message -> !distinctSet.contains(message)).map(LearnMessage::getId).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(deleteIds)) {
|
||||
example.clear();
|
||||
example.createCriteria().andIdIn(deleteIds);
|
||||
learnMessageDAO.deleteByExample(example);
|
||||
}
|
||||
//修改时间
|
||||
int day = 365 * 4;
|
||||
Random random = new Random();
|
||||
List<Integer> dayOffsetList = new ArrayList<>();
|
||||
for (LearnMessage ignored : list) {
|
||||
dayOffsetList.add(random.nextInt(day));
|
||||
}
|
||||
dayOffsetList.sort((i1, i2) -> i2 - i1);
|
||||
Map<Integer, Long> dayCountMap = dayOffsetList.stream().collect(Collectors.groupingBy(Function.identity(), LinkedHashMap::new, Collectors.counting()));
|
||||
int startIndex = 0;
|
||||
LocalDateTime now = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0);
|
||||
for (Integer dayOffset : dayCountMap.keySet()) {
|
||||
List<Integer> secondsOffsetList = new ArrayList<>();
|
||||
Long dayCount = dayCountMap.get(dayOffset);
|
||||
for (int i = 0; i < dayCount; i++) {
|
||||
secondsOffsetList.add(random.nextInt(24 * 3600 - 8 * 3600) + 8 * 3600);
|
||||
secondsOffsetList.sort(Integer::compareTo);
|
||||
}
|
||||
for (int i = startIndex; i < startIndex + dayCount; i++) {
|
||||
LearnMessage message = list.get(i);
|
||||
message.setCreateTime(now.minusDays(dayOffset).plusSeconds(secondsOffsetList.get(i - startIndex)));
|
||||
learnMessageDAO.updateByPrimaryKey(message);
|
||||
}
|
||||
startIndex += dayCount;
|
||||
}
|
||||
}
|
||||
//修改时间
|
||||
int day = 365 * 4;
|
||||
Random random = new Random();
|
||||
List<Integer> dayOffsetList = new ArrayList<>();
|
||||
for (LearnMessage ignored : list) {
|
||||
dayOffsetList.add(random.nextInt(day));
|
||||
}
|
||||
dayOffsetList.sort((i1, i2) -> i2 - i1);
|
||||
Map<Integer, Long> dayCountMap = dayOffsetList.stream().collect(
|
||||
Collectors.groupingBy(Function.identity(), LinkedHashMap::new, Collectors.counting()));
|
||||
int startIndex = 0;
|
||||
LocalDateTime now = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0);
|
||||
for (Integer dayOffset : dayCountMap.keySet()) {
|
||||
List<Integer> secondsOffsetList = new ArrayList<>();
|
||||
Long dayCount = dayCountMap.get(dayOffset);
|
||||
for (int i = 0; i < dayCount; i++) {
|
||||
secondsOffsetList.add(random.nextInt(24 * 3600 - 8 * 3600) + 8 * 3600);
|
||||
secondsOffsetList.sort(Integer::compareTo);
|
||||
}
|
||||
for (int i = startIndex; i < startIndex + dayCount; i++) {
|
||||
LearnMessage message = list.get(i);
|
||||
message.setCreateTime(
|
||||
now.minusDays(dayOffset).plusSeconds(secondsOffsetList.get(i - startIndex)));
|
||||
learnMessageDAO.updateByPrimaryKey(message);
|
||||
}
|
||||
startIndex += dayCount;
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// @Override
|
||||
// public Integer likeMessage(Long messageId) {
|
||||
// LearnMessageWithBLOBs message = getMessage(messageId);
|
||||
// message.setLike(message.getLike() == null ? 0 : message.getLike() + 1);
|
||||
@ -487,38 +459,38 @@ public class LearnService implements ILearnService {
|
||||
// return message.getUnlike();
|
||||
// }
|
||||
|
||||
private LearnComment findCommentEntity(Long commentId) {
|
||||
return learnCommentDAO.selectByPrimaryKey(commentId);
|
||||
}
|
||||
private LearnComment findCommentEntity(Long commentId) {
|
||||
return learnCommentDAO.selectByPrimaryKey(commentId);
|
||||
}
|
||||
|
||||
private LearnComment getCommentEntity(Long commentId) {
|
||||
LearnComment comment = findCommentEntity(commentId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(comment,
|
||||
"该评论不存在或已被删除");
|
||||
return comment;
|
||||
}
|
||||
private LearnComment getCommentEntity(Long commentId) {
|
||||
LearnComment comment = findCommentEntity(commentId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(comment,
|
||||
"该评论不存在或已被删除");
|
||||
return comment;
|
||||
}
|
||||
|
||||
private void deleteMessage(Long messageId) {
|
||||
learnMessageDAO.deleteByPrimaryKey(messageId);
|
||||
deleteCommentByMessageId(messageId);
|
||||
}
|
||||
private void deleteMessage(Long messageId) {
|
||||
learnMessageDAO.deleteByPrimaryKey(messageId);
|
||||
deleteCommentByMessageId(messageId);
|
||||
}
|
||||
|
||||
private void deleteCommentByMessageId(Long messageId) {
|
||||
LearnCommentExample example = new LearnCommentExample();
|
||||
example.createCriteria().andMessageIdEqualTo(messageId);
|
||||
learnCommentDAO.deleteByExample(example);
|
||||
}
|
||||
private void deleteCommentByMessageId(Long messageId) {
|
||||
LearnCommentExample example = new LearnCommentExample();
|
||||
example.createCriteria().andMessageIdEqualTo(messageId);
|
||||
learnCommentDAO.deleteByExample(example);
|
||||
}
|
||||
|
||||
private LearnPost topCheck(Long postId, AccountVO accountVO) {
|
||||
iSysUserService.confirmAdmin(accountVO);
|
||||
LearnPost post = getPostEntity(postId);
|
||||
return post;
|
||||
}
|
||||
private LearnPost topCheck(Long postId, AccountVO accountVO) {
|
||||
iSysUserService.confirmAdmin(accountVO);
|
||||
LearnPost post = getPostEntity(postId);
|
||||
return post;
|
||||
}
|
||||
|
||||
private void checkContent(String content) {
|
||||
WxError wxError = this.miniProgramService.msgSecCheck(content);
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(wxError.isError(),
|
||||
String.format("内容校验不通过: [%s]", wxError.toString()));
|
||||
private void checkContent(String content) {
|
||||
WxError wxError = this.miniProgramService.msgSecCheck(content);
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(wxError.isError(),
|
||||
String.format("内容校验不通过: [%s]", wxError.toString()));
|
||||
// Map<String, String> param = new HashMap<>();
|
||||
// param.put("content", content);
|
||||
// WxBaseResp resp = restTemplate.postForObject(weChatConfig.getMsgSecCheckUrl(), param, WxBaseResp.class);
|
||||
@ -530,46 +502,44 @@ public class LearnService implements ILearnService {
|
||||
// } else {
|
||||
// throw new BusinessException(ExceptionMapping.SERVER_CALL_EXCEPTION);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 留言检查
|
||||
*/
|
||||
private void checkMessageExist(Long messageId) {
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(findMessageEntity(messageId),
|
||||
String.format("id为[%s]的留言不存在", messageId));
|
||||
}
|
||||
/**
|
||||
* 留言检查
|
||||
*/
|
||||
private void checkMessageExist(Long messageId) {
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(findMessageEntity(messageId),
|
||||
String.format("id为[%s]的留言不存在", messageId));
|
||||
}
|
||||
|
||||
private LearnMessage findMessageEntity(Long messageId) {
|
||||
return learnMessageDAO.selectByPrimaryKey(messageId);
|
||||
}
|
||||
private LearnMessage findMessageEntity(Long messageId) {
|
||||
return learnMessageDAO.selectByPrimaryKey(messageId);
|
||||
}
|
||||
|
||||
private LearnMessage getMessageEntity(Long messageId) {
|
||||
LearnMessage message = findMessageEntity(messageId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(message,
|
||||
String.format("id为[%s]的留言不存在", messageId));
|
||||
return message;
|
||||
}
|
||||
private LearnMessage getMessageEntity(Long messageId) {
|
||||
LearnMessage message = findMessageEntity(messageId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(message, String.format("id为[%s]的留言不存在", messageId));
|
||||
return message;
|
||||
}
|
||||
|
||||
private LearnPost findPostEntity(Long postId) {
|
||||
return learnPostDAO.selectByPrimaryKey(postId);
|
||||
}
|
||||
private LearnPost findPostEntity(Long postId) {
|
||||
return learnPostDAO.selectByPrimaryKey(postId);
|
||||
}
|
||||
|
||||
private LearnPost getPostEntity(Long postId) {
|
||||
LearnPost post = findPostEntity(postId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(post);
|
||||
return post;
|
||||
}
|
||||
private LearnPost getPostEntity(Long postId) {
|
||||
LearnPost post = findPostEntity(postId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(post);
|
||||
return post;
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认该项目的留言板不存在
|
||||
*/
|
||||
private void confirmPostIsNotExist(String project) {
|
||||
LearnPostExample example = new LearnPostExample();
|
||||
example.createCriteria().andProjectEqualTo(project);
|
||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertTrue(
|
||||
learnPostDAO.countByExample(example) == 0,
|
||||
String.format("项目[%s]下留言板已存在", project));
|
||||
}
|
||||
/**
|
||||
* 确认该项目的留言板不存在
|
||||
*/
|
||||
private void confirmPostIsNotExist(String project) {
|
||||
LearnPostExample example = new LearnPostExample();
|
||||
example.createCriteria().andProjectEqualTo(project);
|
||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertTrue(learnPostDAO.countByExample(example) == 0,
|
||||
String.format("项目[%s]下留言板已存在", project));
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,6 @@ package club.joylink.rtss.services.auth;
|
||||
import club.joylink.rtss.configuration.configProp.OtherConfig;
|
||||
import club.joylink.rtss.configuration.configProp.WeChatConfig;
|
||||
import club.joylink.rtss.constants.Client;
|
||||
import club.joylink.rtss.constants.ProjectCode;
|
||||
import club.joylink.rtss.dao.SysAccountLoginDAO;
|
||||
import club.joylink.rtss.entity.SysAccountLogin;
|
||||
import club.joylink.rtss.entity.project.Project;
|
||||
@ -23,7 +22,6 @@ import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.client.LoginStatusVO;
|
||||
import club.joylink.rtss.vo.client.LoginUserVO;
|
||||
import club.joylink.rtss.vo.client.SocketMessageVO;
|
||||
import club.joylink.rtss.vo.client.cgy.CgyThirdPartyLoginInfoVO;
|
||||
import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
|
||||
import club.joylink.rtss.vo.client.project.ProjectDeviceVO;
|
||||
import club.joylink.rtss.vo.client.project.RelationLoginConfigVO;
|
||||
@ -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 去除设置组织信息
|
||||
*/
|
||||
@ -404,7 +384,8 @@ public class AuthenticateService implements IAuthenticateService {
|
||||
.assertTrue(this.iSysUserService.isThirdParentAccountExist(loginInfo.getParentAccount()),
|
||||
String.format("第三方企业账号不存在: %s", loginInfo.getParentAccount()));
|
||||
AccountVO accountVO = this.iSysUserService.queryOrCreateThirdAccount(
|
||||
loginInfo.getParentAccount(), loginInfo.getAccount(), null);
|
||||
loginInfo.getParentAccount(),
|
||||
loginInfo.getAccount());
|
||||
Client client = Client.getByIdAndSecret(loginInfo.getClientId(), loginInfo.getSecret());
|
||||
ProjectVO projectVO = projectService.queryLoginProjectByCode(loginInfo.getProject());
|
||||
// 构造登陆用户信息
|
||||
@ -497,8 +478,6 @@ public class AuthenticateService implements IAuthenticateService {
|
||||
case ILW:
|
||||
case PIS_STAND:
|
||||
case PIS_TRAIN:
|
||||
case PIS:
|
||||
case TMS:
|
||||
case VR_IBP: {
|
||||
RelationLoginConfigVO config = deviceVO.buildRelationLoginConfig();
|
||||
if (Objects.nonNull(config) && Objects.nonNull(config.getDeviceCode())) {
|
||||
|
@ -5,127 +5,120 @@ import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.client.LoginStatusVO;
|
||||
import club.joylink.rtss.vo.client.LoginUserVO;
|
||||
import club.joylink.rtss.vo.client.cgy.CgyThirdPartyLoginInfoVO;
|
||||
|
||||
public interface IAuthenticateService {
|
||||
|
||||
/**
|
||||
* 获取登陆状态/token
|
||||
*
|
||||
* @param sessionId
|
||||
* @return
|
||||
*/
|
||||
LoginStatusVO checkStatus(String sessionId);
|
||||
/**
|
||||
* 获取登陆状态/token
|
||||
*
|
||||
* @param sessionId
|
||||
* @return
|
||||
*/
|
||||
LoginStatusVO checkStatus(String sessionId);
|
||||
|
||||
|
||||
/**
|
||||
* 通过密码登陆
|
||||
*
|
||||
* @param loginUser
|
||||
*/
|
||||
String loginWithPwd(LoginUserVO loginUser);
|
||||
/**
|
||||
* 通过密码登陆
|
||||
*
|
||||
* @param loginUser
|
||||
*/
|
||||
String loginWithPwd(LoginUserVO loginUser);
|
||||
|
||||
/**
|
||||
* 第三方登录
|
||||
*
|
||||
* @param loginInfo
|
||||
* @return
|
||||
*/
|
||||
String thirdPartyLogin(LoginUserVO loginInfo);
|
||||
/**
|
||||
* 第三方登录
|
||||
*
|
||||
* @param loginInfo
|
||||
* @return
|
||||
*/
|
||||
String thirdPartyLogin(LoginUserVO loginInfo);
|
||||
|
||||
/**
|
||||
* 登出
|
||||
*
|
||||
* @param token
|
||||
*/
|
||||
void logout(String token);
|
||||
/**
|
||||
* 登出
|
||||
*
|
||||
* @param token
|
||||
*/
|
||||
void logout(String token);
|
||||
|
||||
/**
|
||||
* 微信小程序扫登陆二维码
|
||||
*
|
||||
* @param code
|
||||
* @param state
|
||||
* @return
|
||||
*/
|
||||
AccountVO scanWmLoginQrCode(String code, String state);
|
||||
/**
|
||||
* 微信小程序扫登陆二维码
|
||||
*
|
||||
* @param code
|
||||
* @param state
|
||||
* @return
|
||||
*/
|
||||
AccountVO scanWmLoginQrCode(String code, String state);
|
||||
|
||||
/**
|
||||
* 获取微信小程序登陆url
|
||||
*
|
||||
* @param clientId
|
||||
* @param secret
|
||||
* @param project
|
||||
* @param deviceCode
|
||||
* @return
|
||||
*/
|
||||
// LoginStatusVO getWmLoginUrl(String clientId, String secret, Project project, String deviceCode);
|
||||
/**
|
||||
* 获取微信小程序登陆url
|
||||
*
|
||||
* @param clientId
|
||||
* @param secret
|
||||
* @param project
|
||||
* @param deviceCode
|
||||
* @return
|
||||
*/
|
||||
// LoginStatusVO getWmLoginUrl(String clientId, String secret, Project project, String deviceCode);
|
||||
|
||||
/**
|
||||
* TODO 20220922 用于替换上方方法 占位
|
||||
* <p>
|
||||
* 测试文档后删除相关注释
|
||||
*/
|
||||
LoginStatusVO getWmLoginUrl(String clientId, String secret, String projectCode,
|
||||
String deviceCode);
|
||||
/**
|
||||
* TODO 20220922 用于替换上方方法 占位
|
||||
* <p>
|
||||
* 测试文档后删除相关注释
|
||||
*/
|
||||
LoginStatusVO getWmLoginUrl(String clientId, String secret, String projectCode, String deviceCode);
|
||||
|
||||
/**
|
||||
* 微信小程序确认登陆
|
||||
*
|
||||
* @param code
|
||||
* @param state
|
||||
*/
|
||||
void wmConfirmClientLogin(String code, String state);
|
||||
/**
|
||||
* 微信小程序确认登陆
|
||||
*
|
||||
* @param code
|
||||
* @param state
|
||||
*/
|
||||
void wmConfirmClientLogin(String code, String state);
|
||||
|
||||
/**
|
||||
* 通过token获取登陆用户信息
|
||||
*
|
||||
* @param token
|
||||
*/
|
||||
LoginUserInfoVO getLoginUserInfoByToken(String token);
|
||||
/**
|
||||
* 通过token获取登陆用户信息
|
||||
*
|
||||
* @param token
|
||||
*/
|
||||
LoginUserInfoVO getLoginUserInfoByToken(String token);
|
||||
|
||||
/**
|
||||
* 根据微信小程序code获取用户(若不存在,创建用户);若已登录,则绑定微信
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
AccountVO getOrCreateUserByWmcode(WxApiService.MiniApp miniApp, String code);
|
||||
/**
|
||||
* 根据微信小程序code获取用户(若不存在,创建用户);若已登录,则绑定微信
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
AccountVO getOrCreateUserByWmcode(WxApiService.MiniApp miniApp, String code);
|
||||
|
||||
/**
|
||||
* 玖琏科技小程序code换token
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
String getTokenByWmCode(String code);
|
||||
/**
|
||||
* 玖琏科技小程序code换token
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
String getTokenByWmCode(String code);
|
||||
|
||||
/**
|
||||
* 到那儿了小程序code换token
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
String getTokenByWmCode2(String code);
|
||||
/**
|
||||
* 到那儿了小程序code换token
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
String getTokenByWmCode2(String code);
|
||||
|
||||
/**
|
||||
* 郑州共赢小程序code换token
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
String getTokenByWmCode3(String code);
|
||||
/**
|
||||
* 郑州共赢小程序code换token
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
String getTokenByWmCode3(String code);
|
||||
|
||||
boolean isTokenExpired(String token);
|
||||
boolean isTokenExpired(String token);
|
||||
|
||||
/**
|
||||
* 预登出(前端在刷新/关闭标签页的时候调用)
|
||||
*
|
||||
* @param token
|
||||
*/
|
||||
void preLogout(String token);
|
||||
|
||||
/**
|
||||
* 成工业虚仿平台跳转登录接口
|
||||
*/
|
||||
String cgyThirdPartyLogin(CgyThirdPartyLoginInfoVO loginInfo);
|
||||
/**
|
||||
* 预登出(前端在刷新/关闭标签页的时候调用)
|
||||
*
|
||||
* @param token
|
||||
*/
|
||||
void preLogout(String token);
|
||||
}
|
||||
|
@ -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)); //实训时长
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,14 +1,26 @@
|
||||
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 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 org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 交路生成
|
||||
*/
|
||||
@ -122,7 +134,7 @@ public class RoutingGenerator {
|
||||
if (signal == null) {
|
||||
Section base = section;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
Section next = base.getSectionOf(right);
|
||||
Section next = base.findNextRunningSectionBaseRealSwitch(right);
|
||||
if (next == null) { // 可能到尽头了
|
||||
return;
|
||||
}
|
||||
|
@ -15,98 +15,91 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public interface IOrgService {
|
||||
OrgVO createTopOrg(TopOrgCreateVO topOrgCreateVO, AccountVO user);
|
||||
|
||||
/**
|
||||
* 查找默认组织
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Org findDefaultOrg();
|
||||
List<OrgVO> queryAllTopOrg();
|
||||
|
||||
OrgVO createTopOrg(TopOrgCreateVO topOrgCreateVO, AccountVO user);
|
||||
PageVO<OrgVO> pagedQueryAllTopOrg(OrgQueryVO queryVO);
|
||||
|
||||
List<OrgVO> queryAllTopOrg();
|
||||
void confirmExist(Long orgId);
|
||||
|
||||
PageVO<OrgVO> pagedQueryAllTopOrg(OrgQueryVO queryVO);
|
||||
OrgVO createCls(NonTopOrgCreateVO createVO, LoginUserInfoVO loginInfo);
|
||||
|
||||
void confirmExist(Long orgId);
|
||||
Org getEntity(long orgId);
|
||||
|
||||
OrgVO createCls(NonTopOrgCreateVO createVO, LoginUserInfoVO loginInfo);
|
||||
Org findEntity(long orgId);
|
||||
|
||||
Org getEntity(long orgId);
|
||||
// TODO 20220922 将Project 修改为 String
|
||||
Collection<Org> getEntities(String project, String status);
|
||||
|
||||
Org findEntity(long orgId);
|
||||
// TODO 20220922 将Project 修改为 String
|
||||
Collection<Org> findEntities(String project, String status);
|
||||
|
||||
// TODO 20220922 将Project 修改为 String
|
||||
Collection<Org> getEntities(String project, String status);
|
||||
OrgVO updateOrg(Long id, OrgVO orgVO, AccountVO user);
|
||||
|
||||
// TODO 20220922 将Project 修改为 String
|
||||
Collection<Org> findEntities(String project, String status);
|
||||
/**
|
||||
* 删除非顶级组织
|
||||
*
|
||||
* @param nonTopOrgId
|
||||
*/
|
||||
void deleteNonTopOrg(Long nonTopOrgId);
|
||||
|
||||
OrgVO updateOrg(Long id, OrgVO orgVO, AccountVO user);
|
||||
List<Org> findEntitiesByParentId(Long parentId, String orderBy, String status);
|
||||
|
||||
/**
|
||||
* 删除非顶级组织
|
||||
*
|
||||
* @param nonTopOrgId
|
||||
*/
|
||||
void deleteNonTopOrg(Long nonTopOrgId);
|
||||
/**
|
||||
* 分页查询自己创建的班级
|
||||
*/
|
||||
PageVO<OrgVO> pagedQueryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo);
|
||||
|
||||
List<Org> findEntitiesByParentId(Long parentId, String orderBy, String status);
|
||||
/**
|
||||
* 查询自己创建的班级
|
||||
*/
|
||||
List<OrgVO> queryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo);
|
||||
|
||||
/**
|
||||
* 分页查询自己创建的班级
|
||||
*/
|
||||
PageVO<OrgVO> pagedQueryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo);
|
||||
/**
|
||||
* 获取该组织所属的顶级组织
|
||||
*/
|
||||
Org getTopOrgEntity(Long orgId);
|
||||
|
||||
/**
|
||||
* 查询自己创建的班级
|
||||
*/
|
||||
List<OrgVO> queryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo);
|
||||
List<Org> findEntities(List<Long> orgIds, String status);
|
||||
|
||||
/**
|
||||
* 获取该组织所属的顶级组织
|
||||
*/
|
||||
Org getTopOrgEntity(Long orgId);
|
||||
/**
|
||||
* 管理员分页查询组织
|
||||
*/
|
||||
Node<Object> adminQueryOrgTree(Long orgId);
|
||||
|
||||
List<Org> findEntities(List<Long> orgIds, String status);
|
||||
OrgVO get(Long id);
|
||||
|
||||
/**
|
||||
* 管理员分页查询组织
|
||||
*/
|
||||
Node<Object> adminQueryOrgTree(Long orgId);
|
||||
/**
|
||||
* 查询这些考试关联的班级
|
||||
*/
|
||||
List<ExamDefinitionVO> queryByExamIds(List<Long> examIds, String status);
|
||||
|
||||
OrgVO get(Long id);
|
||||
void confirmIsTopOrg(long id);
|
||||
|
||||
/**
|
||||
* 查询这些考试关联的班级
|
||||
*/
|
||||
List<ExamDefinitionVO> queryByExamIds(List<Long> examIds, String status);
|
||||
void confirmIsNonTopOrg(Long id);
|
||||
|
||||
void confirmIsTopOrg(long id);
|
||||
List<Org> queryAllSubOrgs(Long orgId);
|
||||
|
||||
void confirmIsNonTopOrg(Long id);
|
||||
String getBindQrCode(long orgId, String project);
|
||||
|
||||
List<Org> queryAllSubOrgs(Long orgId);
|
||||
/**
|
||||
* 获取该用户所属的顶级组织
|
||||
*/
|
||||
Org getTopOrgOfUser(long userId);
|
||||
|
||||
String getBindQrCode(long orgId, String project);
|
||||
Org findTopOrgOfUser(long userId);
|
||||
|
||||
/**
|
||||
* 获取该用户所属的顶级组织
|
||||
*/
|
||||
Org getTopOrgOfUser(long userId);
|
||||
/**
|
||||
* 查询该组织下的所有班级。
|
||||
* 目前组织结构仅有两级,非顶级的就是班级。
|
||||
*/
|
||||
List<OrgVO> listQueryCls(long topOrgId);
|
||||
|
||||
Org findTopOrgOfUser(long userId);
|
||||
/**
|
||||
* 查询组织信息(可能返回null)
|
||||
*/
|
||||
OrgVO query(Long id);
|
||||
|
||||
/**
|
||||
* 查询该组织下的所有班级。 目前组织结构仅有两级,非顶级的就是班级。
|
||||
*/
|
||||
List<OrgVO> listQueryCls(long topOrgId);
|
||||
|
||||
/**
|
||||
* 查询组织信息(可能返回null)
|
||||
*/
|
||||
OrgVO query(Long id);
|
||||
|
||||
OrgVO getTopOrg(long topOrgId);
|
||||
OrgVO getTopOrg(long topOrgId);
|
||||
}
|
||||
|
@ -1,13 +1,11 @@
|
||||
package club.joylink.rtss.services.org;
|
||||
|
||||
import club.joylink.rtss.constants.BusinessConsts;
|
||||
import club.joylink.rtss.constants.Project;
|
||||
import club.joylink.rtss.dao.OrgDAO;
|
||||
import club.joylink.rtss.entity.*;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.ISysUserService;
|
||||
import club.joylink.rtss.services.QRCodeManager;
|
||||
import club.joylink.rtss.services.cache.ICacheService;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
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 com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.annotation.PostConstruct;
|
||||
import lombok.NonNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -32,470 +28,444 @@ import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class OrgService implements IOrgService {
|
||||
@Autowired
|
||||
private OrgDAO orgDAO;
|
||||
|
||||
@Autowired
|
||||
private OrgDAO orgDAO;
|
||||
@Autowired
|
||||
private IOrgUserService iOrgUserService;
|
||||
|
||||
@Autowired
|
||||
private IOrgUserService iOrgUserService;
|
||||
@Autowired
|
||||
private ISysUserService iSysUserService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService iSysUserService;
|
||||
@Autowired
|
||||
private QRCodeManager qrCodeManager;
|
||||
|
||||
@Autowired
|
||||
private QRCodeManager qrCodeManager;
|
||||
@Autowired
|
||||
private IOrgProjectService orgProjectService;
|
||||
|
||||
@Autowired
|
||||
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;
|
||||
@Transactional
|
||||
@Override
|
||||
public OrgVO createTopOrg(TopOrgCreateVO topOrgCreateVO, AccountVO user) {
|
||||
confirmNameUnique(null, topOrgCreateVO.getName());
|
||||
/* 处理 */
|
||||
Org entity = topOrgCreateVO.toDB();
|
||||
entity.setId(null);
|
||||
entity.setCreatorId(user.getId());
|
||||
entity.setCreateTime(LocalDateTime.now());
|
||||
entity.setStatus(BusinessConsts.Org.Status.VALID);
|
||||
this.orgDAO.insert(entity);
|
||||
entity.setRootId(entity.getId());
|
||||
orgDAO.updateByPrimaryKey(entity);
|
||||
// 20220929 增加
|
||||
orgProjectService.save(entity.getId(), topOrgCreateVO.getProjectCodes(), user);
|
||||
return new OrgVO(entity, topOrgCreateVO.getProjectCodes());
|
||||
}
|
||||
|
||||
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;
|
||||
/**
|
||||
* 确认名称唯一
|
||||
*/
|
||||
private void confirmNameUnique(Long orgId, String name) {
|
||||
//名称检查
|
||||
OrgExample example = new OrgExample();
|
||||
OrgExample.Criteria criteria = example.createCriteria().andNameEqualTo(name);
|
||||
if (orgId != null) {
|
||||
criteria.andIdNotEqualTo(orgId);
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertTrue(orgDAO.countByExample(example) == 0,
|
||||
"名称重复");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public OrgVO createTopOrg(TopOrgCreateVO topOrgCreateVO, AccountVO user) {
|
||||
confirmNameUnique(null, topOrgCreateVO.getName());
|
||||
/* 处理 */
|
||||
Org entity = topOrgCreateVO.toDB();
|
||||
entity.setId(null);
|
||||
entity.setCreatorId(user.getId());
|
||||
entity.setCreateTime(LocalDateTime.now());
|
||||
entity.setStatus(BusinessConsts.Org.Status.VALID);
|
||||
this.orgDAO.insert(entity);
|
||||
entity.setRootId(entity.getId());
|
||||
orgDAO.updateByPrimaryKey(entity);
|
||||
// 20220929 增加
|
||||
orgProjectService.save(entity.getId(), topOrgCreateVO.getProjectCodes(), user);
|
||||
return new OrgVO(entity, topOrgCreateVO.getProjectCodes());
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认名称唯一
|
||||
*/
|
||||
private void confirmNameUnique(Long orgId, String name) {
|
||||
//名称检查
|
||||
OrgExample example = new OrgExample();
|
||||
OrgExample.Criteria criteria = example.createCriteria().andNameEqualTo(name);
|
||||
if (orgId != null) {
|
||||
criteria.andIdNotEqualTo(orgId);
|
||||
@Override
|
||||
public List<OrgVO> queryAllTopOrg() {
|
||||
OrgExample example = new OrgExample();
|
||||
example.createCriteria().andParentIdIsNull();
|
||||
List<Org> orgs = this.orgDAO.selectByExample(example);
|
||||
List<Long> orgIds = orgs.stream().map(Org::getId).collect(Collectors.toList());
|
||||
List<OrgProject> orgProjects = orgProjectService.queryOrgProjectListByOrgIds(orgIds);
|
||||
return OrgVO.convert2VOList(orgs, orgProjects);
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertTrue(orgDAO.countByExample(example) == 0,
|
||||
"名称重复");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrgVO> queryAllTopOrg() {
|
||||
OrgExample example = new OrgExample();
|
||||
example.createCriteria().andParentIdIsNull();
|
||||
List<Org> orgs = this.orgDAO.selectByExample(example);
|
||||
List<Long> orgIds = orgs.stream().map(Org::getId).collect(Collectors.toList());
|
||||
List<OrgProject> orgProjects = orgProjectService.queryOrgProjectListByOrgIds(orgIds);
|
||||
return OrgVO.convert2VOList(orgs, orgProjects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageVO<OrgVO> pagedQueryAllTopOrg(OrgQueryVO queryVO) {
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
OrgExample example = new OrgExample();
|
||||
OrgExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andParentIdIsNull().andStatusEqualTo(BusinessConsts.Org.Status.VALID);
|
||||
if (StringUtils.hasText(queryVO.getName())) {
|
||||
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
|
||||
@Override
|
||||
public PageVO<OrgVO> pagedQueryAllTopOrg(OrgQueryVO queryVO) {
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
OrgExample example = new OrgExample();
|
||||
OrgExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andParentIdIsNull().andStatusEqualTo(BusinessConsts.Org.Status.VALID);
|
||||
if (StringUtils.hasText(queryVO.getName())) {
|
||||
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
|
||||
}
|
||||
Page<Org> page = (Page<Org>) orgDAO.selectByExample(example);
|
||||
List<Long> orgIds = page.getResult().stream().map(Org::getId).collect(Collectors.toList());
|
||||
List<OrgProject> orgProjects = orgProjectService.queryOrgProjectListByOrgIds(orgIds);
|
||||
List<OrgVO> voList = OrgVO.convert2VOList(page.getResult(), orgProjects);
|
||||
return PageVO.convert(page, voList);
|
||||
}
|
||||
Page<Org> page = (Page<Org>) orgDAO.selectByExample(example);
|
||||
List<Long> orgIds = page.getResult().stream().map(Org::getId).collect(Collectors.toList());
|
||||
List<OrgProject> orgProjects = orgProjectService.queryOrgProjectListByOrgIds(orgIds);
|
||||
List<OrgVO> voList = OrgVO.convert2VOList(page.getResult(), orgProjects);
|
||||
return PageVO.convert(page, voList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void confirmExist(Long orgId) {
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(orgDAO.selectByPrimaryKey(orgId),
|
||||
String.format("id为[%s]的组织不存在", orgId));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public OrgVO createCls(NonTopOrgCreateVO createVO, LoginUserInfoVO loginInfo) {
|
||||
//检查
|
||||
Long topOrgId = loginInfo.getTopOrgId();
|
||||
Long userId = loginInfo.getAccountVO().getId();
|
||||
iOrgUserService.confirmUserIsTheRoleInThisOrg(userId, topOrgId, BusinessConsts.OrgRole.Admin);
|
||||
|
||||
Org cls = createNonTopOrg(createVO.getName(), topOrgId, topOrgId, userId);
|
||||
iOrgUserService.create(cls.getId(), userId, BusinessConsts.OrgRole.Teacher);
|
||||
return new OrgVO(cls);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Org getEntity(long orgId) {
|
||||
Org org = orgDAO.selectByPrimaryKey(orgId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(org, String.format("id为[%s]的组织不存在", orgId));
|
||||
return org;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Org findEntity(long orgId) {
|
||||
return orgDAO.selectByPrimaryKey(orgId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Org> getEntities(String project, String status) {
|
||||
Collection<Org> orgs = findEntities(project, status);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(orgs, String.format("关联项目[%s]的组织不存在", project));
|
||||
return orgs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Org> findEntities(@NonNull String project, String status) {
|
||||
OrgExample example = new OrgExample();
|
||||
OrgExample.Criteria criteria = example.createCriteria().andProjectCodeLike(String.format("%%%s%%", project));
|
||||
if (StringUtils.hasText(status)) {
|
||||
criteria.andStatusEqualTo(status);
|
||||
@Override
|
||||
public void confirmExist(Long orgId) {
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(orgDAO.selectByPrimaryKey(orgId),
|
||||
String.format("id为[%s]的组织不存在", orgId));
|
||||
}
|
||||
return orgDAO.selectByExample(example);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrgVO updateOrg(Long id, OrgVO orgVO, AccountVO user) {
|
||||
//校验
|
||||
Org org = getEntity(id);
|
||||
if (!CollectionUtils.isEmpty(orgVO.getProjectCodes())) {
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(isTopOrg(org), "非顶级组织不能修改关联项目");
|
||||
@Transactional
|
||||
@Override
|
||||
public OrgVO createCls(NonTopOrgCreateVO createVO, LoginUserInfoVO loginInfo) {
|
||||
//检查
|
||||
Long topOrgId = loginInfo.getTopOrgId();
|
||||
Long userId = loginInfo.getAccountVO().getId();
|
||||
iOrgUserService.confirmUserIsTheRoleInThisOrg(userId, topOrgId, BusinessConsts.OrgRole.Admin);
|
||||
|
||||
Org cls = createNonTopOrg(createVO.getName(), topOrgId, topOrgId, userId);
|
||||
iOrgUserService.create(cls.getId(), userId, BusinessConsts.OrgRole.Teacher);
|
||||
return new OrgVO(cls);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Org getEntity(long orgId) {
|
||||
Org org = orgDAO.selectByPrimaryKey(orgId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(org, String.format("id为[%s]的组织不存在", orgId));
|
||||
return org;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Org findEntity(long orgId) {
|
||||
return orgDAO.selectByPrimaryKey(orgId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Org> getEntities(String project, String status) {
|
||||
Collection<Org> orgs = findEntities(project, status);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(orgs, String.format("关联项目[%s]的组织不存在", project));
|
||||
return orgs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Org> findEntities(@NonNull String project, String status) {
|
||||
OrgExample example = new OrgExample();
|
||||
OrgExample.Criteria criteria = example.createCriteria().andProjectCodeLike(String.format("%%%s%%", project));
|
||||
if (StringUtils.hasText(status)) {
|
||||
criteria.andStatusEqualTo(status);
|
||||
}
|
||||
return orgDAO.selectByExample(example);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrgVO updateOrg(Long id, OrgVO orgVO, AccountVO user) {
|
||||
//校验
|
||||
Org org = getEntity(id);
|
||||
if (!CollectionUtils.isEmpty(orgVO.getProjectCodes())) {
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(isTopOrg(org), "非顶级组织不能修改关联项目");
|
||||
// confirmProjectCodesNotRepeat(org.getId(), orgVO.getProjectCodes());
|
||||
// 20220929 增加
|
||||
orgProjectService.update(id, orgVO.getProjectCodes(), user);
|
||||
}
|
||||
confirmNameUnique(id, orgVO.getName());
|
||||
//更新
|
||||
org.setName(orgVO.getName());
|
||||
// 20220929 增加
|
||||
orgProjectService.update(id, orgVO.getProjectCodes(), user);
|
||||
}
|
||||
confirmNameUnique(id, orgVO.getName());
|
||||
//更新
|
||||
org.setName(orgVO.getName());
|
||||
// org.setProjectCode(orgVO.getDBProjectCode());
|
||||
org.setUpdateId(user.getId());
|
||||
org.setUpdateTime(LocalDateTime.now());
|
||||
this.orgDAO.updateByPrimaryKeySelective(org);
|
||||
List<String> projects = orgProjectService.queryOrgProjectListByOrgId(org.getId()).stream()
|
||||
.map(OrgProject::getProjectCode).collect(Collectors.toList());
|
||||
return new OrgVO(org, projects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteNonTopOrg(Long nonTopOrgId) {
|
||||
confirmIsNonTopOrg(nonTopOrgId);
|
||||
Org org = new Org();
|
||||
org.setId(nonTopOrgId);
|
||||
org.setStatus(BusinessConsts.Org.Status.DELETE);
|
||||
orgDAO.updateByPrimaryKeySelective(org);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Org> findEntitiesByParentId(@NonNull Long parentId, String orderBy, String status) {
|
||||
OrgExample example = new OrgExample();
|
||||
if (StringUtils.hasText(orderBy)) {
|
||||
example.setOrderByClause(orderBy);
|
||||
org.setUpdateId(user.getId());
|
||||
org.setUpdateTime(LocalDateTime.now());
|
||||
this.orgDAO.updateByPrimaryKeySelective(org);
|
||||
List<String> projects = orgProjectService.queryOrgProjectListByOrgId(org.getId()).stream()
|
||||
.map(OrgProject::getProjectCode).collect(Collectors.toList());
|
||||
return new OrgVO(org, projects);
|
||||
}
|
||||
OrgExample.Criteria criteria = example.createCriteria().andParentIdEqualTo(parentId);
|
||||
if (StringUtils.hasText(status)) {
|
||||
criteria.andStatusEqualTo(status);
|
||||
}
|
||||
return orgDAO.selectByExample(example);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageVO<OrgVO> pagedQueryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo) {
|
||||
OrgExample example = new OrgExample();
|
||||
OrgExample.Criteria criteria = example.createCriteria().andParentIdEqualTo(loginInfo.getTopOrgId())
|
||||
.andStatusEqualTo(BusinessConsts.Org.Status.VALID);
|
||||
if (StringUtils.hasText(queryVO.getName())) {
|
||||
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
|
||||
@Override
|
||||
public void deleteNonTopOrg(Long nonTopOrgId) {
|
||||
confirmIsNonTopOrg(nonTopOrgId);
|
||||
Org org = new Org();
|
||||
org.setId(nonTopOrgId);
|
||||
org.setStatus(BusinessConsts.Org.Status.DELETE);
|
||||
orgDAO.updateByPrimaryKeySelective(org);
|
||||
}
|
||||
if (StringUtils.hasText(queryVO.getCreatorName())) {
|
||||
List<Long> creatorIds = iSysUserService.findUserByName(queryVO.getCreatorName()).stream().map(AccountVO::getId).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(creatorIds)) {
|
||||
return new PageVO<>(queryVO.getPageNum(), queryVO.getPageSize(), 0, new ArrayList<>());
|
||||
} else {
|
||||
criteria.andCreatorIdIn(creatorIds);
|
||||
}
|
||||
}
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
Page<Org> page = (Page<Org>) orgDAO.selectByExample(example);
|
||||
List<Long> creatorIds = page.stream().map(Org::getCreatorId).collect(Collectors.toList());
|
||||
Map<Long, SysAccount> creatorMap = iSysUserService.findEntities(creatorIds, null).stream()
|
||||
.collect(Collectors.toMap(SysAccount::getId, Function.identity()));
|
||||
List<OrgVO> list = page.getResult().stream().map(entity -> {
|
||||
int numberOfPeople = iOrgUserService.getQuantities(entity.getId(), BusinessConsts.OrgRole.Student);
|
||||
return new OrgVO(entity, null, numberOfPeople, creatorMap.get(entity.getCreatorId()));
|
||||
}).collect(Collectors.toList());
|
||||
return PageVO.convert(page, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrgVO> queryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo) {
|
||||
OrgExample example = new OrgExample();
|
||||
OrgExample.Criteria criteria = example.createCriteria()
|
||||
.andParentIdEqualTo(loginInfo.getTopOrgId())
|
||||
.andStatusEqualTo(BusinessConsts.Org.Status.VALID);
|
||||
if (queryVO != null) {
|
||||
if (StringUtils.hasText(queryVO.getName())) {
|
||||
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
|
||||
}
|
||||
}
|
||||
List<Org> clsList = orgDAO.selectByExample(example);
|
||||
return clsList.stream().map(OrgVO::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Org getTopOrgEntity(Long orgId) {
|
||||
Org entity = getEntity(orgId);
|
||||
if (isTopOrg(entity)) {
|
||||
return entity;
|
||||
}
|
||||
return getEntity(entity.getRootId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Org> findEntities(List<Long> orgIds, String status) {
|
||||
if (CollectionUtils.isEmpty(orgIds)) {
|
||||
return new ArrayList<>();
|
||||
} else {
|
||||
OrgExample example = new OrgExample();
|
||||
OrgExample.Criteria criteria = example.createCriteria().andIdIn(orgIds);
|
||||
if (StringUtils.hasText(status)) {
|
||||
criteria.andStatusEqualTo(status);
|
||||
}
|
||||
return orgDAO.selectByExample(example);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node<Object> adminQueryOrgTree(Long orgId) {
|
||||
/* 先筛选组织 */
|
||||
OrgVO orgVO = get(orgId);
|
||||
Map<Long, List<Org>> groupByParentIdOrg = findEntitiesByRootId(orgVO.getRootId(), null, BusinessConsts.Org.Status.VALID)
|
||||
.stream().filter(o -> !isTopOrg(o)).collect(Collectors.groupingBy(Org::getParentId));
|
||||
Node<Object> root = new Node<>(orgVO, Node.Type.ORG);
|
||||
Map<Long, Node<Object>> all_orgId_node_map = new HashMap<>(); //所有的组织和对应的节点
|
||||
Map<Long, Node<Object>> orgId_node_map = new HashMap<>();
|
||||
orgId_node_map.put(orgVO.getId(), root);
|
||||
while (!orgId_node_map.isEmpty()) {
|
||||
all_orgId_node_map.putAll(orgId_node_map);
|
||||
Map<Long, Node<Object>> newMap = new HashMap<>();
|
||||
orgId_node_map.forEach((k, v) -> {
|
||||
List<Org> childOrgList = groupByParentIdOrg.get(k);
|
||||
if (!CollectionUtils.isEmpty(childOrgList)) {
|
||||
List<Node<Object>> children = childOrgList.stream().map(o -> {
|
||||
Node<Object> node = new Node<>(new OrgVO(o), Node.Type.ORG);
|
||||
newMap.put(o.getId(), node);
|
||||
return node;
|
||||
}).collect(Collectors.toList());
|
||||
v.setChildren(children);
|
||||
@Override
|
||||
public List<Org> findEntitiesByParentId(@NonNull Long parentId, String orderBy, String status) {
|
||||
OrgExample example = new OrgExample();
|
||||
if (StringUtils.hasText(orderBy)) {
|
||||
example.setOrderByClause(orderBy);
|
||||
}
|
||||
});
|
||||
orgId_node_map = newMap;
|
||||
OrgExample.Criteria criteria = example.createCriteria().andParentIdEqualTo(parentId);
|
||||
if (StringUtils.hasText(status)) {
|
||||
criteria.andStatusEqualTo(status);
|
||||
}
|
||||
return orgDAO.selectByExample(example);
|
||||
}
|
||||
/* 再查询用户 */
|
||||
List<OrgUser> orgUsers = iOrgUserService.findEntitiesByOrgIds(new ArrayList<>(all_orgId_node_map.keySet()), null);
|
||||
Map<Long, List<OrgUser>> groupByOrgIdOrgUsers = orgUsers.stream().collect(Collectors.groupingBy(OrgUser::getOrgId));
|
||||
List<Long> userIds = orgUsers.stream().map(OrgUser::getUserId).collect(Collectors.toList());
|
||||
Map<Long, SysAccount> userMap = iSysUserService.findEntities(userIds, null)
|
||||
.stream().collect(Collectors.toMap(SysAccount::getId, Function.identity()));
|
||||
all_orgId_node_map.forEach((k, v) -> {
|
||||
List<OrgUser> ous = groupByOrgIdOrgUsers.get(k);
|
||||
if (!CollectionUtils.isEmpty(ous)) {
|
||||
List<Node<Object>> children = ous.stream().map(ou -> {
|
||||
OrgUserVO vo = new OrgUserVO(ou, userMap.get(ou.getUserId()));
|
||||
return new Node<Object>(vo, Node.Type.USER);
|
||||
|
||||
@Override
|
||||
public PageVO<OrgVO> pagedQueryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo) {
|
||||
OrgExample example = new OrgExample();
|
||||
OrgExample.Criteria criteria = example.createCriteria().andParentIdEqualTo(loginInfo.getTopOrgId())
|
||||
.andStatusEqualTo(BusinessConsts.Org.Status.VALID);
|
||||
if (StringUtils.hasText(queryVO.getName())) {
|
||||
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
|
||||
}
|
||||
if (StringUtils.hasText(queryVO.getCreatorName())) {
|
||||
List<Long> creatorIds = iSysUserService.findUserByName(queryVO.getCreatorName()).stream().map(AccountVO::getId).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(creatorIds)) {
|
||||
return new PageVO<>(queryVO.getPageNum(), queryVO.getPageSize(), 0, new ArrayList<>());
|
||||
} else {
|
||||
criteria.andCreatorIdIn(creatorIds);
|
||||
}
|
||||
}
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
Page<Org> page = (Page<Org>) orgDAO.selectByExample(example);
|
||||
List<Long> creatorIds = page.stream().map(Org::getCreatorId).collect(Collectors.toList());
|
||||
Map<Long, SysAccount> creatorMap = iSysUserService.findEntities(creatorIds, null).stream()
|
||||
.collect(Collectors.toMap(SysAccount::getId, Function.identity()));
|
||||
List<OrgVO> list = page.getResult().stream().map(entity -> {
|
||||
int numberOfPeople = iOrgUserService.getQuantities(entity.getId(), BusinessConsts.OrgRole.Student);
|
||||
return new OrgVO(entity, null, numberOfPeople, creatorMap.get(entity.getCreatorId()));
|
||||
}).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(v.getChildren())) {
|
||||
children.addAll(v.getChildren());
|
||||
return PageVO.convert(page, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrgVO> queryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo) {
|
||||
OrgExample example = new OrgExample();
|
||||
OrgExample.Criteria criteria = example.createCriteria()
|
||||
.andParentIdEqualTo(loginInfo.getTopOrgId())
|
||||
.andStatusEqualTo(BusinessConsts.Org.Status.VALID);
|
||||
if (queryVO != null) {
|
||||
if (StringUtils.hasText(queryVO.getName())) {
|
||||
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
|
||||
}
|
||||
}
|
||||
v.setChildren(children);
|
||||
}
|
||||
});
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrgVO get(Long id) {
|
||||
OrgVO vo = query(id);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(vo, String.format("[id:%s]的组织不存在", id));
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamDefinitionVO> queryByExamIds(List<Long> examIds, String status) {
|
||||
if (CollectionUtils.isEmpty(examIds)) {
|
||||
return new ArrayList<>();
|
||||
List<Org> clsList = orgDAO.selectByExample(example);
|
||||
return clsList.stream().map(OrgVO::new).collect(Collectors.toList());
|
||||
}
|
||||
return orgDAO.queryByExamIds(examIds, status);
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认是顶级组织
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
@Override
|
||||
public void confirmIsTopOrg(long id) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(isTopOrg(id),
|
||||
String.format("组织[%s]不是顶级组织", id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认是非顶级组织
|
||||
*/
|
||||
@Override
|
||||
public void confirmIsNonTopOrg(Long id) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(!isTopOrg(id),
|
||||
String.format("组织[%s]是顶级组织", id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Org> queryAllSubOrgs(Long orgId) {
|
||||
OrgExample example = new OrgExample();
|
||||
example.createCriteria()
|
||||
.andParentIdEqualTo(orgId)
|
||||
.andStatusEqualTo(BusinessConsts.Org.Status.VALID);
|
||||
List<Org> orgs = this.orgDAO.selectByExample(example);
|
||||
return orgs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBindQrCode(long orgId, String project) {
|
||||
return qrCodeManager.getOrgBindCode(orgId, project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Org getTopOrgOfUser(long userId) {
|
||||
Org org = findTopOrgOfUser(userId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(org, String.format("用户[%s]无所属顶级组织", userId));
|
||||
return org;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Org findTopOrgOfUser(long userId) {
|
||||
List<OrgUser> orgUsers = iOrgUserService.findEntitiesByUserId(userId, null);
|
||||
if (CollectionUtils.isEmpty(orgUsers)) {
|
||||
return null;
|
||||
@Override
|
||||
public Org getTopOrgEntity(Long orgId) {
|
||||
Org entity = getEntity(orgId);
|
||||
if (isTopOrg(entity))
|
||||
return entity;
|
||||
return getEntity(entity.getRootId());
|
||||
}
|
||||
Long orgId = orgUsers.stream()
|
||||
.filter(orgUser -> BusinessConsts.OrgRole.Admin.name().equals(orgUser.getRole())) //目前有管理员的一定是顶级组织
|
||||
.findAny().orElse(orgUsers.get(0)).getOrgId();
|
||||
Org org = getTopOrgEntity(orgId);
|
||||
if (BusinessConsts.Org.Status.VALID.equals(org.getStatus())) {
|
||||
return org;
|
||||
} else {
|
||||
return null;
|
||||
|
||||
@Override
|
||||
public List<Org> findEntities(List<Long> orgIds, String status) {
|
||||
if (CollectionUtils.isEmpty(orgIds)) {
|
||||
return new ArrayList<>();
|
||||
} else {
|
||||
OrgExample example = new OrgExample();
|
||||
OrgExample.Criteria criteria = example.createCriteria().andIdIn(orgIds);
|
||||
if (StringUtils.hasText(status)) {
|
||||
criteria.andStatusEqualTo(status);
|
||||
}
|
||||
return orgDAO.selectByExample(example);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrgVO> listQueryCls(long topOrgId) {
|
||||
List<Org> clsList = findClsByTopOrgId(topOrgId);
|
||||
return OrgVO.convert2VOList(clsList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrgVO query(Long id) {
|
||||
Org entity = findEntity(id);
|
||||
if (entity == null) {
|
||||
return null;
|
||||
@Override
|
||||
public Node<Object> adminQueryOrgTree(Long orgId) {
|
||||
/* 先筛选组织 */
|
||||
OrgVO orgVO = get(orgId);
|
||||
Map<Long, List<Org>> groupByParentIdOrg = findEntitiesByRootId(orgVO.getRootId(), null, BusinessConsts.Org.Status.VALID)
|
||||
.stream().filter(o -> !isTopOrg(o)).collect(Collectors.groupingBy(Org::getParentId));
|
||||
Node<Object> root = new Node<>(orgVO, Node.Type.ORG);
|
||||
Map<Long, Node<Object>> all_orgId_node_map = new HashMap<>(); //所有的组织和对应的节点
|
||||
Map<Long, Node<Object>> orgId_node_map = new HashMap<>();
|
||||
orgId_node_map.put(orgVO.getId(), root);
|
||||
while (!orgId_node_map.isEmpty()) {
|
||||
all_orgId_node_map.putAll(orgId_node_map);
|
||||
Map<Long, Node<Object>> newMap = new HashMap<>();
|
||||
orgId_node_map.forEach((k, v) -> {
|
||||
List<Org> childOrgList = groupByParentIdOrg.get(k);
|
||||
if (!CollectionUtils.isEmpty(childOrgList)) {
|
||||
List<Node<Object>> children = childOrgList.stream().map(o -> {
|
||||
Node<Object> node = new Node<>(new OrgVO(o), Node.Type.ORG);
|
||||
newMap.put(o.getId(), node);
|
||||
return node;
|
||||
}).collect(Collectors.toList());
|
||||
v.setChildren(children);
|
||||
}
|
||||
});
|
||||
orgId_node_map = newMap;
|
||||
}
|
||||
/* 再查询用户 */
|
||||
List<OrgUser> orgUsers = iOrgUserService.findEntitiesByOrgIds(new ArrayList<>(all_orgId_node_map.keySet()), null);
|
||||
Map<Long, List<OrgUser>> groupByOrgIdOrgUsers = orgUsers.stream().collect(Collectors.groupingBy(OrgUser::getOrgId));
|
||||
List<Long> userIds = orgUsers.stream().map(OrgUser::getUserId).collect(Collectors.toList());
|
||||
Map<Long, SysAccount> userMap = iSysUserService.findEntities(userIds, null)
|
||||
.stream().collect(Collectors.toMap(SysAccount::getId, Function.identity()));
|
||||
all_orgId_node_map.forEach((k, v) -> {
|
||||
List<OrgUser> ous = groupByOrgIdOrgUsers.get(k);
|
||||
if (!CollectionUtils.isEmpty(ous)) {
|
||||
List<Node<Object>> children = ous.stream().map(ou -> {
|
||||
OrgUserVO vo = new OrgUserVO(ou, userMap.get(ou.getUserId()));
|
||||
return new Node<Object>(vo, Node.Type.USER);
|
||||
}).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(v.getChildren())) {
|
||||
children.addAll(v.getChildren());
|
||||
}
|
||||
v.setChildren(children);
|
||||
}
|
||||
});
|
||||
return root;
|
||||
}
|
||||
List<String> projects;
|
||||
if (isTopOrg(entity)) {
|
||||
projects = orgProjectService.queryOrgProjectListByOrgId(entity.getId()).stream()
|
||||
.map(OrgProject::getProjectCode).collect(Collectors.toList());
|
||||
} else {
|
||||
projects = null;
|
||||
|
||||
@Override
|
||||
public OrgVO get(Long id) {
|
||||
OrgVO vo = query(id);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(vo, String.format("[id:%s]的组织不存在", id));
|
||||
return vo;
|
||||
}
|
||||
return new OrgVO(entity, projects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrgVO getTopOrg(long topOrgId) {
|
||||
Org org = getEntity(topOrgId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(isTopOrg(org),
|
||||
String.format("[id:%s]的组织不是顶级组织", topOrgId));
|
||||
List<String> projects = orgProjectService.queryOrgProjectListByOrgId(topOrgId)
|
||||
.stream().map(OrgProject::getProjectCode).collect(Collectors.toList());
|
||||
return new OrgVO(org, projects);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询该顶级组织下的班级
|
||||
*/
|
||||
private List<Org> findClsByTopOrgId(long topOrgId) {
|
||||
OrgExample orgExample = new OrgExample();
|
||||
orgExample.createCriteria().andRootIdEqualTo(topOrgId).andParentIdIsNull();
|
||||
return orgDAO.selectByExample(orgExample);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建非顶级组织
|
||||
*/
|
||||
private Org createNonTopOrg(@NonNull String name, @NonNull Long parentId, @NonNull Long rootId, @NonNull Long creatorId) {
|
||||
//检查顶级组织
|
||||
confirmIsTopOrg(rootId);
|
||||
//检查同级同名组织
|
||||
List<Org> entities = findEntitiesByParentId(parentId, null, BusinessConsts.Org.Status.VALID);
|
||||
if (!CollectionUtils.isEmpty(entities)) {
|
||||
BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertTrue(entities.stream().noneMatch(org -> org.getName().equals(name)),
|
||||
String.format("上级为[%s]的同名组织已存在", parentId));
|
||||
@Override
|
||||
public List<ExamDefinitionVO> queryByExamIds(List<Long> examIds, String status) {
|
||||
if (CollectionUtils.isEmpty(examIds)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return orgDAO.queryByExamIds(examIds, status);
|
||||
}
|
||||
//创建新组织
|
||||
Org org = new Org();
|
||||
org.setName(name);
|
||||
org.setParentId(parentId);
|
||||
org.setRootId(rootId);
|
||||
org.setCreatorId(creatorId);
|
||||
org.setCreateTime(LocalDateTime.now());
|
||||
org.setStatus(BusinessConsts.Org.Status.VALID);
|
||||
orgDAO.insert(org);
|
||||
return org;
|
||||
}
|
||||
|
||||
private boolean isTopOrg(long orgId) {
|
||||
return isTopOrg(getEntity(orgId));
|
||||
}
|
||||
|
||||
private boolean isTopOrg(Org org) {
|
||||
return org.getParentId() == null;
|
||||
}
|
||||
|
||||
private List<Org> findEntitiesByRootId(Long rootId, String orderBy, String status) {
|
||||
OrgExample example = new OrgExample();
|
||||
if (StringUtils.hasText(orderBy)) {
|
||||
example.setOrderByClause(orderBy);
|
||||
/**
|
||||
* 确认是顶级组织
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
@Override
|
||||
public void confirmIsTopOrg(long id) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(isTopOrg(id),
|
||||
String.format("组织[%s]不是顶级组织", id));
|
||||
}
|
||||
OrgExample.Criteria criteria = example.createCriteria().andRootIdEqualTo(rootId);
|
||||
if (StringUtils.hasText(status)) {
|
||||
criteria.andStatusEqualTo(status);
|
||||
|
||||
/**
|
||||
* 确认是非顶级组织
|
||||
*/
|
||||
@Override
|
||||
public void confirmIsNonTopOrg(Long id) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(!isTopOrg(id),
|
||||
String.format("组织[%s]是顶级组织", id));
|
||||
}
|
||||
List<Org> orgs = orgDAO.selectByExample(example);
|
||||
|
||||
@Override
|
||||
public List<Org> queryAllSubOrgs(Long orgId) {
|
||||
OrgExample example = new OrgExample();
|
||||
example.createCriteria()
|
||||
.andParentIdEqualTo(orgId)
|
||||
.andStatusEqualTo(BusinessConsts.Org.Status.VALID);
|
||||
List<Org> orgs = this.orgDAO.selectByExample(example);
|
||||
return orgs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBindQrCode(long orgId, String project) {
|
||||
return qrCodeManager.getOrgBindCode(orgId, project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Org getTopOrgOfUser(long userId) {
|
||||
Org org = findTopOrgOfUser(userId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(org, String.format("用户[%s]无所属顶级组织", userId));
|
||||
return org;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Org findTopOrgOfUser(long userId) {
|
||||
List<OrgUser> orgUsers = iOrgUserService.findEntitiesByUserId(userId, null);
|
||||
if (CollectionUtils.isEmpty(orgUsers))
|
||||
return null;
|
||||
Long orgId = orgUsers.stream()
|
||||
.filter(orgUser -> BusinessConsts.OrgRole.Admin.name().equals(orgUser.getRole())) //目前有管理员的一定是顶级组织
|
||||
.findAny().orElse(orgUsers.get(0)).getOrgId();
|
||||
Org org = getTopOrgEntity(orgId);
|
||||
if (BusinessConsts.Org.Status.VALID.equals(org.getStatus())) {
|
||||
return org;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrgVO> listQueryCls(long topOrgId) {
|
||||
List<Org> clsList = findClsByTopOrgId(topOrgId);
|
||||
return OrgVO.convert2VOList(clsList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrgVO query(Long id) {
|
||||
Org entity = findEntity(id);
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
List<String> projects;
|
||||
if (isTopOrg(entity)) {
|
||||
projects = orgProjectService.queryOrgProjectListByOrgId(entity.getId()).stream()
|
||||
.map(OrgProject::getProjectCode).collect(Collectors.toList());
|
||||
} else {
|
||||
projects = null;
|
||||
}
|
||||
return new OrgVO(entity, projects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrgVO getTopOrg(long topOrgId) {
|
||||
Org org = getEntity(topOrgId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(isTopOrg(org),
|
||||
String.format("[id:%s]的组织不是顶级组织", topOrgId));
|
||||
List<String> projects = orgProjectService.queryOrgProjectListByOrgId(topOrgId)
|
||||
.stream().map(OrgProject::getProjectCode).collect(Collectors.toList());
|
||||
return new OrgVO(org, projects);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询该顶级组织下的班级
|
||||
*/
|
||||
private List<Org> findClsByTopOrgId(long topOrgId) {
|
||||
OrgExample orgExample = new OrgExample();
|
||||
orgExample.createCriteria().andRootIdEqualTo(topOrgId).andParentIdIsNull();
|
||||
return orgDAO.selectByExample(orgExample);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建非顶级组织
|
||||
*/
|
||||
private Org createNonTopOrg(@NonNull String name, @NonNull Long parentId, @NonNull Long rootId, @NonNull Long creatorId) {
|
||||
//检查顶级组织
|
||||
confirmIsTopOrg(rootId);
|
||||
//检查同级同名组织
|
||||
List<Org> entities = findEntitiesByParentId(parentId, null, BusinessConsts.Org.Status.VALID);
|
||||
if (!CollectionUtils.isEmpty(entities)) {
|
||||
BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertTrue(entities.stream().noneMatch(org -> org.getName().equals(name)),
|
||||
String.format("上级为[%s]的同名组织已存在", parentId));
|
||||
}
|
||||
//创建新组织
|
||||
Org org = new Org();
|
||||
org.setName(name);
|
||||
org.setParentId(parentId);
|
||||
org.setRootId(rootId);
|
||||
org.setCreatorId(creatorId);
|
||||
org.setCreateTime(LocalDateTime.now());
|
||||
org.setStatus(BusinessConsts.Org.Status.VALID);
|
||||
orgDAO.insert(org);
|
||||
return org;
|
||||
}
|
||||
|
||||
private boolean isTopOrg(long orgId) {
|
||||
return isTopOrg(getEntity(orgId));
|
||||
}
|
||||
|
||||
private boolean isTopOrg(Org org) {
|
||||
return org.getParentId() == null;
|
||||
}
|
||||
|
||||
private List<Org> findEntitiesByRootId(Long rootId, String orderBy, String status) {
|
||||
OrgExample example = new OrgExample();
|
||||
if (StringUtils.hasText(orderBy)) {
|
||||
example.setOrderByClause(orderBy);
|
||||
}
|
||||
OrgExample.Criteria criteria = example.createCriteria().andRootIdEqualTo(rootId);
|
||||
if (StringUtils.hasText(status)) {
|
||||
criteria.andStatusEqualTo(status);
|
||||
}
|
||||
List<Org> orgs = orgDAO.selectByExample(example);
|
||||
// BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(orgs,
|
||||
// String.format("没有顶级组织id为[%s]的组织", rootId));
|
||||
return orgs;
|
||||
}
|
||||
return orgs;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 确认这些项目没有被关联到其它的组织
|
||||
|
@ -2,12 +2,10 @@ package club.joylink.rtss.services.paper;
|
||||
|
||||
import club.joylink.rtss.constants.BusinessConsts;
|
||||
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.PaperQuestionExample;
|
||||
import club.joylink.rtss.entity.paper.question.PaperQuestionWithBLOBs;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.org.OrgService;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
@ -39,69 +37,56 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PagerQuestionService {
|
||||
@Resource
|
||||
private PaperQuestionDAO questionDAO;
|
||||
|
||||
@Resource
|
||||
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
|
||||
*
|
||||
* @param queryVO 查询对象
|
||||
* @param orgIdCanNull orgId是否可以为空
|
||||
* @param queryLabelIsNull 当查询对象labels属性为空时 是否查询 tags is null
|
||||
* @return
|
||||
*/
|
||||
public void createQueryExample(PaperQuestionExample.Criteria criteria, QuestionQueryVO queryVO, boolean orgIdCanNull, boolean queryLabelIsNull) {
|
||||
if (Objects.equals(false, orgIdCanNull)) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(queryVO.getOrgId()), "用户组织信息不能为空");
|
||||
}
|
||||
if (StringUtils.hasText(queryVO.getTopic())) {
|
||||
criteria.andQuestionLike(String.format("%%%s%%", queryVO.getTopic()));
|
||||
}
|
||||
if (StringUtils.hasText(queryVO.getType())) {
|
||||
criteria.andTypeEqualTo(queryVO.getType());
|
||||
}
|
||||
|
||||
if (Objects.nonNull(queryVO.getOrgId())) {
|
||||
criteria.andOrgIdEqualTo(queryVO.getOrgId());
|
||||
}
|
||||
criteria.andIsDelEqualTo(BusinessConsts.DBLogicDelete.NORMAL.ordinal());
|
||||
if (Objects.equals(false, queryLabelIsNull) && StringUtils.hasText(queryVO.getLabels())) {
|
||||
List<String> tmpLableList = Splitter.on(",").omitEmptyStrings().splitToList(queryVO.getLabels());
|
||||
if (Objects.equals(false, CollectionUtils.isEmpty(tmpLableList))) {
|
||||
StringBuilder sqlBuilder = new StringBuilder("(");
|
||||
for (var i = 0; i < tmpLableList.size(); i++) {
|
||||
String data = tmpLableList.get(i);
|
||||
if (i != 0) {
|
||||
sqlBuilder.append(" and ");
|
||||
}
|
||||
sqlBuilder.append(String.format(" find_in_set('%s',tags) > 0 ", data));
|
||||
/**
|
||||
* 创建对应的查询example
|
||||
* @param queryVO 查询对象
|
||||
* @param orgIdCanNull orgId是否可以为空
|
||||
* @param queryLabelIsNull 当查询对象labels属性为空时 是否查询 tags is null
|
||||
* @return
|
||||
*/
|
||||
public void createQueryExample(PaperQuestionExample.Criteria criteria,QuestionQueryVO queryVO, boolean orgIdCanNull,boolean queryLabelIsNull){
|
||||
if(Objects.equals(false,orgIdCanNull)){
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(queryVO.getOrgId()),"用户组织信息不能为空");
|
||||
}
|
||||
sqlBuilder.append(")");
|
||||
Class<?> criteriaCls = criteria.getClass();
|
||||
Class<?> generatedCriteriaCls = criteriaCls.getSuperclass();
|
||||
try {
|
||||
Method addCriterion = generatedCriteriaCls.getDeclaredMethod("addCriterion", String.class);
|
||||
addCriterion.setAccessible(true);
|
||||
addCriterion.invoke(criteria, sqlBuilder.toString());
|
||||
} catch (Exception e) {
|
||||
log.error("拼写查询标签错误 msg:" + e.getMessage(), e);
|
||||
if (StringUtils.hasText(queryVO.getTopic())) {
|
||||
criteria.andQuestionLike(String.format("%%%s%%", queryVO.getTopic()));
|
||||
}
|
||||
if (StringUtils.hasText(queryVO.getType())) {
|
||||
criteria.andTypeEqualTo(queryVO.getType());
|
||||
}
|
||||
|
||||
if(Objects.nonNull(queryVO.getOrgId())){
|
||||
criteria.andOrgIdEqualTo(queryVO.getOrgId());
|
||||
}
|
||||
criteria.andIsDelEqualTo(BusinessConsts.DBLogicDelete.NORMAL.ordinal());
|
||||
if(Objects.equals(false,queryLabelIsNull) && StringUtils.hasText(queryVO.getLabels())){
|
||||
List<String> tmpLableList = Splitter.on(",").omitEmptyStrings().splitToList(queryVO.getLabels());
|
||||
if(Objects.equals(false,CollectionUtils.isEmpty(tmpLableList))){
|
||||
StringBuilder sqlBuilder = new StringBuilder("(");
|
||||
for(var i = 0 ; i < tmpLableList.size();i++){
|
||||
String data = tmpLableList.get(i);
|
||||
if(i != 0){
|
||||
sqlBuilder.append(" and ");
|
||||
}
|
||||
sqlBuilder.append(String.format(" find_in_set('%s',tags) > 0 ",data));
|
||||
}
|
||||
sqlBuilder.append(")");
|
||||
Class<?> criteriaCls = criteria.getClass();
|
||||
Class<?> generatedCriteriaCls = criteriaCls.getSuperclass();
|
||||
try{
|
||||
Method addCriterion = generatedCriteriaCls.getDeclaredMethod("addCriterion", String.class);
|
||||
addCriterion.setAccessible(true);
|
||||
addCriterion.invoke(criteria, sqlBuilder.toString());
|
||||
}catch (Exception e){
|
||||
log.error("拼写查询标签错误 msg:" + e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
criteria.andTagsIsNull();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
criteria.andTagsIsNull();
|
||||
}
|
||||
/* if(!StringUtils.hasText(queryVO.getLabels())){
|
||||
if(queryLabelIsNull) {
|
||||
criteria.andTagsIsNull();
|
||||
@ -130,265 +115,258 @@ public class PagerQuestionService {
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询对应的类型标签对应的数量
|
||||
*
|
||||
* @param orgId 用户组织id
|
||||
* @param type 类型
|
||||
* @param labels 逗号隔开的标签
|
||||
* @return
|
||||
*/
|
||||
public long queryCount(Long orgId, BusinessConsts.TheoryType type, String labels) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId), "组织信息不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(type == BusinessConsts.TheoryType.select
|
||||
|| type == BusinessConsts.TheoryType.multi
|
||||
|| type == BusinessConsts.TheoryType.judge, "查询类型只支持单选,多选,选择");
|
||||
QuestionQueryVO queryVO = new QuestionQueryVO();
|
||||
queryVO.setOrgId(orgId);
|
||||
queryVO.setType(type.name());
|
||||
queryVO.setLabels(labels);
|
||||
PaperQuestionExample example = new PaperQuestionExample();
|
||||
PaperQuestionExample.Criteria criteria = example.createCriteria();
|
||||
this.createQueryExample(criteria, queryVO, false, false);
|
||||
return this.questionDAO.countByExample(example);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取题库分页列表
|
||||
*
|
||||
* @param queryVO
|
||||
* @param companyIdCanNull
|
||||
* @return
|
||||
*/
|
||||
public PageVO<PaperQuestionVO> pagingQueryQuestions(QuestionQueryVO queryVO, boolean companyIdCanNull) {
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
PaperQuestionExample example = new PaperQuestionExample();
|
||||
PaperQuestionExample.Criteria criteria = example.createCriteria();
|
||||
this.createQueryExample(criteria, queryVO, companyIdCanNull, false);
|
||||
Page<PaperQuestionWithBLOBs> page = (Page<PaperQuestionWithBLOBs>) this.questionDAO.selectByExampleWithBLOBs(example);
|
||||
List<PaperQuestionVO> questionVOS = PaperQuestionVO.convert2VOList(page.getResult());
|
||||
return PageVO.convert(page, questionVOS);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取题型列表
|
||||
*
|
||||
* @param queryVO
|
||||
* @param companyIdCanNull
|
||||
* @return
|
||||
*/
|
||||
public List<PaperQuestionVO> queryQuestions(QuestionQueryVO queryVO, boolean companyIdCanNull) {
|
||||
PaperQuestionExample example = new PaperQuestionExample();
|
||||
PaperQuestionExample.Criteria criteria = example.createCriteria();
|
||||
this.createQueryExample(criteria, queryVO, companyIdCanNull, false);
|
||||
List<PaperQuestionWithBLOBs> list = this.questionDAO.selectByExampleWithBLOBs(example);
|
||||
List<PaperQuestionVO> questionVOS = PaperQuestionVO.convert2VOList(list);
|
||||
return questionVOS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取题型所有数据
|
||||
*
|
||||
* @param questionId
|
||||
* @param doNotCheckDel 是否检测数据状态是否删除 true = 不检测,false=检测
|
||||
* @return
|
||||
*/
|
||||
public PaperQuestionVO getQuestion(Long questionId, boolean doNotCheckDel, boolean random) {
|
||||
PaperQuestionWithBLOBs question = questionDAO.selectByPrimaryKey(questionId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(question), "没有找到对应的数据");
|
||||
boolean isDel = question.getIsDel() == BusinessConsts.DBLogicDelete.NORMAL.ordinal();
|
||||
if (doNotCheckDel) {
|
||||
isDel = true;
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(isDel);
|
||||
PaperQuestionVO questionVO = new PaperQuestionVO(question);
|
||||
if (random) {
|
||||
Collections.shuffle(questionVO.getOptionList());
|
||||
}
|
||||
return questionVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测题目是否正确
|
||||
*
|
||||
* @param questionId 题目id
|
||||
* @param answerIds 检测的答案Id
|
||||
* @return
|
||||
*/
|
||||
public boolean answer(Long questionId, List<Integer> answerIds) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(!CollectionUtils.isEmpty(answerIds), "题目答案不能为空");
|
||||
PaperQuestionVO vo = this.getQuestion(questionId, true, false);
|
||||
List<Integer> newAnswerList = answerIds.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
/**
|
||||
* 查询对应的类型标签对应的数量
|
||||
* @param orgId 用户组织id
|
||||
* @param type 类型
|
||||
* @param labels 逗号隔开的标签
|
||||
* @return
|
||||
*/
|
||||
public long queryCount(Long orgId,BusinessConsts.TheoryType type,String labels){
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId),"组织信息不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(type == BusinessConsts.TheoryType.select
|
||||
|| type == BusinessConsts.TheoryType.multi
|
||||
|| type == BusinessConsts.TheoryType.judge ,"查询类型只支持单选,多选,选择");
|
||||
QuestionQueryVO queryVO = new QuestionQueryVO();
|
||||
queryVO.setOrgId(orgId);
|
||||
queryVO.setType(type.name());
|
||||
queryVO.setLabels(labels);
|
||||
PaperQuestionExample example = new PaperQuestionExample();
|
||||
PaperQuestionExample.Criteria criteria = example.createCriteria();
|
||||
this.createQueryExample(criteria,queryVO,false,false);
|
||||
return this.questionDAO.countByExample(example);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取题库分页列表
|
||||
* @param queryVO
|
||||
* @param companyIdCanNull
|
||||
* @return
|
||||
*/
|
||||
public PageVO<PaperQuestionVO> pagingQueryQuestions(QuestionQueryVO queryVO,boolean companyIdCanNull) {
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
PaperQuestionExample example = new PaperQuestionExample();
|
||||
PaperQuestionExample.Criteria criteria = example.createCriteria();
|
||||
this.createQueryExample(criteria,queryVO,companyIdCanNull,false);
|
||||
Page<PaperQuestionWithBLOBs> page = (Page<PaperQuestionWithBLOBs>)this.questionDAO.selectByExampleWithBLOBs(example);
|
||||
List<PaperQuestionVO> questionVOS = PaperQuestionVO.convert2VOList(page.getResult());
|
||||
return PageVO.convert(page, questionVOS);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取题型列表
|
||||
* @param queryVO
|
||||
* @param companyIdCanNull
|
||||
* @return
|
||||
*/
|
||||
public List<PaperQuestionVO> queryQuestions(QuestionQueryVO queryVO,boolean companyIdCanNull) {
|
||||
PaperQuestionExample example = new PaperQuestionExample();
|
||||
PaperQuestionExample.Criteria criteria = example.createCriteria();
|
||||
this.createQueryExample(criteria,queryVO,companyIdCanNull,false);
|
||||
List<PaperQuestionWithBLOBs> list = this.questionDAO.selectByExampleWithBLOBs(example);
|
||||
List<PaperQuestionVO> questionVOS = PaperQuestionVO.convert2VOList(list);
|
||||
return questionVOS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取题型所有数据
|
||||
* @param questionId
|
||||
* @param doNotCheckDel 是否检测数据状态是否删除 true = 不检测,false=检测
|
||||
* @return
|
||||
*/
|
||||
public PaperQuestionVO getQuestion(Long questionId,boolean doNotCheckDel,boolean random) {
|
||||
PaperQuestionWithBLOBs question = questionDAO.selectByPrimaryKey(questionId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(question),"没有找到对应的数据");
|
||||
boolean isDel = question.getIsDel() == BusinessConsts.DBLogicDelete.NORMAL.ordinal();
|
||||
if(doNotCheckDel){
|
||||
isDel = true;
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(isDel);
|
||||
PaperQuestionVO questionVO = new PaperQuestionVO(question);
|
||||
if(random){
|
||||
Collections.shuffle(questionVO.getOptionList());
|
||||
}
|
||||
return questionVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测题目是否正确
|
||||
* @param questionId 题目id
|
||||
* @param answerIds 检测的答案Id
|
||||
* @return
|
||||
*/
|
||||
public boolean answer(Long questionId,List<Integer> answerIds){
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(!CollectionUtils.isEmpty(answerIds),"题目答案不能为空");
|
||||
PaperQuestionVO vo = this.getQuestion(questionId,true,false);
|
||||
List<Integer> newAnswerList = answerIds.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
/* if(Objects.equals(BusinessConsts.TheoryType.select.name(),vo.getType())
|
||||
|| Objects.equals(BusinessConsts.TheoryType.judge.name(),vo.getType())){
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(newAnswerList.size() == 1 ,"单选,判断题答案只能有一个!");
|
||||
}else if(Objects.equals(BusinessConsts.TheoryType.multi.name(),vo.getType())){
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(newAnswerList.size() >= 2 ,"多选题答案最少需要2个");
|
||||
}*/
|
||||
Collections.sort(newAnswerList);
|
||||
String answerStr = Joiner.on(",").skipNulls().join(newAnswerList);
|
||||
if (Objects.equals(answerStr, vo.getAnswer())) {
|
||||
return true;
|
||||
Collections.sort(newAnswerList);
|
||||
String answerStr = Joiner.on(",").skipNulls().join(newAnswerList);
|
||||
if(Objects.equals(answerStr,vo.getAnswer())){
|
||||
return true;
|
||||
}
|
||||
log.info("检查题目[{}]答案,获取原答案[{}],正确答案[{}] ",questionId, answerStr,vo.getQuestionAnswer());
|
||||
return false;
|
||||
}
|
||||
log.info("检查题目[{}]答案,获取原答案[{}],正确答案[{}] ", questionId, answerStr, vo.getQuestionAnswer());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有公司组织下的标签
|
||||
*/
|
||||
public Collection<String> findAllLable(Long orgId, String type) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId), "组织id不能为空");
|
||||
PaperQuestionExample example = new PaperQuestionExample();
|
||||
PaperQuestionExample.Criteria criteria = example.createCriteria();
|
||||
if (Objects.nonNull(type)) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.equals(type, BusinessConsts.TheoryType.select.name())
|
||||
|| Objects.equals(type, BusinessConsts.TheoryType.multi.name())
|
||||
|| Objects.equals(type, BusinessConsts.TheoryType.judge.name()), "查询类型只支持单选,多选,选择");
|
||||
criteria.andTypeEqualTo(type);
|
||||
/**
|
||||
* 获取所有公司组织下的标签
|
||||
*
|
||||
*/
|
||||
public Collection<String> findAllLable(Long orgId,String type){
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId),"组织id不能为空");
|
||||
PaperQuestionExample example = new PaperQuestionExample();
|
||||
PaperQuestionExample.Criteria criteria = example.createCriteria();
|
||||
if(Objects.nonNull(type)){
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.equals(type,BusinessConsts.TheoryType.select.name())
|
||||
||Objects.equals(type,BusinessConsts.TheoryType.multi.name())
|
||||
||Objects.equals(type,BusinessConsts.TheoryType.judge.name()),"查询类型只支持单选,多选,选择");
|
||||
criteria.andTypeEqualTo(type);
|
||||
}
|
||||
criteria.andOrgIdEqualTo(orgId);
|
||||
criteria.andIsDelEqualTo(BusinessConsts.DBLogicDelete.NORMAL.ordinal());
|
||||
List<PaperQuestion> lableList = this.questionDAO.selectByExample(example);
|
||||
if(CollectionUtils.isEmpty(lableList)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return lableList.stream().map(PaperQuestion::getTags).filter(StringUtils::hasText).flatMap(d-> Splitter.on(",").omitEmptyStrings()
|
||||
.trimResults().splitToStream(d)).collect(Collectors.toSet());
|
||||
}
|
||||
criteria.andOrgIdEqualTo(orgId);
|
||||
criteria.andIsDelEqualTo(BusinessConsts.DBLogicDelete.NORMAL.ordinal());
|
||||
List<PaperQuestion> lableList = this.questionDAO.selectByExample(example);
|
||||
if (CollectionUtils.isEmpty(lableList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return lableList.stream().map(PaperQuestion::getTags).filter(StringUtils::hasText).flatMap(d -> Splitter.on(",").omitEmptyStrings()
|
||||
.trimResults().splitToStream(d)).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据公司id和标签或类型查询
|
||||
*
|
||||
* @param companyId
|
||||
* @param queryVO
|
||||
* @return
|
||||
*/
|
||||
public List<PaperQuestionVO> queryQuestionsForRaceLable(Long companyId, PagerLableQueryVO queryVO) {
|
||||
/**
|
||||
* 根据公司id和标签或类型查询
|
||||
* @param companyId
|
||||
* @param queryVO
|
||||
* @return
|
||||
*/
|
||||
public List<PaperQuestionVO> queryQuestionsForRaceLable(Long companyId, PagerLableQueryVO queryVO) {
|
||||
/*boolean isDefault = Project.isDefault(projectCode);
|
||||
List<Long> idList = null;
|
||||
if(Objects.equals(false,isDefault)){
|
||||
idList = this.queryFromProjectCode(projectCode);
|
||||
}*/
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(companyId), "组织id不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(queryVO.allNotNullOrEmpty(), "查询内容不能为空");
|
||||
int isDel = BusinessConsts.DBLogicDelete.NORMAL.ordinal();
|
||||
List<PaperQuestionWithBLOBs> list = this.questionDAO.findFromAndRaceLable(companyId, isDel, queryVO.getLables(), queryVO.getTypes());
|
||||
List<PaperQuestionVO> questionVOS = PaperQuestionVO.convert2VOList(list);
|
||||
return questionVOS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加修改
|
||||
*
|
||||
* @param questionVO
|
||||
* @param accountVO
|
||||
*/
|
||||
public void saveOrUpdate(PaperQuestionVO questionVO, AccountVO accountVO) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(questionVO.getOrgId()), "组织id不能为空");
|
||||
this.checkQuestionType(questionVO, "题库目前只支持单选,多选和判断");
|
||||
if (questionVO.isSelect() || questionVO.isJudge()) {
|
||||
this.checkQuestionTypeForSelectAndJudge(questionVO, "单选或判断题正确答案有且只有一个!");
|
||||
} else if (questionVO.isMulti()) {
|
||||
this.checkQuestionTypeForMulti(questionVO, "多选题正确答案必须是2个以上!");
|
||||
}
|
||||
if (StringUtils.hasText(questionVO.getTags())) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Splitter.on(",").splitToList(questionVO.getTags()).size() <= 1, "分类最多只能有1个");
|
||||
}
|
||||
PaperQuestionWithBLOBs question = questionVO.convert2DB();
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(question.getQuestion().length() < 512, "问题字符长度不用超过512");
|
||||
int wordCounts = questionVO.getOptionList().stream().map(d -> d.getContent().length()).reduce(0, Integer::sum);
|
||||
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(wordCounts < 512, "问题选项长度不用超过512");
|
||||
question.setCreateUserId(accountVO.getId());
|
||||
question.setCreateTime(LocalDateTime.now());
|
||||
if (Objects.nonNull(questionVO.getId())) {
|
||||
PaperQuestionExample example = new PaperQuestionExample();
|
||||
PaperQuestionExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andIdEqualTo(questionVO.getId());
|
||||
criteria.andIsDelEqualTo(BusinessConsts.DBLogicDelete.NORMAL.ordinal());
|
||||
Long exist = this.questionDAO.countByExample(example);
|
||||
if (exist <= 0) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(true,
|
||||
"未找到要修改的数据!");
|
||||
}
|
||||
questionDAO.updateByPrimaryKeyWithBLOBs(question);
|
||||
} else {
|
||||
questionDAO.insert(question);
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(companyId),"组织id不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(queryVO.allNotNullOrEmpty(),"查询内容不能为空");
|
||||
int isDel = BusinessConsts.DBLogicDelete.NORMAL.ordinal();
|
||||
List<PaperQuestionWithBLOBs> list = this.questionDAO.findFromAndRaceLable(companyId,isDel,queryVO.getLables(),queryVO.getTypes());
|
||||
List<PaperQuestionVO> questionVOS = PaperQuestionVO.convert2VOList(list);
|
||||
return questionVOS;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void checkQuestionType(PaperQuestionVO vo, String errStr) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue((Objects.equals(BusinessConsts.TheoryType.select.name(), vo.getType())
|
||||
|| Objects.equals(BusinessConsts.TheoryType.judge.name(), vo.getType())
|
||||
|| Objects.equals(BusinessConsts.TheoryType.multi.name(), vo.getType())), errStr);
|
||||
}
|
||||
/**
|
||||
* 添加修改
|
||||
* @param questionVO
|
||||
* @param accountVO
|
||||
*/
|
||||
public void saveOrUpdate(PaperQuestionVO questionVO, AccountVO accountVO) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(questionVO.getOrgId()),"组织id不能为空");
|
||||
this.checkQuestionType(questionVO,"题库目前只支持单选,多选和判断");
|
||||
if (questionVO.isSelect() || questionVO.isJudge()) {
|
||||
this.checkQuestionTypeForSelectAndJudge(questionVO,"单选或判断题正确答案有且只有一个!");
|
||||
}else if(questionVO.isMulti()){
|
||||
this.checkQuestionTypeForMulti(questionVO,"多选题正确答案必须是2个以上!");
|
||||
}
|
||||
if(StringUtils.hasText(questionVO.getTags())){
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Splitter.on(",").splitToList(questionVO.getTags()).size() <= 1,"分类最多只能有1个");
|
||||
}
|
||||
PaperQuestionWithBLOBs question = questionVO.convert2DB();
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(question.getQuestion().length() <512,"问题字符长度不用超过512");
|
||||
int wordCounts = questionVO.getOptionList().stream().map(d->d.getContent().length()).reduce(0,Integer::sum);
|
||||
|
||||
private void checkQuestionTypeForSelectAndJudge(PaperQuestionVO vo, String errStr) {
|
||||
long answerCount = vo.getOptionList().stream().filter(PaperQuestionOptionVO2::getCorrect).count();
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(answerCount == 1, errStr);
|
||||
}
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(wordCounts <512,"问题选项长度不用超过512");
|
||||
question.setCreateUserId(accountVO.getId());
|
||||
question.setCreateTime(LocalDateTime.now());
|
||||
if(Objects.nonNull(questionVO.getId())){
|
||||
PaperQuestionExample example = new PaperQuestionExample();
|
||||
PaperQuestionExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andIdEqualTo(questionVO.getId());
|
||||
criteria.andIsDelEqualTo(BusinessConsts.DBLogicDelete.NORMAL.ordinal());
|
||||
Long exist = this.questionDAO.countByExample(example);
|
||||
if(exist <= 0){
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(true,
|
||||
"未找到要修改的数据!");
|
||||
}
|
||||
questionDAO.updateByPrimaryKeyWithBLOBs(question);
|
||||
}else{
|
||||
questionDAO.insert(question);
|
||||
}
|
||||
|
||||
private void checkQuestionTypeForMulti(PaperQuestionVO vo, String errStr) {
|
||||
long answerCount = vo.getOptionList().stream().filter(PaperQuestionOptionVO2::getCorrect).count();
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(answerCount >= 2, errStr);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearAllForOrgId(LoginUserInfoVO userInfoVO) {
|
||||
PaperQuestionExample example = new PaperQuestionExample();
|
||||
PaperQuestionExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andOrgIdEqualTo(userInfoVO.getTopOrgId());
|
||||
PaperQuestionWithBLOBs pq = new PaperQuestionWithBLOBs();
|
||||
pq.setIsDel(BusinessConsts.DBLogicDelete.DELETE.ordinal());
|
||||
questionDAO.updateByExampleSelective(pq, example);
|
||||
}
|
||||
private void checkQuestionType(PaperQuestionVO vo ,String errStr){
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue((Objects.equals(BusinessConsts.TheoryType.select.name(),vo.getType())
|
||||
|| Objects.equals(BusinessConsts.TheoryType.judge.name(),vo.getType())
|
||||
|| Objects.equals(BusinessConsts.TheoryType.multi.name(),vo.getType())),errStr);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void importProjectQuestion(List<PaperQuestionVO> questions, Long companyId, AccountVO accountVO) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(companyId), "组织id不能为空");
|
||||
questions.forEach(questionVO -> {
|
||||
String topic = questionVO.getTopic();
|
||||
this.checkQuestionType(questionVO, String.format("题库目前只支持单选,多选和判断,题序[%s]", questionVO.getId()));
|
||||
if (questionVO.isSelect() || questionVO.isJudge()) {
|
||||
this.checkQuestionTypeForSelectAndJudge(questionVO, String.format("题序[%s]:单选或判断题[%s]正确答案应当有且只有一个!", questionVO.getId(), topic));
|
||||
} else if (questionVO.isMulti()) {
|
||||
this.checkQuestionTypeForMulti(questionVO, String.format("题序[%s]:多选题[%s]正确答案应当至少有两个以上!", questionVO.getId(), topic));
|
||||
}
|
||||
if (StringUtils.hasText(questionVO.getTags())) {
|
||||
List<String> tagList = Splitter.on(",").splitToList(questionVO.getTags());
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(tagList.size() <= 1, "分类最多只能为1个");
|
||||
}
|
||||
});
|
||||
private void checkQuestionTypeForSelectAndJudge(PaperQuestionVO vo,String errStr){
|
||||
long answerCount = vo.getOptionList().stream().filter(PaperQuestionOptionVO2::getCorrect).count();
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(answerCount == 1,errStr);
|
||||
}
|
||||
|
||||
questions.forEach(questionVO -> {
|
||||
PaperQuestionWithBLOBs question = questionVO.convert2DB();
|
||||
question.setOrgId(companyId);
|
||||
question.setCreateUserId(accountVO.getId());
|
||||
question.setCreateTime(LocalDateTime.now());
|
||||
questionDAO.insert(question);
|
||||
});
|
||||
private void checkQuestionTypeForMulti(PaperQuestionVO vo,String errStr){
|
||||
long answerCount = vo.getOptionList().stream().filter(PaperQuestionOptionVO2::getCorrect).count();
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(answerCount >= 2,errStr);
|
||||
}
|
||||
|
||||
public void clearAllForOrgId(LoginUserInfoVO userInfoVO){
|
||||
PaperQuestionExample example = new PaperQuestionExample();
|
||||
PaperQuestionExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andOrgIdEqualTo(userInfoVO.getTopOrgId());
|
||||
PaperQuestionWithBLOBs pq = new PaperQuestionWithBLOBs();
|
||||
pq.setIsDel(BusinessConsts.DBLogicDelete.DELETE.ordinal());
|
||||
questionDAO.updateByExampleSelective(pq,example);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void importProjectQuestion(List<PaperQuestionVO> questions, Long companyId, AccountVO accountVO) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(companyId),"组织id不能为空");
|
||||
questions.forEach(questionVO -> {
|
||||
String topic = questionVO.getTopic();
|
||||
this.checkQuestionType(questionVO,String.format("题库目前只支持单选,多选和判断,题序[%s]",questionVO.getId()));
|
||||
if (questionVO.isSelect() || questionVO.isJudge()) {
|
||||
this.checkQuestionTypeForSelectAndJudge(questionVO,String.format("题序[%s]:单选或判断题[%s]正确答案应当有且只有一个!", questionVO.getId(),topic));
|
||||
}else if(questionVO.isMulti()){
|
||||
this.checkQuestionTypeForMulti(questionVO,String.format("题序[%s]:多选题[%s]正确答案应当至少有两个以上!", questionVO.getId(),topic));
|
||||
}
|
||||
if(StringUtils.hasText(questionVO.getTags())){
|
||||
List<String> tagList = Splitter.on(",").splitToList(questionVO.getTags());
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(tagList.size() <= 1 ,"分类最多只能为1个");
|
||||
}
|
||||
});
|
||||
|
||||
questions.forEach(questionVO -> {
|
||||
PaperQuestionWithBLOBs question = questionVO.convert2DB();
|
||||
question.setOrgId(companyId);
|
||||
question.setCreateUserId(accountVO.getId());
|
||||
question.setCreateTime(LocalDateTime.now());
|
||||
questionDAO.insert(question);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除 逻辑删除
|
||||
*
|
||||
* @param questionId 文本id
|
||||
*/
|
||||
public void deleteQuestion(List<Long> questionId) {
|
||||
PaperQuestionExample example = new PaperQuestionExample();
|
||||
example.createCriteria().andIdIn(questionId);
|
||||
PaperQuestionWithBLOBs pq = new PaperQuestionWithBLOBs();
|
||||
pq.setIsDel(BusinessConsts.DBLogicDelete.DELETE.ordinal());
|
||||
questionDAO.updateByExampleSelective(pq, example);
|
||||
}
|
||||
/**
|
||||
* 删除 逻辑删除
|
||||
* @param questionId 文本id
|
||||
*/
|
||||
public void deleteQuestion(List<Long> questionId) {
|
||||
PaperQuestionExample example = new PaperQuestionExample();
|
||||
example.createCriteria().andIdIn(questionId);
|
||||
PaperQuestionWithBLOBs pq = new PaperQuestionWithBLOBs();
|
||||
pq.setIsDel(BusinessConsts.DBLogicDelete.DELETE.ordinal());
|
||||
questionDAO.updateByExampleSelective(pq,example);
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ import club.joylink.rtss.exception.PaperExceptionAssert;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.paper.*;
|
||||
import club.joylink.rtss.vo.paper.PaperCompositionWithRuleVo.CreatorBasic;
|
||||
import club.joylink.rtss.vo.paper.convertor.PaperCompositionConvertor;
|
||||
import club.joylink.rtss.vo.paper.convertor.PaperRuleConvertor;
|
||||
import com.github.pagehelper.Page;
|
||||
@ -38,170 +37,139 @@ import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PaperCompositionService {
|
||||
@Autowired
|
||||
private PaperCompositionDAO compositionDAO;
|
||||
@Autowired
|
||||
private PaperRuleDAO ruleDAO;
|
||||
@Autowired
|
||||
private SysAccountDAO sysAccountDAO;
|
||||
|
||||
@Autowired
|
||||
private PaperCompositionDAO compositionDAO;
|
||||
@Autowired
|
||||
private PaperRuleDAO ruleDAO;
|
||||
@Autowired
|
||||
private SysAccountDAO sysAccountDAO;
|
||||
/**
|
||||
* 创建试卷蓝图包括规则定义
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CreatePaperCompositionRspVo createPaperCompositionWithRule(PaperCompositionWithRuleVo req, AccountVO user) {
|
||||
//根据项目和名称来查,如果存在则结束
|
||||
PaperExceptionAssert.PcNotExisted.assertTrue(Objects.nonNull(req.getMapId()), "请选择对应的线路");
|
||||
List<PaperComposition> pcList = this.findCompositionByCompanyIdAndName(req.getOrgId(), req.getName());
|
||||
PaperExceptionAssert.PcNotExisted.assertTrue(CollectionUtils.isEmpty(pcList), "试卷定义已经存在:orgId=" + req.getOrgId() + " name=" + req.getName());
|
||||
Optional<PaperCompositionWithRuleVo.PaperRuleVo> optionalRule = req.getRuleList().stream().filter(d->d.getSubtype() == PaperQType.SubType.Single
|
||||
&& (Objects.isNull(d.getSubTypeParam()) || Objects.isNull(d.getSubTypeParam().getClient()))).findAny();
|
||||
|
||||
/**
|
||||
* 创建试卷蓝图包括规则定义
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CreatePaperCompositionRspVo createPaperCompositionWithRule(PaperCompositionWithRuleVo req,
|
||||
AccountVO user) {
|
||||
//根据项目和名称来查,如果存在则结束
|
||||
PaperExceptionAssert.PcNotExisted.assertTrue(Objects.nonNull(req.getMapId()),
|
||||
"请选择对应的线路");
|
||||
List<PaperComposition> pcList = this.findCompositionByCompanyIdAndName(req.getOrgId(),
|
||||
req.getName());
|
||||
PaperExceptionAssert.PcNotExisted.assertTrue(CollectionUtils.isEmpty(pcList),
|
||||
"试卷定义已经存在:orgId=" + req.getOrgId() + " name=" + req.getName());
|
||||
Optional<PaperCompositionWithRuleVo.PaperRuleVo> optionalRule = req.getRuleList().stream()
|
||||
.filter(d -> d.getSubtype() == PaperQType.SubType.Single
|
||||
&& (Objects.isNull(d.getSubTypeParam()) || Objects.isNull(
|
||||
d.getSubTypeParam().getClient()))).findAny();
|
||||
PaperExceptionAssert.PcNotHavePr.assertTrue(optionalRule.isEmpty(), "试卷规则-单操缺少客户端的定义");
|
||||
PaperComposition newPc = PaperCompositionConvertor.convertToBean(req);
|
||||
|
||||
PaperExceptionAssert.PcNotHavePr.assertTrue(optionalRule.isEmpty(),
|
||||
"试卷规则-单操缺少客户端的定义");
|
||||
PaperComposition newPc = PaperCompositionConvertor.convertToBean(req);
|
||||
newPc.setCreateTime(LocalDateTime.now());
|
||||
newPc.setUpdateTime(LocalDateTime.now());
|
||||
newPc.setCreatorId(user.getId());
|
||||
newPc.setUpdateId(user.getId());
|
||||
newPc.setState(PaperCompositionState.Editing.getValue());
|
||||
compositionDAO.insertSelective(newPc);
|
||||
|
||||
newPc.setCreateTime(LocalDateTime.now());
|
||||
newPc.setUpdateTime(LocalDateTime.now());
|
||||
newPc.setCreatorId(user.getId());
|
||||
newPc.setUpdateId(user.getId());
|
||||
newPc.setState(PaperCompositionState.Editing.getValue());
|
||||
compositionDAO.insertSelective(newPc);
|
||||
|
||||
if (!CollectionUtils.isEmpty(req.getRuleList())) {
|
||||
final Long pcId = newPc.getId();
|
||||
this.createPaperCompositionRule(pcId, req.getRuleList());
|
||||
if (!CollectionUtils.isEmpty(req.getRuleList())) {
|
||||
final Long pcId = newPc.getId();
|
||||
this.createPaperCompositionRule(pcId, req.getRuleList());
|
||||
}
|
||||
//
|
||||
CreatePaperCompositionRspVo rsp = new CreatePaperCompositionRspVo();
|
||||
rsp.setId(newPc.getId());
|
||||
rsp.setName(newPc.getName());
|
||||
rsp.setProfile(newPc.getProfile());
|
||||
rsp.setOrgId(newPc.getOrgId());
|
||||
return rsp;
|
||||
}
|
||||
//
|
||||
CreatePaperCompositionRspVo rsp = new CreatePaperCompositionRspVo();
|
||||
rsp.setId(newPc.getId());
|
||||
rsp.setName(newPc.getName());
|
||||
rsp.setProfile(newPc.getProfile());
|
||||
rsp.setOrgId(newPc.getOrgId());
|
||||
return rsp;
|
||||
}
|
||||
|
||||
private String ruleMapKey(PaperCompositionWithRuleVo.PaperRuleVo vo) {
|
||||
String key = String.format("%s-%s-%s", vo.getType(), vo.getSubtype(),
|
||||
CollectionUtils.isEmpty(vo.getTags()) ? "" : Joiner.on(",").join(vo.getTags()));
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* 试卷蓝图添加规则
|
||||
*/
|
||||
private void createPaperCompositionRule(Long pcId,
|
||||
List<PaperCompositionWithRuleVo.PaperRuleVo> reqList) {
|
||||
Map<String, List<PaperCompositionWithRuleVo.PaperRuleVo>> tmpList = reqList.stream()
|
||||
.collect(Collectors.groupingBy(this::ruleMapKey));
|
||||
|
||||
for (PaperCompositionWithRuleVo.PaperRuleVo req : reqList) {
|
||||
req.setPcId(pcId);
|
||||
PaperQType.assertPaperSubTypeMatchGroupType(req.getSubtype(), req.getType());
|
||||
String key = this.ruleMapKey(req);
|
||||
List<PaperCompositionWithRuleVo.PaperRuleVo> voList = tmpList.get(key);
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
|
||||
!CollectionUtils.isEmpty(voList) && voList.size() <= 1,
|
||||
String.format("试题规则类型[%s],规则类型[%s] 规则只能有一个",
|
||||
PaperQType.GroupType.getTypeName(req.getType()),
|
||||
PaperQType.SubType.getItemName(req.getSubtype())));
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
|
||||
!CollectionUtils.isEmpty(req.getTags()) && req.getTags().size() <= 1,
|
||||
String.format("试题规则类型[%s],规则类型[%s],分类%s最多只能有一个",
|
||||
PaperQType.GroupType.getTypeName(req.getType()),
|
||||
PaperQType.SubType.getItemName(req.getSubtype()), req.getTags()));
|
||||
PaperRule rule = PaperRuleConvertor.convert(req);
|
||||
ruleDAO.insertSelective(rule);
|
||||
private String ruleMapKey(PaperCompositionWithRuleVo.PaperRuleVo vo){
|
||||
String key = String.format("%s-%s-%s",vo.getType(),vo.getSubtype(), CollectionUtils.isEmpty(vo.getTags())? "" : Joiner.on(",").join(vo.getTags()));
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新试卷蓝图包括规则定义
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updatePaperCompositionWithRule(PaperCompositionWithRuleVo req, AccountVO user) {
|
||||
PaperExceptionAssert.PcNotExisted.assertTrue(Objects.nonNull(req.getMapId()),
|
||||
"请选择对应的线路");
|
||||
Optional<PaperCompositionWithRuleVo.PaperRuleVo> optionalRule = req.getRuleList().stream()
|
||||
.filter(d -> d.getSubtype() == PaperQType.SubType.Single
|
||||
&& (Objects.isNull(d.getSubTypeParam()) || Objects.isNull(
|
||||
d.getSubTypeParam().getClient()))).findAny();
|
||||
PaperExceptionAssert.PcNotHavePr.assertTrue(optionalRule.isEmpty(),
|
||||
"试卷规则-单操缺少客户端的定义");
|
||||
/**
|
||||
* 试卷蓝图添加规则
|
||||
*/
|
||||
private void createPaperCompositionRule(Long pcId, List<PaperCompositionWithRuleVo.PaperRuleVo> reqList) {
|
||||
Map<String,List<PaperCompositionWithRuleVo.PaperRuleVo>> tmpList = reqList.stream().collect(Collectors.groupingBy(this::ruleMapKey));
|
||||
|
||||
PaperComposition curPc = compositionDAO.selectByPrimaryKey(req.getId());
|
||||
assertPaperCompositionCanModify(curPc);
|
||||
//
|
||||
List<PaperComposition> pcList = this.findCompositionByCompanyIdAndName(req.getOrgId(),
|
||||
req.getName());
|
||||
if (!CollectionUtils.isEmpty(pcList)) {
|
||||
boolean exist = pcList.stream().anyMatch(c -> c.getId().compareTo(curPc.getId()) != 0);
|
||||
PaperExceptionAssert.PcExisted.assertNotTrue(exist,
|
||||
"试卷定义已经存在:orgId=" + req.getOrgId() + " name=" + req.getName());
|
||||
for (PaperCompositionWithRuleVo.PaperRuleVo req : reqList) {
|
||||
req.setPcId(pcId);
|
||||
PaperQType.assertPaperSubTypeMatchGroupType(req.getSubtype(), req.getType());
|
||||
String key = this.ruleMapKey(req);
|
||||
List<PaperCompositionWithRuleVo.PaperRuleVo> voList = tmpList.get(key);
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(!CollectionUtils.isEmpty(voList) && voList.size() <= 1 ,String.format("试题规则类型[%s],规则类型[%s] 规则只能有一个", PaperQType.GroupType.getTypeName(req.getType()), PaperQType.SubType.getItemName(req.getSubtype())));
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(!CollectionUtils.isEmpty(req.getTags()) && req.getTags().size() <= 1 ,String.format("试题规则类型[%s],规则类型[%s],分类%s最多只能有一个", PaperQType.GroupType.getTypeName(req.getType()), PaperQType.SubType.getItemName(req.getSubtype()),req.getTags()));
|
||||
PaperRule rule = PaperRuleConvertor.convert(req);
|
||||
ruleDAO.insertSelective(rule);
|
||||
}
|
||||
}
|
||||
PaperComposition newPc = PaperCompositionConvertor.convertToBean(req);
|
||||
newPc.setId(curPc.getId());
|
||||
newPc.setUpdateTime(LocalDateTime.now());
|
||||
curPc.setUpdateId(user.getId());
|
||||
compositionDAO.updateByPrimaryKeySelective(newPc);
|
||||
// 更新规则
|
||||
this.updateCompositionRule(req.getRuleList(), req.getId());
|
||||
}
|
||||
|
||||
private void updateCompositionRule(List<PaperCompositionWithRuleVo.PaperRuleVo> updateRuleList,
|
||||
Long pcId) {
|
||||
PaperRuleExample ruleExample = new PaperRuleExample();
|
||||
ruleExample.createCriteria().andPcIdEqualTo(pcId);
|
||||
this.ruleDAO.deleteByExample(ruleExample);
|
||||
this.createPaperCompositionRule(pcId, updateRuleList);
|
||||
}
|
||||
/**
|
||||
* 更新试卷蓝图包括规则定义
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updatePaperCompositionWithRule(PaperCompositionWithRuleVo req, AccountVO user) {
|
||||
PaperExceptionAssert.PcNotExisted.assertTrue(Objects.nonNull(req.getMapId()), "请选择对应的线路");
|
||||
Optional<PaperCompositionWithRuleVo.PaperRuleVo> optionalRule = req.getRuleList().stream().filter(d->d.getSubtype() == PaperQType.SubType.Single
|
||||
&& (Objects.isNull(d.getSubTypeParam()) || Objects.isNull(d.getSubTypeParam().getClient()))).findAny();
|
||||
PaperExceptionAssert.PcNotHavePr.assertTrue(optionalRule.isEmpty(), "试卷规则-单操缺少客户端的定义");
|
||||
|
||||
/**
|
||||
* 将编辑好的试卷蓝图封存
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void lockPaperComposition(Long pcId, AccountVO user) {
|
||||
PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId);
|
||||
PaperExceptionAssert.PcCanModify.assertTrue(
|
||||
null != curPc && PaperCompositionState.Editing.equals(
|
||||
PaperCompositionState.getItem(curPc.getState())), "试卷定义不存在或非编辑中");
|
||||
PaperExceptionAssert.PcScore.assertTrue(this.checkRulesScoreEqualFull(curPc.getId()),
|
||||
"规则总分值不等于试卷总分值");
|
||||
//
|
||||
PaperComposition nPc = new PaperComposition();
|
||||
nPc.setId(curPc.getId());
|
||||
nPc.setState(PaperCompositionState.Locked.getValue());
|
||||
compositionDAO.updateByPrimaryKeySelective(nPc);
|
||||
// 封存试卷时校验总分值与规则总分值是否相等
|
||||
}
|
||||
PaperComposition curPc = compositionDAO.selectByPrimaryKey(req.getId());
|
||||
assertPaperCompositionCanModify(curPc);
|
||||
//
|
||||
List<PaperComposition> pcList = this.findCompositionByCompanyIdAndName(req.getOrgId(), req.getName());
|
||||
if (!CollectionUtils.isEmpty(pcList)) {
|
||||
boolean exist = pcList.stream().anyMatch(c ->c.getId().compareTo(curPc.getId()) != 0);
|
||||
PaperExceptionAssert.PcExisted.assertNotTrue(exist, "试卷定义已经存在:orgId=" + req.getOrgId() + " name=" + req.getName());
|
||||
}
|
||||
PaperComposition newPc = PaperCompositionConvertor.convertToBean(req);
|
||||
newPc.setId(curPc.getId());
|
||||
newPc.setUpdateTime(LocalDateTime.now());
|
||||
curPc.setUpdateId(user.getId());
|
||||
compositionDAO.updateByPrimaryKeySelective(newPc);
|
||||
// 更新规则
|
||||
this.updateCompositionRule(req.getRuleList(), req.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 将封存的试卷蓝图设置失效
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void unlockPaperComposition(Long pcId, AccountVO user) {
|
||||
PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId);
|
||||
PaperExceptionAssert.PcCanModify.assertTrue(
|
||||
null != curPc && PaperCompositionState.Locked.equals(
|
||||
PaperCompositionState.getItem(curPc.getState())), "试卷定义不存在或非封存中");
|
||||
//
|
||||
PaperComposition nPc = new PaperComposition();
|
||||
nPc.setId(curPc.getId());
|
||||
nPc.setState(PaperCompositionState.Invalid.getValue());
|
||||
nPc.setUpdateId(user.getId());
|
||||
compositionDAO.updateByPrimaryKeySelective(nPc);
|
||||
}
|
||||
private void updateCompositionRule(List<PaperCompositionWithRuleVo.PaperRuleVo> updateRuleList, Long pcId) {
|
||||
PaperRuleExample ruleExample = new PaperRuleExample();
|
||||
ruleExample.createCriteria().andPcIdEqualTo(pcId);
|
||||
this.ruleDAO.deleteByExample(ruleExample);
|
||||
this.createPaperCompositionRule(pcId,updateRuleList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记已封存的试卷已使用
|
||||
*/
|
||||
/**
|
||||
* 将编辑好的试卷蓝图封存
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void lockPaperComposition(Long pcId, AccountVO user) {
|
||||
PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId);
|
||||
PaperExceptionAssert.PcCanModify.assertTrue(null != curPc && PaperCompositionState.Editing.equals(PaperCompositionState.getItem(curPc.getState())), "试卷定义不存在或非编辑中");
|
||||
PaperExceptionAssert.PcScore.assertTrue(this.checkRulesScoreEqualFull(curPc.getId()), "规则总分值不等于试卷总分值");
|
||||
//
|
||||
PaperComposition nPc = new PaperComposition();
|
||||
nPc.setId(curPc.getId());
|
||||
nPc.setState(PaperCompositionState.Locked.getValue());
|
||||
compositionDAO.updateByPrimaryKeySelective(nPc);
|
||||
// 封存试卷时校验总分值与规则总分值是否相等
|
||||
}
|
||||
|
||||
/**
|
||||
* 将封存的试卷蓝图设置失效
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void unlockPaperComposition(Long pcId, AccountVO user) {
|
||||
PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId);
|
||||
PaperExceptionAssert.PcCanModify.assertTrue(null != curPc && PaperCompositionState.Locked.equals(PaperCompositionState.getItem(curPc.getState())), "试卷定义不存在或非封存中");
|
||||
//
|
||||
PaperComposition nPc = new PaperComposition();
|
||||
nPc.setId(curPc.getId());
|
||||
nPc.setState(PaperCompositionState.Invalid.getValue());
|
||||
nPc.setUpdateId(user.getId());
|
||||
compositionDAO.updateByPrimaryKeySelective(nPc);
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记已封存的试卷已使用
|
||||
*/
|
||||
/* @Transactional(rollbackFor = Exception.class)
|
||||
public void usePaperComposition(Long pcId) {
|
||||
PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId);
|
||||
@ -213,299 +181,289 @@ public class PaperCompositionService {
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 删除试卷蓝图(只能删除处于编辑状态的)
|
||||
*
|
||||
* @param pcId 试卷蓝图id
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deletePaperComposition(Long pcId, AccountVO user) {
|
||||
PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId);
|
||||
if (null != curPc) {
|
||||
assertPaperCompositionCanModify(curPc);
|
||||
//先删除试卷定义中的规则
|
||||
PaperRuleExample ruleExample = new PaperRuleExample();
|
||||
ruleExample.createCriteria().andPcIdEqualTo(pcId);
|
||||
ruleDAO.deleteByExample(ruleExample);
|
||||
//删除试卷定义
|
||||
compositionDAO.deleteByPrimaryKey(pcId);
|
||||
/**
|
||||
* 删除试卷蓝图(只能删除处于编辑状态的)
|
||||
*
|
||||
* @param pcId 试卷蓝图id
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deletePaperComposition(Long pcId, AccountVO user) {
|
||||
PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId);
|
||||
if (null != curPc) {
|
||||
assertPaperCompositionCanModify(curPc);
|
||||
//先删除试卷定义中的规则
|
||||
PaperRuleExample ruleExample = new PaperRuleExample();
|
||||
ruleExample.createCriteria().andPcIdEqualTo(pcId);
|
||||
ruleDAO.deleteByExample(ruleExample);
|
||||
//删除试卷定义
|
||||
compositionDAO.deleteByPrimaryKey(pcId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 断言试卷蓝图可以修改
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public void assertPaperCompositionCanModify(Long pcId) {
|
||||
PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId);
|
||||
this.assertPaperCompositionCanModify(curPc);
|
||||
}
|
||||
/**
|
||||
* 断言试卷蓝图可以修改
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public void assertPaperCompositionCanModify(Long pcId) {
|
||||
PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId);
|
||||
this.assertPaperCompositionCanModify(curPc);
|
||||
}
|
||||
|
||||
/**
|
||||
* 断言试卷蓝图可以修改
|
||||
*/
|
||||
public void assertPaperCompositionCanModify(PaperComposition curPc) {
|
||||
PaperExceptionAssert.PcCanModify.assertTrue(
|
||||
null != curPc && PaperCompositionState.Editing.equals(
|
||||
PaperCompositionState.getItem(curPc.getState())),
|
||||
"试卷定义不存在或状态非编辑中,不能修改,pcId = " + curPc.getId());
|
||||
}
|
||||
/**
|
||||
* 断言试卷蓝图可以修改
|
||||
*/
|
||||
public void assertPaperCompositionCanModify(PaperComposition curPc) {
|
||||
PaperExceptionAssert.PcCanModify.assertTrue(null != curPc && PaperCompositionState.Editing.equals(PaperCompositionState.getItem(curPc.getState())), "试卷定义不存在或状态非编辑中,不能修改,pcId = " + curPc.getId());
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public PageVO<PaperCompositionWithRuleVo> findPaperCompositionByPageForAccount(
|
||||
FindPaperCompositionByAccountReqVo req) {
|
||||
PaperExceptionAssert.PpValid.assertTrue(null != req.getAccount() || null != req.getUserId(),
|
||||
"账号和用户id不能同时为空");
|
||||
Long userId = req.getUserId();
|
||||
if (null == userId) {
|
||||
SysAccountExample accountExample = new SysAccountExample();
|
||||
//
|
||||
SysAccountExample.Criteria mobileC = accountExample.or();
|
||||
mobileC.andMobileEqualTo(req.getAccount());
|
||||
if (null != req.getPwd()) {
|
||||
mobileC.andPasswordEqualTo(req.getPwd());
|
||||
}
|
||||
//
|
||||
SysAccountExample.Criteria emailC = accountExample.or();
|
||||
emailC.andEmailEqualTo(req.getAccount());
|
||||
if (null != req.getPwd()) {
|
||||
emailC.andPasswordEqualTo(req.getPwd());
|
||||
}
|
||||
//
|
||||
SysAccountExample.Criteria accountC = accountExample.or();
|
||||
accountC.andAccountEqualTo(req.getAccount());
|
||||
if (null != req.getPwd()) {
|
||||
accountC.andPasswordEqualTo(req.getPwd());
|
||||
}
|
||||
//
|
||||
List<SysAccount> users = this.sysAccountDAO.selectByExample(accountExample);
|
||||
PaperExceptionAssert.PdValid.assertTrue(null != users && users.size() == 1,
|
||||
"用户不存在或根据账户信息匹配了多个");
|
||||
userId = users.get(0).getId();
|
||||
@Transactional(readOnly = true)
|
||||
public PageVO<PaperCompositionWithRuleVo> findPaperCompositionByPageForAccount(FindPaperCompositionByAccountReqVo req) {
|
||||
PaperExceptionAssert.PpValid.assertTrue(null != req.getAccount() || null != req.getUserId(), "账号和用户id不能同时为空");
|
||||
Long userId = req.getUserId();
|
||||
if (null == userId) {
|
||||
SysAccountExample accountExample = new SysAccountExample();
|
||||
//
|
||||
SysAccountExample.Criteria mobileC = accountExample.or();
|
||||
mobileC.andMobileEqualTo(req.getAccount());
|
||||
if (null != req.getPwd()) {
|
||||
mobileC.andPasswordEqualTo(req.getPwd());
|
||||
}
|
||||
//
|
||||
SysAccountExample.Criteria emailC = accountExample.or();
|
||||
emailC.andEmailEqualTo(req.getAccount());
|
||||
if (null != req.getPwd()) {
|
||||
emailC.andPasswordEqualTo(req.getPwd());
|
||||
}
|
||||
//
|
||||
SysAccountExample.Criteria accountC = accountExample.or();
|
||||
accountC.andAccountEqualTo(req.getAccount());
|
||||
if (null != req.getPwd()) {
|
||||
accountC.andPasswordEqualTo(req.getPwd());
|
||||
}
|
||||
//
|
||||
List<SysAccount> users = this.sysAccountDAO.selectByExample(accountExample);
|
||||
PaperExceptionAssert.PdValid.assertTrue(null != users && users.size() == 1, "用户不存在或根据账户信息匹配了多个");
|
||||
userId = users.get(0).getId();
|
||||
}
|
||||
//
|
||||
PaperCompositionExample pcEx = new PaperCompositionExample();
|
||||
PaperCompositionExample.Criteria pcExCriteria = pcEx.createCriteria();
|
||||
pcExCriteria.andCreatorIdEqualTo(userId);
|
||||
List<PaperCompositionState> findStates = req.stateList();
|
||||
pcExCriteria.andStateIn(findStates.stream().map(pcState -> {
|
||||
return pcState.getValue();
|
||||
}).collect(Collectors.toList()));
|
||||
//
|
||||
//1--创建时间 2--更新时间 3--名称;默认值为1;
|
||||
String orderBy = "create_time";
|
||||
switch (req.getOrderBy()) {
|
||||
case 1:
|
||||
orderBy = "create_time";
|
||||
break;
|
||||
case 2:
|
||||
orderBy = "update_time";
|
||||
break;
|
||||
case 3:
|
||||
orderBy = "name";
|
||||
break;
|
||||
}
|
||||
orderBy+=(req.getDesc()?" desc":"");
|
||||
//
|
||||
PageHelper.clearPage();
|
||||
PageHelper.startPage(req.getPageNum(),req.getPageSize(),orderBy);
|
||||
Page<PaperComposition> sqlPage = (Page<PaperComposition>) compositionDAO.selectByExample(pcEx);
|
||||
//
|
||||
final List<PaperCompositionWithRuleVo> rtList = new ArrayList<>();
|
||||
if(!CollectionUtils.isEmpty(sqlPage.getResult())){
|
||||
sqlPage.getResult().forEach(pc->{
|
||||
List<PaperRule> prList = this.findRuleByPcId(pc.getId());
|
||||
rtList.add(PaperCompositionConvertor.convert(pc, prList));
|
||||
});
|
||||
}
|
||||
//
|
||||
PageVO<PaperCompositionWithRuleVo> page = PageVO.convert(sqlPage,rtList);
|
||||
//
|
||||
if (!CollectionUtils.isEmpty(page.getList())) {
|
||||
page.getList().forEach(pc -> {
|
||||
pc.setCreatorInfo(this.findCreatorInfo(pc.getCreatorId()));
|
||||
});
|
||||
}
|
||||
//
|
||||
return page;
|
||||
}
|
||||
//
|
||||
PaperCompositionExample pcEx = new PaperCompositionExample();
|
||||
PaperCompositionExample.Criteria pcExCriteria = pcEx.createCriteria();
|
||||
pcExCriteria.andCreatorIdEqualTo(userId);
|
||||
List<PaperCompositionState> findStates = req.stateList();
|
||||
pcExCriteria.andStateIn(findStates.stream().map(pcState -> {
|
||||
return pcState.getValue();
|
||||
}).collect(Collectors.toList()));
|
||||
//
|
||||
//1--创建时间 2--更新时间 3--名称;默认值为1;
|
||||
String orderBy = "create_time";
|
||||
switch (req.getOrderBy()) {
|
||||
case 1:
|
||||
orderBy = "create_time";
|
||||
break;
|
||||
case 2:
|
||||
orderBy = "update_time";
|
||||
break;
|
||||
case 3:
|
||||
orderBy = "name";
|
||||
break;
|
||||
}
|
||||
orderBy += (req.getDesc() ? " desc" : "");
|
||||
//
|
||||
PageHelper.clearPage();
|
||||
PageHelper.startPage(req.getPageNum(), req.getPageSize(), orderBy);
|
||||
Page<PaperComposition> sqlPage = (Page<PaperComposition>) compositionDAO.selectByExample(pcEx);
|
||||
//
|
||||
final List<PaperCompositionWithRuleVo> rtList = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(sqlPage.getResult())) {
|
||||
sqlPage.getResult().forEach(pc -> {
|
||||
List<PaperRule> prList = this.findRuleByPcId(pc.getId());
|
||||
rtList.add(PaperCompositionConvertor.convert(pc, prList));
|
||||
});
|
||||
}
|
||||
//
|
||||
PageVO<PaperCompositionWithRuleVo> page = PageVO.convert(sqlPage, rtList);
|
||||
//
|
||||
if (!CollectionUtils.isEmpty(page.getList())) {
|
||||
page.getList().forEach(pc -> {
|
||||
pc.setCreatorInfo(this.findCreatorInfo(pc.getCreatorId()));
|
||||
});
|
||||
}
|
||||
//
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 返回蓝图的列表基本信息
|
||||
*/
|
||||
public List<PaperCompositionWithRuleVo> findPaperCompositionList(
|
||||
FindPaperCompositionPageReqVo req) {
|
||||
PaperCompositionExample pcEx = this.queryExample(req);
|
||||
pcEx.setOrderByClause(" create_time desc ");
|
||||
List<PaperComposition> sqlPage = compositionDAO.selectByExample(pcEx);
|
||||
//
|
||||
final List<PaperCompositionWithRuleVo> rtList = new ArrayList<>();
|
||||
for (PaperComposition pc : sqlPage) {
|
||||
rtList.add(PaperCompositionConvertor.convert(pc, null));
|
||||
/**
|
||||
* 返回蓝图的列表基本信息
|
||||
*/
|
||||
public List<PaperCompositionWithRuleVo> findPaperCompositionList(FindPaperCompositionPageReqVo req){
|
||||
PaperCompositionExample pcEx = this.queryExample(req);
|
||||
pcEx.setOrderByClause(" create_time desc ");
|
||||
List<PaperComposition> sqlPage = compositionDAO.selectByExample(pcEx);
|
||||
//
|
||||
final List<PaperCompositionWithRuleVo> rtList = new ArrayList<>();
|
||||
for (PaperComposition pc : sqlPage) {
|
||||
rtList.add(PaperCompositionConvertor.convert(pc,null));
|
||||
}
|
||||
return rtList;
|
||||
}
|
||||
return rtList;
|
||||
}
|
||||
|
||||
private PaperCompositionExample queryExample(FindPaperCompositionPageReqVo req) {
|
||||
PaperCompositionExample pcEx = new PaperCompositionExample();
|
||||
PaperCompositionExample.Criteria pcExCriteria = pcEx.createCriteria();
|
||||
if (Objects.nonNull(req.getOrgId())) {
|
||||
pcExCriteria.andOrgIdEqualTo(req.getOrgId());
|
||||
private PaperCompositionExample queryExample(FindPaperCompositionPageReqVo req){
|
||||
PaperCompositionExample pcEx = new PaperCompositionExample();
|
||||
PaperCompositionExample.Criteria pcExCriteria = pcEx.createCriteria();
|
||||
if (Objects.nonNull(req.getOrgId())) {
|
||||
pcExCriteria.andOrgIdEqualTo(req.getOrgId());
|
||||
}
|
||||
if(Objects.nonNull(req.getMapId())){
|
||||
pcExCriteria.andMapIdEqualTo(req.getMapId());
|
||||
}
|
||||
if (StringUtils.hasText(req.getName())) {
|
||||
if (req.getNameLike()) {
|
||||
pcExCriteria.andNameLike(String.format("%%%s%%", req.getName()));
|
||||
} else {
|
||||
pcExCriteria.andNameEqualTo(req.getName());
|
||||
}
|
||||
}
|
||||
if (StringUtils.hasText(req.getProfile())) {
|
||||
if (req.getProfileLike()) {
|
||||
pcExCriteria.andProfileLike(String.format("%%%s%%", req.getProfile()));
|
||||
} else {
|
||||
pcExCriteria.andProfileEqualTo(req.getProfile());
|
||||
}
|
||||
}
|
||||
List<PaperCompositionState> findStates = req.stateList();
|
||||
pcExCriteria.andStateIn(findStates.stream().map(pcState -> {
|
||||
return pcState.getValue();
|
||||
}).collect(Collectors.toList()));
|
||||
return pcEx;
|
||||
}
|
||||
if (Objects.nonNull(req.getMapId())) {
|
||||
pcExCriteria.andMapIdEqualTo(req.getMapId());
|
||||
/**
|
||||
* 分页查找试卷蓝图
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public PageVO<PaperCompositionWithRuleVo> findPaperCompositionByPage(FindPaperCompositionPageReqVo req) {
|
||||
PaperCompositionExample pcEx = this.queryExample(req);
|
||||
//
|
||||
//1--创建时间 2--更新时间 3--名称;默认值为1;
|
||||
String orderBy = "create_time";
|
||||
switch (req.getOrderBy()) {
|
||||
case 1:
|
||||
orderBy = "create_time";
|
||||
break;
|
||||
case 2:
|
||||
orderBy = "update_time";
|
||||
break;
|
||||
case 3:
|
||||
orderBy = "name";
|
||||
break;
|
||||
}
|
||||
orderBy+=(req.getDesc()?" desc":"");
|
||||
//
|
||||
PageHelper.clearPage();
|
||||
PageHelper.startPage(req.getPageNum(),req.getPageSize(),orderBy);
|
||||
Page<PaperComposition> sqlPage = (Page<PaperComposition>) compositionDAO.selectByExample(pcEx);
|
||||
//
|
||||
final List<PaperCompositionWithRuleVo> rtList = new ArrayList<>();
|
||||
if(!CollectionUtils.isEmpty(sqlPage.getResult())){
|
||||
for (PaperComposition pc : sqlPage.getResult()) {
|
||||
List<PaperRule> prList = this.findRuleByPcId(pc.getId());
|
||||
rtList.add(PaperCompositionConvertor.convert(pc, prList));
|
||||
}
|
||||
}
|
||||
//
|
||||
PageVO<PaperCompositionWithRuleVo> page = PageVO.convert(sqlPage,rtList);
|
||||
//
|
||||
if (!CollectionUtils.isEmpty(page.getList())) {
|
||||
page.getList().forEach(pc -> {
|
||||
pc.setCreatorInfo(this.findCreatorInfo(pc.getCreatorId()));
|
||||
});
|
||||
}
|
||||
//
|
||||
return page;
|
||||
}
|
||||
if (StringUtils.hasText(req.getName())) {
|
||||
if (req.getNameLike()) {
|
||||
pcExCriteria.andNameLike(String.format("%%%s%%", req.getName()));
|
||||
} else {
|
||||
pcExCriteria.andNameEqualTo(req.getName());
|
||||
}
|
||||
}
|
||||
if (StringUtils.hasText(req.getProfile())) {
|
||||
if (req.getProfileLike()) {
|
||||
pcExCriteria.andProfileLike(String.format("%%%s%%", req.getProfile()));
|
||||
} else {
|
||||
pcExCriteria.andProfileEqualTo(req.getProfile());
|
||||
}
|
||||
}
|
||||
if (req.getCreatorId() != null) {
|
||||
pcExCriteria.andCreatorIdEqualTo(req.getCreatorId());
|
||||
}
|
||||
List<PaperCompositionState> findStates = req.stateList();
|
||||
pcExCriteria.andStateIn(findStates.stream().map(pcState -> {
|
||||
return pcState.getValue();
|
||||
}).collect(Collectors.toList()));
|
||||
return pcEx;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查找试卷蓝图
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public PageVO<PaperCompositionWithRuleVo> findPaperCompositionByPage(
|
||||
FindPaperCompositionPageReqVo req) {
|
||||
PaperCompositionExample pcEx = this.queryExample(req);
|
||||
//
|
||||
//1--创建时间 2--更新时间 3--名称;默认值为1;
|
||||
String orderBy = "create_time";
|
||||
switch (req.getOrderBy()) {
|
||||
case 1:
|
||||
orderBy = "create_time";
|
||||
break;
|
||||
case 2:
|
||||
orderBy = "update_time";
|
||||
break;
|
||||
case 3:
|
||||
orderBy = "name";
|
||||
break;
|
||||
private PaperCompositionWithRuleVo.CreatorBasic findCreatorInfo(Long creatorId) {
|
||||
SysAccount sa = this.sysAccountDAO.selectByPrimaryKey(creatorId);
|
||||
if (null != sa) {
|
||||
PaperCompositionWithRuleVo.CreatorBasic rt = new PaperCompositionWithRuleVo.CreatorBasic();
|
||||
rt.setId(sa.getId());
|
||||
rt.setName(sa.getName());
|
||||
rt.setAccount(sa.getAccount());
|
||||
rt.setMobile(sa.getMobile());
|
||||
rt.setEmail(sa.getEmail());
|
||||
return rt;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
orderBy += (req.getDesc() ? " desc" : "");
|
||||
//
|
||||
PageHelper.clearPage();
|
||||
PageHelper.startPage(req.getPageNum(), req.getPageSize(), orderBy);
|
||||
Page<PaperComposition> sqlPage = (Page<PaperComposition>) compositionDAO.selectByExample(pcEx);
|
||||
//
|
||||
final List<PaperCompositionWithRuleVo> rtList = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(sqlPage.getResult())) {
|
||||
for (PaperComposition pc : sqlPage.getResult()) {
|
||||
List<PaperRule> prList = this.findRuleByPcId(pc.getId());
|
||||
rtList.add(PaperCompositionConvertor.convert(pc, prList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取试卷完整的蓝图,包括规则
|
||||
*
|
||||
* @param pcId 试卷蓝图id
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public PaperCompositionWithRuleVo findPaperComposition(Long pcId, AccountVO user) {
|
||||
PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId);
|
||||
PaperExceptionAssert.PcExisted.assertTrue(null != curPc, "试卷定义不存在:id=" + pcId);
|
||||
List<PaperRule> paperRuleList = this.findRuleByPcId(pcId);
|
||||
//
|
||||
PaperCompositionWithRuleVo rt = PaperCompositionConvertor.convert(curPc, paperRuleList);
|
||||
rt.setCreatorInfo(this.findCreatorInfo(rt.getCreatorId()));
|
||||
return rt;
|
||||
}
|
||||
//
|
||||
PageVO<PaperCompositionWithRuleVo> page = PageVO.convert(sqlPage, rtList);
|
||||
//
|
||||
if (!CollectionUtils.isEmpty(page.getList())) {
|
||||
page.getList().forEach(pc -> {
|
||||
pc.setCreatorInfo(this.findCreatorInfo(pc.getCreatorId()));
|
||||
});
|
||||
|
||||
/**
|
||||
* 根据试卷蓝图的项目和名称查找项目
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public List<PaperComposition> findCompositionByCompanyIdAndName(Long orgId, String name) {
|
||||
PaperCompositionExample example = new PaperCompositionExample();
|
||||
example.createCriteria().andOrgIdEqualTo(orgId).andNameEqualTo(name);
|
||||
List<PaperComposition> list = compositionDAO.selectByExample(example);
|
||||
return list;
|
||||
}
|
||||
//
|
||||
return page;
|
||||
}
|
||||
|
||||
private PaperCompositionWithRuleVo.CreatorBasic findCreatorInfo(Long creatorId) {
|
||||
SysAccount sa = this.sysAccountDAO.selectByPrimaryKey(creatorId);
|
||||
if (null != sa) {
|
||||
PaperCompositionWithRuleVo.CreatorBasic rt = new PaperCompositionWithRuleVo.CreatorBasic();
|
||||
rt.setId(sa.getId());
|
||||
if (StringUtils.hasText(sa.getName())) {
|
||||
rt.setName(sa.getName());
|
||||
} else {
|
||||
rt.setName("昵称:" + sa.getNickname());
|
||||
}
|
||||
rt.setAccount(sa.getAccount());
|
||||
rt.setMobile(sa.getMobile());
|
||||
rt.setEmail(sa.getEmail());
|
||||
return rt;
|
||||
/**
|
||||
* 查询试卷蓝图的所有规则
|
||||
*
|
||||
* @param pcId 试卷蓝图的id
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public List<PaperRule> findRuleByPcId(Long pcId) {
|
||||
PaperRuleExample example = new PaperRuleExample();
|
||||
example.createCriteria().andPcIdEqualTo(pcId);
|
||||
return ruleDAO.selectByExample(example);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取试卷完整的蓝图,包括规则
|
||||
*
|
||||
* @param pcId 试卷蓝图id
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public PaperCompositionWithRuleVo findPaperComposition(Long pcId, AccountVO user) {
|
||||
PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId);
|
||||
PaperExceptionAssert.PcExisted.assertTrue(null != curPc, "试卷定义不存在:id=" + pcId);
|
||||
List<PaperRule> paperRuleList = this.findRuleByPcId(pcId);
|
||||
//
|
||||
PaperCompositionWithRuleVo rt = PaperCompositionConvertor.convert(curPc, paperRuleList);
|
||||
rt.setCreatorInfo(this.findCreatorInfo(rt.getCreatorId()));
|
||||
return rt;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据试卷蓝图的项目和名称查找项目
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public List<PaperComposition> findCompositionByCompanyIdAndName(Long orgId, String name) {
|
||||
PaperCompositionExample example = new PaperCompositionExample();
|
||||
example.createCriteria().andOrgIdEqualTo(orgId).andNameEqualTo(name);
|
||||
List<PaperComposition> list = compositionDAO.selectByExample(example);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询试卷蓝图的所有规则
|
||||
*
|
||||
* @param pcId 试卷蓝图的id
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public List<PaperRule> findRuleByPcId(Long pcId) {
|
||||
PaperRuleExample example = new PaperRuleExample();
|
||||
example.createCriteria().andPcIdEqualTo(pcId);
|
||||
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)
|
||||
.distinct()
|
||||
.forEach(creatorId -> creators.add(this.findCreatorInfo(creatorId)));
|
||||
return creators;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验规则当前规定的总分值是否等于试卷蓝图中的满分
|
||||
*/
|
||||
private boolean checkRulesScoreEqualFull(Long pcId) {
|
||||
PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId);
|
||||
PaperExceptionAssert.PcExisted.assertTrue(null != curPc,
|
||||
String.format("试卷定义[id = %s]不存在", pcId));
|
||||
List<PaperRule> ruleList = findRuleByPcId(pcId);
|
||||
int ruleScore = 0;
|
||||
if (!CollectionUtils.isEmpty(ruleList)) {
|
||||
ruleScore = ruleList.stream().mapToInt(rule -> {
|
||||
return rule.getScore() * rule.getAmount();
|
||||
}).sum();
|
||||
/**
|
||||
* 校验规则当前规定的总分值是否小于等于试卷蓝图中的满分
|
||||
*/
|
||||
private boolean checkRulesScoreLessOrEqualFull(Long pcId) {
|
||||
PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId);
|
||||
PaperExceptionAssert.PcExisted.assertTrue(null != curPc, String.format("试卷定义[id = %s]不存在", pcId));
|
||||
List<PaperRule> ruleList = findRuleByPcId(pcId);
|
||||
int ruleScore = 0;
|
||||
if (!CollectionUtils.isEmpty(ruleList)) {
|
||||
ruleScore = ruleList.stream().mapToInt(rule -> {
|
||||
return rule.getScore() * rule.getAmount();
|
||||
}).sum();
|
||||
}
|
||||
return ruleScore <= curPc.getFullScore();
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验规则当前规定的总分值是否等于试卷蓝图中的满分
|
||||
*/
|
||||
private boolean checkRulesScoreEqualFull(Long pcId) {
|
||||
PaperComposition curPc = compositionDAO.selectByPrimaryKey(pcId);
|
||||
PaperExceptionAssert.PcExisted.assertTrue(null != curPc, String.format("试卷定义[id = %s]不存在", pcId));
|
||||
List<PaperRule> ruleList = findRuleByPcId(pcId);
|
||||
int ruleScore = 0;
|
||||
if (!CollectionUtils.isEmpty(ruleList)) {
|
||||
ruleScore = ruleList.stream().mapToInt(rule -> {
|
||||
return rule.getScore() * rule.getAmount();
|
||||
}).sum();
|
||||
}
|
||||
return ruleScore == curPc.getFullScore();
|
||||
}
|
||||
return ruleScore == curPc.getFullScore();
|
||||
}
|
||||
}
|
||||
|
@ -231,7 +231,8 @@ public interface DeviceService {
|
||||
|
||||
void addOrUpdateThailandDeviceConfig(AccountVO accountVO, Long mapId);
|
||||
|
||||
/**
|
||||
* 所有沙盘项目通用接口
|
||||
*/
|
||||
void addOrUpdateNgyDeviceConfig(AccountVO accountVO, Long mapId);
|
||||
|
||||
void addOrUpdateCdgxyDeviceConfig(AccountVO user);
|
||||
}
|
||||
|
@ -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.VrIbpConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.VrpsdConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.cgy.CgyPslConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.cgy.CgySectionConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.cgy.CgySignalConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.cgy.CgySwitchConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.gzb.GzbSignalConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.gzb.GzbSwitchConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.hhcj.HhcjIbpConfigVO;
|
||||
@ -260,8 +256,7 @@ public class DeviceServiceImpl implements DeviceService {
|
||||
ProjectDevice device = this.projectDeviceDAO.selectByPrimaryKey(id);
|
||||
BusinessExceptionAssertEnum.INVALID_OPERATION.assertEquals(
|
||||
ProjectDeviceType.valueOf(device.getType()), ProjectDeviceType.SANDBOX,
|
||||
String.format("设备[%s(%s)]不是电子沙盘工作站,不能更新", device.getCode(),
|
||||
device.getType()));
|
||||
String.format("设备[%s(%s)]不是电子沙盘工作站,不能更新", device.getCode(), device.getType()));
|
||||
device.setConfig(configVO.toJson());
|
||||
this.projectDeviceDAO.updateByPrimaryKeySelective(device);
|
||||
}
|
||||
@ -271,8 +266,7 @@ public class DeviceServiceImpl implements DeviceService {
|
||||
ProjectDevice device = this.projectDeviceDAO.selectByPrimaryKey(id);
|
||||
BusinessExceptionAssertEnum.INVALID_OPERATION.assertEquals(
|
||||
ProjectDeviceType.valueOf(device.getType()), ProjectDeviceType.ISCS_LW,
|
||||
String.format("设备[%s(%s)]不是现地综合监控工作站,不能更新", device.getCode(),
|
||||
device.getType()));
|
||||
String.format("设备[%s(%s)]不是现地综合监控工作站,不能更新", device.getCode(), device.getType()));
|
||||
device.setConfig(configVO.toJson());
|
||||
this.projectDeviceDAO.updateByPrimaryKeySelective(device);
|
||||
}
|
||||
@ -282,8 +276,7 @@ public class DeviceServiceImpl implements DeviceService {
|
||||
ProjectDevice device = this.projectDeviceDAO.selectByPrimaryKey(id);
|
||||
BusinessExceptionAssertEnum.INVALID_OPERATION.assertEquals(
|
||||
ProjectDeviceType.valueOf(device.getType()), ProjectDeviceType.ISCS_CW,
|
||||
String.format("设备[%s(%s)]不是中心综合监控工作站,不能更新", device.getCode(),
|
||||
device.getType()));
|
||||
String.format("设备[%s(%s)]不是中心综合监控工作站,不能更新", device.getCode(), device.getType()));
|
||||
device.setConfig(configVO.toJson());
|
||||
this.projectDeviceDAO.updateByPrimaryKeySelective(device);
|
||||
}
|
||||
@ -293,8 +286,7 @@ public class DeviceServiceImpl implements DeviceService {
|
||||
ProjectDevice device = this.projectDeviceDAO.selectByPrimaryKey(id);
|
||||
BusinessExceptionAssertEnum.INVALID_OPERATION.assertEquals(
|
||||
ProjectDeviceType.valueOf(device.getType()), ProjectDeviceType.VR_PSD,
|
||||
String.format("设备[%s(%s)]不是虚拟屏蔽门工作站,不能更新", device.getCode(),
|
||||
device.getType()));
|
||||
String.format("设备[%s(%s)]不是虚拟屏蔽门工作站,不能更新", device.getCode(), device.getType()));
|
||||
device.setConfig(configVO.toJson());
|
||||
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) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
List<ProjectDevice> list = new ArrayList<>();
|
||||
@ -1299,8 +1188,8 @@ public class DeviceServiceImpl implements DeviceService {
|
||||
section.setCreateTime(now);
|
||||
SandTableSectionConfigVO configVO = new SandTableSectionConfigVO(mapSectionNewVO.getCode(),
|
||||
mapSectionNewVO.getSrCode());
|
||||
section.setConfig(JsonUtils.writeValueAsString(configVO));
|
||||
ngyFillTime(configVO, mapSectionNewVO);
|
||||
section.setConfig(JsonUtils.writeValueAsString(configVO));
|
||||
list.add(section);
|
||||
}
|
||||
}
|
||||
@ -1324,7 +1213,8 @@ public class DeviceServiceImpl implements DeviceService {
|
||||
private void ngyFillTime(SandTableSectionConfigVO configVO, MapSectionNewVO section) {
|
||||
Float headDelayTime = null;
|
||||
Float tailDelayTime = null;
|
||||
if (section.isStandTrack() || section.isReentryTrack() || section.isTransferTrack()) {
|
||||
if (section.isStandTrack() || section.isReentryTrack() || section.isTransferTrack()
|
||||
|| section.isParkingTrack()) {
|
||||
if (section.isStandTrack()) {
|
||||
tailDelayTime = 1f;
|
||||
} else {
|
||||
|
@ -12,166 +12,152 @@ import club.joylink.rtss.simulation.cbtc.data.map.Stand;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl;
|
||||
import club.joylink.rtss.simulation.cbtc.event.SimulationPslStatusEvent;
|
||||
import club.joylink.rtss.vo.client.psl.PslStatus;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class VirtualRealityPslService implements IVirtualRealityPslService {
|
||||
|
||||
@Autowired
|
||||
private GroupSimulationService groupSimulationService;
|
||||
@Autowired
|
||||
private GroupSimulationService groupSimulationService;
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Autowired
|
||||
private CiApiService ciApiService;
|
||||
@Autowired
|
||||
private CiApiService ciApiService;
|
||||
|
||||
@Override
|
||||
public PslStatus getStatus(String group, String standCode) {
|
||||
Simulation simulation = groupSimulationService.getSimulationByGroup(group);
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
Map<String, PslStatus> pslStatusMap = repository.getPslStatusMap();
|
||||
PslStatus status = pslStatusMap.get(standCode);
|
||||
if (status != null) {
|
||||
return status;
|
||||
}
|
||||
Stand stand = repository.getByCode(standCode, Stand.class);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(stand.getPsd(),
|
||||
String.format("%s没有屏蔽门", stand.debugStr()));
|
||||
VirtualRealityPsl vrPsl = collectStatus(stand);
|
||||
status = new PslStatus(vrPsl);
|
||||
pslStatusMap.put(standCode, status);
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pressTheButton(Simulation simulation, String standCode,
|
||||
VirtualRealityPsl.Button button) {
|
||||
Stand stand = simulation.getRepository().getByCode(standCode, Stand.class);
|
||||
VirtualRealityPsl vrPsl = collectStatus(stand);
|
||||
theButtonIsPressed(simulation, vrPsl, button);
|
||||
}
|
||||
|
||||
private void theButtonIsPressed(Simulation simulation, VirtualRealityPsl vrPsl,
|
||||
VirtualRealityPsl.Button button) {
|
||||
Stand stand = vrPsl.getStand();
|
||||
switch (button) {
|
||||
case YXJZ:
|
||||
vrPsl.setYxjzKey(!vrPsl.isYxjzKey());
|
||||
break;
|
||||
case HSJC:
|
||||
vrPsl.setHsjcKey(!vrPsl.isHsjcKey());
|
||||
ciApiService.setOrCancelInterlockRelease(simulation, stand, vrPsl.isHsjcKey());
|
||||
break;
|
||||
case KM:
|
||||
ciApiService.openScreenDoor(simulation, stand.getCode(),
|
||||
CiStandService.PsdCommandSource.PSL);
|
||||
break;
|
||||
case GM:
|
||||
ciApiService.closeScreenDoor(simulation, stand.getCode(),
|
||||
CiStandService.PsdCommandSource.PSL);
|
||||
break;
|
||||
case SD:
|
||||
vrPsl.setSdButton(!vrPsl.isSdButton());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(Simulation simulation, VirtualRealityPsl vrPsl,
|
||||
VirtualRealityPsl.Button button, boolean on) {
|
||||
switch (button) {
|
||||
case YXJZ:
|
||||
vrPsl.setYxjzKey(on);
|
||||
break;
|
||||
case HSJC:
|
||||
vrPsl.setHsjcKey(on);
|
||||
break;
|
||||
case KM:
|
||||
vrPsl.setKmButton(on);
|
||||
break;
|
||||
case GM:
|
||||
vrPsl.setGmButton(on);
|
||||
break;
|
||||
case SD:
|
||||
vrPsl.setSdButton(on);
|
||||
break;
|
||||
}
|
||||
effective(simulation, vrPsl.getStand(), button, on);
|
||||
}
|
||||
|
||||
private void effective(Simulation simulation, Stand stand, VirtualRealityPsl.Button button,
|
||||
boolean on) {
|
||||
switch (button) {
|
||||
case YXJZ:
|
||||
break;
|
||||
case HSJC:
|
||||
ciApiService.setOrCancelInterlockRelease(simulation, stand, on);
|
||||
break;
|
||||
case KM:
|
||||
if (on) {
|
||||
ciApiService.openScreenDoor(simulation, stand.getCode(),
|
||||
CiStandService.PsdCommandSource.PSL);
|
||||
@Override
|
||||
public PslStatus getStatus(String group, String standCode) {
|
||||
Simulation simulation = groupSimulationService.getSimulationByGroup(group);
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
Map<String, PslStatus> pslStatusMap = repository.getPslStatusMap();
|
||||
PslStatus status = pslStatusMap.get(standCode);
|
||||
if (status != null) {
|
||||
return status;
|
||||
}
|
||||
break;
|
||||
case GM:
|
||||
if (on) {
|
||||
ciApiService.closeScreenDoor(simulation, stand.getCode(),
|
||||
CiStandService.PsdCommandSource.PSL);
|
||||
Stand stand = repository.getByCode(standCode, Stand.class);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(stand.getPsd(),
|
||||
String.format("%s没有屏蔽门", stand.debugStr()));
|
||||
VirtualRealityPsl vrPsl = collectStatus(stand);
|
||||
status = new PslStatus(vrPsl);
|
||||
pslStatusMap.put(standCode, status);
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pressTheButton(Simulation simulation, String standCode, VirtualRealityPsl.Button button) {
|
||||
Stand stand = simulation.getRepository().getByCode(standCode, Stand.class);
|
||||
VirtualRealityPsl vrPsl = collectStatus(stand);
|
||||
theButtonIsPressed(simulation, vrPsl, button);
|
||||
}
|
||||
|
||||
private void theButtonIsPressed(Simulation simulation, VirtualRealityPsl vrPsl, VirtualRealityPsl.Button button) {
|
||||
Stand stand = vrPsl.getStand();
|
||||
switch (button) {
|
||||
case YXJZ:
|
||||
vrPsl.setYxjzKey(!vrPsl.isYxjzKey());
|
||||
break;
|
||||
case HSJC:
|
||||
vrPsl.setHsjcKey(!vrPsl.isHsjcKey());
|
||||
ciApiService.setOrCancelInterlockRelease(simulation, stand, vrPsl.isHsjcKey());
|
||||
break;
|
||||
case KM:
|
||||
ciApiService.openScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
|
||||
break;
|
||||
case GM:
|
||||
ciApiService.closeScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
|
||||
break;
|
||||
case SD:
|
||||
vrPsl.setSdButton(!vrPsl.isSdButton());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SD:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addJobs(Simulation simulation) {
|
||||
simulation.addJobIfAbsent(Simulation.JobName.pslStatus,
|
||||
() -> this.collectAndDispatcher(simulation), SimulationConstants.PSL_STATUS_COLLECT_RATE);
|
||||
}
|
||||
|
||||
public void collectAndDispatcher(Simulation simulation) {
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
Map<String, PslStatus> ibpStatusMap = repository.getPslStatusMap();
|
||||
Map<String, PslStatus> collectionMap = new HashMap<>();
|
||||
for (Stand stand : repository.getStandList()) {
|
||||
if (stand.getVrPsl() == null) {
|
||||
continue;
|
||||
}
|
||||
VirtualRealityPsl vrPsl = this.collectStatus(stand);
|
||||
PslStatus pslStatus = ibpStatusMap.get(stand.getCode());
|
||||
if (pslStatus == null) {
|
||||
PslStatus newStatus = new PslStatus(vrPsl);
|
||||
ibpStatusMap.put(stand.getCode(), newStatus);
|
||||
collectionMap.put(stand.getCode(), newStatus);
|
||||
} else {
|
||||
PslStatus difference = pslStatus.collectDifference(vrPsl);
|
||||
if (difference != null) {
|
||||
collectionMap.put(stand.getCode(), difference);
|
||||
@Override
|
||||
public void updateStatus(Simulation simulation, VirtualRealityPsl vrPsl, VirtualRealityPsl.Button button, boolean on) {
|
||||
switch (button) {
|
||||
case YXJZ:
|
||||
vrPsl.setYxjzKey(on);
|
||||
break;
|
||||
case HSJC:
|
||||
vrPsl.setHsjcKey(on);
|
||||
break;
|
||||
case KM:
|
||||
case GM:
|
||||
break;
|
||||
case SD:
|
||||
vrPsl.setSdButton(on);
|
||||
break;
|
||||
}
|
||||
}
|
||||
effective(simulation, vrPsl.getStand(), button, on);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(collectionMap)) {
|
||||
applicationContext.publishEvent(
|
||||
new SimulationPslStatusEvent(this, simulation, collectionMap));
|
||||
}
|
||||
}
|
||||
|
||||
private VirtualRealityPsl collectStatus(Stand stand) {
|
||||
VirtualRealityPsl vrPsl = stand.getVrPsl();
|
||||
PSD psd = stand.getPsd();
|
||||
vrPsl.setQbgmLight(vrPsl.isSdButton() || psd.isCloseAndLock());
|
||||
vrPsl.setPslczLight(vrPsl.isSdButton() || vrPsl.isYxjzKey());
|
||||
vrPsl.setHsjcLight(vrPsl.isSdButton() || vrPsl.isHsjcKey());
|
||||
vrPsl.setKmLight(vrPsl.isSdButton() || !psd.isClose());
|
||||
vrPsl.setGmLight(vrPsl.isSdButton() || psd.isClose());
|
||||
return vrPsl;
|
||||
}
|
||||
private void effective(Simulation simulation, Stand stand, VirtualRealityPsl.Button button, boolean on) {
|
||||
switch (button) {
|
||||
case YXJZ:
|
||||
break;
|
||||
case HSJC:
|
||||
ciApiService.setOrCancelInterlockRelease(simulation, stand, on);
|
||||
break;
|
||||
case KM:
|
||||
if (on)
|
||||
ciApiService.openScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
|
||||
break;
|
||||
case GM:
|
||||
if (on)
|
||||
ciApiService.closeScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
|
||||
break;
|
||||
case SD:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addJobs(Simulation simulation) {
|
||||
simulation.addJobIfAbsent(Simulation.JobName.pslStatus,
|
||||
() -> this.collectAndDispatcher(simulation), SimulationConstants.PSL_STATUS_COLLECT_RATE);
|
||||
}
|
||||
|
||||
public void collectAndDispatcher(Simulation simulation) {
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
Map<String, PslStatus> ibpStatusMap = repository.getPslStatusMap();
|
||||
Map<String, PslStatus> collectionMap = new HashMap<>();
|
||||
for (Stand stand : repository.getStandList()) {
|
||||
if (stand.getVrPsl() == null)
|
||||
continue;
|
||||
VirtualRealityPsl vrPsl = this.collectStatus(stand);
|
||||
PslStatus pslStatus = ibpStatusMap.get(stand.getCode());
|
||||
if (pslStatus == null) {
|
||||
PslStatus newStatus = new PslStatus(vrPsl);
|
||||
ibpStatusMap.put(stand.getCode(), newStatus);
|
||||
collectionMap.put(stand.getCode(), newStatus);
|
||||
} else {
|
||||
PslStatus difference = pslStatus.collectDifference(vrPsl);
|
||||
if (difference != null) {
|
||||
collectionMap.put(stand.getCode(), difference);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(collectionMap)) {
|
||||
applicationContext.publishEvent(new SimulationPslStatusEvent(this, simulation, collectionMap));
|
||||
}
|
||||
}
|
||||
|
||||
private VirtualRealityPsl collectStatus(Stand stand) {
|
||||
VirtualRealityPsl vrPsl = stand.getVrPsl();
|
||||
PSD psd = stand.getPsd();
|
||||
vrPsl.setQbgmLight(vrPsl.isSdButton() || psd.isCloseAndLock());
|
||||
vrPsl.setPslczLight(vrPsl.isSdButton() || vrPsl.isYxjzKey());
|
||||
vrPsl.setHsjcLight(vrPsl.isSdButton() || vrPsl.isHsjcKey());
|
||||
vrPsl.setKmLight(vrPsl.isSdButton() || !psd.isClose());
|
||||
vrPsl.setGmLight(vrPsl.isSdButton() || psd.isClose());
|
||||
return vrPsl;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -280,7 +280,13 @@ public class PublishMapDataHandler {
|
||||
MapGraphDataNewVO data = JsonUtils.read(map.getGraphData(), MapGraphDataNewVO.class);
|
||||
for (MapSectionNewVO section : data.getSectionList()) {
|
||||
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));
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -18,10 +18,24 @@ import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
|
||||
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 com.github.pagehelper.Page;
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -29,230 +43,258 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class RunPlanRoutingService implements IRunPlanRoutingService {
|
||||
|
||||
@Autowired
|
||||
private RunPlanRoutingDAO runPlanRoutingDAO;
|
||||
@Autowired
|
||||
private RunPlanRoutingDAO runPlanRoutingDAO;
|
||||
|
||||
@Autowired
|
||||
private RunPlanDraftDAO runPlanDraftDAO;
|
||||
@Autowired
|
||||
private RunPlanDraftDAO runPlanDraftDAO;
|
||||
|
||||
@Autowired
|
||||
private IRunPlanRunlevelService planRunlevelService;
|
||||
@Autowired
|
||||
private IRunPlanRunlevelService planRunlevelService;
|
||||
|
||||
@Autowired
|
||||
private IRunPlanParktimeService planParktimeService;
|
||||
@Autowired
|
||||
private IRunPlanParktimeService planParktimeService;
|
||||
|
||||
@Autowired
|
||||
private IRunPlanUserConfigService planConfigService;
|
||||
@Autowired
|
||||
private IRunPlanUserConfigService planConfigService;
|
||||
|
||||
@Autowired
|
||||
private IMapService iMapService;
|
||||
@Autowired
|
||||
private IMapService iMapService;
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void createUserRouting(RunPlanRoutingVO routingVO) {
|
||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(routingDataExist(routingVO), "交路数据重复");
|
||||
MapVO map = this.iMapService.getMapDetail(routingVO.getMapId());
|
||||
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
|
||||
if (map.getCheckConfig().isCheck()) {
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
||||
"地图基础数据校验不通过");
|
||||
@Transactional
|
||||
@Override
|
||||
public void createUserRouting(RunPlanRoutingVO routingVO) {
|
||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(routingDataExist(routingVO),
|
||||
"交路数据重复");
|
||||
MapVO map = this.iMapService.getMapDetail(routingVO.getMapId());
|
||||
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(
|
||||
map);
|
||||
if (map.getCheckConfig().isCheck()) {
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
||||
"地图基础数据校验不通过");
|
||||
}
|
||||
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
|
||||
setRoutingType(routingVO, deviceMap);
|
||||
RunPlanRouting routing = routingVO.convert2Entity();
|
||||
runPlanRoutingDAO.insert(routing);
|
||||
createRoutingRefData(deviceMap, routingVO);
|
||||
if (Objects.equals(RunPlanRoutingVO.UserRoutingType.LOOP, routingVO.getRoutingType())) {
|
||||
RunPlanRoutingVO routingDataLoop = routingVO.getRoutingDataLoop();
|
||||
try {
|
||||
generateUserRoutingSections(routingDataLoop, deviceMap);
|
||||
} catch (BaseException e) {
|
||||
return;
|
||||
}
|
||||
if (routingDataExist(routingDataLoop)) {
|
||||
return;
|
||||
}
|
||||
Section endSection = (Section) deviceMap.get(routingDataLoop.getEndSectionCode());
|
||||
routingDataLoop.setDestinationCode(endSection.getDestinationCode());
|
||||
runPlanRoutingDAO.insert(routingDataLoop.convert2Entity());
|
||||
createRoutingRefData(deviceMap, routingDataLoop);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void createDefaultRoutings(List<RunPlanRoutingVO> defaultRoutings) {
|
||||
if (CollectionUtils.isEmpty(defaultRoutings)) {
|
||||
return;
|
||||
}
|
||||
MapVO map = this.iMapService.getMapDetail(defaultRoutings.get(0).getMapId());
|
||||
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(
|
||||
map);
|
||||
// BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(), "地图基础数据校验不通过");
|
||||
if (CollectionUtils.isEmpty(buildResult.getErrMsgList())) {
|
||||
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
|
||||
defaultRoutings.forEach(routingVO -> {
|
||||
routingVO.setUserId(null);
|
||||
if (routingDataExist(routingVO)) {
|
||||
return;
|
||||
}
|
||||
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
|
||||
setRoutingType(routingVO, deviceMap);
|
||||
RunPlanRouting routing = routingVO.convert2Entity();
|
||||
runPlanRoutingDAO.insert(routing);
|
||||
createRoutingRefData(deviceMap, routingVO);
|
||||
if (Objects.equals(RunPlanRoutingVO.UserRoutingType.LOOP, routingVO.getRoutingType())) {
|
||||
RunPlanRoutingVO routingDataLoop = routingVO.getRoutingDataLoop();
|
||||
try {
|
||||
generateUserRoutingSections(routingDataLoop, deviceMap);
|
||||
}catch (BaseException e){
|
||||
return;
|
||||
}
|
||||
if (routingDataExist(routingDataLoop)) return;
|
||||
Section endSection = (Section) deviceMap.get(routingDataLoop.getEndSectionCode());
|
||||
routingDataLoop.setDestinationCode(endSection.getDestinationCode());
|
||||
runPlanRoutingDAO.insert(routingDataLoop.convert2Entity());
|
||||
createRoutingRefData(deviceMap, routingDataLoop);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void createDefaultRoutings(List<RunPlanRoutingVO> defaultRoutings) {
|
||||
if (CollectionUtils.isEmpty(defaultRoutings)) return;
|
||||
MapVO map = this.iMapService.getMapDetail(defaultRoutings.get(0).getMapId());
|
||||
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
|
||||
// BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(), "地图基础数据校验不通过");
|
||||
if (CollectionUtils.isEmpty(buildResult.getErrMsgList())) {
|
||||
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
|
||||
defaultRoutings.forEach(routingVO -> {
|
||||
routingVO.setUserId(null);
|
||||
if (routingDataExist(routingVO)) return;
|
||||
setRoutingType(routingVO, deviceMap);
|
||||
RunPlanRouting routing = routingVO.convert2Entity();
|
||||
runPlanRoutingDAO.insert(routing);
|
||||
});
|
||||
}
|
||||
@Override
|
||||
@Transactional
|
||||
public void syncDefaultRoutingRefData(Long userId, Long mapId) {
|
||||
List<RunPlanRoutingVO> defaultRoutingVOs = getDefaultRoutings(mapId);
|
||||
if (CollectionUtils.isEmpty(defaultRoutingVOs)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void syncDefaultRoutingRefData(Long userId, Long mapId) {
|
||||
List<RunPlanRoutingVO> defaultRoutingVOs = getDefaultRoutings(mapId);
|
||||
if (CollectionUtils.isEmpty(defaultRoutingVOs)) return;
|
||||
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(this.iMapService.getMapDetail(mapId));
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(), "地图基础数据校验不通过");
|
||||
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
|
||||
//根据默认交路生成站间运行等级、停站时间、折返数据
|
||||
Set<RunPlanRunlevelVO> levelList = new HashSet<>(100);
|
||||
Set<RunPlanParkingTimeVO> parkingTimeList = new HashSet<>(30);
|
||||
RunPlanUserConfigVO userConfig = planConfigService.getConfig(userId, mapId);
|
||||
Map<String, RunPlanUserConfigVO.ReentryTime> reentryData;
|
||||
if (Objects.nonNull(userConfig)) {
|
||||
reentryData = userConfig.getConfig().getReentryData();
|
||||
} else {
|
||||
RunPlanUserConfigVO.Config config = new RunPlanUserConfigVO.Config();
|
||||
reentryData = config.getReentryData();
|
||||
userConfig = new RunPlanUserConfigVO(mapId, userId, config);
|
||||
}
|
||||
defaultRoutingVOs.forEach(routingVO -> {
|
||||
routingVO.setUserId(userId);
|
||||
List<RunPlanRunlevelVO> levels = RunPlanRunlevelVO.runLevelsFromRouting(routingVO);
|
||||
levelList.addAll(levels.stream().filter(l -> {
|
||||
Section startSection = (Section) deviceMap.get(l.getStartSectionCode());
|
||||
Section endSection = (Section) deviceMap.get(l.getEndSectionCode());
|
||||
if ((startSection.isTurnBackTrack() && !startSection.isStandTrack())
|
||||
|| (endSection.isTurnBackTrack() && !endSection.isStandTrack())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}).collect(Collectors.toList()));
|
||||
|
||||
List<RunPlanParkingTimeVO> parkingTimeVOS = RunPlanParkingTimeVO.parkingTimeFromRouting(routingVO);
|
||||
parkingTimeVOS.forEach(p -> {
|
||||
if (((Section) deviceMap.get(p.getSectionCode())).isStandTrack()) {
|
||||
parkingTimeList.add(p);
|
||||
}
|
||||
});
|
||||
|
||||
setStationReentryTime(deviceMap, reentryData, routingVO);
|
||||
}
|
||||
);
|
||||
//先简单插入新数据
|
||||
List<RunPlanRunlevelVO> levels = planRunlevelService.queryUserRunLevels(userId, mapId);
|
||||
levelList.removeAll(levels);
|
||||
levelList.forEach(l -> {
|
||||
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(
|
||||
this.iMapService.getMapDetail(mapId));
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
||||
"地图基础数据校验不通过");
|
||||
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
|
||||
//根据默认交路生成站间运行等级、停站时间、折返数据
|
||||
Set<RunPlanRunlevelVO> levelList = new HashSet<>(100);
|
||||
Set<RunPlanParkingTimeVO> parkingTimeList = new HashSet<>(30);
|
||||
RunPlanUserConfigVO userConfig = planConfigService.getConfig(userId, mapId);
|
||||
Map<String, RunPlanUserConfigVO.ReentryTime> reentryData;
|
||||
if (Objects.nonNull(userConfig)) {
|
||||
reentryData = userConfig.getConfig().getReentryData();
|
||||
} else {
|
||||
RunPlanUserConfigVO.Config config = new RunPlanUserConfigVO.Config();
|
||||
reentryData = config.getReentryData();
|
||||
userConfig = new RunPlanUserConfigVO(mapId, userId, config);
|
||||
}
|
||||
defaultRoutingVOs.forEach(routingVO -> {
|
||||
routingVO.setUserId(userId);
|
||||
List<RunPlanRunlevelVO> levels = RunPlanRunlevelVO.runLevelsFromRouting(routingVO);
|
||||
levelList.addAll(levels.stream().filter(l -> {
|
||||
Section startSection = (Section) deviceMap.get(l.getStartSectionCode());
|
||||
Section endSection = (Section) deviceMap.get(l.getEndSectionCode());
|
||||
if ((startSection.isStandTrack() && endSection.isTransferTrack()) || (endSection.isStandTrack() && startSection.isTransferTrack())) {
|
||||
Float distance;
|
||||
try {
|
||||
distance = CalculateService.calculateDistance(startSection, endSection, l.getRight());
|
||||
} catch (SimulationException e) {
|
||||
distance = CalculateService.calculateDistance(startSection, endSection, !l.getRight());
|
||||
}
|
||||
l.setDistance(distance);
|
||||
l.generateDefaultRunLevel();
|
||||
planRunlevelService.createUserRunlevel(l);
|
||||
return;
|
||||
if ((startSection.isTurnBackTrack() && !startSection.isStandTrack())
|
||||
|| (endSection.isTurnBackTrack() && !endSection.isStandTrack())) {
|
||||
return false;
|
||||
}
|
||||
Float distance = CalculateService.calculateDistance(startSection, endSection, l.getRight());
|
||||
l.setDistance(distance);
|
||||
l.generateDefaultRunLevel();
|
||||
planRunlevelService.createUserRunlevel(l);
|
||||
});
|
||||
List<RunPlanParkingTimeVO> parktimes = planParktimeService.queryUserParktimes(userId, mapId);
|
||||
parkingTimeList.removeAll(parktimes);
|
||||
parkingTimeList.forEach(p -> {
|
||||
planParktimeService.createUserParktime(p);
|
||||
});
|
||||
planConfigService.saveConfig(userId, mapId, userConfig.getConfig());
|
||||
}
|
||||
return true;
|
||||
}).collect(Collectors.toList()));
|
||||
|
||||
private void setStationReentryTime(Map<String, MapElement> deviceMap, Map<String, RunPlanUserConfigVO.ReentryTime> reentryData, RunPlanRoutingVO routingVO) {
|
||||
Section startSection = (Section) deviceMap.get(routingVO.getStartSectionCode());
|
||||
if (startSection.isTurnBackTrack()) {
|
||||
reentryData.putIfAbsent(routingVO.getStartStationCode(), new RunPlanUserConfigVO.ReentryTime(120, 210, 45, 45));
|
||||
List<RunPlanParkingTimeVO> parkingTimeVOS = RunPlanParkingTimeVO.parkingTimeFromRouting(
|
||||
routingVO);
|
||||
parkingTimeVOS.forEach(p -> {
|
||||
if (((Section) deviceMap.get(p.getSectionCode())).isStandTrack()) {
|
||||
parkingTimeList.add(p);
|
||||
}
|
||||
});
|
||||
|
||||
setStationReentryTime(deviceMap, reentryData, routingVO);
|
||||
}
|
||||
Section endSection = (Section) deviceMap.get(routingVO.getEndSectionCode());
|
||||
if (endSection.isTurnBackTrack()) {
|
||||
reentryData.putIfAbsent(routingVO.getEndStationCode(), new RunPlanUserConfigVO.ReentryTime(120, 210, 45, 45));
|
||||
);
|
||||
//先简单插入新数据
|
||||
List<RunPlanRunlevelVO> levels = planRunlevelService.queryUserRunLevels(userId, mapId);
|
||||
levelList.removeAll(levels);
|
||||
levelList.forEach(l -> {
|
||||
Section startSection = (Section) deviceMap.get(l.getStartSectionCode());
|
||||
Section endSection = (Section) deviceMap.get(l.getEndSectionCode());
|
||||
if ((startSection.isStandTrack() && endSection.isTransferTrack()) || (
|
||||
endSection.isStandTrack() && startSection.isTransferTrack())) {
|
||||
Float distance;
|
||||
try {
|
||||
distance = CalculateService.calculateDistance(startSection, endSection, l.getRight());
|
||||
} catch (SimulationException e) {
|
||||
distance = CalculateService.calculateDistance(startSection, endSection, !l.getRight());
|
||||
}
|
||||
}
|
||||
l.setDistance(distance);
|
||||
l.generateDefaultRunLevel();
|
||||
planRunlevelService.createUserRunlevel(l);
|
||||
return;
|
||||
}
|
||||
Float distance = CalculateService.calculateDistance(startSection, endSection, l.getRight());
|
||||
l.setDistance(distance);
|
||||
l.generateDefaultRunLevel();
|
||||
planRunlevelService.createUserRunlevel(l);
|
||||
});
|
||||
List<RunPlanParkingTimeVO> parktimes = planParktimeService.queryUserParktimes(userId, mapId);
|
||||
parkingTimeList.removeAll(parktimes);
|
||||
parkingTimeList.forEach(p -> {
|
||||
planParktimeService.createUserParktime(p);
|
||||
});
|
||||
planConfigService.saveConfig(userId, mapId, userConfig.getConfig());
|
||||
}
|
||||
|
||||
private void createRoutingRefData(Map<String, MapElement> deviceMap, RunPlanRoutingVO routingVO) {
|
||||
generateUserRunlevels(routingVO, deviceMap);
|
||||
generateUserParktimes(routingVO, deviceMap);
|
||||
generateUserStationReentryTimes(routingVO, deviceMap);
|
||||
private void setStationReentryTime(Map<String, MapElement> deviceMap,
|
||||
Map<String, RunPlanUserConfigVO.ReentryTime> reentryData, RunPlanRoutingVO routingVO) {
|
||||
Section startSection = (Section) deviceMap.get(routingVO.getStartSectionCode());
|
||||
if (startSection.isTurnBackTrack()) {
|
||||
reentryData.putIfAbsent(routingVO.getStartStationCode(),
|
||||
new RunPlanUserConfigVO.ReentryTime(120, 210, 45, 45));
|
||||
}
|
||||
Section endSection = (Section) deviceMap.get(routingVO.getEndSectionCode());
|
||||
if (endSection.isTurnBackTrack()) {
|
||||
reentryData.putIfAbsent(routingVO.getEndStationCode(),
|
||||
new RunPlanUserConfigVO.ReentryTime(120, 210, 45, 45));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RunPlanRoutingVO generateUserRoutingData(RunPlanRoutingVO routingVO) {
|
||||
MapVO map = this.iMapService.getMapDetail(routingVO.getMapId());
|
||||
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
||||
"地图基础数据校验不通过");
|
||||
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
|
||||
generateUserRoutingSections(routingVO, deviceMap);
|
||||
return routingVO;
|
||||
}
|
||||
private void createRoutingRefData(Map<String, MapElement> deviceMap, RunPlanRoutingVO routingVO) {
|
||||
generateUserRunlevels(routingVO, deviceMap);
|
||||
generateUserParktimes(routingVO, deviceMap);
|
||||
generateUserStationReentryTimes(routingVO, deviceMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RunPlanRoutingVO> queryRoutes(Long mapId, RunPlanRoutingQueryVO queryVO, AccountVO user) {
|
||||
return getUserRoutingBy(user.getId(), mapId).stream()
|
||||
.filter(routing -> Objects.equals(routing.getDestinationCode(), queryVO.getDestinationCode()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
@Override
|
||||
public RunPlanRoutingVO generateUserRoutingData(RunPlanRoutingVO routingVO) {
|
||||
MapVO map = this.iMapService.getMapDetail(routingVO.getMapId());
|
||||
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(
|
||||
map);
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
||||
"地图基础数据校验不通过");
|
||||
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
|
||||
generateUserRoutingSections(routingVO, deviceMap);
|
||||
return routingVO;
|
||||
}
|
||||
|
||||
private void generateUserRoutingSections(RunPlanRoutingVO routingVO, Map<String, MapElement> deviceMap) {
|
||||
Section startSection = (Section) deviceMap.get(routingVO.getStartSectionCode());
|
||||
Section endSection = (Section) deviceMap.get(routingVO.getEndSectionCode());
|
||||
//中间经停所有站台轨
|
||||
List<Section> passingStandTrack = CalculateService.findPassingStandTrack(startSection, endSection, routingVO.getRight());
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotNull(passingStandTrack,
|
||||
String.format("没有找到线路方向[%s]的中间经停区段,是否需要更换方向/手动添加/直接保存交路", routingVO.getRight() ? "右向" : "左向"));
|
||||
LinkedList<RunPlanRoutingSection> parkSectionCodeList = passingStandTrack.stream().map(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);
|
||||
}
|
||||
@Override
|
||||
public List<RunPlanRoutingVO> queryRoutes(Long mapId, RunPlanRoutingQueryVO queryVO,
|
||||
AccountVO user) {
|
||||
return getUserRoutingBy(user.getId(), mapId).stream()
|
||||
.filter(
|
||||
routing -> Objects.equals(routing.getDestinationCode(), queryVO.getDestinationCode()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RunPlanRoutingVO getUserRouting(Long routingId) {
|
||||
RunPlanRouting routing = getRunPlanRoutingData(routingId);
|
||||
return RunPlanRoutingVO.convert2VO(routing);
|
||||
}
|
||||
private void generateUserRoutingSections(RunPlanRoutingVO routingVO,
|
||||
Map<String, MapElement> deviceMap) {
|
||||
Section startSection = (Section) deviceMap.get(routingVO.getStartSectionCode());
|
||||
Section endSection = (Section) deviceMap.get(routingVO.getEndSectionCode());
|
||||
//中间经停所有站台轨
|
||||
List<Section> passingStandTrack = CalculateService.findPassingStandTrack(startSection,
|
||||
endSection, routingVO.getRight());
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotNull(passingStandTrack,
|
||||
String.format("没有找到线路方向[%s]的中间经停区段,是否需要更换方向/手动添加/直接保存交路",
|
||||
routingVO.getRight() ? "右向" : "左向"));
|
||||
LinkedList<RunPlanRoutingSection> parkSectionCodeList = passingStandTrack.stream().map(
|
||||
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);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void updateUserRouting(Long routingId, RunPlanRoutingVO routingVO) {
|
||||
MapVO map = this.iMapService.getMapDetail(routingVO.getMapId());
|
||||
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
||||
"地图基础数据校验不通过");
|
||||
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
|
||||
setRoutingType(routingVO, deviceMap);
|
||||
RunPlanRouting newRouting = routingVO.convert2Entity();
|
||||
newRouting.setId(routingId);
|
||||
RunPlanRouting routing = getRunPlanRoutingData(routingId);
|
||||
if(Objects.equals(routing.getSectionData(),JsonUtils.writeValueAsString(routingVO.getParkSectionCodeList()))){
|
||||
runPlanRoutingDAO.updateByPrimaryKey(newRouting);
|
||||
return;
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(routingDataExist(routingVO), "交路数据重复");
|
||||
runPlanRoutingDAO.updateByPrimaryKeyWithBLOBs(newRouting);
|
||||
generateUserRunlevels(routingVO, deviceMap);
|
||||
generateUserParktimes(routingVO, deviceMap);
|
||||
generateUserStationReentryTimes(routingVO, deviceMap);
|
||||
@Override
|
||||
public RunPlanRoutingVO getUserRouting(Long routingId) {
|
||||
RunPlanRouting routing = getRunPlanRoutingData(routingId);
|
||||
return RunPlanRoutingVO.convert2VO(routing);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void updateUserRouting(Long routingId, RunPlanRoutingVO routingVO) {
|
||||
MapVO map = this.iMapService.getMapDetail(routingVO.getMapId());
|
||||
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(
|
||||
map);
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
||||
"地图基础数据校验不通过");
|
||||
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
|
||||
setRoutingType(routingVO, deviceMap);
|
||||
RunPlanRouting newRouting = routingVO.convert2Entity();
|
||||
newRouting.setId(routingId);
|
||||
RunPlanRouting routing = getRunPlanRoutingData(routingId);
|
||||
if (Objects.equals(routing.getSectionData(),
|
||||
JsonUtils.writeValueAsString(routingVO.getParkSectionCodeList()))) {
|
||||
runPlanRoutingDAO.updateByPrimaryKey(newRouting);
|
||||
return;
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(routingDataExist(routingVO),
|
||||
"交路数据重复");
|
||||
runPlanRoutingDAO.updateByPrimaryKeyWithBLOBs(newRouting);
|
||||
generateUserRunlevels(routingVO, deviceMap);
|
||||
generateUserParktimes(routingVO, deviceMap);
|
||||
generateUserStationReentryTimes(routingVO, deviceMap);
|
||||
}
|
||||
|
||||
private void setRoutingType(RunPlanRoutingVO routingVO, Map<String, MapElement> deviceMap) {
|
||||
Section startSection = (Section) deviceMap.get(routingVO.getStartSectionCode());
|
||||
@ -268,175 +310,200 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
|
||||
}
|
||||
}
|
||||
|
||||
private void generateUserParktimes(RunPlanRoutingVO routingVO, Map<String, MapElement> deviceMap) {
|
||||
List<RunPlanParkingTimeVO> parkingTimeVOS = RunPlanParkingTimeVO.parkingTimeFromRouting(routingVO);
|
||||
parkingTimeVOS.forEach(p -> {
|
||||
if (((Section) deviceMap.get(p.getSectionCode())).isStandTrack()) {
|
||||
planParktimeService.createUserParktime(p);
|
||||
}
|
||||
});
|
||||
}
|
||||
private void generateUserParktimes(RunPlanRoutingVO routingVO,
|
||||
Map<String, MapElement> deviceMap) {
|
||||
List<RunPlanParkingTimeVO> parkingTimeVOS = RunPlanParkingTimeVO.parkingTimeFromRouting(
|
||||
routingVO);
|
||||
parkingTimeVOS.forEach(p -> {
|
||||
if (((Section) deviceMap.get(p.getSectionCode())).isStandTrack()) {
|
||||
planParktimeService.createUserParktime(p);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void generateUserRunlevels(RunPlanRoutingVO routingVO, Map<String, MapElement> deviceMap) {
|
||||
List<RunPlanRunlevelVO> levels = RunPlanRunlevelVO.runLevelsFromRouting(routingVO);
|
||||
levels.forEach(l -> {
|
||||
Section startSection = (Section) deviceMap.get(l.getStartSectionCode());
|
||||
Section endSection = (Section) deviceMap.get(l.getEndSectionCode());
|
||||
if ((startSection.isTurnBackTrack() && !startSection.isStandTrack())
|
||||
|| (endSection.isTurnBackTrack() && !endSection.isStandTrack())) {
|
||||
return;
|
||||
}
|
||||
if ((startSection.isStandTrack() && endSection.isTransferTrack()) || (endSection.isStandTrack() && startSection.isTransferTrack())) {
|
||||
Float distance;
|
||||
try {
|
||||
distance = CalculateService.calculateDistance(startSection, endSection, l.getRight());
|
||||
} catch (SimulationException e) {
|
||||
distance = CalculateService.calculateDistance(startSection, endSection, !l.getRight());
|
||||
}
|
||||
l.setDistance(distance);
|
||||
l.generateDefaultRunLevel();
|
||||
planRunlevelService.createUserRunlevel(l);
|
||||
return;
|
||||
}
|
||||
Float distance = CalculateService.calculateDistance(startSection, endSection, l.getRight());
|
||||
l.setDistance(distance);
|
||||
l.generateDefaultRunLevel();
|
||||
planRunlevelService.createUserRunlevel(l);
|
||||
});
|
||||
}
|
||||
|
||||
private void generateUserStationReentryTimes(RunPlanRoutingVO routingVO, Map<String, MapElement> deviceMap) {
|
||||
RunPlanUserConfigVO userConfig = planConfigService.getConfig(routingVO.getUserId(), routingVO.getMapId());
|
||||
Map<String, RunPlanUserConfigVO.ReentryTime> reentryData;
|
||||
if (Objects.nonNull(userConfig)) {
|
||||
reentryData = userConfig.getConfig().getReentryData();
|
||||
}else{
|
||||
RunPlanUserConfigVO.Config config = new RunPlanUserConfigVO.Config();
|
||||
reentryData = config.getReentryData();
|
||||
userConfig = new RunPlanUserConfigVO( routingVO.getMapId(),routingVO.getUserId(),config);
|
||||
private void generateUserRunlevels(RunPlanRoutingVO routingVO,
|
||||
Map<String, MapElement> deviceMap) {
|
||||
List<RunPlanRunlevelVO> levels = RunPlanRunlevelVO.runLevelsFromRouting(routingVO);
|
||||
levels.forEach(l -> {
|
||||
Section startSection = (Section) deviceMap.get(l.getStartSectionCode());
|
||||
Section endSection = (Section) deviceMap.get(l.getEndSectionCode());
|
||||
if ((startSection.isTurnBackTrack() && !startSection.isStandTrack())
|
||||
|| (endSection.isTurnBackTrack() && !endSection.isStandTrack())) {
|
||||
return;
|
||||
}
|
||||
if ((startSection.isStandTrack() && endSection.isTransferTrack()) || (
|
||||
endSection.isStandTrack() && startSection.isTransferTrack())) {
|
||||
Float distance;
|
||||
try {
|
||||
distance = CalculateService.calculateDistance(startSection, endSection, l.getRight());
|
||||
} catch (SimulationException e) {
|
||||
distance = CalculateService.calculateDistance(startSection, endSection, !l.getRight());
|
||||
}
|
||||
//交路是折返轨的一头 设置折返时间
|
||||
setStationReentryTime(deviceMap, reentryData, routingVO);
|
||||
planConfigService.saveConfig(routingVO.getUserId(), routingVO.getMapId(),userConfig.getConfig());
|
||||
l.setDistance(distance);
|
||||
l.generateDefaultRunLevel();
|
||||
planRunlevelService.createUserRunlevel(l);
|
||||
return;
|
||||
}
|
||||
Float distance = CalculateService.calculateDistance(startSection, endSection, l.getRight());
|
||||
l.setDistance(distance);
|
||||
l.generateDefaultRunLevel();
|
||||
planRunlevelService.createUserRunlevel(l);
|
||||
});
|
||||
}
|
||||
|
||||
private void generateUserStationReentryTimes(RunPlanRoutingVO routingVO,
|
||||
Map<String, MapElement> deviceMap) {
|
||||
RunPlanUserConfigVO userConfig = planConfigService.getConfig(routingVO.getUserId(),
|
||||
routingVO.getMapId());
|
||||
Map<String, RunPlanUserConfigVO.ReentryTime> reentryData;
|
||||
if (Objects.nonNull(userConfig)) {
|
||||
reentryData = userConfig.getConfig().getReentryData();
|
||||
} else {
|
||||
RunPlanUserConfigVO.Config config = new RunPlanUserConfigVO.Config();
|
||||
reentryData = config.getReentryData();
|
||||
userConfig = new RunPlanUserConfigVO(routingVO.getMapId(), routingVO.getUserId(), config);
|
||||
}
|
||||
//交路是折返轨的一头 设置折返时间
|
||||
setStationReentryTime(deviceMap, reentryData, routingVO);
|
||||
planConfigService.saveConfig(routingVO.getUserId(), routingVO.getMapId(),
|
||||
userConfig.getConfig());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUserRouting(Long routingId) {
|
||||
runPlanRoutingDAO.deleteByPrimaryKey(routingId);
|
||||
@Override
|
||||
public void deleteUserRouting(Long routingId) {
|
||||
runPlanRoutingDAO.deleteByPrimaryKey(routingId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void deleteDefaultRouting(Long mapId) {
|
||||
RunPlanRoutingExample example = new RunPlanRoutingExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId).andUserIdIsNull();
|
||||
runPlanRoutingDAO.deleteByExample(example);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageVO<RunPlanRoutingVO> queryPagedUserRouting(Long userId, Long mapId,
|
||||
RunPlanRoutingQueryVO queryVO) {
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
RunPlanRoutingExample example = new RunPlanRoutingExample();
|
||||
example.setOrderByClause("user_id DESC,id");
|
||||
RunPlanRoutingExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andMapIdEqualTo(mapId).andUserIdEqualTo(userId);
|
||||
RunPlanRoutingExample.Criteria or = example.or();
|
||||
or.andMapIdEqualTo(mapId).andUserIdIsNull();
|
||||
if (StringUtils.hasText(queryVO.getStartStationCode())) {
|
||||
criteria.andStartStationCodeEqualTo(queryVO.getStartStationCode());
|
||||
or.andStartStationCodeEqualTo(queryVO.getStartStationCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void deleteDefaultRouting(Long mapId) {
|
||||
RunPlanRoutingExample example = new RunPlanRoutingExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId).andUserIdIsNull();
|
||||
runPlanRoutingDAO.deleteByExample(example);
|
||||
if (StringUtils.hasText(queryVO.getEndStationCode())) {
|
||||
criteria.andEndStationCodeEqualTo(queryVO.getEndStationCode());
|
||||
or.andEndStationCodeEqualTo(queryVO.getEndStationCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageVO<RunPlanRoutingVO> queryPagedUserRouting(Long userId, Long mapId, RunPlanRoutingQueryVO queryVO) {
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
RunPlanRoutingExample example = new RunPlanRoutingExample();
|
||||
example.setOrderByClause("user_id DESC,id");
|
||||
RunPlanRoutingExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andMapIdEqualTo(mapId).andUserIdEqualTo(userId);
|
||||
RunPlanRoutingExample.Criteria or = example.or();
|
||||
or.andMapIdEqualTo(mapId).andUserIdIsNull();
|
||||
if (StringUtils.hasText(queryVO.getStartStationCode())) {
|
||||
criteria.andStartStationCodeEqualTo(queryVO.getStartStationCode());
|
||||
or.andStartStationCodeEqualTo(queryVO.getStartStationCode());
|
||||
}
|
||||
if (StringUtils.hasText(queryVO.getEndStationCode())) {
|
||||
criteria.andEndStationCodeEqualTo(queryVO.getEndStationCode());
|
||||
or.andEndStationCodeEqualTo(queryVO.getEndStationCode());
|
||||
}
|
||||
if (StringUtils.hasText(queryVO.getStartSectionCode())) {
|
||||
criteria.andStartSectionCodeEqualTo(queryVO.getStartSectionCode());
|
||||
or.andStartSectionCodeEqualTo(queryVO.getStartSectionCode());
|
||||
}
|
||||
if (StringUtils.hasText(queryVO.getEndSectionCode())) {
|
||||
criteria.andEndSectionCodeEqualTo(queryVO.getEndSectionCode());
|
||||
or.andEndSectionCodeEqualTo(queryVO.getEndSectionCode());
|
||||
}
|
||||
Page<RunPlanRouting> page = (Page<RunPlanRouting>) runPlanRoutingDAO.selectByExampleWithBLOBs(example);
|
||||
List<RunPlanRoutingVO> routingVOList = page.getResult().stream().map(RunPlanRoutingVO::convert2VO).collect(Collectors.toList());
|
||||
return PageVO.convert(page, routingVOList);
|
||||
if (StringUtils.hasText(queryVO.getStartSectionCode())) {
|
||||
criteria.andStartSectionCodeEqualTo(queryVO.getStartSectionCode());
|
||||
or.andStartSectionCodeEqualTo(queryVO.getStartSectionCode());
|
||||
}
|
||||
|
||||
public List<RunPlanRoutingVO> getDefaultRoutings(Long mapId) {
|
||||
RunPlanRoutingExample example = new RunPlanRoutingExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId).andUserIdIsNull();
|
||||
List<RunPlanRouting> runPlanRoutings = runPlanRoutingDAO.selectByExampleWithBLOBs(example);
|
||||
return RunPlanRoutingVO.convert2VOList(runPlanRoutings);
|
||||
if (StringUtils.hasText(queryVO.getEndSectionCode())) {
|
||||
criteria.andEndSectionCodeEqualTo(queryVO.getEndSectionCode());
|
||||
or.andEndSectionCodeEqualTo(queryVO.getEndSectionCode());
|
||||
}
|
||||
Page<RunPlanRouting> page = (Page<RunPlanRouting>) runPlanRoutingDAO.selectByExampleWithBLOBs(
|
||||
example);
|
||||
List<RunPlanRoutingVO> routingVOList = page.getResult().stream()
|
||||
.map(RunPlanRoutingVO::convert2VO).collect(Collectors.toList());
|
||||
return PageVO.convert(page, routingVOList);
|
||||
}
|
||||
|
||||
public List<RunPlanRoutingVO> getDefaultRoutings(Long mapId) {
|
||||
RunPlanRoutingExample example = new RunPlanRoutingExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId).andUserIdIsNull();
|
||||
List<RunPlanRouting> runPlanRoutings = runPlanRoutingDAO.selectByExampleWithBLOBs(example);
|
||||
return RunPlanRoutingVO.convert2VOList(runPlanRoutings);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<RunPlanRoutingVO> getUserRoutingBy(Long userId, Long mapId) {
|
||||
RunPlanRoutingExample example = new RunPlanRoutingExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId).andUserIdEqualTo(userId);
|
||||
example.or().andMapIdEqualTo(mapId).andUserIdIsNull();
|
||||
List<RunPlanRouting> runPlanRoutings = runPlanRoutingDAO.selectByExample(example);
|
||||
return RunPlanRoutingVO.convert2VOList(runPlanRoutings,this.iMapService.getMapDetail(mapId));
|
||||
@Override
|
||||
public List<RunPlanRoutingVO> getUserRoutingBy(Long userId, Long mapId) {
|
||||
RunPlanRoutingExample example = new RunPlanRoutingExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId).andUserIdEqualTo(userId);
|
||||
example.or().andMapIdEqualTo(mapId).andUserIdIsNull();
|
||||
List<RunPlanRouting> runPlanRoutings = runPlanRoutingDAO.selectByExample(example);
|
||||
return RunPlanRoutingVO.convert2VOList(runPlanRoutings, this.iMapService.getMapDetail(mapId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RunPlanRoutingVO> getUserRoutingByType(Long userId, Long mapId,
|
||||
RunPlanRoutingVO.UserRoutingType routingType) {
|
||||
RunPlanRoutingExample example = new RunPlanRoutingExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId).andUserIdEqualTo(userId)
|
||||
.andTypeEqualTo(routingType.name());
|
||||
example.or().andMapIdEqualTo(mapId).andUserIdIsNull().andTypeEqualTo(routingType.name());
|
||||
List<RunPlanRouting> runPlanRoutings = runPlanRoutingDAO.selectByExampleWithBLOBs(example);
|
||||
return RunPlanRoutingVO.convert2VOList(runPlanRoutings, this.iMapService.getMapDetail(mapId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RunPlanRoutingVO queryUserRoutingBySDTNumber(Long userId, Long planId, String SDTNumber) {
|
||||
RunPlanVO planVO = this.getRunPlanById(planId);
|
||||
RunPlanTripVO trip = planVO.getTripList().stream()
|
||||
.filter(tripVO -> tripVO.getSDTNumberNew().equals(SDTNumber))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> BusinessExceptionAssertEnum.DATA_NOT_EXIST.exception());
|
||||
RunPlanRoutingExample example = new RunPlanRoutingExample();
|
||||
example.createCriteria().andMapIdEqualTo(planVO.getMapId()).andUserIdEqualTo(userId)
|
||||
.andStartSectionCodeEqualTo(trip.getStartSectionCode())
|
||||
.andEndSectionCodeEqualTo(trip.getEndSectionCode());
|
||||
example.or().andMapIdEqualTo(planVO.getMapId()).andUserIdIsNull()
|
||||
.andStartSectionCodeEqualTo(trip.getStartSectionCode())
|
||||
.andEndSectionCodeEqualTo(trip.getEndSectionCode());
|
||||
List<RunPlanRouting> runPlanRoutings = runPlanRoutingDAO.selectByExampleWithBLOBs(example);
|
||||
if (CollectionUtils.isEmpty(runPlanRoutings)) {
|
||||
return null;
|
||||
}
|
||||
return RunPlanRoutingVO.convert2VO(runPlanRoutings.get(0),
|
||||
this.iMapService.getMapDetail(planVO.getMapId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RunPlanRoutingVO> getUserRoutingByType(Long userId, Long mapId, RunPlanRoutingVO.UserRoutingType routingType) {
|
||||
RunPlanRoutingExample example = new RunPlanRoutingExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId).andUserIdEqualTo(userId).andTypeEqualTo(routingType.name());
|
||||
example.or().andMapIdEqualTo(mapId).andUserIdIsNull().andTypeEqualTo(routingType.name());
|
||||
List<RunPlanRouting> runPlanRoutings = runPlanRoutingDAO.selectByExampleWithBLOBs(example);
|
||||
return RunPlanRoutingVO.convert2VOList(runPlanRoutings,this.iMapService.getMapDetail(mapId));
|
||||
@Override
|
||||
public RunPlanRoutingVO queryUserRoutingById(Long userId, Long mapId, Long routingId) {
|
||||
RunPlanRouting runPlanRouting = getRunPlanRoutingData(routingId);
|
||||
return RunPlanRoutingVO.convert2VO(runPlanRouting, this.iMapService.getMapDetail(mapId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RunPlanRoutingSection> getRoutingSectionDataBy(Long userId, Long routingId) {
|
||||
RunPlanRouting routing = runPlanRoutingDAO.selectByPrimaryKey(routingId);
|
||||
if (Objects.isNull(routing)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return RunPlanRoutingVO.convert2VO(routing).getParkSectionCodeList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RunPlanRoutingVO queryUserRoutingBySDTNumber(Long userId, Long planId, String SDTNumber) {
|
||||
RunPlanVO planVO = this.getRunPlanById(planId);
|
||||
RunPlanTripVO trip = planVO.getTripList().stream()
|
||||
.filter(tripVO -> tripVO.getSDTNumberNew().equals(SDTNumber))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> BusinessExceptionAssertEnum.DATA_NOT_EXIST.exception());
|
||||
RunPlanRoutingExample example = new RunPlanRoutingExample();
|
||||
example.createCriteria().andMapIdEqualTo(planVO.getMapId()).andUserIdEqualTo(userId).andStartSectionCodeEqualTo(trip.getStartSectionCode()).andEndSectionCodeEqualTo(trip.getEndSectionCode());
|
||||
example.or().andMapIdEqualTo(planVO.getMapId()).andUserIdIsNull().andStartSectionCodeEqualTo(trip.getStartSectionCode()).andEndSectionCodeEqualTo(trip.getEndSectionCode());
|
||||
List<RunPlanRouting> runPlanRoutings = runPlanRoutingDAO.selectByExampleWithBLOBs(example);
|
||||
if (CollectionUtils.isEmpty(runPlanRoutings)) return null;
|
||||
return RunPlanRoutingVO.convert2VO(runPlanRoutings.get(0), this.iMapService.getMapDetail(planVO.getMapId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RunPlanRoutingVO queryUserRoutingById(Long userId, Long mapId, Long routingId) {
|
||||
RunPlanRouting runPlanRouting = getRunPlanRoutingData(routingId);
|
||||
return RunPlanRoutingVO.convert2VO(runPlanRouting,this.iMapService.getMapDetail(mapId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RunPlanRoutingSection> getRoutingSectionDataBy(Long userId, Long routingId) {
|
||||
RunPlanRouting routing = runPlanRoutingDAO.selectByPrimaryKey(routingId);
|
||||
if (Objects.isNull(routing)) return Collections.emptyList();
|
||||
return RunPlanRoutingVO.convert2VO(routing).getParkSectionCodeList();
|
||||
}
|
||||
|
||||
|
||||
private boolean routingDataExist(RunPlanRoutingVO routingVO) {
|
||||
return runPlanRoutingDAO.countUserRoutingBySectionData(routingVO.getUserId(), routingVO.getMapId(), JsonUtils.writeValueAsString(routingVO.getParkSectionCodeList())) > 0;
|
||||
}
|
||||
|
||||
private RunPlanRouting getRunPlanRoutingData(Long routingId) {
|
||||
RunPlanRouting routing = runPlanRoutingDAO.selectByPrimaryKey(routingId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(routing, String.format("交路[%s]不存在", routingId));
|
||||
return routing;
|
||||
}
|
||||
|
||||
private RunPlanVO getRunPlanById(Long planId) {
|
||||
RunPlanDraft runPlanDraft = this.runPlanDraftDAO.selectByPrimaryKey(planId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(runPlanDraft);
|
||||
RunPlanVO runPlanVO = new RunPlanVO(runPlanDraft);
|
||||
if (StringUtils.hasText(runPlanDraft.getTrips())) {
|
||||
runPlanVO.setTripList(JsonUtils.read(runPlanDraft.getTrips(), JsonUtils.getCollectionType(List.class, RunPlanTripVO.class)));
|
||||
} else {
|
||||
runPlanVO.setTripList(new ArrayList<>());
|
||||
}
|
||||
return runPlanVO;
|
||||
|
||||
private boolean routingDataExist(RunPlanRoutingVO routingVO) {
|
||||
return
|
||||
runPlanRoutingDAO.countUserRoutingBySectionData(routingVO.getUserId(), routingVO.getMapId(),
|
||||
JsonUtils.writeValueAsString(routingVO.getParkSectionCodeList())) > 0;
|
||||
}
|
||||
|
||||
private RunPlanRouting getRunPlanRoutingData(Long routingId) {
|
||||
RunPlanRouting routing = runPlanRoutingDAO.selectByPrimaryKey(routingId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(routing,
|
||||
String.format("交路[%s]不存在", routingId));
|
||||
return routing;
|
||||
}
|
||||
|
||||
private RunPlanVO getRunPlanById(Long planId) {
|
||||
RunPlanDraft runPlanDraft = this.runPlanDraftDAO.selectByPrimaryKey(planId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(runPlanDraft);
|
||||
RunPlanVO runPlanVO = new RunPlanVO(runPlanDraft);
|
||||
if (StringUtils.hasText(runPlanDraft.getTrips())) {
|
||||
runPlanVO.setTripList(JsonUtils.read(runPlanDraft.getTrips(),
|
||||
JsonUtils.getCollectionType(List.class, RunPlanTripVO.class)));
|
||||
} else {
|
||||
runPlanVO.setTripList(new ArrayList<>());
|
||||
}
|
||||
return runPlanVO;
|
||||
}
|
||||
}
|
||||
|
@ -7,104 +7,82 @@ import club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs;
|
||||
import club.joylink.rtss.vo.training2.draft.DraftTraining2InfoVo;
|
||||
import club.joylink.rtss.vo.training2.publish.PublishedTraining2InfoRspVo;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
public class Training2Convertor {
|
||||
public static DraftTraining2InfoVo convertFrom(DraftTraining2 dt) {
|
||||
DraftTraining2InfoVo ti = new DraftTraining2InfoVo();
|
||||
ti.setCreateTime(dt.getCreateTime());
|
||||
ti.setCreatorId(dt.getCreatorId());
|
||||
ti.setId(dt.getId());
|
||||
ti.setDescription(dt.getDescription());
|
||||
ti.setLabelJson(dt.getLabelJson());
|
||||
ti.setMapId(dt.getMapId());
|
||||
ti.setName(dt.getName());
|
||||
ti.setUpdateTime(dt.getUpdateTime());
|
||||
ti.setType(dt.getType());
|
||||
ti.setClient(dt.getClient());
|
||||
return ti;
|
||||
}
|
||||
|
||||
public static DraftTraining2InfoVo convertFrom(DraftTraining2 dt) {
|
||||
DraftTraining2InfoVo ti = new DraftTraining2InfoVo();
|
||||
ti.setCreateTime(dt.getCreateTime());
|
||||
ti.setCreatorId(dt.getCreatorId());
|
||||
ti.setId(dt.getId());
|
||||
ti.setDescription(dt.getDescription());
|
||||
ti.setLabelJson(dt.getLabelJson());
|
||||
ti.setMapId(dt.getMapId());
|
||||
ti.setName(dt.getName());
|
||||
ti.setUpdateTime(dt.getUpdateTime());
|
||||
ti.setType(dt.getType());
|
||||
ti.setClient(dt.getClient());
|
||||
return ti;
|
||||
}
|
||||
/**
|
||||
* 实训草稿转化为已发布实训,注意已发布实训的状态为上架且已发布实训的id为空(数据库自动生成)
|
||||
*/
|
||||
public static PublishedTraining2WithBLOBs convertFrom(DraftTraining2WithBLOBs from) {
|
||||
PublishedTraining2WithBLOBs pub = new PublishedTraining2WithBLOBs();
|
||||
//
|
||||
pub.setState(PublishedTraining2StateEnum.PutOn.getState());
|
||||
//
|
||||
pub.setMemberJson(null == from.getMemberJson() ? "" : from.getMemberJson());
|
||||
pub.setBgSceneJson(null == from.getBgSceneJson() ? "" : from.getBgSceneJson());
|
||||
pub.setOperaJson(null == from.getOperaJson() ? "" : from.getOperaJson());
|
||||
pub.setDescription(null == from.getDescription() ? "" : from.getDescription());
|
||||
pub.setCreateTime(LocalDateTime.now());
|
||||
pub.setUpdateTime(LocalDateTime.now());
|
||||
pub.setCreatorId(from.getCreatorId());
|
||||
pub.setName(null == from.getName() ? "" : from.getName());
|
||||
pub.setPlayerIdJson(null == from.getPlayerIdJson() ? "" : from.getPlayerIdJson());
|
||||
pub.setScoringRuleJson(null == from.getScoringRuleJson() ? "" : from.getScoringRuleJson());
|
||||
pub.setStepJson(null == from.getStepJson() ? "" : from.getStepJson());
|
||||
pub.setFailureConditionJson(null == from.getFailureConditionJson() ? "" : from.getFailureConditionJson());
|
||||
pub.setLabelJson(null == from.getLabelJson() ? "" : from.getLabelJson());
|
||||
pub.setMapId(from.getMapId());
|
||||
pub.setMapLocationJson(null == from.getMapLocationJson() ? "" : from.getMapLocationJson());
|
||||
pub.setType(null == from.getType() ? "" : from.getType());
|
||||
pub.setRunPlanId(from.getRunPlanId());
|
||||
pub.setClient(from.getClient());
|
||||
//
|
||||
return pub;
|
||||
}
|
||||
|
||||
/**
|
||||
* 实训草稿转化为已发布实训,注意已发布实训的状态为上架且已发布实训的id为空(数据库自动生成)
|
||||
*/
|
||||
public static PublishedTraining2WithBLOBs convertFrom(DraftTraining2WithBLOBs from) {
|
||||
PublishedTraining2WithBLOBs pub = new PublishedTraining2WithBLOBs();
|
||||
//
|
||||
pub.setState(PublishedTraining2StateEnum.PutOn.getState());
|
||||
//
|
||||
pub.setMemberJson(null == from.getMemberJson() ? "" : from.getMemberJson());
|
||||
pub.setBgSceneJson(null == from.getBgSceneJson() ? "" : from.getBgSceneJson());
|
||||
pub.setOperaJson(null == from.getOperaJson() ? "" : from.getOperaJson());
|
||||
pub.setDescription(null == from.getDescription() ? "" : from.getDescription());
|
||||
pub.setCreateTime(LocalDateTime.now());
|
||||
pub.setUpdateTime(LocalDateTime.now());
|
||||
pub.setCreatorId(from.getCreatorId());
|
||||
pub.setName(null == from.getName() ? "" : from.getName());
|
||||
pub.setPlayerIdJson(null == from.getPlayerIdJson() ? "" : from.getPlayerIdJson());
|
||||
pub.setScoringRuleJson(null == from.getScoringRuleJson() ? "" : from.getScoringRuleJson());
|
||||
pub.setStepJson(null == from.getStepJson() ? "" : from.getStepJson());
|
||||
pub.setFailureConditionJson(
|
||||
null == from.getFailureConditionJson() ? "" : from.getFailureConditionJson());
|
||||
pub.setLabelJson(null == from.getLabelJson() ? "" : from.getLabelJson());
|
||||
pub.setMapId(from.getMapId());
|
||||
pub.setMapLocationJson(null == from.getMapLocationJson() ? "" : from.getMapLocationJson());
|
||||
pub.setType(null == from.getType() ? "" : from.getType());
|
||||
pub.setRunPlanId(from.getRunPlanId());
|
||||
pub.setClient(from.getClient());
|
||||
//
|
||||
return pub;
|
||||
}
|
||||
public static List<PublishedTraining2InfoRspVo> convertFrom(List<PublishedTraining2> froms) {
|
||||
List<PublishedTraining2InfoRspVo> list = Lists.newArrayList();
|
||||
froms.forEach(d -> list.add(convertFrom(d)));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<PublishedTraining2InfoRspVo> convertFrom(List<PublishedTraining2> froms) {
|
||||
List<PublishedTraining2InfoRspVo> list = Lists.newArrayList();
|
||||
froms.forEach(d -> list.add(convertFrom(d)));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static PublishedTraining2InfoRspVo convertFrom(PublishedTraining2 from) {
|
||||
PublishedTraining2InfoRspVo rsp = new PublishedTraining2InfoRspVo();
|
||||
rsp.setCreateTime(from.getCreateTime());
|
||||
rsp.setDescription(from.getDescription());
|
||||
rsp.setCreatorId(from.getCreatorId());
|
||||
rsp.setId(from.getId());
|
||||
rsp.setName(from.getName());
|
||||
rsp.setLabelJson(from.getLabelJson());
|
||||
rsp.setMapId(from.getMapId());
|
||||
rsp.setPlayerIdJson(from.getPlayerIdJson());
|
||||
rsp.setType(from.getType());
|
||||
rsp.setFailureConditionJson(from.getFailureConditionJson());
|
||||
rsp.setUpdateTime(from.getUpdateTime());
|
||||
rsp.setRunPlanId(from.getRunPlanId());
|
||||
rsp.setMapLocationJson(from.getMapLocationJson());
|
||||
rsp.setState(from.getState());
|
||||
rsp.setClient(from.getClient());
|
||||
rsp.setShared(from.getShared());
|
||||
rsp.setOrgId(from.getOrgId());
|
||||
return rsp;
|
||||
}
|
||||
|
||||
|
||||
public static DraftTraining2WithBLOBs convertFrom(PublishedTraining2WithBLOBs from) {
|
||||
DraftTraining2WithBLOBs dtb = new DraftTraining2WithBLOBs();
|
||||
dtb.setName(from.getName());
|
||||
dtb.setMapId(from.getMapId());
|
||||
// map_system、terminal
|
||||
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;
|
||||
}
|
||||
public static PublishedTraining2InfoRspVo convertFrom(PublishedTraining2 from) {
|
||||
PublishedTraining2InfoRspVo rsp = new PublishedTraining2InfoRspVo();
|
||||
rsp.setCreateTime(from.getCreateTime());
|
||||
rsp.setDescription(from.getDescription());
|
||||
rsp.setCreatorId(from.getCreatorId());
|
||||
rsp.setId(from.getId());
|
||||
rsp.setName(from.getName());
|
||||
rsp.setLabelJson(from.getLabelJson());
|
||||
rsp.setMapId(from.getMapId());
|
||||
rsp.setPlayerIdJson(from.getPlayerIdJson());
|
||||
rsp.setType(from.getType());
|
||||
rsp.setFailureConditionJson(from.getFailureConditionJson());
|
||||
rsp.setUpdateTime(from.getUpdateTime());
|
||||
rsp.setRunPlanId(from.getRunPlanId());
|
||||
rsp.setMapLocationJson(from.getMapLocationJson());
|
||||
rsp.setState(from.getState());
|
||||
rsp.setClient(from.getClient());
|
||||
rsp.setShared(from.getShared());
|
||||
rsp.setOrgId(from.getOrgId());
|
||||
return rsp;
|
||||
}
|
||||
}
|
||||
|
@ -3,110 +3,82 @@ package club.joylink.rtss.services.training2;
|
||||
import club.joylink.rtss.constants.BusinessConsts;
|
||||
import club.joylink.rtss.dao.DraftTraining2DAO;
|
||||
import club.joylink.rtss.dao.PublishedTraining2DAO;
|
||||
import club.joylink.rtss.entity.training2.DraftTraining2;
|
||||
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.entity.training2.*;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.training2.draft.TrainingDraftPublishReqVo;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 实训草稿发布业务实现
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class Training2DraftPublishService {
|
||||
@Autowired
|
||||
private DraftTraining2DAO trainingDao;
|
||||
@Autowired
|
||||
private PublishedTraining2DAO publishedDao;
|
||||
@Autowired
|
||||
private Training2TraceService training2TraceService;
|
||||
|
||||
@Autowired
|
||||
private DraftTraining2DAO trainingDao;
|
||||
@Autowired
|
||||
private PublishedTraining2DAO publishedDao;
|
||||
@Autowired
|
||||
private Training2TraceService training2TraceService;
|
||||
|
||||
/**
|
||||
* 草稿发布
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void draftPublish(TrainingDraftPublishReqVo req, Long userId, Long orgId) {
|
||||
Long draftId = Long.valueOf(req.getDraftId());
|
||||
DraftTraining2Example dtExample = new DraftTraining2Example();
|
||||
dtExample.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(draftId);
|
||||
List<DraftTraining2WithBLOBs> dtFinds = this.trainingDao.selectByExampleWithBLOBs(dtExample);
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != dtFinds && !dtFinds.isEmpty(),
|
||||
"实训草稿不存在");
|
||||
DraftTraining2WithBLOBs draft = dtFinds.get(0);
|
||||
//
|
||||
PublishedTraining2WithBLOBs pub = Training2Convertor.convertFrom(draft);
|
||||
//加入共享,默认不共享
|
||||
pub.setShared(BusinessConsts.STATUS_NOT_USE_INT);
|
||||
if (null != req.getReName() && req.getReName().trim().length() > 0) {
|
||||
pub.setName(req.getReName());
|
||||
/**
|
||||
* 草稿发布
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void draftPublish(TrainingDraftPublishReqVo req, Long userId,Long orgId) {
|
||||
Long draftId = Long.valueOf(req.getDraftId());
|
||||
DraftTraining2Example dtExample = new DraftTraining2Example();
|
||||
dtExample.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(draftId);
|
||||
List<DraftTraining2WithBLOBs> dtFinds = this.trainingDao.selectByExampleWithBLOBs(dtExample);
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != dtFinds && !dtFinds.isEmpty(), "实训草稿不存在");
|
||||
DraftTraining2WithBLOBs draft = dtFinds.get(0);
|
||||
//
|
||||
PublishedTraining2WithBLOBs pub = Training2Convertor.convertFrom(draft);
|
||||
//加入共享,默认不共享
|
||||
pub.setShared(BusinessConsts.STATUS_NOT_USE_INT);
|
||||
if(null!=req.getReName()&&req.getReName().trim().length()>0){
|
||||
pub.setName(req.getReName());
|
||||
}
|
||||
//根据要发布的草稿名称来查找已发布的实训
|
||||
//如果以有同名的则会被覆盖
|
||||
PublishedTraining2Example ptExample = new PublishedTraining2Example();
|
||||
ptExample.createCriteria().andNameEqualTo(pub.getName()).andMapIdEqualTo(pub.getMapId());
|
||||
List<PublishedTraining2> ptFinds = this.publishedDao.selectByExample(ptExample);
|
||||
pub.setOrgId(orgId);
|
||||
//
|
||||
if(null==ptFinds||ptFinds.isEmpty()){//同地图同名已发布实训不存在则直接存入
|
||||
//发布
|
||||
this.publishedDao.insertSelective(pub);
|
||||
}else{//同地图同名已发布实训存在
|
||||
if(ptFinds.size()>1){//当有多个存在时,则全部删除再存入
|
||||
this.publishedDao.deleteByExample(ptExample);
|
||||
this.publishedDao.insertSelective(pub);
|
||||
}else{//当有且仅有一个时,直接更新
|
||||
PublishedTraining2 old = ptFinds.get(0);
|
||||
pub.setId(old.getId());
|
||||
this.publishedDao.updateByPrimaryKeySelective(pub);
|
||||
}
|
||||
}
|
||||
//记录发布轨迹
|
||||
final PublishedTraining2 tracePub = this.findByNameAndMapId(pub.getName(),pub.getMapId());
|
||||
final DraftTraining2 traceDraft = draft;
|
||||
this.training2TraceService.addTrace(traceDraft,tracePub,userId);
|
||||
}
|
||||
//根据要发布的草稿名称来查找已发布的实训
|
||||
//如果以有同名的则会被覆盖
|
||||
PublishedTraining2Example ptExample = new PublishedTraining2Example();
|
||||
ptExample.createCriteria().andNameEqualTo(pub.getName()).andMapIdEqualTo(pub.getMapId());
|
||||
List<PublishedTraining2> ptFinds = this.publishedDao.selectByExample(ptExample);
|
||||
pub.setOrgId(orgId);
|
||||
//
|
||||
if (null == ptFinds || ptFinds.isEmpty()) {//同地图同名已发布实训不存在则直接存入
|
||||
//发布
|
||||
this.publishedDao.insertSelective(pub);
|
||||
} else {//同地图同名已发布实训存在
|
||||
if (ptFinds.size() > 1) {//当有多个存在时,则全部删除再存入
|
||||
this.publishedDao.deleteByExample(ptExample);
|
||||
this.publishedDao.insertSelective(pub);
|
||||
} else {//当有且仅有一个时,直接更新
|
||||
PublishedTraining2 old = ptFinds.get(0);
|
||||
pub.setId(old.getId());
|
||||
this.publishedDao.updateByPrimaryKeySelective(pub);
|
||||
}
|
||||
@Transactional(readOnly = true)
|
||||
public PublishedTraining2 findByNameAndMapId(String name,Long mapId){
|
||||
PublishedTraining2Example ptExample = new PublishedTraining2Example();
|
||||
ptExample.createCriteria().andNameEqualTo(name).andMapIdEqualTo(mapId);
|
||||
List<PublishedTraining2> ptFinds = this.publishedDao.selectByExample(ptExample);
|
||||
//
|
||||
if(null!=ptFinds){
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(ptFinds.size()<=1, String.format("已发布实训[name=%s mapId=%s]不唯一!",name,mapId));
|
||||
return ptFinds.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//记录发布轨迹
|
||||
final PublishedTraining2 tracePub = this.findByNameAndMapId(pub.getName(), pub.getMapId());
|
||||
final DraftTraining2 traceDraft = draft;
|
||||
this.training2TraceService.addTrace(traceDraft, tracePub, userId);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public PublishedTraining2 findByNameAndMapId(String name, Long mapId) {
|
||||
PublishedTraining2Example ptExample = new PublishedTraining2Example();
|
||||
ptExample.createCriteria().andNameEqualTo(name).andMapIdEqualTo(mapId);
|
||||
List<PublishedTraining2> ptFinds = this.publishedDao.selectByExample(ptExample);
|
||||
//
|
||||
if (null != ptFinds) {
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(ptFinds.size() <= 1,
|
||||
String.format("已发布实训[name=%s mapId=%s]不唯一!", name, mapId));
|
||||
return ptFinds.get(0);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -15,27 +15,9 @@ import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.map.MapVO;
|
||||
import club.joylink.rtss.vo.paper.FindCountForQuestionReqVo;
|
||||
import club.joylink.rtss.vo.paper.PaperQType;
|
||||
import club.joylink.rtss.vo.training2.publish.DeletePublishedTraining2ReqVo;
|
||||
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 club.joylink.rtss.vo.training2.publish.*;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -43,489 +25,491 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 已发布实训管理业务实现
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class Training2PublishService {
|
||||
@Autowired
|
||||
private PublishedTraining2DAO publishedDao;
|
||||
@Autowired
|
||||
private IMapService mapService;
|
||||
|
||||
@Autowired
|
||||
private PublishedTraining2DAO publishedDao;
|
||||
@Autowired
|
||||
private IMapService mapService;
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public PublishedTraining2 findById(Long id) {
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
example.createCriteria().andIdEqualTo(id);
|
||||
List<PublishedTraining2> find = this.publishedDao.selectByExample(example);
|
||||
return null != find && find.size() > 0 ? find.get(0) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据组织,类型(单操作,实操),标签获取对应的数量
|
||||
*/
|
||||
public Long queryCountForLabel(FindCountForQuestionReqVo reqVo) {
|
||||
if (Objects.isNull(reqVo.getTrainingClient())) {
|
||||
//单操没有选定客户端,不查询数量
|
||||
return 0L;
|
||||
@Transactional(readOnly = true)
|
||||
public PublishedTraining2 findById(Long id) {
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
example.createCriteria().andIdEqualTo(id);
|
||||
List<PublishedTraining2> find = this.publishedDao.selectByExample(example);
|
||||
return null != find && find.size() > 0 ? find.get(0) : null;
|
||||
}
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
PublishedTraining2Example.Criteria c = this.basicQueryCriteria(example, reqVo.getMapId(),
|
||||
reqVo.getOrgId(), reqVo.getSubType().name().toUpperCase(), Arrays.asList(reqVo.getTags()),
|
||||
reqVo.getTrainingClient());
|
||||
return this.publishedDao.countByExample(example);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 组织,类型(单操作,实操) 获取标签
|
||||
*/
|
||||
public Collection<String> findAllLabel(Long mapId, Long orgId, String type,
|
||||
PaperQType.TrainingClient client) {
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
PublishedTraining2Example.Criteria c = this.basicQueryCriteria(example, mapId, orgId, type,
|
||||
null, client);
|
||||
List<PublishedTraining2> dataList = this.publishedDao.selectByExample(example);
|
||||
if (CollectionUtils.isEmpty(dataList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return dataList.stream().map(PublishedTraining2::getLabelJson).filter(StringUtils::hasText)
|
||||
.map(d -> {
|
||||
List<String> l = JsonUtils.readCollection(d, List.class, String.class);
|
||||
return l;
|
||||
}).flatMap(Collection::stream).collect(Collectors.toSet());
|
||||
}
|
||||
/**
|
||||
* 根据组织,类型(单操作,实操),标签获取对应的数量
|
||||
|
||||
public PublishedTraining2Example.Criteria basicQueryCriteria(PublishedTraining2Example example,
|
||||
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(orgId),
|
||||
"组织信息不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(type),
|
||||
"查询类型信息不能为空");
|
||||
|
||||
PublishedTraining2Example.Criteria criteria = example.createCriteria();
|
||||
|
||||
criteria.andMapIdEqualTo(mapId);
|
||||
criteria.andOrgIdEqualTo(orgId);
|
||||
criteria.andTypeEqualTo(type);
|
||||
criteria.andStateEqualTo(BusinessConsts.STATUS_USE_INT);//上架
|
||||
|
||||
//查询共享的数据
|
||||
PublishedTraining2Example.Criteria or = example.or();
|
||||
or.andSharedEqualTo(BusinessConsts.STATUS_USE_INT);
|
||||
or.andMapIdEqualTo(mapId);
|
||||
or.andTypeEqualTo(type);
|
||||
or.andStateEqualTo(BusinessConsts.STATUS_USE_INT);
|
||||
|
||||
if (Objects.nonNull(client)) {
|
||||
criteria.andClientEqualTo(client.name());
|
||||
or.andClientEqualTo(client.name());
|
||||
}
|
||||
// or.andOrgIdNotEqualTo(orgId);
|
||||
if (!CollectionUtils.isEmpty(lables)) {
|
||||
for (String tag : lables) {
|
||||
if (StringUtils.hasText(tag)) {
|
||||
criteria.andLabelJsonLike(String.format("%%%s%%", tag));
|
||||
or.andLabelJsonLike(String.format("%%%s%%", tag));
|
||||
*/
|
||||
public Long queryCountForLabel(FindCountForQuestionReqVo reqVo){
|
||||
if(Objects.isNull(reqVo.getTrainingClient())){
|
||||
//单操没有选定客户端,不查询数量
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
PublishedTraining2Example.Criteria c = this.basicQueryCriteria(example,reqVo.getMapId(),reqVo.getOrgId(),reqVo.getSubType().name().toUpperCase(),Arrays.asList(reqVo.getTags()),reqVo.getTrainingClient());
|
||||
return this.publishedDao.countByExample(example);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* 已发布实训分页列表
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public PageVO<PublishedTraining2InfoRspVo> publishedTrainingsPage(
|
||||
PublishedTraining2InfoPageReqVo req) {
|
||||
PageHelper.startPage(req.getPageNum(), req.getPageSize());
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
PublishedTraining2Example.Criteria c = example.createCriteria();
|
||||
if (Objects.nonNull(req.getState())) {
|
||||
c.andStateEqualTo(req.getState());
|
||||
/**
|
||||
* 根据 组织,类型(单操作,实操) 获取标签
|
||||
*/
|
||||
public Collection<String> findAllLabel(Long mapId, Long orgId, String type, PaperQType.TrainingClient client){
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
PublishedTraining2Example.Criteria c = this.basicQueryCriteria(example,mapId,orgId,type,null,client);
|
||||
List<PublishedTraining2> dataList = this.publishedDao.selectByExample(example);
|
||||
if(CollectionUtils.isEmpty(dataList)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return dataList.stream().map(PublishedTraining2::getLabelJson).filter(StringUtils::hasText).map(d->{
|
||||
List<String> l = JsonUtils.readCollection(d,List.class,String.class);
|
||||
return l;
|
||||
}).flatMap(Collection::stream).collect(Collectors.toSet());
|
||||
}
|
||||
if (Objects.nonNull(req.getOrgId())) {
|
||||
c.andOrgIdEqualTo(req.getOrgId());
|
||||
|
||||
public PublishedTraining2Example.Criteria basicQueryCriteria(PublishedTraining2Example example, 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(orgId),"组织信息不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(type),"查询类型信息不能为空");
|
||||
|
||||
PublishedTraining2Example.Criteria criteria = example.createCriteria();
|
||||
|
||||
criteria.andMapIdEqualTo(mapId);
|
||||
criteria.andOrgIdEqualTo(orgId);
|
||||
criteria.andTypeEqualTo(type);
|
||||
criteria.andStateEqualTo(BusinessConsts.STATUS_USE_INT);//上架
|
||||
|
||||
//查询共享的数据
|
||||
PublishedTraining2Example.Criteria or = example.or();
|
||||
or.andSharedEqualTo(BusinessConsts.STATUS_USE_INT);
|
||||
or.andMapIdEqualTo(mapId);
|
||||
or.andTypeEqualTo(type);
|
||||
or.andStateEqualTo(BusinessConsts.STATUS_USE_INT);
|
||||
|
||||
if(Objects.nonNull(client)){
|
||||
criteria.andClientEqualTo(client.name());
|
||||
or.andClientEqualTo(client.name());
|
||||
}
|
||||
// or.andOrgIdNotEqualTo(orgId);
|
||||
if(!CollectionUtils.isEmpty(lables)){
|
||||
for (String tag : lables) {
|
||||
if(StringUtils.hasText(tag)){
|
||||
criteria.andLabelJsonLike(String.format("%%%s%%", tag));
|
||||
or.andLabelJsonLike(String.format("%%%s%%", tag));
|
||||
}
|
||||
}
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
if (Objects.nonNull(req.getMapId())) {
|
||||
c.andMapIdEqualTo(req.getMapId());
|
||||
}
|
||||
if (Objects.nonNull(req.getMapId())) {
|
||||
c.andMapIdEqualTo(req.getMapId());
|
||||
}
|
||||
if (Objects.nonNull(req.getType())) {
|
||||
c.andTypeEqualTo(req.getType());
|
||||
}
|
||||
if (StringUtils.hasText(req.getName())) {
|
||||
c.andNameLike(String.format("%%%s%%", req.getName()));
|
||||
}
|
||||
if (Objects.equals(false, CollectionUtils.isEmpty(req.getLabelLikes()))) {
|
||||
for (String ll : req.getLabelLikes()) {
|
||||
c.andLabelJsonLike(String.format("%%%s%%", ll));
|
||||
}
|
||||
}
|
||||
String orderBy = "create_time";
|
||||
switch (req.getOrderBy()) {
|
||||
|
||||
/**
|
||||
* 已发布实训分页列表
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public PageVO<PublishedTraining2InfoRspVo> publishedTrainingsPage(PublishedTraining2InfoPageReqVo req) {
|
||||
PageHelper.startPage(req.getPageNum(), req.getPageSize());
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
PublishedTraining2Example.Criteria c = example.createCriteria();
|
||||
if (Objects.nonNull(req.getState())) {
|
||||
c.andStateEqualTo(req.getState());
|
||||
}
|
||||
if (Objects.nonNull(req.getOrgId())) {
|
||||
c.andOrgIdEqualTo(req.getOrgId());
|
||||
}
|
||||
if (Objects.nonNull(req.getMapId())) {
|
||||
c.andMapIdEqualTo(req.getMapId());
|
||||
}
|
||||
if (Objects.nonNull(req.getMapId())) {
|
||||
c.andMapIdEqualTo(req.getMapId());
|
||||
}
|
||||
if (Objects.nonNull(req.getType())) {
|
||||
c.andTypeEqualTo(req.getType());
|
||||
}
|
||||
if (StringUtils.hasText(req.getName())) {
|
||||
c.andNameLike(String.format("%%%s%%", req.getName()));
|
||||
}
|
||||
if (Objects.equals(false, CollectionUtils.isEmpty(req.getLabelLikes()))) {
|
||||
for (String ll : req.getLabelLikes()) {
|
||||
c.andLabelJsonLike(String.format("%%%s%%", ll));
|
||||
}
|
||||
}
|
||||
String orderBy = "create_time";
|
||||
switch (req.getOrderBy()) {
|
||||
// case 1:orderBy="create_time";break;
|
||||
case 2:
|
||||
orderBy = "update_time";
|
||||
break;
|
||||
case 3:
|
||||
orderBy = "name";
|
||||
break;
|
||||
case 4:
|
||||
orderBy = "state";
|
||||
break;
|
||||
}
|
||||
if (req.getDesc()) {
|
||||
example.setOrderByClause(String.format(" %s desc", orderBy));
|
||||
}
|
||||
Page<PublishedTraining2> page = (Page<PublishedTraining2>) this.publishedDao.selectByExample(
|
||||
example);
|
||||
List<PublishedTraining2InfoRspVo> tmpList = Training2Convertor.convertFrom(page.getResult());
|
||||
case 2:
|
||||
orderBy = "update_time";
|
||||
break;
|
||||
case 3:
|
||||
orderBy = "name";
|
||||
break;
|
||||
case 4:
|
||||
orderBy = "state";
|
||||
break;
|
||||
}
|
||||
if (req.getDesc()) {
|
||||
example.setOrderByClause(String.format(" %s desc", orderBy));
|
||||
}
|
||||
Page<PublishedTraining2> page = (Page<PublishedTraining2>) this.publishedDao.selectByExample(example);
|
||||
List<PublishedTraining2InfoRspVo> tmpList = Training2Convertor.convertFrom(page.getResult());
|
||||
|
||||
return PageVO.convert(page, tmpList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 已发布实训上架
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PutOnPublishedTraining2RspVo putOnPublishedTrainings(PutOnPublishedTraining2ReqVo req,
|
||||
LoginUserInfoVO userInfoVO) {
|
||||
final PutOnPublishedTraining2RspVo rsp = new PutOnPublishedTraining2RspVo();
|
||||
rsp.setIds(new ArrayList<>());
|
||||
if (CollectionUtils.isEmpty(req.getIds())) {
|
||||
return rsp;
|
||||
}
|
||||
List<Long> newIds = this.pretreatmentFindData(req.getIds(), userInfoVO);
|
||||
for (Long newId : newIds) {
|
||||
PublishedTraining2WithBLOBs pub = new PublishedTraining2WithBLOBs();
|
||||
pub.setId(newId);
|
||||
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(newId.toString());
|
||||
}
|
||||
}
|
||||
return rsp;
|
||||
}
|
||||
|
||||
public void changeSharedStatus(Long id, Integer shared, LoginUserInfoVO userInfoVO) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(id), "id信息不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(shared),
|
||||
"未知共享类型");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
|
||||
shared == BusinessConsts.STATUS_USE_INT || shared == BusinessConsts.STATUS_NOT_USE_INT,
|
||||
"未知共享类型");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 已发布实训下架
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PullOffPublishedTraining2RspVo pullOffPublishedTrainings(
|
||||
PullOffPublishedTraining2ReqVo req, LoginUserInfoVO userInfoVO) {
|
||||
final PullOffPublishedTraining2RspVo rsp = new PullOffPublishedTraining2RspVo();
|
||||
rsp.setIds(new ArrayList<>());
|
||||
if (CollectionUtils.isEmpty(req.getIds())) {
|
||||
return rsp;
|
||||
}
|
||||
List<Long> newIds = this.pretreatmentFindData(req.getIds(), userInfoVO);
|
||||
for (Long newId : newIds) {
|
||||
PublishedTraining2WithBLOBs pub = new PublishedTraining2WithBLOBs();
|
||||
pub.setId(newId);
|
||||
pub.setState(PublishedTraining2StateEnum.PullOff.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(newId.toString());
|
||||
}
|
||||
return PageVO.convert(page, tmpList);
|
||||
}
|
||||
|
||||
return rsp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除已发布实训
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public DeletePublishedTraining2RspVo deletePublishedTrainings(DeletePublishedTraining2ReqVo req,
|
||||
LoginUserInfoVO userInfoVO) {
|
||||
DeletePublishedTraining2RspVo rsp = new DeletePublishedTraining2RspVo();
|
||||
rsp.setIds(new ArrayList<>());
|
||||
if (CollectionUtils.isEmpty(req.getIds())) {
|
||||
return rsp;
|
||||
/**
|
||||
* 已发布实训上架
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PutOnPublishedTraining2RspVo putOnPublishedTrainings(PutOnPublishedTraining2ReqVo req,LoginUserInfoVO userInfoVO) {
|
||||
final PutOnPublishedTraining2RspVo rsp = new PutOnPublishedTraining2RspVo();
|
||||
rsp.setIds(new ArrayList<>());
|
||||
if(CollectionUtils.isEmpty(req.getIds())){
|
||||
return rsp;
|
||||
}
|
||||
List<Long> newIds = this.pretreatmentFindData(req.getIds(),userInfoVO);
|
||||
for (Long newId : newIds) {
|
||||
PublishedTraining2WithBLOBs pub = new PublishedTraining2WithBLOBs();
|
||||
pub.setId(newId);
|
||||
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(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;
|
||||
}
|
||||
List<Long> newIds = this.pretreatmentFindData(req.getIds(), userInfoVO);
|
||||
for (Long newId : newIds) {
|
||||
int drt = this.publishedDao.deleteByPrimaryKey(newId);
|
||||
if (drt > 0) {
|
||||
rsp.getIds().add(newId.toString());
|
||||
}
|
||||
|
||||
public void changeSharedStatus(Long id ,Integer shared,LoginUserInfoVO userInfoVO){
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(id),"id信息不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(shared),"未知共享类型");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(shared == BusinessConsts.STATUS_USE_INT || shared == BusinessConsts.STATUS_NOT_USE_INT,"未知共享类型");
|
||||
|
||||
}
|
||||
return rsp;
|
||||
}
|
||||
/**
|
||||
* 已发布实训下架
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PullOffPublishedTraining2RspVo pullOffPublishedTrainings(PullOffPublishedTraining2ReqVo req,LoginUserInfoVO userInfoVO) {
|
||||
final PullOffPublishedTraining2RspVo rsp = new PullOffPublishedTraining2RspVo();
|
||||
rsp.setIds(new ArrayList<>());
|
||||
if(CollectionUtils.isEmpty(req.getIds())){
|
||||
return rsp;
|
||||
}
|
||||
List<Long> newIds = this.pretreatmentFindData(req.getIds(),userInfoVO);
|
||||
for (Long newId : newIds) {
|
||||
PublishedTraining2WithBLOBs pub = new PublishedTraining2WithBLOBs();
|
||||
pub.setId(newId);
|
||||
pub.setState(PublishedTraining2StateEnum.PullOff.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(newId.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private List<Long> pretreatmentFindData(List<String> ids, LoginUserInfoVO userInfoVO) {
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
PublishedTraining2Example.Criteria criteria = example.createCriteria();
|
||||
List<Long> idLong = ids.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
criteria.andIdIn(idLong);
|
||||
List<PublishedTraining2> t2 = this.publishedDao.selectByExample(example);
|
||||
List<PublishedTraining2> notExeList = t2.stream().filter(
|
||||
d -> Objects.equals(d.getOrgId(), userInfoVO.getTopOrgId()) && !Objects.equals(
|
||||
d.getCreatorId(), userInfoVO.getAccountVO().getId()))
|
||||
.collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(notExeList)) {
|
||||
String names = notExeList.stream().map(d -> d.getName()).collect(Collectors.joining(","));
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(false,
|
||||
String.format("共享数据[%s]不能删除", names));
|
||||
return rsp;
|
||||
}
|
||||
List<Long> findIds = t2.stream()
|
||||
.filter(d -> Objects.equals(d.getOrgId(), userInfoVO.getTopOrgId()))
|
||||
.map(d -> d.getId()).collect(Collectors.toList());
|
||||
return findIds;
|
||||
}
|
||||
|
||||
private PublishedTraining2Example.Criteria createQueryOrExample(PublishedTraining2Example example,
|
||||
PublishedTrainingListRspVo reqVO, List<Long> mapIdList) {
|
||||
/**
|
||||
* 删除已发布实训
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public DeletePublishedTraining2RspVo deletePublishedTrainings(DeletePublishedTraining2ReqVo req, LoginUserInfoVO userInfoVO) {
|
||||
DeletePublishedTraining2RspVo rsp = new DeletePublishedTraining2RspVo();
|
||||
rsp.setIds(new ArrayList<>());
|
||||
if(CollectionUtils.isEmpty(req.getIds())){
|
||||
return rsp;
|
||||
}
|
||||
List<Long> newIds = this.pretreatmentFindData(req.getIds(),userInfoVO);
|
||||
for (Long newId : newIds) {
|
||||
int drt = this.publishedDao.deleteByPrimaryKey(newId);
|
||||
if (drt > 0) {
|
||||
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;
|
||||
}
|
||||
|
||||
PublishedTraining2Example.Criteria criteria = example.createCriteria();
|
||||
private List<Long> pretreatmentFindData(List<String> ids, LoginUserInfoVO userInfoVO){
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
PublishedTraining2Example.Criteria criteria = example.createCriteria();
|
||||
List<Long> idLong = ids.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
criteria.andIdIn(idLong);
|
||||
List<PublishedTraining2> t2 = this.publishedDao.selectByExample(example);
|
||||
List<PublishedTraining2> notExeList = t2.stream().filter(d->Objects.equals(d.getOrgId(),userInfoVO.getTopOrgId())).collect(Collectors.toList());
|
||||
if(!CollectionUtils.isEmpty(notExeList)){
|
||||
String names = notExeList.stream().map(d->d.getName()).collect(Collectors.joining(","));
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(false,String.format("共享数据[%s]不能删除",names));
|
||||
}
|
||||
List<Long> findIds = t2.stream()
|
||||
.filter(d->Objects.equals(d.getOrgId(),userInfoVO.getTopOrgId()))
|
||||
.map(d->d.getId()).collect(Collectors.toList());
|
||||
return findIds;
|
||||
}
|
||||
private PublishedTraining2Example.Criteria createQueryOrExample(PublishedTraining2Example example , PublishedTrainingListRspVo reqVO,List<Long> mapIdList){
|
||||
|
||||
PublishedTraining2Example.Criteria criteria = example.createCriteria();
|
||||
// PublishedTraining2Example.Criteria or = example.or();
|
||||
|
||||
if (reqVO.getMapId() != null) {
|
||||
criteria.andMapIdEqualTo(reqVO.getMapId());
|
||||
} else {
|
||||
criteria.andMapIdIn(mapIdList);
|
||||
if (reqVO.getMapId() != null) {
|
||||
criteria.andMapIdEqualTo(reqVO.getMapId());
|
||||
}else{
|
||||
criteria.andMapIdIn(mapIdList);
|
||||
}
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
/* private PublishedTraining2Example.Criteria createQueryExample(PublishedTraining2Example example ,PublishedTrainingListRspVo reqVO){
|
||||
|
||||
public PageVO<PublishedTraining2InfoRspVo> findTrainingInfoForPage(
|
||||
PublishedTrainingListRspVo reqVO, LoginUserInfoVO userInfoVO, boolean findSharedData) {
|
||||
List<MapVO> mapVOS = this.mapService.listMapsOfUser(userInfoVO);
|
||||
List<Long> mapIdList = mapVOS.stream().map(d -> d.getId()).collect(Collectors.toList());
|
||||
PublishedTraining2Example.Criteria criteria = example.createCriteria();
|
||||
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;
|
||||
}*/
|
||||
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
PublishedTraining2Example.Criteria criteria = this.createQueryOrExample(example, reqVO,
|
||||
mapIdList);
|
||||
if (findSharedData) {
|
||||
PublishedTraining2Example.Criteria or = example.or();
|
||||
or.andStateEqualTo(BusinessConsts.STATUS_USE_INT)
|
||||
.andSharedEqualTo(BusinessConsts.STATUS_USE_INT);
|
||||
if (reqVO.getType() != null) {
|
||||
or.andTypeEqualTo(reqVO.getType().value());
|
||||
}
|
||||
if (Objects.isNull(reqVO.getMapId())) {
|
||||
or.andMapIdIn(mapIdList);
|
||||
} else {
|
||||
public PageVO<PublishedTraining2InfoRspVo> findTrainingInfoForPage(PublishedTrainingListRspVo reqVO,LoginUserInfoVO userInfoVO,boolean findSharedData){
|
||||
List<MapVO> mapVOS = this.mapService.listMapsOfUser(userInfoVO);
|
||||
List<Long> mapIdList = mapVOS.stream().map(d->d.getId()).collect(Collectors.toList());
|
||||
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
PublishedTraining2Example.Criteria criteria = this.createQueryOrExample(example,reqVO,mapIdList);
|
||||
if(findSharedData){
|
||||
PublishedTraining2Example.Criteria or = example.or();
|
||||
or.andStateEqualTo(BusinessConsts.STATUS_USE_INT).andSharedEqualTo(BusinessConsts.STATUS_USE_INT);
|
||||
if (reqVO.getType() != null) {
|
||||
or.andTypeEqualTo(reqVO.getType().value());
|
||||
}
|
||||
if(Objects.isNull(reqVO.getMapId())){
|
||||
or.andMapIdIn(mapIdList);
|
||||
}else{
|
||||
or.andMapIdEqualTo(reqVO.getMapId());
|
||||
}
|
||||
// if(Objects.nonNull(reqVO.getOrgId())){
|
||||
// or.andOrgIdNotEqualTo(reqVO.getOrgId());
|
||||
// }
|
||||
}
|
||||
PageHelper.startPage(reqVO.getPageNum(), reqVO.getPageSize());
|
||||
Page<PublishedTraining2> page = (Page<PublishedTraining2>)this.publishedDao.selectByExample(example);
|
||||
if(page.isEmpty()){
|
||||
return PageVO.convert(page,Collections.emptyList());
|
||||
}
|
||||
return PageVO.convert(page,Training2Convertor.convertFrom(page.getResult()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据地图ID和类型查询实训列表
|
||||
*/
|
||||
public List<PublishedTraining2InfoRspVo> findTrainingInfo(PublishedTrainingListRspVo reqVO,LoginUserInfoVO userInfoVO) {
|
||||
List<MapVO> mapVOS = this.mapService.listMapsOfUser(userInfoVO);
|
||||
List<Long> mapIdList = mapVOS.stream().map(d->d.getId()).collect(Collectors.toList());
|
||||
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
this.createQueryOrExample(example,reqVO,mapIdList);
|
||||
PublishedTraining2Example.Criteria or = example.or();
|
||||
or.andStateEqualTo(BusinessConsts.STATUS_USE_INT).andSharedEqualTo(BusinessConsts.STATUS_USE_INT);
|
||||
or.andMapIdEqualTo(reqVO.getMapId());
|
||||
}
|
||||
if (reqVO.getType() != null) {
|
||||
or.andTypeEqualTo(reqVO.getType().value());
|
||||
}
|
||||
// if(reqVO.getOrgId() !=null){
|
||||
// or.andOrgIdNotEqualTo(reqVO.getOrgId());
|
||||
// }
|
||||
List<PublishedTraining2> list = this.publishedDao.selectByExample(example);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return List.of();
|
||||
} else {
|
||||
return list.stream().map(Training2Convertor::convertFrom).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
PageHelper.startPage(reqVO.getPageNum(), reqVO.getPageSize());
|
||||
Page<PublishedTraining2> page = (Page<PublishedTraining2>) this.publishedDao.selectByExample(
|
||||
example);
|
||||
if (page.isEmpty()) {
|
||||
return PageVO.convert(page, Collections.emptyList());
|
||||
|
||||
/**
|
||||
* 根据已发布实训的id来查询实现的所有信息
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public PublishedTraining2DetailRspVo findTrainingAllInfoById(Long trainingId) {
|
||||
PublishedTraining2WithBLOBs b = this.publishedDao.selectByPrimaryKey(trainingId);
|
||||
if (null != b) {
|
||||
PublishedTraining2DetailRspVo rsp = new PublishedTraining2DetailRspVo();
|
||||
//
|
||||
rsp.setDescription(b.getDescription());
|
||||
rsp.setFailureConditionJson(b.getFailureConditionJson());
|
||||
rsp.setCreateTime(b.getCreateTime());
|
||||
rsp.setCreatorId(b.getCreatorId());
|
||||
rsp.setLabelJson(b.getLabelJson());
|
||||
rsp.setMapId(b.getMapId());
|
||||
rsp.setName(b.getName());
|
||||
rsp.setId(b.getId());
|
||||
rsp.setType(b.getType());
|
||||
rsp.setBgSceneJson(b.getBgSceneJson());
|
||||
rsp.setMemberJson(b.getMemberJson());
|
||||
rsp.setOperaJson(b.getOperaJson());
|
||||
rsp.setStepJson(b.getStepJson());
|
||||
rsp.setUpdateTime(b.getUpdateTime());
|
||||
rsp.setPlayerIdJson(b.getPlayerIdJson());
|
||||
rsp.setMapLocationJson(b.getMapLocationJson());
|
||||
rsp.setRunPlanId(b.getRunPlanId());
|
||||
rsp.setScoringRuleJson(b.getScoringRuleJson());
|
||||
rsp.setState(b.getState());
|
||||
rsp.setClient(b.getClient());
|
||||
//
|
||||
return rsp;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return PageVO.convert(page, Training2Convertor.convertFrom(page.getResult()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据地图ID和类型查询实训列表
|
||||
*/
|
||||
public List<PublishedTraining2InfoRspVo> findTrainingInfo(PublishedTrainingListRspVo reqVO,
|
||||
LoginUserInfoVO userInfoVO) {
|
||||
List<MapVO> mapVOS = this.mapService.listMapsOfUser(userInfoVO);
|
||||
List<Long> mapIdList = mapVOS.stream().map(d -> d.getId()).collect(Collectors.toList());
|
||||
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
this.createQueryOrExample(example, reqVO, mapIdList);
|
||||
PublishedTraining2Example.Criteria or = example.or();
|
||||
or.andStateEqualTo(BusinessConsts.STATUS_USE_INT)
|
||||
.andSharedEqualTo(BusinessConsts.STATUS_USE_INT);
|
||||
or.andMapIdEqualTo(reqVO.getMapId());
|
||||
if (reqVO.getType() != null) {
|
||||
or.andTypeEqualTo(reqVO.getType().value());
|
||||
/**
|
||||
* 根据地图ID列表修改生成实训的组织ID
|
||||
*/
|
||||
public void updatePublishTrainingOrgIdByMapId(Long orgId, List<Long> mapIdList) {
|
||||
if (!CollectionUtils.isEmpty(mapIdList)) {
|
||||
publishedDao.updateTrainingOrgByMapIdList(orgId, mapIdList);
|
||||
}
|
||||
}
|
||||
example.setOrderByClause("id desc");
|
||||
List<PublishedTraining2> list = this.publishedDao.selectByExample(example);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return List.of();
|
||||
} else {
|
||||
return list.stream().map(Training2Convertor::convertFrom).collect(Collectors.toList());
|
||||
|
||||
/**
|
||||
* 批量更新实训label
|
||||
*/
|
||||
public void updateTrainingLabelList(List<PublishedTraining2> publishedTraining2List) {
|
||||
List<PublishedTraining2> training2List = publishedTraining2List.stream().filter(t -> t.getId() != null).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(training2List)) {
|
||||
return;
|
||||
}
|
||||
publishedDao.updateTrainingLabelList(training2List);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据已发布实训的id来查询实现的所有信息
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public PublishedTraining2DetailRspVo findTrainingAllInfoById(Long trainingId) {
|
||||
PublishedTraining2WithBLOBs b = this.publishedDao.selectByPrimaryKey(trainingId);
|
||||
if (null != b) {
|
||||
PublishedTraining2DetailRspVo rsp = new PublishedTraining2DetailRspVo();
|
||||
//
|
||||
rsp.setDescription(b.getDescription());
|
||||
rsp.setFailureConditionJson(b.getFailureConditionJson());
|
||||
rsp.setCreateTime(b.getCreateTime());
|
||||
rsp.setCreatorId(b.getCreatorId());
|
||||
rsp.setLabelJson(b.getLabelJson());
|
||||
rsp.setMapId(b.getMapId());
|
||||
rsp.setName(b.getName());
|
||||
rsp.setId(b.getId());
|
||||
rsp.setType(b.getType());
|
||||
rsp.setBgSceneJson(b.getBgSceneJson());
|
||||
rsp.setMemberJson(b.getMemberJson());
|
||||
rsp.setOperaJson(b.getOperaJson());
|
||||
rsp.setStepJson(b.getStepJson());
|
||||
rsp.setUpdateTime(b.getUpdateTime());
|
||||
rsp.setPlayerIdJson(b.getPlayerIdJson());
|
||||
rsp.setMapLocationJson(b.getMapLocationJson());
|
||||
rsp.setRunPlanId(b.getRunPlanId());
|
||||
rsp.setScoringRuleJson(b.getScoringRuleJson());
|
||||
rsp.setState(b.getState());
|
||||
rsp.setClient(b.getClient());
|
||||
//
|
||||
return rsp;
|
||||
/**
|
||||
* 更新实训label
|
||||
*/
|
||||
public void updateTrainingLabel(PublishedTraining2 training2) {
|
||||
PublishedTraining2WithBLOBs blobs = new PublishedTraining2WithBLOBs();
|
||||
blobs.setId(training2.getId());
|
||||
blobs.setLabelJson(training2.getLabelJson());
|
||||
publishedDao.updateByPrimaryKeySelective(blobs);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据地图ID列表修改生成实训的组织ID
|
||||
*/
|
||||
public void updatePublishTrainingOrgIdByMapId(Long orgId, List<Long> mapIdList) {
|
||||
if (!CollectionUtils.isEmpty(mapIdList)) {
|
||||
publishedDao.updateTrainingOrgByMapIdList(orgId, mapIdList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新实训label
|
||||
*/
|
||||
public void updateTrainingLabelList(List<PublishedTraining2> publishedTraining2List) {
|
||||
List<PublishedTraining2> training2List = publishedTraining2List.stream()
|
||||
.filter(t -> t.getId() != null).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(training2List)) {
|
||||
return;
|
||||
}
|
||||
publishedDao.updateTrainingLabelList(training2List);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新实训label
|
||||
*/
|
||||
public void updateTrainingLabel(PublishedTraining2 training2) {
|
||||
PublishedTraining2WithBLOBs blobs = new PublishedTraining2WithBLOBs();
|
||||
blobs.setId(training2.getId());
|
||||
blobs.setLabelJson(training2.getLabelJson());
|
||||
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 实训列表
|
||||
* @return 实训列表
|
||||
*/
|
||||
public List<ExportTraining2> exportTraining(List<Long> tidList) {
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
example.createCriteria().andIdIn(tidList);
|
||||
List<PublishedTraining2WithBLOBs> training2WithBLOBsList = publishedDao.selectByExampleWithBLOBs(
|
||||
example);
|
||||
Map<Long, List<PublishedTraining2WithBLOBs>> mapTrainingMap = training2WithBLOBsList.stream()
|
||||
.peek(t -> {
|
||||
t.setId(null);
|
||||
t.setUpdateTime(null);
|
||||
t.setCreateTime(null);
|
||||
/**
|
||||
* 导出实训信息
|
||||
* @param tidList 实训列表
|
||||
* @return 实训列表
|
||||
*/
|
||||
public List<ExportTraining2> exportTraining(List<Long> tidList) {
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
example.createCriteria().andIdIn(tidList);
|
||||
List<PublishedTraining2WithBLOBs> training2WithBLOBsList = publishedDao.selectByExampleWithBLOBs(example);
|
||||
Map<Long, List<PublishedTraining2WithBLOBs>> mapTrainingMap = training2WithBLOBsList.stream().peek(t -> {
|
||||
t.setId(null);
|
||||
t.setUpdateTime(null);
|
||||
t.setCreateTime(null);
|
||||
}).collect(Collectors.groupingBy(PublishedTraining2WithBLOBs::getMapId));
|
||||
// 地图基本信息列表
|
||||
List<MapInfo> mapInfoList = mapService.queryMapInfoList(
|
||||
new ArrayList<>(mapTrainingMap.keySet()));
|
||||
Map<Long, MapInfo> mapInfoMap = mapInfoList.stream()
|
||||
.collect(Collectors.toMap(MapInfo::getId, m -> m, (o, n) -> n));
|
||||
List<ExportTraining2> exportTraining2List = new ArrayList<>(mapTrainingMap.size());
|
||||
mapInfoMap.forEach((k, v) -> {
|
||||
ExportTraining2 exportData = new ExportTraining2();
|
||||
exportData.setName(v.getName());
|
||||
exportData.setLineCode(v.getLineCode());
|
||||
exportData.setList(mapTrainingMap.get(k));
|
||||
exportTraining2List.add(exportData);
|
||||
});
|
||||
return exportTraining2List;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入实训接口
|
||||
*
|
||||
* @param trainingList 实训列表
|
||||
*/
|
||||
public List<String> importTraining(List<ExportTraining2> trainingList,
|
||||
LoginUserInfoVO userInfoVO) {
|
||||
List<String> msgList = new ArrayList<>();
|
||||
trainingList.forEach(t -> {
|
||||
List<MapInfo> mapInfoList = mapService.queryMapInfo(t.getName(), t.getLineCode());
|
||||
if (mapInfoList.size() == 1) {
|
||||
Long mapId = mapInfoList.get(0).getId();
|
||||
t.getList().forEach(training -> {
|
||||
training.setMapId(mapId);
|
||||
training.setCreatorId(userInfoVO.getAccountVO().getId());
|
||||
training.setCreateTime(LocalDateTime.now());
|
||||
// 地图基本信息列表
|
||||
List<MapInfo> mapInfoList = mapService.queryMapInfoList(new ArrayList<>(mapTrainingMap.keySet()));
|
||||
Map<Long, MapInfo> mapInfoMap = mapInfoList.stream().collect(Collectors.toMap(MapInfo::getId, m -> m, (o,n) -> n));
|
||||
List<ExportTraining2> exportTraining2List = new ArrayList<>(mapTrainingMap.size());
|
||||
mapInfoMap.forEach((k, v) -> {
|
||||
ExportTraining2 exportData = new ExportTraining2();
|
||||
exportData.setName(v.getName());
|
||||
exportData.setLineCode(v.getLineCode());
|
||||
exportData.setList(mapTrainingMap.get(k));
|
||||
exportTraining2List.add(exportData);
|
||||
});
|
||||
publishedDao.insertList(t.getList());
|
||||
msgList.add(String.format("地图【%s】实训信息导入成功", t.getName()));
|
||||
} else {
|
||||
msgList.add(String.format("地图【%s】实训信息导入失败,线路【%s】地图【%s】未上线", t.getName(),
|
||||
t.getLineCode(), t.getName()));
|
||||
}
|
||||
});
|
||||
return msgList;
|
||||
}
|
||||
return exportTraining2List;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入实训接口
|
||||
* @param trainingList 实训列表
|
||||
*/
|
||||
public List<String> importTraining(List<ExportTraining2> trainingList, LoginUserInfoVO userInfoVO) {
|
||||
List<String> msgList = new ArrayList<>();
|
||||
trainingList.forEach(t -> {
|
||||
List<MapInfo> mapInfoList = mapService.queryMapInfo(t.getName(), t.getLineCode());
|
||||
if (mapInfoList.size() == 1) {
|
||||
Long mapId = mapInfoList.get(0).getId();
|
||||
t.getList().forEach(training -> {
|
||||
training.setMapId(mapId);
|
||||
training.setCreatorId(userInfoVO.getAccountVO().getId());
|
||||
training.setCreateTime(LocalDateTime.now());
|
||||
});
|
||||
publishedDao.insertList(t.getList());
|
||||
msgList.add(String.format("地图【%s】实训信息导入成功", t.getName()));
|
||||
} else {
|
||||
msgList.add(String.format("地图【%s】实训信息导入失败", t.getName()));
|
||||
}
|
||||
});
|
||||
return msgList;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package club.joylink.rtss.services.training2;
|
||||
|
||||
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.PublishedTraining2DAO;
|
||||
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.RtsMapFunction;
|
||||
import club.joylink.rtss.entity.RtsMapFunctionExample;
|
||||
import club.joylink.rtss.entity.training2.PublishedTraining2Example;
|
||||
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.entity.training2.*;
|
||||
import club.joylink.rtss.services.mapFunction.RtsMapFunctionService;
|
||||
import club.joylink.rtss.services.project.ProjectService;
|
||||
import club.joylink.rtss.simulation.SimulationManager;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.SimulationService;
|
||||
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.vo.LoginUserInfoVO;
|
||||
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.Training2Rule;
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.logging.log4j.util.BiConsumer;
|
||||
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;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -76,7 +85,7 @@ public class Training2RuleService {
|
||||
* @return 生成结果
|
||||
*/
|
||||
public List<String> generateTrainingByRule(String groupId) {
|
||||
Simulation simulation = simulationManager.getById(groupId, Simulation.class);
|
||||
Simulation simulation = simulationManager.getById(groupId , Simulation.class);
|
||||
Long mapId = simulation.getBuildParams().getMap().getId();
|
||||
if (runningMapIdSet.contains(mapId)) {
|
||||
return Arrays.asList("该地图正在生成实训!");
|
||||
@ -122,6 +131,7 @@ public class Training2RuleService {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param mapId
|
||||
* @param functionId
|
||||
* @return
|
||||
@ -134,7 +144,7 @@ public class Training2RuleService {
|
||||
/**
|
||||
* 根据地图ID生成实训
|
||||
*/
|
||||
public List<String> generateTrainingByMapId(List<Long> mapIdList, LoginUserInfoVO loginUserInfoVO) {
|
||||
public List<String> generateTrainingByMapId(List<Long> mapIdList, LoginUserInfoVO loginUserInfoVO){
|
||||
// 地图列表
|
||||
MapInfoExample example = new MapInfoExample();
|
||||
MapInfoExample.Criteria criteria = example.createCriteria().andStatusEqualTo(MapStatus.Online.getCode());
|
||||
@ -213,7 +223,7 @@ public class Training2RuleService {
|
||||
List<Map<String, Long>> publishTrainingIdList = publishedTraining2DAO.selectTrainingByRuleId(
|
||||
ruleIdList, mapList.stream().map(MapInfo::getId).collect(Collectors.toList()));
|
||||
Map<Long, List<Long>> publishTrainingIdMap = publishTrainingIdList.stream().collect(
|
||||
Collectors.groupingBy(m -> m.get("mapId"), Collectors.mapping(m -> m.get("id"), Collectors.toList())));
|
||||
Collectors.groupingBy(m -> m.get("mapId"), Collectors.mapping(m -> m.get("id") , Collectors.toList())));
|
||||
|
||||
List<String> errorMsgList = new ArrayList<>();
|
||||
loopMapListGenerateTraining(loginUserInfoVO, mapList, lineCodeRuleMap, errorMsgList, publishTrainingIdMap);
|
||||
@ -227,7 +237,7 @@ public class Training2RuleService {
|
||||
List<String> errorMsgList = new ArrayList<>();
|
||||
mapRuleIdMap.forEach((k, v) -> {
|
||||
// 地图信息
|
||||
MapInfo mapInfo = mapInfoDAO.selectByPrimaryKey(k);
|
||||
MapInfo mapInfo = mapInfoDAO.selectByPrimaryKey(k);
|
||||
// 规则列表
|
||||
RtsTraining2RuleExample rtsTraining2RuleExample = new RtsTraining2RuleExample();
|
||||
rtsTraining2RuleExample.createCriteria().andIdIn(v).andLineCodeEqualTo(mapInfo.getLineCode());
|
||||
@ -236,8 +246,8 @@ public class Training2RuleService {
|
||||
// 获取客户端参数
|
||||
List<RtsMapFunction> entities = getRtsMapFunctions(k);
|
||||
if (!CollectionUtils.isEmpty(entities)) {
|
||||
List<Map<String, String>> ruleNameMapList = ruleList.stream().map(r -> {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
List<Map<String,String>> ruleNameMapList = ruleList.stream().map(r -> {
|
||||
Map<String,String> map = new HashMap<>();
|
||||
map.put("ruleName", r.getName());
|
||||
map.put("client", r.getClient());
|
||||
return map;
|
||||
@ -245,7 +255,7 @@ public class Training2RuleService {
|
||||
// 需要删除的列表
|
||||
List<Long> delTrainingIdList = publishedTraining2DAO.selectTrainingIdByRuleNameAndMapId(ruleNameMapList, k);
|
||||
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));
|
||||
} catch (Exception e) {
|
||||
log.error("创建仿真失败", e);
|
||||
@ -278,7 +288,7 @@ public class Training2RuleService {
|
||||
bloBs.setId(rule.getId());
|
||||
bloBs.setScoreRule(JsonUtils.writeValueAsString(detailVOList));
|
||||
return bloBs;
|
||||
}).collect(Collectors.toList());
|
||||
}).collect(Collectors.toList());
|
||||
rtsTraining2RuleMapper.updateScoreRule(ruleScoreList);
|
||||
}
|
||||
|
||||
@ -292,7 +302,7 @@ public class Training2RuleService {
|
||||
List<RtsMapFunction> entities = getRtsMapFunctions(mapInfo.getId());
|
||||
if (!CollectionUtils.isEmpty(entities) && !CollectionUtils.isEmpty(lineCodeRuleMap.get(mapInfo.getLineCode()))) {
|
||||
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)) {
|
||||
errorMsgList.addAll(generateTraining(simulation, lineCodeRuleMap.get(mapInfo.getLineCode()), null, delPublishTrainingByMapId));
|
||||
} else {
|
||||
@ -308,9 +318,8 @@ public class Training2RuleService {
|
||||
|
||||
/**
|
||||
* 生成实训方法
|
||||
*
|
||||
* @param simulation 对应地图仿真
|
||||
* @param ruleList 生成规则
|
||||
* @param simulation 对应地图仿真
|
||||
* @param ruleList 生成规则
|
||||
* @param delTrainingIds 要删除已发布的实训ID
|
||||
* @param delConsumer 删除实训方法
|
||||
* @return
|
||||
@ -349,11 +358,11 @@ public class Training2RuleService {
|
||||
publishedTraining2DAO.insertList(training2WithBLOBs);
|
||||
} catch (RuntimeException e) {
|
||||
log.error("实训反序列化失败", e);
|
||||
errorMsgList.add(String.format("地图%d实训[%s]反序列化,实训ID【%d】", mapId, rule.getName(), rule.getId(), Locale.ENGLISH));
|
||||
errorMsgList.add(String.format("地图%d实训[%s]反序列化,实训ID【%d】", mapId, rule.getName(), rule.getId(),Locale.ENGLISH));
|
||||
} catch (Exception e) {
|
||||
log.error("实训生成失败", e);
|
||||
errorMsgList.add(String.format("地图%d实训[%s]生成失败,设备信息【%s】,原因:%s", mapId,
|
||||
rule.getName(), rule.getDeviceRule(), e.getMessage(), Locale.ENGLISH));
|
||||
rule.getName(), rule.getDeviceRule(),e.getMessage(),Locale.ENGLISH));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,6 @@ import club.joylink.rtss.entity.RtsMapFunction;
|
||||
import club.joylink.rtss.entity.SysAccount;
|
||||
import club.joylink.rtss.entity.UserSimulationRecord;
|
||||
import club.joylink.rtss.entity.UserSimulationRecordExample;
|
||||
import club.joylink.rtss.entity.UserSimulationRecordExample.Criteria;
|
||||
import club.joylink.rtss.event.UserSimulationRecordEvent;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.IMapService;
|
||||
@ -14,7 +13,6 @@ import club.joylink.rtss.services.mapFunction.RtsMapFunctionService;
|
||||
import club.joylink.rtss.simulation.cbtc.message.UserSimulationRecordManager;
|
||||
import club.joylink.rtss.util.TimeUnit;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.simulationUsage.SimulationUsageRecordQueryVO;
|
||||
import club.joylink.rtss.vo.client.simulationUsage.UserSimulationQueryVO;
|
||||
import club.joylink.rtss.vo.client.simulationUsage.UserSimulationRecordVO;
|
||||
import club.joylink.rtss.vo.client.simulationUsage.UserSimulationStatsVO;
|
||||
@ -68,8 +66,7 @@ public class UserSimulationRecordService {
|
||||
}
|
||||
|
||||
public List<UserSimulationRecord> queryByMapAndUserIds(Long mapId, List<Long> userIds) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(userIds,
|
||||
"用户列表不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(userIds, "用户列表不能为空");
|
||||
UserSimulationRecordExample example = new UserSimulationRecordExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId).andUserIdIn(userIds);
|
||||
return userSimulationRecordDAO.selectByExample(example);
|
||||
@ -168,22 +165,6 @@ public class UserSimulationRecordService {
|
||||
return statistic(startTime, endTime, timeUnit, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询仿真使用记录
|
||||
*/
|
||||
public List<UserSimulationRecord> listSimulationUsageRecords(
|
||||
SimulationUsageRecordQueryVO queryVO) {
|
||||
UserSimulationRecordExample example = new UserSimulationRecordExample();
|
||||
Criteria criteria = example.createCriteria();
|
||||
if (queryVO.getUid() != null) {
|
||||
criteria.andUserIdEqualTo(queryVO.getUid());
|
||||
}
|
||||
if (queryVO.getFunctionId() != null) {
|
||||
criteria.andFunctionIdEqualTo(queryVO.getFunctionId());
|
||||
}
|
||||
return userSimulationRecordDAO.selectByExample(example);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对使用记录按照时间单位、开始、结束时间分段统计
|
||||
*/
|
||||
@ -242,12 +223,9 @@ public class UserSimulationRecordService {
|
||||
}
|
||||
|
||||
private void checkParam(UserSimulationQueryVO queryVO) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getTimeUnit(),
|
||||
"缺少时间单位");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getStartTime(),
|
||||
"缺少开始时间");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getEndTime(),
|
||||
"缺少结束时间");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getTimeUnit(), "缺少时间单位");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getStartTime(), "缺少开始时间");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getEndTime(), "缺少结束时间");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
|
||||
!queryVO.getStartTime().isAfter(queryVO.getEndTime()), "开始时间不能晚于结束时间");
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.competition.VoiceErrorVO;
|
||||
import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult;
|
||||
import club.joylink.rtss.vo.voice.VoiceVerifyResultVO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
@ -12,19 +11,9 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
*/
|
||||
public interface IVoiceTrainingService {
|
||||
|
||||
PageVO<VoiceErrorVO> pagedQueryErrorSet(PageQueryVO queryVO);
|
||||
PageVO<VoiceErrorVO> pagedQueryErrorSet(PageQueryVO queryVO);
|
||||
|
||||
VoiceRecognitionResult voiceRecognition(MultipartFile file);
|
||||
VoiceRecognitionResult voiceRecognition(MultipartFile file);
|
||||
|
||||
VoiceRecognitionResult voiceRecognition(byte[] bytes, String filePath);
|
||||
|
||||
/**
|
||||
* 校验语音识别结果
|
||||
*
|
||||
* @param contentType
|
||||
* @param file 需要校验的语音
|
||||
* @param text 正确的文本
|
||||
* @return 校验结果
|
||||
*/
|
||||
VoiceVerifyResultVO verifyVoice(String contentType, byte[] file, String text);
|
||||
VoiceRecognitionResult voiceRecognition(byte[] bytes, String filePath);
|
||||
}
|
||||
|
@ -19,70 +19,66 @@ import java.util.Objects;
|
||||
@Component
|
||||
public class VoiceService {
|
||||
|
||||
private final MinioClientUtil voiceSynthesisUtil;
|
||||
private final MinioClientUtil voiceRecognitionUtil;
|
||||
private final static String SYNTHESIS_FOLDER = "synthesis";
|
||||
private final static String RECOGNITION_FOLDER = "recognition";
|
||||
private final MinioClientUtil voiceSynthesisUtil;
|
||||
private final MinioClientUtil voiceRecognitionUtil;
|
||||
private final static String SYNTHESIS_FOLDER = "synthesis";
|
||||
private final static String RECOGNITION_FOLDER = "recognition";
|
||||
|
||||
@Autowired
|
||||
@Qualifier(value = "baiDuVoiceService2")
|
||||
private IVoiceService2 voiceService;
|
||||
@Autowired
|
||||
@Qualifier(value = "baiDuVoiceService2")
|
||||
private IVoiceService2 voiceService;
|
||||
|
||||
public VoiceService(MinioClientConfig minioClientConfig) {
|
||||
this.voiceSynthesisUtil = MinioClientUtil.getInstance(minioClientConfig, SYNTHESIS_FOLDER);
|
||||
this.voiceRecognitionUtil = MinioClientUtil.getInstance(minioClientConfig, RECOGNITION_FOLDER);
|
||||
}
|
||||
|
||||
/**
|
||||
* 语音识别
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public VoiceRecognitionResult voiceRecognition(VoiceRecognitionVO vo) {
|
||||
String fileName = String.format("%s.wav", System.currentTimeMillis());
|
||||
this.uploadFile(voiceRecognitionUtil, vo.getData(), fileName, RECOGNITION_FOLDER);
|
||||
String filePath = this.voiceRecognitionUtil.getDownLoadPath(fileName);
|
||||
VoiceAsrResult voiceResult = voiceService.recognition(vo);
|
||||
return new VoiceRecognitionResult(filePath, voiceResult.getResult().get(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* 语音合成
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public VoiceCompose synthesis(BaseVoiceSynthesisVO vo) {
|
||||
String md5Code = vo.md5Code();
|
||||
String fileName = String.format("%s.wav", md5Code);
|
||||
if (Objects.equals(false, this.voiceSynthesisUtil.checkFileIsExist(fileName))) {
|
||||
byte[] bytes = voiceService.voiceSynthesis(vo);
|
||||
byte[] data = bytes;
|
||||
this.uploadFile(voiceSynthesisUtil, data, fileName, SYNTHESIS_FOLDER);
|
||||
public VoiceService(MinioClientConfig minioClientConfig){
|
||||
this.voiceSynthesisUtil = MinioClientUtil.getInstance(minioClientConfig,SYNTHESIS_FOLDER);
|
||||
this.voiceRecognitionUtil = MinioClientUtil.getInstance(minioClientConfig,RECOGNITION_FOLDER);
|
||||
}
|
||||
String filePath = this.voiceSynthesisUtil.getDownLoadPath(fileName);
|
||||
return new VoiceCompose(filePath, md5Code, vo.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 语音合成返回原数据
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public byte[] synthesisSource(BaseVoiceSynthesisVO vo) {
|
||||
byte[] data = voiceService.voiceSynthesis(vo);
|
||||
return data;
|
||||
}
|
||||
|
||||
private void uploadFile(MinioClientUtil minioClient, byte[] data, String fileName, String folder) {
|
||||
try {
|
||||
minioClient.uploadBytes(data, fileName);
|
||||
} catch (SimulationException e) {
|
||||
log.error("文件上传失败 folder:{},文件名:{} errmsg:{}", folder, fileName, e.getMessage(), e);
|
||||
throw e;
|
||||
/**
|
||||
* 语音识别
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public VoiceRecognitionResult voiceRecognition(VoiceRecognitionVO vo){
|
||||
String fileName = String.format("%s.wav",System.currentTimeMillis());
|
||||
this.uploadFile(voiceRecognitionUtil,vo.getData(),fileName,RECOGNITION_FOLDER);
|
||||
String filePath = this.voiceRecognitionUtil.getDownLoadPath(fileName);
|
||||
VoiceAsrResult voiceResult = voiceService.recognition(vo);
|
||||
return new VoiceRecognitionResult(filePath,voiceResult.getResult().get(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* 语音合成
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public VoiceCompose synthesis(BaseVoiceSynthesisVO vo){
|
||||
String md5Code = vo.md5Code();
|
||||
String fileName = String.format("%s.wav",md5Code);
|
||||
if(Objects.equals(false,this.voiceSynthesisUtil.checkFileIsExist(fileName))){
|
||||
byte[] data = voiceService.voiceSynthesis(vo);
|
||||
this.uploadFile(voiceSynthesisUtil,data,fileName,SYNTHESIS_FOLDER);
|
||||
}
|
||||
String filePath = this.voiceSynthesisUtil.getDownLoadPath(fileName);
|
||||
return new VoiceCompose(filePath,md5Code,vo.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 语音合成返回原数据
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public byte[] synthesisSource(BaseVoiceSynthesisVO vo){
|
||||
byte[] data = voiceService.voiceSynthesis(vo);
|
||||
return data;
|
||||
}
|
||||
|
||||
private void uploadFile(MinioClientUtil minioClient ,byte[] data,String fileName,String folder){
|
||||
try{
|
||||
minioClient.uploadBytes(data,fileName);
|
||||
}catch (SimulationException e){
|
||||
log.error("文件上传失败 folder:{},文件名:{} errmsg:{}",folder,fileName,e.getMessage(),e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,118 +2,63 @@ package club.joylink.rtss.services.voice;
|
||||
|
||||
import club.joylink.rtss.dao.CompetitionErrorSetDAO;
|
||||
import club.joylink.rtss.entity.CompetitionErrorSet;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.simulation.cbtc.conversation.SimulationVoiceHandler;
|
||||
import club.joylink.rtss.util.StrUtils;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.competition.VoiceErrorVO;
|
||||
import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult;
|
||||
import club.joylink.rtss.vo.client.voice.VoiceRecognitionVO;
|
||||
import club.joylink.rtss.vo.voice.VoiceVerifyResultVO;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import 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.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class VoiceTrainingService implements IVoiceTrainingService {
|
||||
|
||||
@Autowired
|
||||
private CompetitionErrorSetDAO competitionErrorSetDAO;
|
||||
@Autowired
|
||||
private CompetitionErrorSetDAO competitionErrorSetDAO;
|
||||
|
||||
/* @Autowired
|
||||
@Qualifier("baiDuVoiceService")
|
||||
private IVoiceService iVoiceService;*/
|
||||
|
||||
@Autowired
|
||||
@Autowired
|
||||
// @Qualifier("baiDuVoiceService2")
|
||||
private VoiceService iVoiceService;
|
||||
private VoiceService iVoiceService;
|
||||
|
||||
@Autowired
|
||||
private SimulationVoiceHandler simulationVoiceHandler;
|
||||
@Autowired
|
||||
private SimulationVoiceHandler simulationVoiceHandler;
|
||||
|
||||
|
||||
@Override
|
||||
public PageVO<VoiceErrorVO> pagedQueryErrorSet(PageQueryVO queryVO) {
|
||||
Page<Object> page = PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
List<CompetitionErrorSet> sets = competitionErrorSetDAO.selectByExample(null);
|
||||
List<VoiceErrorVO> list = sets.stream().map(VoiceErrorVO::new).collect(Collectors.toList());
|
||||
return PageVO.convert(page, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoiceRecognitionResult voiceRecognition(MultipartFile file) {
|
||||
VoiceRecognitionVO vo = VoiceRecognitionVO.load(file);
|
||||
return voiceRecognition(vo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoiceRecognitionResult voiceRecognition(byte[] bytes, String filePath) {
|
||||
VoiceRecognitionVO vo = new VoiceRecognitionVO(bytes);
|
||||
return voiceRecognition(vo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoiceVerifyResultVO verifyVoice(String contentType, byte[] fileData, String text) {
|
||||
byte[] monoData = convertToMonoChannel(fileData);
|
||||
VoiceRecognitionResult voiceRecognitionResult = voiceRecognition(
|
||||
new VoiceRecognitionVO(monoData, contentType));
|
||||
boolean match = StrUtils.isMatch(text, voiceRecognitionResult.getResult(), 70);
|
||||
return new VoiceVerifyResultVO(voiceRecognitionResult.getResult(), match);
|
||||
}
|
||||
|
||||
private VoiceRecognitionResult voiceRecognition(VoiceRecognitionVO vo) {
|
||||
VoiceRecognitionResult result = this.iVoiceService.voiceRecognition(vo);
|
||||
// VoiceRecognitionResult result = this.iVoiceService.voiceRecognition(file, "");
|
||||
result.setResult(simulationVoiceHandler.handle(result.getResult()));
|
||||
return result;
|
||||
}
|
||||
|
||||
private byte[] convertToMonoChannel(byte[] audioData) {
|
||||
try {
|
||||
// 假设输入和输出音频都存储在字节数组中
|
||||
byte[] outputAudioBytes;
|
||||
|
||||
// 将输入音频字节数组转换为音频输入流
|
||||
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(audioData);
|
||||
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(byteArrayInputStream);
|
||||
AudioFormat format = audioInputStream.getFormat();
|
||||
|
||||
// 确保输入音频是立体声
|
||||
if (format.getChannels() != 2) {
|
||||
System.out.println("Input audio is not stereo.");
|
||||
return audioData;
|
||||
}
|
||||
|
||||
// 创建单声道格式
|
||||
AudioFormat monoFormat = new AudioFormat(format.getEncoding(), format.getSampleRate(),
|
||||
format.getSampleSizeInBits(), 1, format.getFrameSize() / 2, format.getFrameRate(), false);
|
||||
|
||||
// 从立体声转换为单声道
|
||||
AudioInputStream monoInputStream = AudioSystem.getAudioInputStream(monoFormat,
|
||||
audioInputStream);
|
||||
|
||||
// 将单声道音频写入字节数组输出流
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
AudioSystem.write(monoInputStream, AudioFileFormat.Type.WAVE, byteArrayOutputStream);
|
||||
|
||||
// 获取输出音频的字节数组
|
||||
return byteArrayOutputStream.toByteArray();
|
||||
} catch (UnsupportedAudioFileException | IOException e) {
|
||||
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception(
|
||||
String.format("音频转单声道失败:%s", e));
|
||||
@Override
|
||||
public PageVO<VoiceErrorVO> pagedQueryErrorSet(PageQueryVO queryVO) {
|
||||
Page<Object> page = PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
List<CompetitionErrorSet> sets = competitionErrorSetDAO.selectByExample(null);
|
||||
List<VoiceErrorVO> list = sets.stream().map(VoiceErrorVO::new).collect(Collectors.toList());
|
||||
return PageVO.convert(page, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoiceRecognitionResult voiceRecognition(MultipartFile file) {
|
||||
VoiceRecognitionVO vo = VoiceRecognitionVO.load(file);
|
||||
VoiceRecognitionResult result = this.iVoiceService.voiceRecognition(vo);
|
||||
// VoiceRecognitionResult result = this.iVoiceService.voiceRecognition(file, "");
|
||||
result.setResult(simulationVoiceHandler.handle(result.getResult()));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoiceRecognitionResult voiceRecognition(byte[] bytes, String filePath) {
|
||||
VoiceRecognitionVO vo = new VoiceRecognitionVO(bytes);
|
||||
VoiceRecognitionResult result = this.iVoiceService.voiceRecognition(vo);
|
||||
// VoiceRecognitionResult result = this.iVoiceService.voiceRecognition(bytes, filePath);
|
||||
result.setResult(simulationVoiceHandler.handle(result.getResult()));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
*/
|
@ -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));
|
||||
// }
|
||||
//}
|
@ -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.support.SectionPosition;
|
||||
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.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* 地面ATP逻辑循环
|
||||
@ -26,226 +25,235 @@ import java.util.stream.Collectors;
|
||||
@Component
|
||||
public class AtpSectionService {
|
||||
|
||||
/**
|
||||
* 收集列车接近信号机消息并发送给CI
|
||||
*/
|
||||
public void changeSignalModeByTrainApproach(Simulation simulation,
|
||||
List<VirtualRealityTrain> onlineTrainList,
|
||||
Map<String, List<Section>> trainAtpSectionMap) {
|
||||
List<Signal> signalList = simulation.getRepository().getSignalList();
|
||||
signalList.forEach(signal -> {
|
||||
int a = 0; // 列车接近信号消息:0-无车接近,1-通信车接近,2-非通信车接近
|
||||
for (VirtualRealityTrain train : onlineTrainList) {
|
||||
List<Section> atpSectionList = trainAtpSectionMap.get(train.getGroupNumber());
|
||||
List<Section> physicalList = this.convert2PhysicalSectionList(atpSectionList);
|
||||
if (train.isCommunicable() && signal.containsApproachAtpSection(atpSectionList)) { //存在通信车接近,继续
|
||||
a = 1;
|
||||
} else if (!train.isCommunicable() && signal.containsApproachPhysicalSection(physicalList)) { //存在非通信车接近,结束
|
||||
a = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (1 == a) { // 只有通信车接近
|
||||
if(!signal.getSignalModel().getGuideAspect().equals(signal.getAspect())) {
|
||||
signal.changeToCbtcMode();
|
||||
}
|
||||
} else if (2 == a) { // 有非通信车接近
|
||||
signal.changeToBackupMode();
|
||||
}
|
||||
signal.updateApproachLock();//更新信号机接近锁闭状态
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 收集列车接近信号机消息并发送给CI
|
||||
*/
|
||||
public void changeSignalModeByTrainApproach(Simulation simulation,
|
||||
List<VirtualRealityTrain> onlineTrainList,
|
||||
Map<String, List<Section>> trainAtpSectionMap) {
|
||||
List<Signal> signalList = simulation.getRepository().getSignalList();
|
||||
signalList.forEach(signal -> {
|
||||
int a = 0; // 列车接近信号消息:0-无车接近,1-通信车接近,2-非通信车接近
|
||||
for (VirtualRealityTrain train : onlineTrainList) {
|
||||
List<Section> atpSectionList = trainAtpSectionMap.get(train.getGroupNumber());
|
||||
List<Section> physicalList = this.convert2PhysicalSectionList(atpSectionList);
|
||||
if (train.isCommunicable() && signal.containsApproachAtpSection(
|
||||
atpSectionList)) { //存在通信车接近,继续
|
||||
a = 1;
|
||||
} else if (!train.isCommunicable() && signal.containsApproachPhysicalSection(
|
||||
physicalList)) { //存在非通信车接近,结束
|
||||
a = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (1 == a) { // 只有通信车接近
|
||||
if (!signal.getSignalModel().getGuideAspect().equals(signal.getAspect())) {
|
||||
signal.changeToCbtcMode();
|
||||
}
|
||||
} else if (2 == a) { // 有非通信车接近
|
||||
signal.changeToBackupMode();
|
||||
}
|
||||
signal.updateApproachLock();//更新信号机接近锁闭状态
|
||||
});
|
||||
}
|
||||
|
||||
private List<Section> convert2PhysicalSectionList(List<Section> sectionList) {
|
||||
List<Section> physicalList = new ArrayList<>();
|
||||
sectionList.forEach(section -> {
|
||||
if (section.isPhysical()) {
|
||||
physicalList.add(section);
|
||||
} else if (section.isLogicSection()) {
|
||||
if (!physicalList.contains(section.getParent())) {
|
||||
physicalList.add(section.getParent());
|
||||
}
|
||||
}
|
||||
});
|
||||
return physicalList;
|
||||
}
|
||||
private List<Section> convert2PhysicalSectionList(List<Section> sectionList) {
|
||||
List<Section> physicalList = new ArrayList<>();
|
||||
sectionList.forEach(section -> {
|
||||
if (section.isPhysical()) {
|
||||
physicalList.add(section);
|
||||
} else if (section.isLogicSection()) {
|
||||
if (!physicalList.contains(section.getParent())) {
|
||||
physicalList.add(section.getParent());
|
||||
}
|
||||
}
|
||||
});
|
||||
return physicalList;
|
||||
}
|
||||
|
||||
/**
|
||||
* ATP区段列车占用检测并设置
|
||||
*
|
||||
* @param simulation
|
||||
* @param train
|
||||
* @return
|
||||
*/
|
||||
public List<Section> atpSectionOccupyCheck(Simulation simulation, VirtualRealityTrain train) {
|
||||
List<Section> atpSectionList = new ArrayList<>();
|
||||
boolean right = train.isRight();
|
||||
SectionPosition trainHeadPosition = train.getHeadPosition();
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
MapConfig config = repository.getConfig();
|
||||
boolean switchSingleHandle = config.isSwitchSingleHandle();
|
||||
boolean isRailway = config.isRailway(); // 大铁逻辑
|
||||
if (train.isCommunicable() || isRailway) { // 通信车占用 或者 大铁配置
|
||||
// 车尾位置追加不确定性距离:(速度*2)m
|
||||
SectionPosition trainTailPosition = CalculateService
|
||||
.calculateNextPositionByStartAndLen(trainHeadPosition, !right, train.getLen() + train.getSpeed() * 2, false);
|
||||
atpSectionList = CalculateService.getAtpSections(trainHeadPosition, trainTailPosition,
|
||||
right, switchSingleHandle);
|
||||
List<Section> removes = new ArrayList<>();
|
||||
for (Section atpSection : atpSectionList) {
|
||||
Section axle = atpSection;
|
||||
Section parent = atpSection.getParent();
|
||||
if (parent != null) {
|
||||
axle = parent;
|
||||
}
|
||||
if (axle.isAxleCounter() && (!axle.isNctOccupied() || Section.AxleFault.FAULT.equals(axle.getFault()))) {
|
||||
removes.add(atpSection);
|
||||
continue;
|
||||
}
|
||||
/**
|
||||
* ATP区段列车占用检测并设置
|
||||
*
|
||||
* @param simulation
|
||||
* @param train
|
||||
* @return
|
||||
*/
|
||||
public List<Section> atpSectionOccupyCheck(Simulation simulation, VirtualRealityTrain train) {
|
||||
List<Section> atpSectionList = new ArrayList<>();
|
||||
boolean right = train.isRight();
|
||||
SectionPosition trainHeadPosition = train.getHeadPosition();
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
MapConfig config = repository.getConfig();
|
||||
boolean switchSingleHandle = config.isSwitchSingleHandle();
|
||||
boolean isRailway = config.isRailway(); // 大铁逻辑
|
||||
if (train.isCommunicable() || isRailway) { // 通信车占用 或者 大铁配置
|
||||
// 车尾位置追加不确定性距离:(速度*2)m
|
||||
SectionPosition trainTailPosition = CalculateService
|
||||
.calculateNextPositionByStartAndLen(trainHeadPosition, !right,
|
||||
train.getLen() + train.getSpeed() * 2, false);
|
||||
atpSectionList = CalculateService.getAtpSections(trainHeadPosition, trainTailPosition,
|
||||
right, switchSingleHandle);
|
||||
List<Section> removes = new ArrayList<>();
|
||||
for (Section atpSection : atpSectionList) {
|
||||
Section axle = atpSection;
|
||||
Section parent = atpSection.getParent();
|
||||
if (parent != null) {
|
||||
axle = parent;
|
||||
}
|
||||
if (axle.isAxleCounter() && (!axle.isNctOccupied() || Section.AxleFault.FAULT.equals(
|
||||
axle.getFault()))) {
|
||||
removes.add(atpSection);
|
||||
continue;
|
||||
}
|
||||
// atpSection.communicateTrainOccupy(right);
|
||||
}
|
||||
if (!removes.isEmpty()) {
|
||||
atpSectionList.removeAll(removes);
|
||||
}
|
||||
} else { // 非通信车
|
||||
List<Section> sectionList = repository.queryTrainOccupySectionList(train.getGroupNumber());
|
||||
if (!CollectionUtils.isEmpty(sectionList)) {
|
||||
for (Section section : sectionList) {
|
||||
if (section.isSwitchAxleCounterSection()) {
|
||||
Section switchSection = section.getLogicList().get(0);
|
||||
atpSectionList.addAll(switchSection.getSwitchAxleSectionsBySwitchPosition());
|
||||
continue;
|
||||
}
|
||||
if (CollectionUtils.isEmpty(section.getLogicList())) {
|
||||
atpSectionList.add(section);
|
||||
} else {
|
||||
atpSectionList.addAll(section.getLogicList());
|
||||
}
|
||||
}
|
||||
}
|
||||
//将列车占压的物理区段及其关联的逻辑区段全部设为非通信车占用
|
||||
}
|
||||
if (!removes.isEmpty()) {
|
||||
atpSectionList.removeAll(removes);
|
||||
}
|
||||
} else { // 非通信车
|
||||
List<Section> sectionList = repository.queryTrainOccupySectionList(train.getGroupNumber());
|
||||
if (!CollectionUtils.isEmpty(sectionList)) {
|
||||
for (Section section : sectionList) {
|
||||
if (section.isSwitchAxleCounterSection()) {
|
||||
Section switchSection = section.getLogicList().get(0);
|
||||
atpSectionList.addAll(switchSection.getSwitchAxleSectionsBySwitchPosition());
|
||||
continue;
|
||||
}
|
||||
if (CollectionUtils.isEmpty(section.getLogicList())) {
|
||||
atpSectionList.add(section);
|
||||
} else {
|
||||
atpSectionList.addAll(section.getLogicList());
|
||||
}
|
||||
}
|
||||
}
|
||||
//将列车占压的物理区段及其关联的逻辑区段全部设为非通信车占用
|
||||
// atpSectionList.forEach(atpSection -> atpSection.nonCommunicateTrainOccupy(right));
|
||||
}
|
||||
return atpSectionList;
|
||||
}
|
||||
return atpSectionList;
|
||||
}
|
||||
|
||||
/**
|
||||
* ARB检测
|
||||
*
|
||||
* @param simulation
|
||||
* @param section
|
||||
* @param sectionList
|
||||
*/
|
||||
public void sectionARBCheck(Simulation simulation, Section section, List<Section> sectionList) {
|
||||
//目前ARB故障才会导致ARB判定
|
||||
if (Section.AxleFault.ARB.equals(section.getFault()) && section.getVirtualAxleCounter().isOccupy()) {
|
||||
if (!sectionList.contains(section)) {
|
||||
section.judgeAsARB();
|
||||
} else {
|
||||
section.setFault(Section.AxleFault.FAULT);
|
||||
}
|
||||
} else if (Section.AxleFault.FAULT.equals(section.getFault()) && section.getVirtualAxleCounter().isOccupy()) {
|
||||
section.judgeAsNctOccupied(simulation);
|
||||
}
|
||||
if (/*!section.isInvalid() &&*/ section.isNctOccupied()) {
|
||||
if (!sectionList.contains(section)) {
|
||||
section.judgeAsNctOccupied(simulation);
|
||||
}
|
||||
}
|
||||
//ARB故障恢复判断
|
||||
if (Section.AxleFault.ARB.equals(section.getFault()) && !section.getVirtualAxleCounter().isOccupy()) {
|
||||
Section.AxleFault.ARB.fix(section);
|
||||
}
|
||||
/**
|
||||
* ARB检测
|
||||
*
|
||||
* @param simulation
|
||||
* @param section
|
||||
* @param sectionList
|
||||
*/
|
||||
public void sectionARBCheck(Simulation simulation, Section section, List<Section> sectionList) {
|
||||
//目前ARB故障才会导致ARB判定
|
||||
if (Section.AxleFault.ARB.equals(section.getFault()) && section.getVirtualAxleCounter()
|
||||
.isOccupy()) {
|
||||
if (!sectionList.contains(section)) {
|
||||
section.judgeAsARB();
|
||||
} else {
|
||||
section.setFault(Section.AxleFault.FAULT);
|
||||
}
|
||||
} else if (Section.AxleFault.FAULT.equals(section.getFault()) && section.getVirtualAxleCounter()
|
||||
.isOccupy()) {
|
||||
section.judgeAsNctOccupied(simulation);
|
||||
}
|
||||
if (/*!section.isInvalid() &&*/ section.isNctOccupied()) {
|
||||
section.judgeAsNctOccupied(simulation);
|
||||
}
|
||||
//ARB故障恢复判断
|
||||
if (Section.AxleFault.ARB.equals(section.getFault()) && !section.getVirtualAxleCounter()
|
||||
.isOccupy()) {
|
||||
Section.AxleFault.ARB.fix(section);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取非通信车可能存在的范围
|
||||
*
|
||||
* @param simulation
|
||||
* @param trainList
|
||||
* @return
|
||||
*/
|
||||
public List<Section> getTrainExistAxleSectionsUnderDelay(Simulation simulation, List<VirtualRealityTrain> trainList) {
|
||||
List<Section> list = new ArrayList<>();
|
||||
for (VirtualRealityTrain train : trainList) {
|
||||
//只统计非通信车
|
||||
if (train.isCommunicable())
|
||||
continue;
|
||||
boolean right = train.isRight();
|
||||
SectionPosition headPosition = train.getHeadPosition();
|
||||
float offset = 50;
|
||||
SectionPosition head = CalculateService
|
||||
.calculateNextPositionByStartAndLen(headPosition, right, offset, false);
|
||||
// 考虑列车最大可能占用区间,用于判断ARB区段
|
||||
SectionPosition tail = CalculateService
|
||||
.calculateNextPositionByStartAndLen(headPosition,
|
||||
!right, train.getLen() + offset, false);
|
||||
List<Section> sectionList = CalculateService.getTrainOccupyAxleSection(head, tail, right);
|
||||
if (!CollectionUtils.isEmpty(sectionList)) {
|
||||
for (Section section : sectionList) {
|
||||
if (!list.contains(section)) {
|
||||
list.add(section);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.warn(String.format("列车[%s]没有存在范围的计轴区段",
|
||||
train.getGroupNumber()));
|
||||
}
|
||||
/**
|
||||
* 获取非通信车可能存在的范围
|
||||
*
|
||||
* @param simulation
|
||||
* @param trainList
|
||||
* @return
|
||||
*/
|
||||
public List<Section> getTrainExistAxleSectionsUnderDelay(Simulation simulation,
|
||||
List<VirtualRealityTrain> trainList) {
|
||||
List<Section> list = new ArrayList<>();
|
||||
for (VirtualRealityTrain train : trainList) {
|
||||
//只统计非通信车
|
||||
if (train.isCommunicable()) {
|
||||
continue;
|
||||
}
|
||||
boolean right = train.isRight();
|
||||
SectionPosition headPosition = train.getHeadPosition();
|
||||
float offset = 50;
|
||||
SectionPosition head = CalculateService
|
||||
.calculateNextPositionByStartAndLen(headPosition, right, offset, false);
|
||||
// 考虑列车最大可能占用区间,用于判断ARB区段
|
||||
SectionPosition tail = CalculateService
|
||||
.calculateNextPositionByStartAndLen(headPosition,
|
||||
!right, train.getLen() + offset, false);
|
||||
List<Section> sectionList = CalculateService.getTrainOccupyAxleSection(head, tail, right);
|
||||
if (!CollectionUtils.isEmpty(sectionList)) {
|
||||
for (Section section : sectionList) {
|
||||
if (!list.contains(section)) {
|
||||
list.add(section);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
} else {
|
||||
log.warn(String.format("列车[%s]没有存在范围的计轴区段",
|
||||
train.getGroupNumber()));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void removeOfflineTrainOccupySections(Simulation simulation, List<VirtualRealityTrain> onlineTrainList) {
|
||||
// 移除已经下线的列车占用区段数据
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
Set<String> oldTOSKeyList = repository.queryTrainOccupySectionKeys();
|
||||
Set<String> currentTrainCodeList = onlineTrainList.stream()
|
||||
.map(VirtualRealityTrain::getGroupNumber)
|
||||
.collect(Collectors.toSet());
|
||||
oldTOSKeyList.removeAll(currentTrainCodeList);
|
||||
oldTOSKeyList.forEach(groupNumber -> {
|
||||
List<Section> sections = repository.queryTrainOccupySectionList(groupNumber);
|
||||
sections.forEach(section -> {
|
||||
section.getVirtualAxleCounter().clear();
|
||||
section.clearOccupy();
|
||||
});
|
||||
repository.deleteTrainOccupySectionList(groupNumber);
|
||||
});
|
||||
}
|
||||
public void removeOfflineTrainOccupySections(Simulation simulation,
|
||||
List<VirtualRealityTrain> onlineTrainList) {
|
||||
// 移除已经下线的列车占用区段数据
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
Set<String> oldTOSKeyList = repository.queryTrainOccupySectionKeys();
|
||||
Set<String> currentTrainCodeList = onlineTrainList.stream()
|
||||
.map(VirtualRealityTrain::getGroupNumber)
|
||||
.collect(Collectors.toSet());
|
||||
oldTOSKeyList.removeAll(currentTrainCodeList);
|
||||
oldTOSKeyList.forEach(groupNumber -> {
|
||||
List<Section> sections = repository.queryTrainOccupySectionList(groupNumber);
|
||||
sections.forEach(section -> {
|
||||
section.getVirtualAxleCounter().clear();
|
||||
section.clearOccupy();
|
||||
});
|
||||
repository.deleteTrainOccupySectionList(groupNumber);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* isSwitchSingleHandle 为TRUE的情况下,获取区段列表
|
||||
*
|
||||
* @param section 区段
|
||||
* @param right 列车行驶方向
|
||||
* @return 区段列表
|
||||
*/
|
||||
private List<Section> handleSingleSwitchPosition(Section section, boolean right) {
|
||||
List<Section> atpSectionList = new ArrayList<>();
|
||||
// 道岔列表
|
||||
List<Switch> relSwitchList = section.getRelSwitchList();
|
||||
// 反位情况下
|
||||
Switch relSwitch = null;
|
||||
if (relSwitchList.stream().anyMatch(Switch::isPosR)) {
|
||||
relSwitch = relSwitchList.stream().filter(Switch::isPosR).findFirst().orElse(null);
|
||||
} else {
|
||||
relSwitch = relSwitchList.stream().filter(Switch::isPosN).findFirst().orElse(null);
|
||||
//relSwitchList.forEach(relSwitch -> atpSectionList.addAll(relSwitch.getSectionsByPosition()));
|
||||
}
|
||||
if (relSwitch != null) {
|
||||
// 反位前区段列表
|
||||
Section nextSection = relSwitch.getA();
|
||||
do {
|
||||
atpSectionList.add(0, nextSection);
|
||||
nextSection = nextSection.getNextRunningSectionOf(!right);
|
||||
} while (nextSection.getRelSwitch() != null && relSwitchList.contains(nextSection.getRelSwitch()));
|
||||
// 反位后区段列表
|
||||
nextSection = relSwitch.getA().getNextRunningSectionOf(right);
|
||||
while (nextSection != null && relSwitchList.contains(nextSection.getRelSwitch())) {
|
||||
atpSectionList.add(nextSection);
|
||||
nextSection = nextSection.getNextRunningSectionOf(right);
|
||||
}
|
||||
}
|
||||
return atpSectionList;
|
||||
/**
|
||||
* isSwitchSingleHandle 为TRUE的情况下,获取区段列表
|
||||
*
|
||||
* @param section 区段
|
||||
* @param right 列车行驶方向
|
||||
* @return 区段列表
|
||||
*/
|
||||
private List<Section> handleSingleSwitchPosition(Section section, boolean right) {
|
||||
List<Section> atpSectionList = new ArrayList<>();
|
||||
// 道岔列表
|
||||
List<Switch> relSwitchList = section.getRelSwitchList();
|
||||
// 反位情况下
|
||||
Switch relSwitch = null;
|
||||
if (relSwitchList.stream().anyMatch(Switch::isPosR)) {
|
||||
relSwitch = relSwitchList.stream().filter(Switch::isPosR).findFirst().orElse(null);
|
||||
} else {
|
||||
relSwitch = relSwitchList.stream().filter(Switch::isPosN).findFirst().orElse(null);
|
||||
//relSwitchList.forEach(relSwitch -> atpSectionList.addAll(relSwitch.getSectionsByPosition()));
|
||||
}
|
||||
if (relSwitch != null) {
|
||||
// 反位前区段列表
|
||||
Section nextSection = relSwitch.getA();
|
||||
do {
|
||||
atpSectionList.add(0, nextSection);
|
||||
nextSection = nextSection.getNextRunningSectionOf(!right);
|
||||
} while (nextSection.getRelSwitch() != null && relSwitchList.contains(
|
||||
nextSection.getRelSwitch()));
|
||||
// 反位后区段列表
|
||||
nextSection = relSwitch.getA().getNextRunningSectionOf(right);
|
||||
while (nextSection != null && relSwitchList.contains(nextSection.getRelSwitch())) {
|
||||
atpSectionList.add(nextSection);
|
||||
nextSection = nextSection.getNextRunningSectionOf(right);
|
||||
}
|
||||
}
|
||||
return atpSectionList;
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user