Compare commits
202 Commits
thailand_s
...
master
Author | SHA1 | Date |
---|---|---|
thesai | f14e377565 | |
thesai | b302bb360b | |
thesai | 1e2ed4d305 | |
thesai | 436a07bcf4 | |
thesai | 235f4dce5b | |
thesai | ac87b0dbe9 | |
thesai | 3536ff75ad | |
thesai | f57952b755 | |
thesai | 9c9e7c60e3 | |
thesai | 98abf0691a | |
thesai | 16e8dc191f | |
tiger_zhou | 4f151fae4a | |
tiger_zhou | e93171e958 | |
thesai | 4cd80bbec5 | |
thesai | 8125e32d7e | |
thesai | e23864fa72 | |
thesai | 212773e679 | |
thesai | 495681db5d | |
thesai | dbe197eba6 | |
thesai | cee9eda430 | |
thesai | 0d10203613 | |
thesai | 99a772a050 | |
thesai | ba1e057bce | |
thesai | 6187e6d667 | |
thesai | bef6dda6b2 | |
thesai | 5d15ba3240 | |
thesai | aae729b637 | |
thesai | 2416d21a4f | |
soul-walker | 346a265164 | |
soul-walker | 9921aea15a | |
soul-walker | 3e19150a48 | |
soul-walker | 202037ec55 | |
soul-walker | 5045f6152a | |
soul-walker | 2a47dc5979 | |
soul-walker | 6597194b9c | |
soul-walker | 319592dd19 | |
soul-walker | 585c32ac0d | |
soul-walker | 3301634aa0 | |
soul-walker | 32d9a9ab21 | |
soul-walker | a440b77c7f | |
soul-walker | 82e41df1c7 | |
soul-walker | 0b7ce9d746 | |
soul-walker | b10ea3b6ba | |
soul-walker | f2b38a9eb2 | |
tiger_zhou | bf87b46662 | |
tiger_zhou | 5f2c1133ca | |
tiger_zhou | 352c44a280 | |
tiger_zhou | d20fe5fd27 | |
tiger_zhou | c085f5f778 | |
tiger_zhou | 5579c4f461 | |
tiger_zhou | 2f9ace88bd | |
tiger_zhou | 287e004ee5 | |
tiger_zhou | 6843a987d5 | |
tiger_zhou | cc7218902e | |
tiger_zhou | 7404c0bfb8 | |
tiger_zhou | ae06533192 | |
tiger_zhou | c18a073dee | |
tiger_zhou | a5b71e159a | |
thesai | 727ddd48ac | |
tiger_zhou | f95ed6a898 | |
tiger_zhou | 985c1de837 | |
tiger_zhou | c0ed50ccdc | |
tiger_zhou | 164c26a01e | |
tiger_zhou | 13451cbec0 | |
tiger_zhou | 2a0e126a7c | |
tiger_zhou | 8b23269aba | |
thesai | 2492184d0e | |
tiger_zhou | 9cda9872cd | |
thesai | 200f7b5db7 | |
thesai | deb7fa11fc | |
thesai | cbb52ddbd7 | |
tiger_zhou | 7fb4199e1b | |
tiger_zhou | 08d7996f32 | |
thesai | 6fe2679fd8 | |
tiger_zhou | 9df4de84b6 | |
tiger_zhou | 823888ac35 | |
tiger_zhou | 1e927b29af | |
tiger_zhou | 97b6d27952 | |
thesai | 58bc68876a | |
tiger_zhou | 4a1316e1bd | |
tiger_zhou | 902a2e78b1 | |
tiger_zhou | 7b36192a9a | |
thesai | 761c7e02eb | |
tiger_zhou | 8446891ba5 | |
tiger_zhou | 7e227fb96b | |
tiger_zhou | 6c1bb1d77f | |
tiger_zhou | 636f049bfe | |
tiger_zhou | 6e19d7acb1 | |
tiger_zhou | e647d54762 | |
tiger_zhou | 161e8ec469 | |
tiger_zhou | eecef5ba96 | |
tiger_zhou | da470b1832 | |
tiger_zhou | 23d46aac0c | |
tiger_zhou | 37f6fd51eb | |
tiger_zhou | 9bf2fede2c | |
tiger_zhou | 025888cbd2 | |
tiger_zhou | 9139c93a75 | |
tiger_zhou | 8200bd7c76 | |
tiger_zhou | 2647a26869 | |
tiger_zhou | 68fdecdf31 | |
tiger_zhou | 2be04ceca1 | |
tiger_zhou | 1cf7397f55 | |
tiger_zhou | 25396dc11c | |
tiger_zhou | 49aff5b340 | |
tiger_zhou | cc58504b5b | |
tiger_zhou | cade3772cd | |
tiger_zhou | 6288c72829 | |
tiger_zhou | 1931e5f52f | |
tiger_zhou | 07e23db1db | |
tiger_zhou | 63c1c88312 | |
tiger_zhou | e515bcb56a | |
tiger_zhou | b24c3ddaa7 | |
tiger_zhou | 2ce51aaac9 | |
tiger_zhou | 740dcefb4c | |
tiger_zhou | d278c01d3b | |
thesai | 5d07d730eb | |
thesai | 76dea2b00b | |
thesai | 6996aae12f | |
tiger_zhou | 92bfa114be | |
tiger_zhou | 006367f3de | |
tiger_zhou | 7b4c5f0948 | |
tiger_zhou | bb0cf5a83f | |
tiger_zhou | 99a47d9d65 | |
joylink_zhangsai | 5cbcd67041 | |
weizhihong | 5372e55b44 | |
joylink_zhangsai | 2316deb8d3 | |
joylink_zhangsai | b0d30ed58c | |
joylink_zhangsai | b8768e6052 | |
joylink_zhangsai | d77e70c126 | |
joylink_zhangsai | 7f30126bd8 | |
weizhihong | 2b3b1134c5 | |
joylink_zhangsai | 5e5a17d79a | |
weizhihong | 659b537f75 | |
weizhihong | 441ec71627 | |
walker | 4739bb6a68 | |
walker | 44e9bd5ec2 | |
weizhihong | bdfa4d2992 | |
weizhihong | d39f9dbdbb | |
weizhihong | 700d95e4a7 | |
weizhihong | 28c74a75cd | |
weizhihong | a73c568b7f | |
joylink_zhangsai | e67b7b8ad1 | |
joylink_zhangsai | 300804dccc | |
joylink_zhangsai | 787ecb5642 | |
joylink_zhangsai | 29b94f0f1b | |
joylink_zhangsai | 3e8ed7095e | |
joylink_zhangsai | 6c6e254751 | |
joylink_zhangsai | 6b14090431 | |
joylink_zhangsai | 5eac7cc9be | |
joylink_zhangsai | 4becfd48cb | |
joylink_zhangsai | aec1a01f96 | |
joylink_zhangsai | 0faf852aa6 | |
tiger_zhou | 3d86ae0355 | |
joylink_zhangsai | 618c8dc33c | |
joylink_zhangsai | 57209785ad | |
joylink_zhangsai | 352ef75923 | |
joylink_zhangsai | 25c31fcefb | |
joylink_zhangsai | f1da71f236 | |
joylink_zhangsai | 885e98dccf | |
joylink_zhangsai | f98dee79a0 | |
joylink_zhangsai | f281499099 | |
tiger_zhou | bb26f1e944 | |
joylink_zhangsai | 48803daf24 | |
joylink_zhangsai | 3855c3ab64 | |
joylink_zhangsai | 3335dea0a6 | |
joylink_zhangsai | b4aa17e028 | |
joylink_zhangsai | 67175c5919 | |
joylink_zhangsai | 376590f5d1 | |
joylink_zhangsai | 361d446a19 | |
joylink_zhangsai | abbfabab40 | |
joylink_zhangsai | 9b5c54f749 | |
joylink_zhangsai | 9b4480f376 | |
joylink_zhangsai | 1be9cccc4a | |
joylink_zhangsai | cd92403096 | |
joylink_zhangsai | b01ac1dc0f | |
joylink_zhangsai | 2f2ec98029 | |
joylink_zhangsai | 18cfe99905 | |
joylink_zhangsai | e7c6d428ad | |
joylink_zhangsai | 9259fd123b | |
tiger_zhou | cf24e2e7f9 | |
tiger_zhou | 42d36d8812 | |
tiger_zhou | f6021e9a2d | |
joylink_zhangsai | e2cd83d298 | |
joylink_zhangsai | d7b42ef478 | |
joylink_zhangsai | 99ecac0318 | |
joylink_zhangsai | 8b85c0a63b | |
joylink_zhangsai | b4bb689dc5 | |
weizhihong | 88d9ae234c | |
weizhihong | f968066501 | |
weizhihong | 8f9316c3c9 | |
tiger_zhou | daee0d2c67 | |
tiger_zhou | 35b9f0cca2 | |
tiger_zhou | 6b30e5c066 | |
tiger_zhou | ee3f242162 | |
tiger_zhou | cf6e117549 | |
tiger_zhou | 36a3609164 | |
tiger_zhou | 92adfad951 | |
joylink_zhangsai | 07b699cf7b | |
tiger_zhou | 71addf2b60 | |
joylink_zhangsai | 21c9cd242f | |
tiger_zhou | 14fa1132fe | |
tiger_zhou | 7f0cb1e41b |
|
@ -0,0 +1,32 @@
|
|||
name: 公网服务发布
|
||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 3 * * 1' # 每周一的凌晨3:30
|
||||
|
||||
jobs:
|
||||
Docker-Build-Push:
|
||||
runs-on: joylink-local233
|
||||
steps:
|
||||
- name: 发布到正式环境1
|
||||
uses: https://gitea.joylink.club/appleboy/ssh-action@v1.0.3
|
||||
with:
|
||||
host: ${{ secrets.PUB1_DOMAIN_SSH_HOST }}
|
||||
port: ${{ secrets.PUB1_DOMAIN_SSH_PORT }}
|
||||
username: ${{ secrets.PUB1_DOMAIN_SSH_USER }}
|
||||
password: ${{ secrets.PUB1_DOMAIN_SSH_PASSWORD }}
|
||||
script: |
|
||||
docker rm -f rt-sim-training-service || echo "rt-sim-training-service not exist"
|
||||
docker pull gitea.joylink.club/joylink/rt-sim-training-service:latest
|
||||
docker run --name rt-sim-training-service -it -u root --restart=always -d -e APP_ENV=prd -p 9000:9000 -p 19000:19000 -v /usr/local/joylink/logs/rtss:/usr/local/joylink/logs/rtss gitea.joylink.club/joylink/rt-sim-training-service:latest
|
||||
- name: 发布到正式环境2
|
||||
uses: https://gitea.joylink.club/appleboy/ssh-action@v1.0.3
|
||||
with:
|
||||
host: ${{ secrets.PUB2_DOMAIN_SSH_HOST }}
|
||||
port: ${{ secrets.PUB2_DOMAIN_SSH_PORT }}
|
||||
username: ${{ secrets.PUB2_DOMAIN_SSH_USER }}
|
||||
password: ${{ secrets.PUB2_DOMAIN_SSH_PASSWORD }}
|
||||
script: |
|
||||
docker rm -f rt-sim-training-service || echo "rt-sim-training-service not exist"
|
||||
docker pull gitea.joylink.club/joylink/rt-sim-training-service:latest
|
||||
docker run --name rt-sim-training-service -it -u root --restart=always -d -e APP_ENV=prd -p 9000:9000 -p 19000:19000 -v /usr/local/joylink/logs/rtss:/usr/local/joylink/logs/rtss gitea.joylink.club/joylink/rt-sim-training-service:latest
|
|
@ -0,0 +1,61 @@
|
|||
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"
|
|
@ -0,0 +1,61 @@
|
|||
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
|
|
@ -0,0 +1,3 @@
|
|||
[submodule "rt-sim-training-message"]
|
||||
path = rt-sim-training-message
|
||||
url = http://120.46.212.6:3000/joylink/rt-sim-training-message.git
|
|
@ -0,0 +1,11 @@
|
|||
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
|
|
@ -0,0 +1,7 @@
|
|||
# CI、CD说明
|
||||
- 分支主要为develop,local-test,master
|
||||
- 本地233服务器部署方式为push到local-test分支即可触发
|
||||
- 公网服务器发布方式:
|
||||
1. push到master(虽然可以用别的分支,但不建议)
|
||||
2. 在版本发布处发布新版本,触发构建docker镜像
|
||||
3. 待docker镜像构建完成后,点击Actions中CD_pub_deploy.yaml,进入第一个任务,点击重新运行所有任务,进行服务发布
|
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,98 +130,123 @@
|
|||
<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.19.3</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.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>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>org.apache.commons</groupId>
|
||||
<artifactId>commons-text</artifactId>
|
||||
<version>1.10.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-text</artifactId>
|
||||
<version>1.10.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</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>
|
||||
<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>
|
||||
<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>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 5dd7fdb3d568c829356fa59b746b559d17da49b8
|
|
@ -1,16 +0,0 @@
|
|||
-- 用户答题生成对应的规则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 '场景实训考试扮演的角色';
|
|
@ -1,2 +0,0 @@
|
|||
ALTER TABLE `joylink`.`rts_map_function`
|
||||
ADD COLUMN `bg_url` varchar(255) NULL COMMENT '背景图片的url' AFTER `desc`;
|
|
@ -1,11 +0,0 @@
|
|||
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='地图功能模板';
|
|
@ -1,3 +0,0 @@
|
|||
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 ;
|
|
@ -1,14 +0,0 @@
|
|||
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;
|
|
@ -1,13 +0,0 @@
|
|||
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='群组信息设置';
|
|
@ -1,2 +0,0 @@
|
|||
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`;
|
|
@ -1,10 +0,0 @@
|
|||
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 +0,0 @@
|
|||
ALTER TABLE `joylink`.`rts_training2_rule` ADD COLUMN `score_rule` text NULL COMMENT '得分规则' AFTER `location_rule`;
|
|
@ -1 +0,0 @@
|
|||
ALTER TABLE `rts_paper_rule` ADD COLUMN `sub_type_param` varchar(255) NULL COMMENT '规则参数';
|
|
@ -1,9 +0,0 @@
|
|||
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';
|
|
@ -0,0 +1,41 @@
|
|||
package club.joylink.rtss.aop;
|
||||
|
||||
import club.joylink.rtss.services.cgy.CgyStatsService;
|
||||
import club.joylink.rtss.simulation.cbtc.SimulationService;
|
||||
import club.joylink.rtss.vo.client.cgy.CgyThirdPartyLoginInfoVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.AfterReturning;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@Aspect
|
||||
@Slf4j
|
||||
@Component
|
||||
public class CgyViewAspect {
|
||||
|
||||
private CgyStatsService cgyStatsService;
|
||||
private RestTemplate restTemplate;
|
||||
private SimulationService simulationService;
|
||||
|
||||
|
||||
@Autowired
|
||||
public CgyViewAspect(CgyStatsService cgyStatsService, RestTemplate restTemplate,
|
||||
SimulationService simulationService) {
|
||||
this.cgyStatsService = cgyStatsService;
|
||||
this.restTemplate = restTemplate;
|
||||
this.simulationService = simulationService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 成工院第三方登录接口被调用后,加一个浏览量,并同步给虚仿平台
|
||||
*/
|
||||
@AfterReturning(value = "execution(public * club.joylink.rtss.controller.LoginController.cgyThirdPartyLogin(..))")
|
||||
public void addViewCount(JoinPoint joinPoint) {
|
||||
Object arg = joinPoint.getArgs()[0];
|
||||
CgyThirdPartyLoginInfoVO loginInfoVO = (CgyThirdPartyLoginInfoVO) arg;
|
||||
cgyStatsService.updateView(loginInfoVO.getAppId());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package club.joylink.rtss.bo.cgy;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 成工院虚仿平台对接统计数据
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@RequiredArgsConstructor
|
||||
public class CgyStatsBO {
|
||||
|
||||
private final String appId;
|
||||
private final String appSecret;
|
||||
private final Long FunctionId;
|
||||
//统计数据是否发生变化
|
||||
private AtomicBoolean change;
|
||||
//浏览量
|
||||
private AtomicLong view;
|
||||
//实训人次
|
||||
private AtomicLong visitor;
|
||||
//实训人数
|
||||
private final Set<Long> userSet = new HashSet<>();
|
||||
//实训时长/s
|
||||
private AtomicLong duration;
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
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,6 +6,7 @@ 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;
|
||||
|
@ -17,36 +18,40 @@ 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";
|
||||
|
||||
@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)));
|
||||
/**
|
||||
* 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";
|
||||
|
||||
builder.serializerByType(LocalDate.class,
|
||||
new LocalDateSerializer(DateTimeFormatter.ofPattern(DATE_FORMAT)));
|
||||
builder.deserializerByType(LocalDate.class,
|
||||
new LocalDateDeserializer(DateTimeFormatter.ofPattern(DATE_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(LocalTime.class,
|
||||
new LocalTimeSerializer(DateTimeFormatter.ofPattern(TIME_FORMAT)));
|
||||
builder.deserializerByType(LocalTime.class,
|
||||
new LocalTimeDeserializer(DateTimeFormatter.ofPattern(TIME_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)));
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,6 +70,8 @@ public class WebConfig implements WebMvcConfigurer {
|
|||
whiteList.add("/api/v2/paper/composition/oldData/handle");
|
||||
whiteList.add("/api/user/sync");
|
||||
whiteList.add("/dataHandle");
|
||||
//modbus测试
|
||||
whiteList.add("/api/test/modbus/writeCoil");
|
||||
|
||||
registry.addInterceptor(authenticateInterceptor).excludePathPatterns(whiteList);
|
||||
}
|
||||
|
|
|
@ -4,5 +4,8 @@ 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,6 +121,8 @@ public enum ProjectDeviceType {
|
|||
|
||||
PIS_STAND,
|
||||
PIS_TRAIN,
|
||||
PIS,
|
||||
TMS,
|
||||
/* -----------client device end---------- */
|
||||
/* -----------Other start---------- */
|
||||
/**
|
||||
|
|
|
@ -7,136 +7,148 @@ import club.joylink.rtss.vo.AccountVO;
|
|||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.client.LoginStatusVO;
|
||||
import club.joylink.rtss.vo.client.LoginUserVO;
|
||||
import club.joylink.rtss.vo.client.cgy.CgyThirdPartyLoginInfoVO;
|
||||
import club.joylink.rtss.vo.client.validGroup.LoginInfoCheck;
|
||||
import club.joylink.rtss.vo.client.validGroup.ThirdLoginInfoCheck;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/login")
|
||||
public class LoginController {
|
||||
|
||||
@Autowired
|
||||
private IAuthenticateService iAuthenticateService;
|
||||
@Autowired
|
||||
private IAuthenticateService iAuthenticateService;
|
||||
|
||||
@PostMapping(path = "/third")
|
||||
public String thirdPartyLogin(@RequestBody @Validated(ThirdLoginInfoCheck.class) LoginUserVO loginInfo) {
|
||||
return this.iAuthenticateService.thirdPartyLogin(loginInfo);
|
||||
}
|
||||
@PostMapping("/cgy/third")
|
||||
public String cgyThirdPartyLogin(@RequestBody @Validated CgyThirdPartyLoginInfoVO loginInfo) {
|
||||
return this.iAuthenticateService.cgyThirdPartyLogin(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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,11 +2,14 @@ package club.joylink.rtss.controller;
|
|||
|
||||
import club.joylink.rtss.services.draftData.DraftMapDataHandleService;
|
||||
import club.joylink.rtss.services.publishData.PublishMapDataHandler;
|
||||
import java.util.LinkedHashMap;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
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.RestController;
|
||||
|
||||
/**
|
||||
* 地图数据处理
|
||||
|
@ -16,31 +19,40 @@ import java.util.LinkedHashMap;
|
|||
@RequestMapping("/api/mapData/handle")
|
||||
public class MapDataHandleController {
|
||||
|
||||
@Autowired
|
||||
private DraftMapDataHandleService draftMapDataHandleService;
|
||||
@Autowired
|
||||
private PublishMapDataHandler publishMapDataHandler;
|
||||
@Autowired
|
||||
private DraftMapDataHandleService draftMapDataHandleService;
|
||||
@Autowired
|
||||
private PublishMapDataHandler publishMapDataHandler;
|
||||
|
||||
@PutMapping("")
|
||||
public void dataHandle() {
|
||||
this.publishMapDataHandler.dataHandle();
|
||||
}
|
||||
@PutMapping("")
|
||||
public void dataHandle() {
|
||||
this.publishMapDataHandler.dataHandle();
|
||||
}
|
||||
|
||||
@PutMapping("/xian3")
|
||||
public void overlapSetHandle() {
|
||||
this.publishMapDataHandler.xian3Handle();
|
||||
}
|
||||
@PutMapping("/xian3")
|
||||
public void overlapSetHandle() {
|
||||
this.publishMapDataHandler.xian3Handle();
|
||||
}
|
||||
|
||||
@PutMapping("/signalSd")
|
||||
public void signalShowDirection() {
|
||||
this.publishMapDataHandler.signalShowDirection();
|
||||
}
|
||||
@PutMapping("/signalSd")
|
||||
public void signalShowDirection() {
|
||||
this.publishMapDataHandler.signalShowDirection();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改线路数据和ISCS的车站名
|
||||
*/
|
||||
@PutMapping("/{mapId}/stationName/mapAndIscs")
|
||||
public void changeStationName(@PathVariable long mapId, @RequestBody LinkedHashMap<String, String> nameMap) {
|
||||
this.publishMapDataHandler.changeStationName(mapId, nameMap);
|
||||
}
|
||||
/**
|
||||
* 批量修改线路数据和ISCS的车站名
|
||||
*/
|
||||
@PutMapping("/{mapId}/stationName/mapAndIscs")
|
||||
public void changeStationName(@PathVariable long mapId,
|
||||
@RequestBody LinkedHashMap<String, String> nameMap) {
|
||||
this.publishMapDataHandler.changeStationName(mapId, nameMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改线路区段长度
|
||||
*/
|
||||
@PutMapping("/{mapId}/{multiple}/sectionLen")
|
||||
public void updateSectionLen(@PathVariable long mapId, @PathVariable int multiple) {
|
||||
publishMapDataHandler.updateSectionLen(mapId, multiple);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,78 +26,79 @@ 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 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;
|
||||
}
|
||||
//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;
|
||||
}*/
|
||||
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());
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
log.error("【系统异常】{}", e);
|
||||
return CommonJsonResponse.newErrorResponse();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import club.joylink.rtss.vo.paper.CreatePaperCompositionRspVo;
|
|||
import club.joylink.rtss.vo.paper.FindPaperCompositionByAccountReqVo;
|
||||
import club.joylink.rtss.vo.paper.FindPaperCompositionPageReqVo;
|
||||
import club.joylink.rtss.vo.paper.PaperCompositionWithRuleVo;
|
||||
import club.joylink.rtss.vo.paper.PaperCompositionWithRuleVo.CreatorBasic;
|
||||
import java.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -109,6 +110,14 @@ public class PaperCompositionController {
|
|||
return this.compositionService.findPaperCompositionByPage(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询试卷的创建者的信息
|
||||
*/
|
||||
@PostMapping("/list/creatorInfo")
|
||||
public List<CreatorBasic> queryCreatorList(@RequestBody FindPaperCompositionPageReqVo req) {
|
||||
return compositionService.queryCreatorList(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据mapId查询蓝图的基本信息
|
||||
*
|
||||
|
|
|
@ -41,247 +41,278 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
@RequestMapping(path = "/api/device")
|
||||
public class DeviceController {
|
||||
|
||||
@Autowired
|
||||
private DeviceService deviceService;
|
||||
@Autowired
|
||||
private DeviceService deviceService;
|
||||
|
||||
/**
|
||||
* 分页查询项目设备
|
||||
*/
|
||||
@GetMapping("/paging")
|
||||
public PageVO<ProjectDeviceVO> pagingQuery(ProjectDevicePageQueryVO queryVO) {
|
||||
return this.deviceService.pagingQuery(queryVO);
|
||||
}
|
||||
/**
|
||||
* 分页查询项目设备
|
||||
*/
|
||||
@GetMapping("/paging")
|
||||
public PageVO<ProjectDeviceVO> pagingQuery(ProjectDevicePageQueryVO queryVO) {
|
||||
return this.deviceService.pagingQuery(queryVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目设备编号是否已经存在
|
||||
*/
|
||||
@GetMapping("/exist/{code}")
|
||||
public boolean isDeviceCodeExist(@PathVariable String code, String projectCode) {
|
||||
String project = Project.isDefault(projectCode) ? Project.DEFAULT_PROJECT_CODE : projectCode;
|
||||
return this.deviceService.isDeviceCodeExist(project, code);
|
||||
}
|
||||
/**
|
||||
* 项目设备编号是否已经存在
|
||||
*/
|
||||
@GetMapping("/exist/{code}")
|
||||
public boolean isDeviceCodeExist(@PathVariable String code, String projectCode) {
|
||||
String project = Project.isDefault(projectCode) ? Project.DEFAULT_PROJECT_CODE : projectCode;
|
||||
return this.deviceService.isDeviceCodeExist(project, code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新建项目设备
|
||||
*/
|
||||
@PostMapping("")
|
||||
public String create(@RequestBody @Validated ProjectDeviceVO deviceVO,
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY)
|
||||
LoginUserInfoVO userLoginInfo) {
|
||||
return this.deviceService.create(deviceVO, userLoginInfo);
|
||||
}
|
||||
/**
|
||||
* 新建项目设备
|
||||
*/
|
||||
@PostMapping("")
|
||||
public String create(@RequestBody @Validated ProjectDeviceVO deviceVO,
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY)
|
||||
LoginUserInfoVO userLoginInfo) {
|
||||
return this.deviceService.create(deviceVO, userLoginInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备详情(包含配置信息)
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public ProjectDeviceVO getDeviceDetailInfoById(@PathVariable Long id) {
|
||||
return this.deviceService.getDeviceDetailInfoById(id);
|
||||
}
|
||||
/**
|
||||
* 获取设备详情(包含配置信息)
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public ProjectDeviceVO getDeviceDetailInfoById(@PathVariable Long id) {
|
||||
return this.deviceService.getDeviceDetailInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/修改道岔设备网关映射配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/plcgateway")
|
||||
public void updatePlcGatewayConfig(@PathVariable Long id, @RequestBody @Validated PlcGatewayConfigVO configVO) {
|
||||
this.deviceService.updatePlcGatewayConfig(id, configVO);
|
||||
}
|
||||
/**
|
||||
* 添加/修改道岔设备网关映射配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/plcgateway")
|
||||
public void updatePlcGatewayConfig(@PathVariable Long id,
|
||||
@RequestBody @Validated PlcGatewayConfigVO configVO) {
|
||||
this.deviceService.updatePlcGatewayConfig(id, configVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/修改道岔设备网关映射配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/switch")
|
||||
public void updateSwitchConfig(@PathVariable Long id, @RequestBody @Validated SwitchConfigVO configVO) {
|
||||
this.deviceService.updateSwitchConfig(id, configVO);
|
||||
}
|
||||
/**
|
||||
* 添加/修改道岔设备网关映射配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/switch")
|
||||
public void updateSwitchConfig(@PathVariable Long id,
|
||||
@RequestBody @Validated SwitchConfigVO configVO) {
|
||||
this.deviceService.updateSwitchConfig(id, configVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/修改信号机设备网关映射配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/signal")
|
||||
public void updateSignalConfig(@PathVariable Long id, @RequestBody @Validated SignalConfigVO configVO) {
|
||||
this.deviceService.updateSignalConfig(id, configVO);
|
||||
}
|
||||
/**
|
||||
* 添加/修改信号机设备网关映射配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/signal")
|
||||
public void updateSignalConfig(@PathVariable Long id,
|
||||
@RequestBody @Validated SignalConfigVO configVO) {
|
||||
this.deviceService.updateSignalConfig(id, configVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/修改屏蔽门设备网关映射配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/psc")
|
||||
public void updatePscConfig(@PathVariable Long id, @RequestBody @Validated PscConfigVO configVO) {
|
||||
this.deviceService.updatePscConfig(id, configVO);
|
||||
}
|
||||
/**
|
||||
* 添加/修改屏蔽门设备网关映射配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/psc")
|
||||
public void updatePscConfig(@PathVariable Long id, @RequestBody @Validated PscConfigVO configVO) {
|
||||
this.deviceService.updatePscConfig(id, configVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/修改屏蔽门设备网关映射配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/psd")
|
||||
public void updatePsdConfig(@PathVariable Long id, @RequestBody @Validated PsdConfigVO configVO) {
|
||||
this.deviceService.updatePsdConfig(id, configVO);
|
||||
}
|
||||
/**
|
||||
* 添加/修改屏蔽门设备网关映射配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/psd")
|
||||
public void updatePsdConfig(@PathVariable Long id, @RequestBody @Validated PsdConfigVO configVO) {
|
||||
this.deviceService.updatePsdConfig(id, configVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/修改屏蔽门设备网关映射配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/psl")
|
||||
public void updatePslConfig(@PathVariable Long id, @RequestBody @Validated PslConfigVO configVO) {
|
||||
this.deviceService.updatePslConfig(id, configVO);
|
||||
}
|
||||
/**
|
||||
* 添加/修改屏蔽门设备网关映射配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/psl")
|
||||
public void updatePslConfig(@PathVariable Long id, @RequestBody @Validated PslConfigVO configVO) {
|
||||
this.deviceService.updatePslConfig(id, configVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/修改屏蔽门设备网关映射配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/ibp")
|
||||
public void updateIbpConfig(@PathVariable Long id, @RequestBody @Validated IbpConfigVO configVO) {
|
||||
this.deviceService.updateIbpConfig(id, configVO);
|
||||
}
|
||||
/**
|
||||
* 添加/修改屏蔽门设备网关映射配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/ibp")
|
||||
public void updateIbpConfig(@PathVariable Long id, @RequestBody @Validated IbpConfigVO configVO) {
|
||||
this.deviceService.updateIbpConfig(id, configVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/修改虚拟IBP盘配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/vribp")
|
||||
public void updateVrIbpConfig(@PathVariable Long id, @RequestBody @Validated VrIbpConfigVO configVO) {
|
||||
this.deviceService.updateVrIbpConfig(id, configVO);
|
||||
}
|
||||
/**
|
||||
* 添加/修改虚拟IBP盘配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/vribp")
|
||||
public void updateVrIbpConfig(@PathVariable Long id,
|
||||
@RequestBody @Validated VrIbpConfigVO configVO) {
|
||||
this.deviceService.updateVrIbpConfig(id, configVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/修改现地工作站配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/lw")
|
||||
public void updateLwConfig(@PathVariable Long id, @RequestBody @Validated LwConfigVO configVO) {
|
||||
this.deviceService.updateLwConfig(id, configVO);
|
||||
}
|
||||
/**
|
||||
* 添加/修改现地工作站配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/lw")
|
||||
public void updateLwConfig(@PathVariable Long id, @RequestBody @Validated LwConfigVO configVO) {
|
||||
this.deviceService.updateLwConfig(id, configVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/修改大屏工作站配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/lsw")
|
||||
public void updateLswConfig(@PathVariable Long id, @RequestBody @Validated LswConfigVO configVO) {
|
||||
this.deviceService.updateLswConfig(id, configVO);
|
||||
}
|
||||
/**
|
||||
* 添加/修改大屏工作站配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/lsw")
|
||||
public void updateLswConfig(@PathVariable Long id, @RequestBody @Validated LswConfigVO configVO) {
|
||||
this.deviceService.updateLswConfig(id, configVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/修改CCTV工作站配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/cctv")
|
||||
public void updateCctvConfig(@PathVariable Long id, @RequestBody @Validated RelationLoginConfigVO configVO) {
|
||||
this.deviceService.updateCctvConfig(id, configVO);
|
||||
}
|
||||
/**
|
||||
* 添加/修改CCTV工作站配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/cctv")
|
||||
public void updateCctvConfig(@PathVariable Long id,
|
||||
@RequestBody @Validated RelationLoginConfigVO configVO) {
|
||||
this.deviceService.updateCctvConfig(id, configVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/修改电子沙盘工作站配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/sandbox")
|
||||
public void updateSandboxConfig(@PathVariable Long id, @RequestBody @Validated RelationLoginConfigVO configVO) {
|
||||
this.deviceService.updateSandboxConfig(id, configVO);
|
||||
}
|
||||
/**
|
||||
* 添加/修改电子沙盘工作站配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/sandbox")
|
||||
public void updateSandboxConfig(@PathVariable Long id,
|
||||
@RequestBody @Validated RelationLoginConfigVO configVO) {
|
||||
this.deviceService.updateSandboxConfig(id, configVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/修改虚拟屏蔽门工作站配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/vrpsd")
|
||||
public void updateVrpsdConfig(@PathVariable Long id, @RequestBody @Validated VrpsdConfigVO configVO) {
|
||||
this.deviceService.updateVrpsdConfig(id, configVO);
|
||||
}
|
||||
/**
|
||||
* 添加/修改虚拟屏蔽门工作站配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/vrpsd")
|
||||
public void updateVrpsdConfig(@PathVariable Long id,
|
||||
@RequestBody @Validated VrpsdConfigVO configVO) {
|
||||
this.deviceService.updateVrpsdConfig(id, configVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/修改现地综合监控工作站配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/iscslw")
|
||||
public void updateIscsLwConfig(@PathVariable Long id, @RequestBody @Validated RelationLoginConfigVO configVO) {
|
||||
this.deviceService.updateIscsLwConfig(id, configVO);
|
||||
}
|
||||
/**
|
||||
* 添加/修改现地综合监控工作站配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/iscslw")
|
||||
public void updateIscsLwConfig(@PathVariable Long id,
|
||||
@RequestBody @Validated RelationLoginConfigVO configVO) {
|
||||
this.deviceService.updateIscsLwConfig(id, configVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/修改中心综合监控工作站配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/iscscw")
|
||||
public void updateIscsCwConfig(@PathVariable Long id, @RequestBody @Validated RelationLoginConfigVO configVO) {
|
||||
this.deviceService.updateIscsCwConfig(id, configVO);
|
||||
}
|
||||
/**
|
||||
* 添加/修改中心综合监控工作站配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/iscscw")
|
||||
public void updateIscsCwConfig(@PathVariable Long id,
|
||||
@RequestBody @Validated RelationLoginConfigVO configVO) {
|
||||
this.deviceService.updateIscsCwConfig(id, configVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/修改联锁工作站配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/ilw")
|
||||
public void updateIlwConfig(@PathVariable Long id, @RequestBody @Validated RelationLoginConfigVO configVO) {
|
||||
this.deviceService.updateIlwConfig(id, configVO);
|
||||
}
|
||||
/**
|
||||
* 添加/修改联锁工作站配置
|
||||
*/
|
||||
@PutMapping("/{id}/config/ilw")
|
||||
public void updateIlwConfig(@PathVariable Long id,
|
||||
@RequestBody @Validated RelationLoginConfigVO configVO) {
|
||||
this.deviceService.updateIlwConfig(id, configVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改配置,以json的形式
|
||||
*/
|
||||
@PutMapping("/config/updateConfig")
|
||||
public void updateConfig(@RequestBody ProjectDeviceVO projectDeviceVO) {
|
||||
this.deviceService.updateConfig(projectDeviceVO);
|
||||
}
|
||||
/**
|
||||
* 修改配置,以json的形式
|
||||
*/
|
||||
@PutMapping("/config/updateConfig")
|
||||
public void updateConfig(@RequestBody ProjectDeviceVO projectDeviceVO) {
|
||||
this.deviceService.updateConfig(projectDeviceVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public void delete(@PathVariable Long id) {
|
||||
this.deviceService.delete(id);
|
||||
}
|
||||
/**
|
||||
* 删除设备
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public void delete(@PathVariable Long id) {
|
||||
this.deviceService.delete(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询某个类型的所有设备
|
||||
*/
|
||||
@GetMapping("/{project}/{type}/all")
|
||||
public List<ProjectDeviceVO> queryByType(@PathVariable String project, @PathVariable ProjectDeviceType type) {
|
||||
return this.deviceService.queryByType(type, project);
|
||||
}
|
||||
/**
|
||||
* 查询某个类型的所有设备
|
||||
*/
|
||||
@GetMapping("/{project}/{type}/all")
|
||||
public List<ProjectDeviceVO> queryByType(@PathVariable String project,
|
||||
@PathVariable ProjectDeviceType type) {
|
||||
return this.deviceService.queryByType(type, project);
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
// @ApiOperation(value = "查询项目下的所有设备")
|
||||
// @GetMapping("/project")
|
||||
// public List<ProjectDeviceVO> queryByProjectCode(String projectCode, String group) {
|
||||
// return this.iProjectDeviceService.queryByProjectCode(projectCode, group);
|
||||
// }
|
||||
@PostMapping("/xty/addOrUpdate")
|
||||
public void addOrUpdateXtyDeviceConfig(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO) {
|
||||
this.deviceService.addOrUpdateXtyDeviceConfig(accountVO);
|
||||
}
|
||||
@PostMapping("/xty/addOrUpdate")
|
||||
public void addOrUpdateXtyDeviceConfig(
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO) {
|
||||
this.deviceService.addOrUpdateXtyDeviceConfig(accountVO);
|
||||
}
|
||||
|
||||
@PostMapping("/gzb/addOrUpdate")
|
||||
public void addOrUpdateGzbDeviceConfig(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO) {
|
||||
this.deviceService.addOrUpdateGzbDeviceConfig(accountVO);
|
||||
}
|
||||
@PostMapping("/gzb/addOrUpdate")
|
||||
public void addOrUpdateGzbDeviceConfig(
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO) {
|
||||
this.deviceService.addOrUpdateGzbDeviceConfig(accountVO);
|
||||
}
|
||||
|
||||
@PostMapping("/sdy/addOrUpdate")
|
||||
public void addOrUpdateSdyDeviceConfig(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO) {
|
||||
this.deviceService.addOrUpdateSdyDeviceConfig(accountVO);
|
||||
}
|
||||
@PostMapping("/sdy/addOrUpdate")
|
||||
public void addOrUpdateSdyDeviceConfig(
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO) {
|
||||
this.deviceService.addOrUpdateSdyDeviceConfig(accountVO);
|
||||
}
|
||||
|
||||
@PostMapping("/zjd/addOrUpdate")
|
||||
public void addOrUpdateZjdDeviceConfig(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO) {
|
||||
this.deviceService.addOrUpdateRichorDeviceConfig(accountVO);
|
||||
}
|
||||
@PostMapping("/zjd/addOrUpdate")
|
||||
public void addOrUpdateZjdDeviceConfig(
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO) {
|
||||
this.deviceService.addOrUpdateRichorDeviceConfig(accountVO);
|
||||
}
|
||||
|
||||
@PostMapping("/sr/addOrUpdate/{mapId}")
|
||||
public void addOrUpdateSrDeviceConfig(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO, @PathVariable Long mapId) {
|
||||
this.deviceService.addOrUpdateSrDeviceConfig(accountVO, mapId);
|
||||
}
|
||||
@PostMapping("/sr/addOrUpdate/{mapId}")
|
||||
public void addOrUpdateSrDeviceConfig(
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO, @PathVariable Long mapId) {
|
||||
this.deviceService.addOrUpdateSrDeviceConfig(accountVO, mapId);
|
||||
}
|
||||
|
||||
@PostMapping("/hhcj/addOrUpdate")
|
||||
public void addOrUpdateHhcjDeviceConfig(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO) {
|
||||
this.deviceService.addOrUpdateHhcjDeviceConfig(accountVO);
|
||||
}
|
||||
@PostMapping("/hhcj/addOrUpdate")
|
||||
public void addOrUpdateHhcjDeviceConfig(
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO) {
|
||||
this.deviceService.addOrUpdateHhcjDeviceConfig(accountVO);
|
||||
}
|
||||
|
||||
@PostMapping("/say/addOrUpdate")
|
||||
public void addOrUpdateSayDeviceConfig(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO) {
|
||||
this.deviceService.addOrUpdateSayDeviceConfig(accountVO);
|
||||
}
|
||||
@PostMapping("/say/addOrUpdate")
|
||||
public void addOrUpdateSayDeviceConfig(
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO) {
|
||||
this.deviceService.addOrUpdateSayDeviceConfig(accountVO);
|
||||
}
|
||||
|
||||
@PostMapping("/thailand/addOrUpdate/{mapId}")
|
||||
public void addOrUpdateThailandDeviceConfig(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
AccountVO accountVO, @PathVariable Long mapId) {
|
||||
this.deviceService.addOrUpdateThailandDeviceConfig(accountVO, mapId);
|
||||
}
|
||||
@PostMapping("/thailand/addOrUpdate/{mapId}")
|
||||
public void addOrUpdateThailandDeviceConfig(
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY)
|
||||
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) {
|
||||
this.deviceService.addOrUpdateNgyDeviceConfig(accountVO, mapId);
|
||||
}
|
||||
|
||||
@PostMapping("/cdgxy/addOrUpdate")
|
||||
public void addOrUpdateCdgxyDeviceConfig(@RequestAttribute AccountVO user) {
|
||||
this.deviceService.addOrUpdateCdgxyDeviceConfig(user);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
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;
|
||||
// }
|
||||
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
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,17 +6,33 @@ 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.entity.training2.PublishedTraining2WithBLOBs;
|
||||
import club.joylink.rtss.services.training2.Training2DraftPublishService;
|
||||
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.*;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 已发布实训管理接口
|
||||
|
@ -25,123 +41,171 @@ import java.util.List;
|
|||
@RestController
|
||||
@RequestMapping("/api/v2/training/published")
|
||||
public class TrainingV2PublishController {
|
||||
@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 Training2PublishService publishService;
|
||||
|
||||
/**
|
||||
* 变更共享状态
|
||||
* @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);
|
||||
}
|
||||
@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 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);
|
||||
}
|
||||
/**
|
||||
* 查所有的已发布场景实训的基础信息
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
/**
|
||||
* 实训查询
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据实训id查该已发布实训的所有信息
|
||||
*/
|
||||
@GetMapping("/{trainingId}")
|
||||
public PublishedTraining2DetailRspVo findTrainingAllInfo(@PathVariable("trainingId") Long trainingId){
|
||||
return this.publishService.findTrainingAllInfoById(trainingId);
|
||||
}
|
||||
/**
|
||||
* 查所有的已发布场景实训的基础信息
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新实训label
|
||||
*/
|
||||
@PutMapping("/update/label")
|
||||
public void updateTrainingLabel(@RequestBody PublishedTraining2 training2) {
|
||||
publishService.updateTrainingLabel(training2);
|
||||
}
|
||||
/**
|
||||
* 根据实训id查该已发布实训的所有信息
|
||||
*/
|
||||
@GetMapping("/{trainingId}")
|
||||
public PublishedTraining2DetailRspVo findTrainingAllInfo(
|
||||
@PathVariable("trainingId") Long trainingId) {
|
||||
return this.publishService.findTrainingAllInfoById(trainingId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新实训label
|
||||
*/
|
||||
@PutMapping("/update/batch/label")
|
||||
public void updateTrainingLabelList(@RequestBody List<PublishedTraining2> publishedTraining2List) {
|
||||
publishService.updateTrainingLabelList(publishedTraining2List);
|
||||
}
|
||||
/**
|
||||
* 更新实训label
|
||||
*/
|
||||
@PutMapping("/update/label")
|
||||
public void updateTrainingLabel(@RequestBody PublishedTraining2 training2) {
|
||||
publishService.updateTrainingLabel(training2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出所选实训
|
||||
* @param tidList 实训ID列表
|
||||
* @return 实训详情信息
|
||||
*/
|
||||
@PostMapping("/export")
|
||||
public List<ExportTraining2> exportTraining(@RequestBody List<Long> tidList) {
|
||||
return publishService.exportTraining(tidList);
|
||||
}
|
||||
/**
|
||||
* 更新发布实训信息
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public void updateTraining(@RequestBody PublishedTraining2 training2) {
|
||||
publishService.updateTrainingBaseInfo(training2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入实训信息
|
||||
* @return 导入结果
|
||||
*/
|
||||
@PostMapping("/import")
|
||||
public List<String> importTraining(@RequestBody List<ExportTraining2> trainingList, @RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
return publishService.importTraining(trainingList, userInfoVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新实训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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,15 +4,25 @@ import club.joylink.rtss.services.ISysUserService;
|
|||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.UserQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.user.*;
|
||||
import club.joylink.rtss.vo.client.user.MobileInfoVO;
|
||||
import club.joylink.rtss.vo.client.user.RetrievePwdVO;
|
||||
import club.joylink.rtss.vo.client.user.UpdateEmailVO;
|
||||
import club.joylink.rtss.vo.client.user.UpdateMobileVO;
|
||||
import club.joylink.rtss.vo.client.user.UpdatePasswordVO;
|
||||
import club.joylink.rtss.vo.user.AccountCreateVO;
|
||||
import club.joylink.rtss.vo.user.AccountRegisterVO;
|
||||
import club.joylink.rtss.vo.user.UserRegisterCheck;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 系统账户接口
|
||||
|
@ -21,165 +31,186 @@ import java.util.List;
|
|||
@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);
|
||||
}
|
||||
/**
|
||||
* 找回密码
|
||||
*/
|
||||
@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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,11 +4,14 @@ import club.joylink.rtss.services.voice.IVoiceTrainingService;
|
|||
import club.joylink.rtss.services.voice.baidu.TokenHolder;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult;
|
||||
import club.joylink.rtss.vo.client.competition.VoiceErrorVO;
|
||||
import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult;
|
||||
import club.joylink.rtss.vo.voice.VoiceVerifyResultVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
@ -20,34 +23,46 @@ 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();
|
||||
}
|
||||
/**
|
||||
* 获取百度语音识别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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,51 +2,55 @@ package club.joylink.rtss.controller.voice;
|
|||
|
||||
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
|
||||
import club.joylink.rtss.services.voice.IVoiceDataConfigService;
|
||||
import club.joylink.rtss.services.voice.IVoiceTrainingService;
|
||||
import club.joylink.rtss.services.voice.baidu.TokenHolder;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.competition.VoiceErrorVO;
|
||||
import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult;
|
||||
import club.joylink.rtss.vo.voice.VoiceDiscriminateConfigVO;
|
||||
import club.joylink.rtss.vo.voice.VoiceQueryVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 语音AI接口
|
||||
* 语音管理接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/voice/manage")
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package club.joylink.rtss.dao;
|
||||
|
||||
import club.joylink.rtss.entity.CgyView;
|
||||
import club.joylink.rtss.entity.CgyViewExample;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* CgyViewDAO继承基类
|
||||
*/
|
||||
@Repository
|
||||
public interface CgyViewDAO extends MyBatisBaseDao<CgyView, String, CgyViewExample> {
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
//package club.joylink.rtss.dao;
|
||||
//
|
||||
//import club.joylink.rtss.entity.Company;
|
||||
//import club.joylink.rtss.entity.CompanyExample;
|
||||
//import org.springframework.stereotype.Repository;
|
||||
//
|
||||
///**
|
||||
// * CompanyDAO继承基类
|
||||
// */
|
||||
////@Repository
|
||||
////public interface CompanyDAO extends MyBatisBaseDao<Company, Integer, CompanyExample> {
|
||||
////}
|
|
@ -14,8 +14,9 @@ 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" +
|
||||
|
@ -24,48 +25,54 @@ 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);
|
||||
long countByExample(PaperQuestionExample example);
|
||||
" 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);
|
||||
|
||||
int deleteByExample(PaperQuestionExample example);
|
||||
@Select("<script>" +
|
||||
"select id from rts_paper_question where org_id = #{orgId} "
|
||||
+ "</script>")
|
||||
List<Long> findAllId(@Param("orgId") Long id);
|
||||
|
||||
int deleteByPrimaryKey(Long id);
|
||||
long countByExample(PaperQuestionExample example);
|
||||
|
||||
int insert(PaperQuestionWithBLOBs record);
|
||||
int deleteByExample(PaperQuestionExample example);
|
||||
|
||||
int insertSelective(PaperQuestionWithBLOBs record);
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
List<PaperQuestionWithBLOBs> selectByExampleWithBLOBs(PaperQuestionExample example);
|
||||
int insert(PaperQuestionWithBLOBs record);
|
||||
|
||||
List<PaperQuestion> selectByExample(PaperQuestionExample example);
|
||||
int insertSelective(PaperQuestionWithBLOBs record);
|
||||
|
||||
PaperQuestionWithBLOBs selectByPrimaryKey(Long id);
|
||||
List<PaperQuestionWithBLOBs> selectByExampleWithBLOBs(PaperQuestionExample example);
|
||||
|
||||
int updateByExampleSelective(@Param("record") PaperQuestionWithBLOBs record, @Param("example") PaperQuestionExample example);
|
||||
List<PaperQuestion> selectByExample(PaperQuestionExample example);
|
||||
|
||||
int updateByExampleWithBLOBs(@Param("record") PaperQuestionWithBLOBs record, @Param("example") PaperQuestionExample example);
|
||||
PaperQuestionWithBLOBs selectByPrimaryKey(Long id);
|
||||
|
||||
int updateByExample(@Param("record") PaperQuestion record, @Param("example") PaperQuestionExample example);
|
||||
int updateByExampleSelective(@Param("record") PaperQuestionWithBLOBs record, @Param("example") PaperQuestionExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(PaperQuestionWithBLOBs record);
|
||||
int updateByExampleWithBLOBs(@Param("record") PaperQuestionWithBLOBs record, @Param("example") PaperQuestionExample example);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(PaperQuestionWithBLOBs record);
|
||||
int updateByExample(@Param("record") PaperQuestion record, @Param("example") PaperQuestionExample example);
|
||||
|
||||
int updateByPrimaryKey(PaperQuestion record);
|
||||
int updateByPrimaryKeySelective(PaperQuestionWithBLOBs record);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(PaperQuestionWithBLOBs record);
|
||||
|
||||
int updateByPrimaryKey(PaperQuestion record);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
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);
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
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);
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
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);
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
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);
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
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);
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
package club.joylink.rtss.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* cgy_view
|
||||
* @author
|
||||
*/
|
||||
public class CgyView implements Serializable {
|
||||
/**
|
||||
* 接入虚仿平台后获取
|
||||
*/
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* 接入虚仿平台后获取
|
||||
*/
|
||||
private String appSecret;
|
||||
|
||||
/**
|
||||
* 地图功能id
|
||||
*/
|
||||
private Long functionId;
|
||||
|
||||
/**
|
||||
* 浏览量
|
||||
*/
|
||||
private Long viewCount;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getAppSecret() {
|
||||
return appSecret;
|
||||
}
|
||||
|
||||
public void setAppSecret(String appSecret) {
|
||||
this.appSecret = appSecret;
|
||||
}
|
||||
|
||||
public Long getFunctionId() {
|
||||
return functionId;
|
||||
}
|
||||
|
||||
public void setFunctionId(Long functionId) {
|
||||
this.functionId = functionId;
|
||||
}
|
||||
|
||||
public Long getViewCount() {
|
||||
return viewCount;
|
||||
}
|
||||
|
||||
public void setViewCount(Long viewCount) {
|
||||
this.viewCount = viewCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (that == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != that.getClass()) {
|
||||
return false;
|
||||
}
|
||||
CgyView other = (CgyView) that;
|
||||
return (this.getAppId() == null ? other.getAppId() == null : this.getAppId().equals(other.getAppId()))
|
||||
&& (this.getAppSecret() == null ? other.getAppSecret() == null : this.getAppSecret().equals(other.getAppSecret()))
|
||||
&& (this.getFunctionId() == null ? other.getFunctionId() == null : this.getFunctionId().equals(other.getFunctionId()))
|
||||
&& (this.getViewCount() == null ? other.getViewCount() == null : this.getViewCount().equals(other.getViewCount()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getAppId() == null) ? 0 : getAppId().hashCode());
|
||||
result = prime * result + ((getAppSecret() == null) ? 0 : getAppSecret().hashCode());
|
||||
result = prime * result + ((getFunctionId() == null) ? 0 : getFunctionId().hashCode());
|
||||
result = prime * result + ((getViewCount() == null) ? 0 : getViewCount().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", appId=").append(appId);
|
||||
sb.append(", appSecret=").append(appSecret);
|
||||
sb.append(", functionId=").append(functionId);
|
||||
sb.append(", viewCount=").append(viewCount);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,482 @@
|
|||
package club.joylink.rtss.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CgyViewExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
private Integer limit;
|
||||
|
||||
private Long offset;
|
||||
|
||||
public CgyViewExample() {
|
||||
oredCriteria = new ArrayList<Criteria>();
|
||||
}
|
||||
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
public void setLimit(Integer limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
public Integer getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setOffset(Long offset) {
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
public Long getOffset() {
|
||||
return offset;
|
||||
}
|
||||
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<Criterion>();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return criteria.size() > 0;
|
||||
}
|
||||
|
||||
public List<Criterion> getAllCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public List<Criterion> getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition) {
|
||||
if (condition == null) {
|
||||
throw new RuntimeException("Value for condition cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value, String property) {
|
||||
if (value == null) {
|
||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||
if (value1 == null || value2 == null) {
|
||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value1, value2));
|
||||
}
|
||||
|
||||
public Criteria andAppIdIsNull() {
|
||||
addCriterion("app_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdIsNotNull() {
|
||||
addCriterion("app_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdEqualTo(String value) {
|
||||
addCriterion("app_id =", value, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdNotEqualTo(String value) {
|
||||
addCriterion("app_id <>", value, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdGreaterThan(String value) {
|
||||
addCriterion("app_id >", value, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("app_id >=", value, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdLessThan(String value) {
|
||||
addCriterion("app_id <", value, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("app_id <=", value, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdLike(String value) {
|
||||
addCriterion("app_id like", value, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdNotLike(String value) {
|
||||
addCriterion("app_id not like", value, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdIn(List<String> values) {
|
||||
addCriterion("app_id in", values, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdNotIn(List<String> values) {
|
||||
addCriterion("app_id not in", values, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdBetween(String value1, String value2) {
|
||||
addCriterion("app_id between", value1, value2, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppIdNotBetween(String value1, String value2) {
|
||||
addCriterion("app_id not between", value1, value2, "appId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretIsNull() {
|
||||
addCriterion("app_secret is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretIsNotNull() {
|
||||
addCriterion("app_secret is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretEqualTo(String value) {
|
||||
addCriterion("app_secret =", value, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretNotEqualTo(String value) {
|
||||
addCriterion("app_secret <>", value, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretGreaterThan(String value) {
|
||||
addCriterion("app_secret >", value, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("app_secret >=", value, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretLessThan(String value) {
|
||||
addCriterion("app_secret <", value, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretLessThanOrEqualTo(String value) {
|
||||
addCriterion("app_secret <=", value, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretLike(String value) {
|
||||
addCriterion("app_secret like", value, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretNotLike(String value) {
|
||||
addCriterion("app_secret not like", value, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretIn(List<String> values) {
|
||||
addCriterion("app_secret in", values, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretNotIn(List<String> values) {
|
||||
addCriterion("app_secret not in", values, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretBetween(String value1, String value2) {
|
||||
addCriterion("app_secret between", value1, value2, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andAppSecretNotBetween(String value1, String value2) {
|
||||
addCriterion("app_secret not between", value1, value2, "appSecret");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdIsNull() {
|
||||
addCriterion("function_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdIsNotNull() {
|
||||
addCriterion("function_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdEqualTo(Long value) {
|
||||
addCriterion("function_id =", value, "functionId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdNotEqualTo(Long value) {
|
||||
addCriterion("function_id <>", value, "functionId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdGreaterThan(Long value) {
|
||||
addCriterion("function_id >", value, "functionId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("function_id >=", value, "functionId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdLessThan(Long value) {
|
||||
addCriterion("function_id <", value, "functionId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdLessThanOrEqualTo(Long value) {
|
||||
addCriterion("function_id <=", value, "functionId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdIn(List<Long> values) {
|
||||
addCriterion("function_id in", values, "functionId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdNotIn(List<Long> values) {
|
||||
addCriterion("function_id not in", values, "functionId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdBetween(Long value1, Long value2) {
|
||||
addCriterion("function_id between", value1, value2, "functionId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFunctionIdNotBetween(Long value1, Long value2) {
|
||||
addCriterion("function_id not between", value1, value2, "functionId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountIsNull() {
|
||||
addCriterion("view_count is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountIsNotNull() {
|
||||
addCriterion("view_count is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountEqualTo(Long value) {
|
||||
addCriterion("view_count =", value, "viewCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountNotEqualTo(Long value) {
|
||||
addCriterion("view_count <>", value, "viewCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountGreaterThan(Long value) {
|
||||
addCriterion("view_count >", value, "viewCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("view_count >=", value, "viewCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountLessThan(Long value) {
|
||||
addCriterion("view_count <", value, "viewCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountLessThanOrEqualTo(Long value) {
|
||||
addCriterion("view_count <=", value, "viewCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountIn(List<Long> values) {
|
||||
addCriterion("view_count in", values, "viewCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountNotIn(List<Long> values) {
|
||||
addCriterion("view_count not in", values, "viewCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountBetween(Long value1, Long value2) {
|
||||
addCriterion("view_count between", value1, value2, "viewCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andViewCountNotBetween(Long value1, Long value2) {
|
||||
addCriterion("view_count not between", value1, value2, "viewCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
||||
protected Criteria() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criterion {
|
||||
private String condition;
|
||||
|
||||
private Object value;
|
||||
|
||||
private Object secondValue;
|
||||
|
||||
private boolean noValue;
|
||||
|
||||
private boolean singleValue;
|
||||
|
||||
private boolean betweenValue;
|
||||
|
||||
private boolean listValue;
|
||||
|
||||
private String typeHandler;
|
||||
|
||||
public String getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Object getSecondValue() {
|
||||
return secondValue;
|
||||
}
|
||||
|
||||
public boolean isNoValue() {
|
||||
return noValue;
|
||||
}
|
||||
|
||||
public boolean isSingleValue() {
|
||||
return singleValue;
|
||||
}
|
||||
|
||||
public boolean isBetweenValue() {
|
||||
return betweenValue;
|
||||
}
|
||||
|
||||
public boolean isListValue() {
|
||||
return listValue;
|
||||
}
|
||||
|
||||
public String getTypeHandler() {
|
||||
return typeHandler;
|
||||
}
|
||||
|
||||
protected Criterion(String condition) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.typeHandler = null;
|
||||
this.noValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.typeHandler = typeHandler;
|
||||
if (value instanceof List<?>) {
|
||||
this.listValue = true;
|
||||
} else {
|
||||
this.singleValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value) {
|
||||
this(condition, value, null);
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.secondValue = secondValue;
|
||||
this.typeHandler = typeHandler;
|
||||
this.betweenValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue) {
|
||||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
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;
|
||||
}
|
|
@ -0,0 +1,723 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
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;
|
||||
}
|
|
@ -0,0 +1,843 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
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;
|
||||
}
|
|
@ -0,0 +1,593 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
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;
|
||||
}
|
|
@ -0,0 +1,733 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
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;
|
||||
}
|
|
@ -0,0 +1,983 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
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,352 +6,365 @@ import club.joylink.rtss.vo.LoginUserInfoVO;
|
|||
import club.joylink.rtss.vo.UserQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.org.OrgVO;
|
||||
import club.joylink.rtss.vo.client.user.*;
|
||||
import club.joylink.rtss.vo.client.user.MobileInfoVO;
|
||||
import club.joylink.rtss.vo.client.user.RetrievePwdVO;
|
||||
import club.joylink.rtss.vo.client.user.UpdateEmailVO;
|
||||
import club.joylink.rtss.vo.client.user.UpdateMobileVO;
|
||||
import club.joylink.rtss.vo.client.user.UpdatePasswordVO;
|
||||
import club.joylink.rtss.vo.client.user.WeChatBindStatusVO;
|
||||
import club.joylink.rtss.vo.user.AccountCreateVO;
|
||||
import club.joylink.rtss.vo.user.AccountRegisterVO;
|
||||
import club.joylink.rtss.vo.wx.WmUserSession;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import lombok.NonNull;
|
||||
|
||||
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);
|
||||
|
||||
/**
|
||||
* 确认用户是超管
|
||||
*/
|
||||
void confirmSuperAdmin(Long userId);
|
||||
|
||||
boolean isExist(Long id);
|
||||
|
||||
/**
|
||||
* 获取微信小程序绑定url
|
||||
*/
|
||||
WeChatBindStatusVO getWeChatBindUrl(LoginUserInfoVO loginInfo);
|
||||
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);
|
||||
|
||||
/**
|
||||
* 用户绑定微信小程序
|
||||
*
|
||||
* @param code
|
||||
* @param userId
|
||||
*/
|
||||
void userBindWm(String code, Long userId);
|
||||
/**
|
||||
* 确认用户是超管
|
||||
*/
|
||||
void confirmSuperAdmin(Long userId);
|
||||
|
||||
OrgVO userScanCodeBindCompanyManager(Long userId, Long companyId);
|
||||
boolean isExist(Long id);
|
||||
|
||||
AccountVO getUserBaseInfoById(Long id);
|
||||
/**
|
||||
* 获取微信小程序绑定url
|
||||
*/
|
||||
WeChatBindStatusVO getWeChatBindUrl(LoginUserInfoVO loginInfo);
|
||||
|
||||
List<AccountVO> getUsersWithEmail();
|
||||
/**
|
||||
* 用户绑定微信小程序
|
||||
*
|
||||
* @param code
|
||||
* @param userId
|
||||
*/
|
||||
void userBindWm(String code, Long userId);
|
||||
|
||||
List<AccountVO> getUsersWithMobile();
|
||||
OrgVO userScanCodeBindCompanyManager(Long userId, Long companyId);
|
||||
|
||||
List<AccountVO> getPlatformUsers();
|
||||
AccountVO getUserBaseInfoById(Long id);
|
||||
|
||||
List<SysAccount> findEntities(List<Long> ids, String orderBy);
|
||||
List<AccountVO> getUsersWithEmail();
|
||||
|
||||
/**
|
||||
* 确认该用户存在
|
||||
*/
|
||||
void confirmExist(Long id);
|
||||
List<AccountVO> getUsersWithMobile();
|
||||
|
||||
void superAdminUpdateUserInfo(AccountVO updateUser, AccountVO superAdmin);
|
||||
List<AccountVO> getPlatformUsers();
|
||||
|
||||
/**
|
||||
* 查询所有的销售人员
|
||||
*/
|
||||
List<AccountVO> querySellers();
|
||||
List<SysAccount> findEntities(List<Long> ids, String orderBy);
|
||||
|
||||
void deleteById(Long id);
|
||||
Map<Long, SysAccount> findEntitiesForMap(List<Long> ids);
|
||||
|
||||
void register(AccountCreateVO accountCreateVO);
|
||||
/**
|
||||
* 确认该用户存在
|
||||
*/
|
||||
void confirmExist(Long id);
|
||||
|
||||
List<AccountVO> queryUsers(List<Long> userIds);
|
||||
void superAdminUpdateUserInfo(AccountVO updateUser, AccountVO superAdmin);
|
||||
|
||||
/**
|
||||
* 查询管理和超管
|
||||
*/
|
||||
List<AccountVO> queryAdminsAndSuperAdmins();
|
||||
/**
|
||||
* 查询所有的销售人员
|
||||
*/
|
||||
List<AccountVO> querySellers();
|
||||
|
||||
AccountVO queryOrCreateThirdAccount(String parentAccount, String account);
|
||||
void deleteById(Long id);
|
||||
|
||||
AccountVO getThirdAccount(String account);
|
||||
void register(AccountCreateVO accountCreateVO);
|
||||
|
||||
void logicDelete(Long id);
|
||||
List<AccountVO> queryUsers(List<Long> userIds);
|
||||
|
||||
boolean isThirdParentAccountExist(String parentAccount);
|
||||
/**
|
||||
* 查询管理和超管
|
||||
*/
|
||||
List<AccountVO> queryAdminsAndSuperAdmins();
|
||||
|
||||
List<SysAccount> findEntitiesBySource(String source);
|
||||
AccountVO queryOrCreateThirdAccount(String parentAccount, String account, @NotEmpty String name);
|
||||
|
||||
void resetPwd(long id);
|
||||
AccountVO getThirdAccount(String account);
|
||||
|
||||
void retrievePwd(RetrievePwdVO vo);
|
||||
void logicDelete(Long id);
|
||||
|
||||
void register2(AccountRegisterVO registerVO);
|
||||
boolean isThirdParentAccountExist(String parentAccount);
|
||||
|
||||
SysAccount getEntityByMobile(String mobile);
|
||||
List<SysAccount> findEntitiesBySource(String source);
|
||||
|
||||
boolean isSameMobileExist(String mobile);
|
||||
void resetPwd(long id);
|
||||
|
||||
boolean isSameEmailExist(String email);
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -6,14 +6,25 @@ import club.joylink.rtss.constants.SystemEnv;
|
|||
import club.joylink.rtss.dao.LearnCommentDAO;
|
||||
import club.joylink.rtss.dao.LearnMessageDAO;
|
||||
import club.joylink.rtss.dao.LearnPostDAO;
|
||||
import club.joylink.rtss.entity.*;
|
||||
import club.joylink.rtss.entity.LearnComment;
|
||||
import club.joylink.rtss.entity.LearnCommentExample;
|
||||
import club.joylink.rtss.entity.LearnMessage;
|
||||
import club.joylink.rtss.entity.LearnMessageExample;
|
||||
import club.joylink.rtss.entity.LearnPost;
|
||||
import club.joylink.rtss.entity.LearnPostExample;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.learn.*;
|
||||
import club.joylink.rtss.vo.client.learn.LearnCommentUpdateVO;
|
||||
import club.joylink.rtss.vo.client.learn.LearnCommentVO;
|
||||
import club.joylink.rtss.vo.client.learn.LearnCreateVO;
|
||||
import club.joylink.rtss.vo.client.learn.LearnMessageUpdateVO;
|
||||
import club.joylink.rtss.vo.client.learn.LearnPostCreateVO;
|
||||
import club.joylink.rtss.vo.client.learn.LearnPostUpdateVO;
|
||||
import club.joylink.rtss.vo.client.learn.LearnPostVO;
|
||||
import club.joylink.rtss.vo.client.post.LearnMessageCreateVO;
|
||||
import club.joylink.rtss.vo.client.post.LearnMessagePagedQueryVO;
|
||||
import club.joylink.rtss.vo.client.post.LearnMessageVO;
|
||||
|
@ -22,362 +33,374 @@ 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 RestTemplate restTemplate;
|
||||
@Autowired
|
||||
private WeChatConfig weChatConfig;
|
||||
|
||||
@Autowired
|
||||
private WeChatConfig weChatConfig;
|
||||
@Autowired
|
||||
private MiniProgramService miniProgramService;
|
||||
|
||||
@Autowired
|
||||
private MiniProgramService miniProgramService;
|
||||
@Autowired
|
||||
private LearnMessageDAO learnMessageDAO;
|
||||
|
||||
@Autowired
|
||||
private LearnMessageDAO learnMessageDAO;
|
||||
@Autowired
|
||||
private OtherConfig otherConfig;
|
||||
|
||||
@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);
|
||||
@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);
|
||||
}
|
||||
|
||||
@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
|
||||
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 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
|
||||
@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 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 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;
|
||||
}
|
||||
@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);
|
||||
}
|
||||
// 回复的用户的昵称
|
||||
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;
|
||||
/**
|
||||
* 回复数据完善
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
@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);
|
||||
@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);
|
||||
}
|
||||
|
||||
@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);
|
||||
@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);
|
||||
}
|
||||
|
||||
@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 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
|
||||
@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 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 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 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 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("无法删除非本人的评论");
|
||||
}
|
||||
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("无法删除非本人的评论");
|
||||
}
|
||||
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 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 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 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 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 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 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 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 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 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 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);
|
||||
}
|
||||
@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
|
||||
|
@ -400,50 +423,55 @@ 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);
|
||||
}
|
||||
//修改时间
|
||||
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;
|
||||
}
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// @Override
|
||||
// public Integer likeMessage(Long messageId) {
|
||||
// LearnMessageWithBLOBs message = getMessage(messageId);
|
||||
// message.setLike(message.getLike() == null ? 0 : message.getLike() + 1);
|
||||
|
@ -459,38 +487,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);
|
||||
|
@ -502,44 +530,46 @@ 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
File diff suppressed because it is too large
Load Diff
|
@ -3,6 +3,7 @@ package club.joylink.rtss.services.auth;
|
|||
import club.joylink.rtss.configuration.configProp.OtherConfig;
|
||||
import club.joylink.rtss.configuration.configProp.WeChatConfig;
|
||||
import club.joylink.rtss.constants.Client;
|
||||
import club.joylink.rtss.constants.ProjectCode;
|
||||
import club.joylink.rtss.dao.SysAccountLoginDAO;
|
||||
import club.joylink.rtss.entity.SysAccountLogin;
|
||||
import club.joylink.rtss.entity.project.Project;
|
||||
|
@ -22,6 +23,7 @@ import club.joylink.rtss.vo.LoginUserInfoVO;
|
|||
import club.joylink.rtss.vo.client.LoginStatusVO;
|
||||
import club.joylink.rtss.vo.client.LoginUserVO;
|
||||
import club.joylink.rtss.vo.client.SocketMessageVO;
|
||||
import club.joylink.rtss.vo.client.cgy.CgyThirdPartyLoginInfoVO;
|
||||
import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
|
||||
import club.joylink.rtss.vo.client.project.ProjectDeviceVO;
|
||||
import club.joylink.rtss.vo.client.project.RelationLoginConfigVO;
|
||||
|
@ -239,6 +241,24 @@ public class AuthenticateService implements IAuthenticateService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String cgyThirdPartyLogin(CgyThirdPartyLoginInfoVO loginInfo) {
|
||||
BusinessExceptionAssertEnum.INVALID_OPERATION
|
||||
.assertTrue(this.iSysUserService.isThirdParentAccountExist(loginInfo.getParentAccount()),
|
||||
String.format("成工院父账号不存在: %s", loginInfo.getParentAccount()));
|
||||
AccountVO accountVO = this.iSysUserService.queryOrCreateThirdAccount(
|
||||
loginInfo.getParentAccount(),
|
||||
loginInfo.getAccount(),
|
||||
loginInfo.getName());
|
||||
ProjectVO projectVO = projectService.queryLoginProjectByCode(ProjectCode.CGY);
|
||||
// 构造登陆用户信息
|
||||
LoginUserInfoVO loginUserInfo = new LoginUserInfoVO(accountVO, Client.Joylink, projectVO, null);
|
||||
loginUserInfo.setThirdLogin(true);
|
||||
// 执行登录
|
||||
login(loginUserInfo, true);
|
||||
return loginUserInfo.getToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* @update 20221019 去除设置组织信息
|
||||
*/
|
||||
|
@ -384,8 +404,7 @@ public class AuthenticateService implements IAuthenticateService {
|
|||
.assertTrue(this.iSysUserService.isThirdParentAccountExist(loginInfo.getParentAccount()),
|
||||
String.format("第三方企业账号不存在: %s", loginInfo.getParentAccount()));
|
||||
AccountVO accountVO = this.iSysUserService.queryOrCreateThirdAccount(
|
||||
loginInfo.getParentAccount(),
|
||||
loginInfo.getAccount());
|
||||
loginInfo.getParentAccount(), loginInfo.getAccount(), null);
|
||||
Client client = Client.getByIdAndSecret(loginInfo.getClientId(), loginInfo.getSecret());
|
||||
ProjectVO projectVO = projectService.queryLoginProjectByCode(loginInfo.getProject());
|
||||
// 构造登陆用户信息
|
||||
|
@ -478,6 +497,8 @@ 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,120 +5,127 @@ 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);
|
||||
/**
|
||||
* 预登出(前端在刷新/关闭标签页的时候调用)
|
||||
*
|
||||
* @param token
|
||||
*/
|
||||
void preLogout(String token);
|
||||
|
||||
/**
|
||||
* 成工业虚仿平台跳转登录接口
|
||||
*/
|
||||
String cgyThirdPartyLogin(CgyThirdPartyLoginInfoVO loginInfo);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,171 @@
|
|||
package club.joylink.rtss.services.cgy;
|
||||
|
||||
import club.joylink.rtss.bo.cgy.CgyStatsBO;
|
||||
import club.joylink.rtss.dao.CgyViewDAO;
|
||||
import club.joylink.rtss.entity.CgyView;
|
||||
import club.joylink.rtss.entity.CgyViewExample;
|
||||
import club.joylink.rtss.entity.UserSimulationRecord;
|
||||
import club.joylink.rtss.event.UserSimulationRecordEvent;
|
||||
import club.joylink.rtss.services.user.UserSimulationRecordService;
|
||||
import club.joylink.rtss.simulation.cbtc.SimulationService;
|
||||
import club.joylink.rtss.simulation.vo.SimulationInfoVO;
|
||||
import club.joylink.rtss.util.EncryptUtil;
|
||||
import club.joylink.rtss.vo.client.simulationUsage.SimulationUsageRecordQueryVO;
|
||||
import club.joylink.rtss.vo.client.simulationv1.SimulationInfoQueryVO;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import javax.annotation.PostConstruct;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
/**
|
||||
* 成工院虚仿平台对接统计服务
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class CgyStatsService {
|
||||
|
||||
private CgyViewDAO cgyViewDAO;
|
||||
private UserSimulationRecordService userSimulationRecordService;
|
||||
private SimulationService simulationService;
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
@Autowired
|
||||
public CgyStatsService(CgyViewDAO cgyViewDAO,
|
||||
UserSimulationRecordService userSimulationRecordService,
|
||||
SimulationService simulationService, RestTemplate restTemplate) {
|
||||
this.cgyViewDAO = cgyViewDAO;
|
||||
this.userSimulationRecordService = userSimulationRecordService;
|
||||
this.simulationService = simulationService;
|
||||
this.restTemplate = restTemplate;
|
||||
}
|
||||
|
||||
private final ConcurrentHashMap<String, CgyStatsBO> appStatsMap = new ConcurrentHashMap<>();
|
||||
private final ConcurrentHashMap<Long, CgyStatsBO> functionStatsMap = new ConcurrentHashMap<>();
|
||||
|
||||
@PostConstruct
|
||||
public void makeCache() {
|
||||
List<CgyView> cgyViews = cgyViewDAO.selectByExample(new CgyViewExample());
|
||||
if (CollectionUtils.isEmpty(cgyViews)) {
|
||||
return;
|
||||
}
|
||||
cgyViews.forEach(cgyView -> {
|
||||
CgyStatsBO bo = new CgyStatsBO(cgyView.getAppId(), cgyView.getAppSecret(),
|
||||
cgyView.getFunctionId());
|
||||
bo.setChange(new AtomicBoolean(true));
|
||||
bo.setView(new AtomicLong(cgyView.getViewCount()));
|
||||
makeCache(bo);
|
||||
appStatsMap.put(cgyView.getAppId(), bo);
|
||||
functionStatsMap.put(cgyView.getFunctionId(), bo);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 向虚仿平台同步数据
|
||||
*/
|
||||
@Scheduled(fixedRate = 2000)
|
||||
public void syncData() {
|
||||
appStatsMap.forEach((appId, statsBO) -> {
|
||||
if (!statsBO.getChange().getAndSet(false)) {
|
||||
return;
|
||||
}
|
||||
//同步汇总数据
|
||||
Map<String, Object> body = new HashMap<>();
|
||||
body.put("app_id", appId);
|
||||
body.put("timestamp", System.currentTimeMillis());
|
||||
body.put("view", statsBO.getView().get());
|
||||
body.put("visitor", statsBO.getVisitor().get());
|
||||
body.put("user", statsBO.getUserSet().size());
|
||||
String sb = "app_id=" + body.get("app_id") + "&"
|
||||
+ "timestamp=" + body.get("timestamp") + "&"
|
||||
+ "user=" + body.get("user") + "&"
|
||||
+ "view=" + body.get("view") + "&"
|
||||
+ "visitor=" + body.get("visitor") + "&"
|
||||
+ "app_secret=" + statsBO.getAppSecret();
|
||||
body.put("sign", EncryptUtil.md5(sb).toLowerCase());
|
||||
//扩展字段
|
||||
body.put("duration", statsBO.getDuration().get() / 60); //分钟
|
||||
SimulationInfoQueryVO queryVO = new SimulationInfoQueryVO();
|
||||
queryVO.setFunctionId(statsBO.getFunctionId());
|
||||
List<SimulationInfoVO> sims = simulationService.listAllSimulation(queryVO);
|
||||
body.put("onlineUser", sims.size());
|
||||
|
||||
HttpHeaders httpHeaders = new HttpHeaders();
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_JSON);
|
||||
HttpEntity<Map<String, Object>> httpEntity = new HttpEntity<>(body, httpHeaders);
|
||||
Map<String, String> resBody = restTemplate.postForObject(
|
||||
"http://gdjtapp.cdivtc.edu.cn/api/applicationCenter/openapi/summary", httpEntity,
|
||||
Map.class);
|
||||
if (resBody != null && Objects.equals(resBody.get("code"), "100001")) {
|
||||
log.error(String.format("成工院虚仿平台同步数据失败:[%s][%s]", resBody.get("msg"),
|
||||
resBody.get("data")));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Async("thirdAccountDataSyncExecutor")
|
||||
@EventListener
|
||||
public void syncUserSimulationUsing(UserSimulationRecordEvent event) {
|
||||
UserSimulationRecord record = event.getRecord();
|
||||
CgyStatsBO cgyStatsBO = functionStatsMap.get(record.getFunctionId());
|
||||
if (Objects.nonNull(cgyStatsBO)) {
|
||||
cgyStatsBO.getVisitor().incrementAndGet();
|
||||
cgyStatsBO.getUserSet().add(record.getUserId());
|
||||
cgyStatsBO.getDuration().addAndGet(record.getDuration());
|
||||
cgyStatsBO.getChange().set(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新此App的浏览量数据
|
||||
*/
|
||||
public void updateView(String appId) {
|
||||
CgyStatsBO cgyStatsBO = appStatsMap.get(appId);
|
||||
if (cgyStatsBO == null) {
|
||||
log.warn(String.format("成工院虚仿平台未知的appId:%s", appId));
|
||||
return;
|
||||
}
|
||||
long count = cgyStatsBO.getView().incrementAndGet();
|
||||
CgyView record = new CgyView();
|
||||
record.setAppId(appId);
|
||||
record.setViewCount(count);
|
||||
CgyViewExample example = new CgyViewExample();
|
||||
example.createCriteria().andAppIdEqualTo(appId).andViewCountLessThan(count);
|
||||
cgyViewDAO.updateByExampleSelective(record, example);
|
||||
cgyStatsBO.getChange().set(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 实训人数、实训人次、实训时长缓存
|
||||
*/
|
||||
private void makeCache(CgyStatsBO bo) {
|
||||
long visitor = 0;
|
||||
long duration = 0;
|
||||
//实训人数、人次、时长
|
||||
List<UserSimulationRecord> records = userSimulationRecordService.listSimulationUsageRecords(
|
||||
new SimulationUsageRecordQueryVO(null, bo.getFunctionId()));
|
||||
if (!CollectionUtils.isEmpty(records)) {
|
||||
visitor = records.size();
|
||||
for (UserSimulationRecord record : records) {
|
||||
bo.getUserSet().add(record.getUserId()); //实训人数
|
||||
duration += record.getDuration();
|
||||
}
|
||||
}
|
||||
bo.setVisitor(new AtomicLong(visitor)); //实训人次
|
||||
bo.setDuration(new AtomicLong(duration)); //实训时长
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -15,91 +15,98 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
|
||||
public interface IOrgService {
|
||||
OrgVO createTopOrg(TopOrgCreateVO topOrgCreateVO, AccountVO user);
|
||||
|
||||
List<OrgVO> queryAllTopOrg();
|
||||
/**
|
||||
* 查找默认组织
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Org findDefaultOrg();
|
||||
|
||||
PageVO<OrgVO> pagedQueryAllTopOrg(OrgQueryVO queryVO);
|
||||
OrgVO createTopOrg(TopOrgCreateVO topOrgCreateVO, AccountVO user);
|
||||
|
||||
void confirmExist(Long orgId);
|
||||
List<OrgVO> queryAllTopOrg();
|
||||
|
||||
OrgVO createCls(NonTopOrgCreateVO createVO, LoginUserInfoVO loginInfo);
|
||||
PageVO<OrgVO> pagedQueryAllTopOrg(OrgQueryVO queryVO);
|
||||
|
||||
Org getEntity(long orgId);
|
||||
void confirmExist(Long orgId);
|
||||
|
||||
Org findEntity(long orgId);
|
||||
OrgVO createCls(NonTopOrgCreateVO createVO, LoginUserInfoVO loginInfo);
|
||||
|
||||
// TODO 20220922 将Project 修改为 String
|
||||
Collection<Org> getEntities(String project, String status);
|
||||
Org getEntity(long orgId);
|
||||
|
||||
// TODO 20220922 将Project 修改为 String
|
||||
Collection<Org> findEntities(String project, String status);
|
||||
Org findEntity(long orgId);
|
||||
|
||||
OrgVO updateOrg(Long id, OrgVO orgVO, AccountVO user);
|
||||
// TODO 20220922 将Project 修改为 String
|
||||
Collection<Org> getEntities(String project, String status);
|
||||
|
||||
/**
|
||||
* 删除非顶级组织
|
||||
*
|
||||
* @param nonTopOrgId
|
||||
*/
|
||||
void deleteNonTopOrg(Long nonTopOrgId);
|
||||
// TODO 20220922 将Project 修改为 String
|
||||
Collection<Org> findEntities(String project, String status);
|
||||
|
||||
List<Org> findEntitiesByParentId(Long parentId, String orderBy, String status);
|
||||
OrgVO updateOrg(Long id, OrgVO orgVO, AccountVO user);
|
||||
|
||||
/**
|
||||
* 分页查询自己创建的班级
|
||||
*/
|
||||
PageVO<OrgVO> pagedQueryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo);
|
||||
/**
|
||||
* 删除非顶级组织
|
||||
*
|
||||
* @param nonTopOrgId
|
||||
*/
|
||||
void deleteNonTopOrg(Long nonTopOrgId);
|
||||
|
||||
/**
|
||||
* 查询自己创建的班级
|
||||
*/
|
||||
List<OrgVO> queryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo);
|
||||
List<Org> findEntitiesByParentId(Long parentId, String orderBy, String status);
|
||||
|
||||
/**
|
||||
* 获取该组织所属的顶级组织
|
||||
*/
|
||||
Org getTopOrgEntity(Long orgId);
|
||||
/**
|
||||
* 分页查询自己创建的班级
|
||||
*/
|
||||
PageVO<OrgVO> pagedQueryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo);
|
||||
|
||||
List<Org> findEntities(List<Long> orgIds, String status);
|
||||
/**
|
||||
* 查询自己创建的班级
|
||||
*/
|
||||
List<OrgVO> queryCls(OrgQueryVO queryVO, LoginUserInfoVO loginInfo);
|
||||
|
||||
/**
|
||||
* 管理员分页查询组织
|
||||
*/
|
||||
Node<Object> adminQueryOrgTree(Long orgId);
|
||||
/**
|
||||
* 获取该组织所属的顶级组织
|
||||
*/
|
||||
Org getTopOrgEntity(Long orgId);
|
||||
|
||||
OrgVO get(Long id);
|
||||
List<Org> findEntities(List<Long> orgIds, String status);
|
||||
|
||||
/**
|
||||
* 查询这些考试关联的班级
|
||||
*/
|
||||
List<ExamDefinitionVO> queryByExamIds(List<Long> examIds, String status);
|
||||
/**
|
||||
* 管理员分页查询组织
|
||||
*/
|
||||
Node<Object> adminQueryOrgTree(Long orgId);
|
||||
|
||||
void confirmIsTopOrg(long id);
|
||||
OrgVO get(Long id);
|
||||
|
||||
void confirmIsNonTopOrg(Long id);
|
||||
/**
|
||||
* 查询这些考试关联的班级
|
||||
*/
|
||||
List<ExamDefinitionVO> queryByExamIds(List<Long> examIds, String status);
|
||||
|
||||
List<Org> queryAllSubOrgs(Long orgId);
|
||||
void confirmIsTopOrg(long id);
|
||||
|
||||
String getBindQrCode(long orgId, String project);
|
||||
void confirmIsNonTopOrg(Long id);
|
||||
|
||||
/**
|
||||
* 获取该用户所属的顶级组织
|
||||
*/
|
||||
Org getTopOrgOfUser(long userId);
|
||||
List<Org> queryAllSubOrgs(Long orgId);
|
||||
|
||||
Org findTopOrgOfUser(long userId);
|
||||
String getBindQrCode(long orgId, String project);
|
||||
|
||||
/**
|
||||
* 查询该组织下的所有班级。
|
||||
* 目前组织结构仅有两级,非顶级的就是班级。
|
||||
*/
|
||||
List<OrgVO> listQueryCls(long topOrgId);
|
||||
/**
|
||||
* 获取该用户所属的顶级组织
|
||||
*/
|
||||
Org getTopOrgOfUser(long userId);
|
||||
|
||||
/**
|
||||
* 查询组织信息(可能返回null)
|
||||
*/
|
||||
OrgVO query(Long id);
|
||||
Org findTopOrgOfUser(long userId);
|
||||
|
||||
OrgVO getTopOrg(long topOrgId);
|
||||
/**
|
||||
* 查询该组织下的所有班级。 目前组织结构仅有两级,非顶级的就是班级。
|
||||
*/
|
||||
List<OrgVO> listQueryCls(long topOrgId);
|
||||
|
||||
/**
|
||||
* 查询组织信息(可能返回null)
|
||||
*/
|
||||
OrgVO query(Long id);
|
||||
|
||||
OrgVO getTopOrg(long topOrgId);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
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;
|
||||
|
@ -14,6 +16,8 @@ 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;
|
||||
|
@ -28,444 +32,470 @@ import java.util.stream.Collectors;
|
|||
|
||||
@Service
|
||||
public class OrgService implements IOrgService {
|
||||
@Autowired
|
||||
private OrgDAO orgDAO;
|
||||
|
||||
@Autowired
|
||||
private IOrgUserService iOrgUserService;
|
||||
@Autowired
|
||||
private OrgDAO orgDAO;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService iSysUserService;
|
||||
@Autowired
|
||||
private IOrgUserService iOrgUserService;
|
||||
|
||||
@Autowired
|
||||
private QRCodeManager qrCodeManager;
|
||||
@Autowired
|
||||
private ISysUserService iSysUserService;
|
||||
|
||||
@Autowired
|
||||
private IOrgProjectService orgProjectService;
|
||||
@Autowired
|
||||
private QRCodeManager qrCodeManager;
|
||||
|
||||
@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());
|
||||
@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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认名称唯一
|
||||
*/
|
||||
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,
|
||||
"名称重复");
|
||||
OrgExample orgExample = new OrgExample();
|
||||
orgExample.createCriteria().andProjectCodeEqualTo(Project.DEFAULT.name());
|
||||
List<Org> orgs = this.orgDAO.selectByExample(orgExample);
|
||||
if (!CollectionUtils.isEmpty(orgs)) {
|
||||
Org org = orgs.get(0);
|
||||
this.cacheService.putExpired(defName, org, 600, TimeUnit.SECONDS);
|
||||
return org;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@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);
|
||||
@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);
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertTrue(orgDAO.countByExample(example) == 0,
|
||||
"名称重复");
|
||||
}
|
||||
|
||||
@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);
|
||||
@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()));
|
||||
}
|
||||
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));
|
||||
@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);
|
||||
}
|
||||
return orgDAO.selectByExample(example);
|
||||
}
|
||||
|
||||
@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), "非顶级组织不能修改关联项目");
|
||||
@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);
|
||||
}
|
||||
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 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);
|
||||
}
|
||||
OrgExample.Criteria criteria = example.createCriteria().andParentIdEqualTo(parentId);
|
||||
if (StringUtils.hasText(status)) {
|
||||
criteria.andStatusEqualTo(status);
|
||||
}
|
||||
return orgDAO.selectByExample(example);
|
||||
@Override
|
||||
public List<Org> findEntitiesByParentId(@NonNull Long parentId, String orderBy, String status) {
|
||||
OrgExample example = new OrgExample();
|
||||
if (StringUtils.hasText(orderBy)) {
|
||||
example.setOrderByClause(orderBy);
|
||||
}
|
||||
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 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());
|
||||
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);
|
||||
}
|
||||
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()));
|
||||
});
|
||||
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());
|
||||
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()));
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(v.getChildren())) {
|
||||
children.addAll(v.getChildren());
|
||||
}
|
||||
List<Org> clsList = orgDAO.selectByExample(example);
|
||||
return clsList.stream().map(OrgVO::new).collect(Collectors.toList());
|
||||
}
|
||||
v.setChildren(children);
|
||||
}
|
||||
});
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Org getTopOrgEntity(Long orgId) {
|
||||
Org entity = getEntity(orgId);
|
||||
if (isTopOrg(entity))
|
||||
return entity;
|
||||
return getEntity(entity.getRootId());
|
||||
}
|
||||
@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<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<ExamDefinitionVO> queryByExamIds(List<Long> examIds, String status) {
|
||||
if (CollectionUtils.isEmpty(examIds)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return orgDAO.queryByExamIds(examIds, status);
|
||||
}
|
||||
|
||||
@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;
|
||||
/**
|
||||
* 确认是顶级组织
|
||||
*
|
||||
* @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 OrgVO get(Long id) {
|
||||
OrgVO vo = query(id);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(vo, String.format("[id:%s]的组织不存在", id));
|
||||
return vo;
|
||||
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<ExamDefinitionVO> queryByExamIds(List<Long> examIds, String status) {
|
||||
if (CollectionUtils.isEmpty(examIds)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return orgDAO.queryByExamIds(examIds, status);
|
||||
@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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认是顶级组织
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
@Override
|
||||
public void confirmIsTopOrg(long id) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(isTopOrg(id),
|
||||
String.format("组织[%s]不是顶级组织", id));
|
||||
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 void confirmIsNonTopOrg(Long id) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(!isTopOrg(id),
|
||||
String.format("组织[%s]是顶级组织", id));
|
||||
@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;
|
||||
}
|
||||
|
||||
@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;
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBindQrCode(long orgId, String project) {
|
||||
return qrCodeManager.getOrgBindCode(orgId, project);
|
||||
OrgExample.Criteria criteria = example.createCriteria().andRootIdEqualTo(rootId);
|
||||
if (StringUtils.hasText(status)) {
|
||||
criteria.andStatusEqualTo(status);
|
||||
}
|
||||
|
||||
@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);
|
||||
List<Org> orgs = orgDAO.selectByExample(example);
|
||||
// BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(orgs,
|
||||
// String.format("没有顶级组织id为[%s]的组织", rootId));
|
||||
return orgs;
|
||||
}
|
||||
return orgs;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 确认这些项目没有被关联到其它的组织
|
||||
|
|
|
@ -2,10 +2,12 @@ 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;
|
||||
|
@ -37,56 +39,69 @@ import java.util.stream.Collectors;
|
|||
@Service
|
||||
@Slf4j
|
||||
public class PagerQuestionService {
|
||||
@Resource
|
||||
private PaperQuestionDAO questionDAO;
|
||||
|
||||
/**
|
||||
* 创建对应的查询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());
|
||||
}
|
||||
@Resource
|
||||
private PaperQuestionDAO questionDAO;
|
||||
|
||||
if(Objects.nonNull(queryVO.getOrgId())){
|
||||
criteria.andOrgIdEqualTo(queryVO.getOrgId());
|
||||
@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));
|
||||
}
|
||||
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();
|
||||
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();
|
||||
}
|
||||
/* if(!StringUtils.hasText(queryVO.getLabels())){
|
||||
if(queryLabelIsNull) {
|
||||
criteria.andTagsIsNull();
|
||||
|
@ -115,258 +130,265 @@ 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询对应的类型标签对应的数量
|
||||
* @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);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(isDel);
|
||||
PaperQuestionVO questionVO = new PaperQuestionVO(question);
|
||||
if (random) {
|
||||
Collections.shuffle(questionVO.getOptionList());
|
||||
}
|
||||
return questionVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取题库分页列表
|
||||
* @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 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;
|
||||
}
|
||||
log.info("检查题目[{}]答案,获取原答案[{}],正确答案[{}] ",questionId, answerStr,vo.getQuestionAnswer());
|
||||
return false;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有公司组织下的标签
|
||||
*
|
||||
*/
|
||||
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());
|
||||
/**
|
||||
* 获取所有公司组织下的标签
|
||||
*/
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据公司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;
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加修改
|
||||
* @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 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);
|
||||
}
|
||||
|
||||
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 checkQuestionTypeForSelectAndJudge(PaperQuestionVO vo, String errStr) {
|
||||
long answerCount = vo.getOptionList().stream().filter(PaperQuestionOptionVO2::getCorrect).count();
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(answerCount == 1, errStr);
|
||||
}
|
||||
|
||||
}
|
||||
private void checkQuestionTypeForMulti(PaperQuestionVO vo, String errStr) {
|
||||
long answerCount = vo.getOptionList().stream().filter(PaperQuestionOptionVO2::getCorrect).count();
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(answerCount >= 2, errStr);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
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 checkQuestionTypeForSelectAndJudge(PaperQuestionVO vo,String errStr){
|
||||
long answerCount = vo.getOptionList().stream().filter(PaperQuestionOptionVO2::getCorrect).count();
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(answerCount == 1,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 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);
|
||||
});
|
||||
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,6 +15,7 @@ import club.joylink.rtss.exception.PaperExceptionAssert;
|
|||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.paper.*;
|
||||
import club.joylink.rtss.vo.paper.PaperCompositionWithRuleVo.CreatorBasic;
|
||||
import club.joylink.rtss.vo.paper.convertor.PaperCompositionConvertor;
|
||||
import club.joylink.rtss.vo.paper.convertor.PaperRuleConvertor;
|
||||
import com.github.pagehelper.Page;
|
||||
|
@ -37,139 +38,170 @@ import java.util.stream.Collectors;
|
|||
@Slf4j
|
||||
@Service
|
||||
public class PaperCompositionService {
|
||||
@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();
|
||||
@Autowired
|
||||
private PaperCompositionDAO compositionDAO;
|
||||
@Autowired
|
||||
private PaperRuleDAO ruleDAO;
|
||||
@Autowired
|
||||
private SysAccountDAO sysAccountDAO;
|
||||
|
||||
PaperExceptionAssert.PcNotHavePr.assertTrue(optionalRule.isEmpty(), "试卷规则-单操缺少客户端的定义");
|
||||
PaperComposition newPc = PaperCompositionConvertor.convertToBean(req);
|
||||
/**
|
||||
* 创建试卷蓝图包括规则定义
|
||||
*/
|
||||
@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();
|
||||
|
||||
newPc.setCreateTime(LocalDateTime.now());
|
||||
newPc.setUpdateTime(LocalDateTime.now());
|
||||
newPc.setCreatorId(user.getId());
|
||||
newPc.setUpdateId(user.getId());
|
||||
newPc.setState(PaperCompositionState.Editing.getValue());
|
||||
compositionDAO.insertSelective(newPc);
|
||||
PaperExceptionAssert.PcNotHavePr.assertTrue(optionalRule.isEmpty(),
|
||||
"试卷规则-单操缺少客户端的定义");
|
||||
PaperComposition newPc = PaperCompositionConvertor.convertToBean(req);
|
||||
|
||||
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;
|
||||
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());
|
||||
}
|
||||
//
|
||||
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 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 void createPaperCompositionRule(Long pcId, List<PaperCompositionWithRuleVo.PaperRuleVo> reqList) {
|
||||
Map<String,List<PaperCompositionWithRuleVo.PaperRuleVo>> tmpList = reqList.stream().collect(Collectors.groupingBy(this::ruleMapKey));
|
||||
/**
|
||||
* 更新试卷蓝图包括规则定义
|
||||
*/
|
||||
@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(),
|
||||
"试卷规则-单操缺少客户端的定义");
|
||||
|
||||
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 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 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 updateCompositionRule(List<PaperCompositionWithRuleVo.PaperRuleVo> updateRuleList,
|
||||
Long pcId) {
|
||||
PaperRuleExample ruleExample = new PaperRuleExample();
|
||||
ruleExample.createCriteria().andPcIdEqualTo(pcId);
|
||||
this.ruleDAO.deleteByExample(ruleExample);
|
||||
this.createPaperCompositionRule(pcId, updateRuleList);
|
||||
}
|
||||
|
||||
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 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);
|
||||
// 封存试卷时校验总分值与规则总分值是否相等
|
||||
}
|
||||
|
||||
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 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 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);
|
||||
|
@ -181,289 +213,299 @@ 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();
|
||||
}
|
||||
//
|
||||
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;
|
||||
@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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 返回蓝图的列表基本信息
|
||||
*/
|
||||
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;
|
||||
/**
|
||||
* 返回蓝图的列表基本信息
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
private PaperCompositionExample queryExample(FindPaperCompositionPageReqVo req) {
|
||||
PaperCompositionExample pcEx = new PaperCompositionExample();
|
||||
PaperCompositionExample.Criteria pcExCriteria = pcEx.createCriteria();
|
||||
if (Objects.nonNull(req.getOrgId())) {
|
||||
pcExCriteria.andOrgIdEqualTo(req.getOrgId());
|
||||
}
|
||||
/**
|
||||
* 分页查找试卷蓝图
|
||||
*/
|
||||
@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 (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());
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
/**
|
||||
* 分页查找试卷蓝图
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取试卷完整的蓝图,包括规则
|
||||
*
|
||||
* @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;
|
||||
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;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据试卷蓝图的项目和名称查找项目
|
||||
*/
|
||||
@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 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询试卷蓝图的所有规则
|
||||
*
|
||||
* @param pcId 试卷蓝图的id
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public List<PaperRule> findRuleByPcId(Long pcId) {
|
||||
PaperRuleExample example = new PaperRuleExample();
|
||||
example.createCriteria().andPcIdEqualTo(pcId);
|
||||
return ruleDAO.selectByExample(example);
|
||||
}
|
||||
/**
|
||||
* 根据试卷蓝图的项目和名称查找项目
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验规则当前规定的总分值是否小于等于试卷蓝图中的满分
|
||||
*/
|
||||
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();
|
||||
}
|
||||
/**
|
||||
* 查询试卷蓝图的所有规则
|
||||
*
|
||||
* @param pcId 试卷蓝图的id
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public List<PaperRule> findRuleByPcId(Long pcId) {
|
||||
PaperRuleExample example = new PaperRuleExample();
|
||||
example.createCriteria().andPcIdEqualTo(pcId);
|
||||
return ruleDAO.selectByExample(example);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验规则当前规定的总分值是否等于试卷蓝图中的满分
|
||||
*/
|
||||
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();
|
||||
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();
|
||||
}
|
||||
return ruleScore == curPc.getFullScore();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,213 +21,217 @@ import club.joylink.rtss.vo.client.project.VrpsdConfigVO;
|
|||
import java.util.List;
|
||||
|
||||
public interface DeviceService {
|
||||
/**
|
||||
* 分页查询项目设备
|
||||
*
|
||||
* @param queryVO
|
||||
* @param userLoginInfo
|
||||
* @return
|
||||
*/
|
||||
PageVO<ProjectDeviceVO> pagingQuery(ProjectDevicePageQueryVO queryVO);
|
||||
|
||||
/**
|
||||
* 项目设备编码是否存在
|
||||
*
|
||||
* @param project
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
boolean isDeviceCodeExist(String project, String code);
|
||||
/**
|
||||
* 分页查询项目设备
|
||||
*
|
||||
* @param queryVO
|
||||
* @return
|
||||
*/
|
||||
PageVO<ProjectDeviceVO> pagingQuery(ProjectDevicePageQueryVO queryVO);
|
||||
|
||||
/**
|
||||
* 新增设备
|
||||
*
|
||||
* @param deviceVO
|
||||
* @param userLoginInfo
|
||||
* @return
|
||||
*/
|
||||
String create(ProjectDeviceVO deviceVO, LoginUserInfoVO userLoginInfo);
|
||||
/**
|
||||
* 项目设备编码是否存在
|
||||
*
|
||||
* @param project
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
boolean isDeviceCodeExist(String project, String code);
|
||||
|
||||
/**
|
||||
* 获取设备基础信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ProjectDeviceVO getDeviceBaseInfoById(Long id);
|
||||
/**
|
||||
* 新增设备
|
||||
*
|
||||
* @param deviceVO
|
||||
* @param userLoginInfo
|
||||
* @return
|
||||
*/
|
||||
String create(ProjectDeviceVO deviceVO, LoginUserInfoVO userLoginInfo);
|
||||
|
||||
void updatePlcGatewayConfig(Long id, PlcGatewayConfigVO configVO);
|
||||
/**
|
||||
* 获取设备基础信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ProjectDeviceVO getDeviceBaseInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 更新道岔配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateSwitchConfig(Long id, SwitchConfigVO configVO);
|
||||
void updatePlcGatewayConfig(Long id, PlcGatewayConfigVO configVO);
|
||||
|
||||
/**
|
||||
* 更新信号机配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateSignalConfig(Long id, SignalConfigVO configVO);
|
||||
/**
|
||||
* 更新道岔配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateSwitchConfig(Long id, SwitchConfigVO configVO);
|
||||
|
||||
/**
|
||||
* 更新屏蔽门控制柜配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updatePscConfig(Long id, PscConfigVO configVO);
|
||||
/**
|
||||
* 更新信号机配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateSignalConfig(Long id, SignalConfigVO configVO);
|
||||
|
||||
/**
|
||||
* 更新屏蔽门配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updatePsdConfig(Long id, PsdConfigVO configVO);
|
||||
/**
|
||||
* 更新屏蔽门控制柜配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updatePscConfig(Long id, PscConfigVO configVO);
|
||||
|
||||
/**
|
||||
* 更新屏蔽门控制盒配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updatePslConfig(Long id, PslConfigVO configVO);
|
||||
/**
|
||||
* 更新屏蔽门配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updatePsdConfig(Long id, PsdConfigVO configVO);
|
||||
|
||||
/**
|
||||
* 更新IBP盘配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateIbpConfig(Long id, IbpConfigVO configVO);
|
||||
/**
|
||||
* 更新屏蔽门控制盒配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updatePslConfig(Long id, PslConfigVO configVO);
|
||||
|
||||
/**
|
||||
* 更新虚拟IBP盘配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateVrIbpConfig(Long id, VrIbpConfigVO configVO);
|
||||
/**
|
||||
* 更新IBP盘配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateIbpConfig(Long id, IbpConfigVO configVO);
|
||||
|
||||
/**
|
||||
* 更新现地工作站配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateLwConfig(Long id, LwConfigVO configVO);
|
||||
/**
|
||||
* 更新虚拟IBP盘配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateVrIbpConfig(Long id, VrIbpConfigVO configVO);
|
||||
|
||||
/**
|
||||
* 更新大屏工作站配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateLswConfig(Long id, LswConfigVO configVO);
|
||||
/**
|
||||
* 更新现地工作站配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateLwConfig(Long id, LwConfigVO configVO);
|
||||
|
||||
/**
|
||||
* 更新CCTV工作站配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateCctvConfig(Long id, RelationLoginConfigVO configVO);
|
||||
/**
|
||||
* 更新大屏工作站配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateLswConfig(Long id, LswConfigVO configVO);
|
||||
|
||||
/**
|
||||
* 更新电子沙盘工作站配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateSandboxConfig(Long id, RelationLoginConfigVO configVO);
|
||||
/**
|
||||
* 更新CCTV工作站配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateCctvConfig(Long id, RelationLoginConfigVO configVO);
|
||||
|
||||
/**
|
||||
* 更新现地ISCS工作站配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateIscsLwConfig(Long id, RelationLoginConfigVO configVO);
|
||||
/**
|
||||
* 更新电子沙盘工作站配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateSandboxConfig(Long id, RelationLoginConfigVO configVO);
|
||||
|
||||
/**
|
||||
* 更新中心ISCS工作站配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateIscsCwConfig(Long id, RelationLoginConfigVO configVO);
|
||||
/**
|
||||
* 更新现地ISCS工作站配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateIscsLwConfig(Long id, RelationLoginConfigVO configVO);
|
||||
|
||||
/**
|
||||
* 更新虚拟屏蔽门客户端配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateVrpsdConfig(Long id, VrpsdConfigVO configVO);
|
||||
/**
|
||||
* 更新中心ISCS工作站配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateIscsCwConfig(Long id, RelationLoginConfigVO configVO);
|
||||
|
||||
/**
|
||||
* 更新联锁工作站客户端配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateIlwConfig(Long id, RelationLoginConfigVO configVO);
|
||||
/**
|
||||
* 更新虚拟屏蔽门客户端配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateVrpsdConfig(Long id, VrpsdConfigVO configVO);
|
||||
|
||||
/**
|
||||
* 更新(以json直接更新)
|
||||
*/
|
||||
void updateConfig(ProjectDeviceVO projectDeviceVO);
|
||||
/**
|
||||
* 更新联锁工作站客户端配置
|
||||
*
|
||||
* @param id
|
||||
* @param configVO
|
||||
*/
|
||||
void updateIlwConfig(Long id, RelationLoginConfigVO configVO);
|
||||
|
||||
/**
|
||||
* 删除设备
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void delete(Long id);
|
||||
/**
|
||||
* 更新(以json直接更新)
|
||||
*/
|
||||
void updateConfig(ProjectDeviceVO projectDeviceVO);
|
||||
|
||||
/**
|
||||
* 查询某分类下的所有设备
|
||||
*
|
||||
* @param type
|
||||
* @param project
|
||||
* @return
|
||||
*/
|
||||
List<ProjectDeviceVO> queryByType(ProjectDeviceType type, String project);
|
||||
/**
|
||||
* 删除设备
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void delete(Long id);
|
||||
|
||||
ProjectDeviceVO getDeviceDetailInfoById(Long id);
|
||||
/**
|
||||
* 查询某分类下的所有设备
|
||||
*
|
||||
* @param type
|
||||
* @param project
|
||||
* @return
|
||||
*/
|
||||
List<ProjectDeviceVO> queryByType(ProjectDeviceType type, String project);
|
||||
|
||||
/**
|
||||
* TODO 20220922用于替换上方方法,占位
|
||||
*/
|
||||
ProjectDeviceVO getDeviceDetailInfoOf(String projectCode, String deviceCode);
|
||||
ProjectDeviceVO getDeviceDetailInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询指定分类下的所有设备
|
||||
*
|
||||
* @param typeList
|
||||
* @param project
|
||||
* @return
|
||||
*/
|
||||
List<ProjectDeviceVO> queryDetailByTypes(List<ProjectDeviceType> typeList, String project);
|
||||
/**
|
||||
* 用于替换上方方法,占位
|
||||
*/
|
||||
ProjectDeviceVO getDeviceDetailInfoOf(String projectCode, String deviceCode);
|
||||
|
||||
void addOrUpdateXtyDeviceConfig(AccountVO accountVO);
|
||||
/**
|
||||
* 查询指定分类下的所有设备
|
||||
*
|
||||
* @param typeList
|
||||
* @param project
|
||||
* @return
|
||||
*/
|
||||
List<ProjectDeviceVO> queryDetailByTypes(List<ProjectDeviceType> typeList, String project);
|
||||
|
||||
void addOrUpdateGzbDeviceConfig(AccountVO accountVO);
|
||||
void addOrUpdateXtyDeviceConfig(AccountVO accountVO);
|
||||
|
||||
void addOrUpdateSdyDeviceConfig(AccountVO accountVO);
|
||||
void addOrUpdateGzbDeviceConfig(AccountVO accountVO);
|
||||
|
||||
void addOrUpdateRichorDeviceConfig(AccountVO accountVO);
|
||||
void addOrUpdateSdyDeviceConfig(AccountVO accountVO);
|
||||
|
||||
void addOrUpdateSrDeviceConfig(AccountVO accountVO, Long mapId);
|
||||
void addOrUpdateRichorDeviceConfig(AccountVO accountVO);
|
||||
|
||||
void addOrUpdateHhcjDeviceConfig(AccountVO accountVO);
|
||||
void addOrUpdateSrDeviceConfig(AccountVO accountVO, Long mapId);
|
||||
|
||||
void addOrUpdateSayDeviceConfig(AccountVO accountVO);
|
||||
void addOrUpdateHhcjDeviceConfig(AccountVO accountVO);
|
||||
|
||||
void addOrUpdateThailandDeviceConfig(AccountVO accountVO, Long mapId);
|
||||
void addOrUpdateSayDeviceConfig(AccountVO accountVO);
|
||||
|
||||
void addOrUpdateThailandDeviceConfig(AccountVO accountVO, Long mapId);
|
||||
|
||||
void addOrUpdateNgyDeviceConfig(AccountVO accountVO, Long mapId);
|
||||
|
||||
void addOrUpdateCdgxyDeviceConfig(AccountVO user);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,10 @@ import club.joylink.rtss.entity.ProjectDevice;
|
|||
import club.joylink.rtss.entity.ProjectDeviceExample;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.IMapService;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.udp.config.SandTableSectionConfigVO;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.udp.config.SandTableSignalConfigVO;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.udp.config.SandTableSwitchConfigVO;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.udp.config.SandTableTrainConfigVO;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.udp.thailand.service.ThailandSignalServiceImpl;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.udp.thailand.service.ThailandSwitchServiceImpl;
|
||||
import club.joylink.rtss.util.JsonUtils;
|
||||
|
@ -30,6 +34,10 @@ 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;
|
||||
|
@ -67,6 +75,7 @@ import java.util.Objects;
|
|||
import java.util.stream.Collectors;
|
||||
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;
|
||||
|
||||
|
@ -79,6 +88,9 @@ public class DeviceServiceImpl implements DeviceService {
|
|||
@Autowired
|
||||
private IMapService iMapService;
|
||||
|
||||
@Autowired
|
||||
private ProjectService projectService;
|
||||
|
||||
// 修改项目编码 20221009
|
||||
@Override
|
||||
public PageVO<ProjectDeviceVO> pagingQuery(ProjectDevicePageQueryVO queryVO) {
|
||||
|
@ -248,7 +260,8 @@ 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);
|
||||
}
|
||||
|
@ -258,7 +271,8 @@ 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);
|
||||
}
|
||||
|
@ -268,7 +282,8 @@ 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);
|
||||
}
|
||||
|
@ -278,7 +293,8 @@ 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);
|
||||
}
|
||||
|
@ -519,6 +535,127 @@ public class DeviceServiceImpl implements DeviceService {
|
|||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void addOrUpdateNgyDeviceConfig(AccountVO accountVO, Long mapId) {
|
||||
// 删除旧配置
|
||||
ProjectDeviceExample example = new ProjectDeviceExample();
|
||||
example.createCriteria()
|
||||
.andProjectCodeEqualTo(ProjectCode.NGY_SAND_TABLE)
|
||||
.andTypeIn(ProjectDeviceType.PlcDeviceList().stream().map(Enum::name)
|
||||
.collect(Collectors.toList()));
|
||||
this.projectDeviceDAO.deleteByExample(example);
|
||||
// 保存新配置
|
||||
List<ProjectDevice> list = this.buildNgyProjectDevices(accountVO, mapId,
|
||||
ProjectCode.NGY_SAND_TABLE);
|
||||
for (ProjectDevice projectDevice : list) {
|
||||
this.projectDeviceDAO.insert(projectDevice);
|
||||
}
|
||||
}
|
||||
|
||||
@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<>();
|
||||
|
@ -1081,4 +1218,146 @@ public class DeviceServiceImpl implements DeviceService {
|
|||
configVO.setHeadDelayTime(headDelayTime);
|
||||
configVO.setTailDelayTime(tailDelayTime);
|
||||
}
|
||||
|
||||
private List<ProjectDevice> buildNgyProjectDevices(AccountVO accountVO, long mapId,
|
||||
String projectCode) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
List<ProjectDevice> list = new ArrayList<>();
|
||||
//道岔和列车数据发送端口
|
||||
ProjectDevice switchTrainUdpLow = new ProjectDevice();
|
||||
switchTrainUdpLow.setProjectCode(projectCode);
|
||||
switchTrainUdpLow.setCode("udp-sender-1");
|
||||
switchTrainUdpLow.setType(ProjectDeviceType.UDP_LOW.name());
|
||||
switchTrainUdpLow.setCreator(accountVO.getId());
|
||||
switchTrainUdpLow.setCreateTime(now);
|
||||
switchTrainUdpLow.setConfig(
|
||||
new UDPLowConfigVO(ThailandSwitchServiceImpl.NAME, "192.168.0.10", 44449).toJson());
|
||||
list.add(switchTrainUdpLow);
|
||||
//信号机数据发送端口
|
||||
ProjectDevice signalUdpLow = new ProjectDevice();
|
||||
signalUdpLow.setProjectCode(projectCode);
|
||||
signalUdpLow.setCode("udp-sender-2");
|
||||
signalUdpLow.setType(ProjectDeviceType.UDP_LOW.name());
|
||||
signalUdpLow.setCreator(accountVO.getId());
|
||||
signalUdpLow.setCreateTime(now);
|
||||
signalUdpLow.setConfig(
|
||||
new UDPLowConfigVO(ThailandSignalServiceImpl.NAME, "192.168.0.10", 44445).toJson());
|
||||
list.add(signalUdpLow);
|
||||
//UDP数据接收
|
||||
ProjectDevice udpClient = new ProjectDevice();
|
||||
udpClient.setProjectCode(projectCode);
|
||||
udpClient.setCode("udp-receiver");
|
||||
udpClient.setType(ProjectDeviceType.UDP_CLIENT.name());
|
||||
udpClient.setCreator(accountVO.getId());
|
||||
udpClient.setCreateTime(now);
|
||||
UDPClientConfigVO udpClientConfigVO = new UDPClientConfigVO("192.168.0.10", 44449);
|
||||
udpClient.setConfig(JsonUtils.writeValueAsString(udpClientConfigVO));
|
||||
list.add(udpClient);
|
||||
/*-------------------- 地图设备 --------------------*/
|
||||
MapVO map = iMapService.getMapDetail(mapId);
|
||||
MapGraphDataNewVO graphDataNew = map.getGraphDataNew();
|
||||
//信号机
|
||||
for (MapSignalNewVO mapSignalNewVO : graphDataNew.getSignalList()) {
|
||||
if (StringUtils.hasText(mapSignalNewVO.getSrCode())) {
|
||||
ProjectDevice signal = new ProjectDevice();
|
||||
signal.setProjectCode(projectCode);
|
||||
signal.setCode(
|
||||
String.join("-", "signal", mapSignalNewVO.getCode(), mapSignalNewVO.getName()));
|
||||
signal.setType(ProjectDeviceType.SIGNAL.name());
|
||||
signal.setCreator(accountVO.getId());
|
||||
signal.setCreateTime(now);
|
||||
SandTableSignalConfigVO configVO = new SandTableSignalConfigVO(mapSignalNewVO.getCode(),
|
||||
mapSignalNewVO.getSrCode());
|
||||
signal.setConfig(JsonUtils.writeValueAsString(configVO));
|
||||
list.add(signal);
|
||||
}
|
||||
}
|
||||
//道岔
|
||||
for (MapSwitchVO mapSwitchVO : graphDataNew.getSwitchList()) {
|
||||
if (StringUtils.hasText(mapSwitchVO.getSrCode())) {
|
||||
ProjectDevice aSwitch = new ProjectDevice();
|
||||
aSwitch.setProjectCode(projectCode);
|
||||
aSwitch.setCode(String.join("-", "switch", mapSwitchVO.getCode(), mapSwitchVO.getName()));
|
||||
aSwitch.setType(ProjectDeviceType.SWITCH.name());
|
||||
aSwitch.setCreator(accountVO.getId());
|
||||
aSwitch.setCreateTime(now);
|
||||
SandTableSwitchConfigVO configVO = new SandTableSwitchConfigVO(mapSwitchVO.getCode(),
|
||||
mapSwitchVO.getSrCode());
|
||||
aSwitch.setConfig(JsonUtils.writeValueAsString(configVO));
|
||||
list.add(aSwitch);
|
||||
}
|
||||
}
|
||||
//区段
|
||||
for (MapSectionNewVO mapSectionNewVO : graphDataNew.getSectionList()) {
|
||||
if (StringUtils.hasText(mapSectionNewVO.getSrCode())) {
|
||||
ProjectDevice section = new ProjectDevice();
|
||||
section.setProjectCode(projectCode);
|
||||
section.setCode(
|
||||
String.join("-", "section", mapSectionNewVO.getCode(), mapSectionNewVO.getName()));
|
||||
section.setType(ProjectDeviceType.SECTION.name());
|
||||
section.setCreator(accountVO.getId());
|
||||
section.setCreateTime(now);
|
||||
SandTableSectionConfigVO configVO = new SandTableSectionConfigVO(mapSectionNewVO.getCode(),
|
||||
mapSectionNewVO.getSrCode());
|
||||
section.setConfig(JsonUtils.writeValueAsString(configVO));
|
||||
ngyFillTime(configVO, mapSectionNewVO);
|
||||
list.add(section);
|
||||
}
|
||||
}
|
||||
//列车
|
||||
List<MapTrainVO> trainList = graphDataNew.getTrainList();
|
||||
for (MapTrainVO mapTrainVO : trainList) {
|
||||
ProjectDevice train = new ProjectDevice();
|
||||
train.setProjectCode(projectCode);
|
||||
train.setCode("train-" + mapTrainVO.getGroupNumber());
|
||||
train.setType(ProjectDeviceType.TRAIN.name());
|
||||
train.setCreator(accountVO.getId());
|
||||
train.setCreateTime(now);
|
||||
SandTableTrainConfigVO configVO = new SandTableTrainConfigVO(mapTrainVO.getGroupNumber(),
|
||||
String.valueOf(Integer.parseInt(mapTrainVO.getGroupNumber())));
|
||||
train.setConfig(JsonUtils.writeValueAsString(configVO));
|
||||
list.add(train);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private void ngyFillTime(SandTableSectionConfigVO configVO, MapSectionNewVO section) {
|
||||
Float headDelayTime = null;
|
||||
Float tailDelayTime = null;
|
||||
if (section.isStandTrack() || section.isReentryTrack() || section.isTransferTrack()) {
|
||||
if (section.isStandTrack()) {
|
||||
tailDelayTime = 1f;
|
||||
} else {
|
||||
tailDelayTime = 0f;
|
||||
}
|
||||
} else {
|
||||
headDelayTime = 2f;
|
||||
}
|
||||
switch (section.getCode()) {
|
||||
case "T68": // 43G
|
||||
tailDelayTime = 1.4f;
|
||||
break;
|
||||
case "T62": //37G
|
||||
tailDelayTime = 0.8f;
|
||||
break;
|
||||
case "T35": //9G
|
||||
tailDelayTime = 1.3f;
|
||||
break;
|
||||
case "T33": //5G
|
||||
tailDelayTime = 0.9f;
|
||||
break;
|
||||
case "T5": //8G
|
||||
tailDelayTime = 0.8f;
|
||||
break;
|
||||
case "T7": //12G
|
||||
tailDelayTime = 0.6f;
|
||||
break;
|
||||
case "T45": //24G
|
||||
tailDelayTime = 0.8f;
|
||||
break;
|
||||
}
|
||||
configVO.setHeadDelayTime(headDelayTime);
|
||||
configVO.setTailDelayTime(tailDelayTime);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,152 +12,166 @@ 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;
|
||||
@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);
|
||||
}
|
||||
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 GM:
|
||||
if (on) {
|
||||
ciApiService.closeScreenDoor(simulation, stand.getCode(),
|
||||
CiStandService.PsdCommandSource.PSL);
|
||||
}
|
||||
break;
|
||||
case SD:
|
||||
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:
|
||||
case GM:
|
||||
break;
|
||||
case SD:
|
||||
vrPsl.setSdButton(on);
|
||||
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);
|
||||
}
|
||||
effective(simulation, vrPsl.getStand(), button, on);
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(collectionMap)) {
|
||||
applicationContext.publishEvent(
|
||||
new SimulationPslStatusEvent(this, simulation, collectionMap));
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,12 @@ import club.joylink.rtss.constants.MapStatus;
|
|||
import club.joylink.rtss.dao.IscsDAO;
|
||||
import club.joylink.rtss.dao.MapDataDAO;
|
||||
import club.joylink.rtss.dao.MapInfoDAO;
|
||||
import club.joylink.rtss.entity.*;
|
||||
import club.joylink.rtss.entity.Iscs;
|
||||
import club.joylink.rtss.entity.IscsExample;
|
||||
import club.joylink.rtss.entity.MapDataExample;
|
||||
import club.joylink.rtss.entity.MapDataWithBLOBs;
|
||||
import club.joylink.rtss.entity.MapInfo;
|
||||
import club.joylink.rtss.entity.MapInfoExample;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.IMapService;
|
||||
import club.joylink.rtss.services.cache.ICacheService;
|
||||
|
@ -18,250 +23,267 @@ import club.joylink.rtss.vo.map.MapCheckConfig;
|
|||
import club.joylink.rtss.vo.map.MapGraphDataNewVO;
|
||||
import club.joylink.rtss.vo.map.MapLogicDataNewVO;
|
||||
import club.joylink.rtss.vo.map.MapVO;
|
||||
import club.joylink.rtss.vo.map.graph.MapSectionNewVO;
|
||||
import club.joylink.rtss.vo.map.graph.MapSignalNewVO;
|
||||
import club.joylink.rtss.vo.map.logic.MapRouteNewVO;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class PublishMapDataHandler {
|
||||
@Autowired
|
||||
private IMapService iMapService;
|
||||
@Autowired
|
||||
private MapInfoDAO mapInfoDAO;
|
||||
@Autowired
|
||||
private MapDataDAO mapDataDAO;
|
||||
@Autowired
|
||||
private IscsDAO iscsDAO;
|
||||
@Autowired
|
||||
private ICacheService iCacheService;
|
||||
|
||||
public List<MapInfo> queryMapInfos() {
|
||||
MapInfoExample example = new MapInfoExample();
|
||||
example.createCriteria().andStatusNotEqualTo(MapStatus.Delete.getCode());
|
||||
List<MapInfo> mapInfos = this.mapInfoDAO.selectByExample(example);
|
||||
return mapInfos;
|
||||
}
|
||||
@Autowired
|
||||
private IMapService iMapService;
|
||||
@Autowired
|
||||
private MapInfoDAO mapInfoDAO;
|
||||
@Autowired
|
||||
private MapDataDAO mapDataDAO;
|
||||
@Autowired
|
||||
private IscsDAO iscsDAO;
|
||||
@Autowired
|
||||
private ICacheService iCacheService;
|
||||
|
||||
public void dataHandle() {
|
||||
List<MapInfo> mapInfos = this.queryMapInfos();
|
||||
for (MapInfo mapInfo : mapInfos) {
|
||||
this.handle(mapInfo);
|
||||
}
|
||||
}
|
||||
public List<MapInfo> queryMapInfos() {
|
||||
MapInfoExample example = new MapInfoExample();
|
||||
example.createCriteria().andStatusNotEqualTo(MapStatus.Delete.getCode());
|
||||
List<MapInfo> mapInfos = this.mapInfoDAO.selectByExample(example);
|
||||
return mapInfos;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void handle(MapInfo mapInfo) {
|
||||
Long mapId = mapInfo.getId();
|
||||
MapVO detail = this.iMapService.getMapDetail(mapId);
|
||||
MapGraphDataNewVO graphDataNew = detail.getGraphDataNew();
|
||||
List<MapSignalNewVO> signalList = graphDataNew.getSignalList();
|
||||
for (MapSignalNewVO signal : signalList) {
|
||||
Signal.SignalType type = signal.getType();
|
||||
switch (type) {
|
||||
case PROTECTION:
|
||||
case PASSING:
|
||||
signal.setSignalModel(SignalModel.RGY.name());
|
||||
break;
|
||||
case BLOCKING:
|
||||
signal.setSignalModel(SignalModel.R.name());
|
||||
break;
|
||||
case SHUNTING:
|
||||
signal.setSignalModel(SignalModel.BW.name());
|
||||
break;
|
||||
case ARRIVAL:
|
||||
signal.setSignalModel(SignalModel.YGRYW.name());
|
||||
break;
|
||||
case EXIT:
|
||||
signal.setSignalModel(SignalModel.YGRGW.name());
|
||||
break;
|
||||
}
|
||||
}
|
||||
MapLogicDataNewVO logicDataNew = detail.getLogicDataNew();
|
||||
List<MapRouteNewVO> routeList = logicDataNew.getRouteList();
|
||||
for (MapRouteNewVO route : routeList) {
|
||||
if (route.isGreenOpen()) {
|
||||
route.setAspect(SignalAspect.G);
|
||||
} else {
|
||||
route.setAspect(SignalAspect.Y);
|
||||
}
|
||||
}
|
||||
//地图数据
|
||||
MapDataWithBLOBs mapData = new MapDataWithBLOBs();
|
||||
mapData.setMapId(mapId);
|
||||
mapData.setGraphData(JsonUtils.writeValueAsString(graphDataNew));
|
||||
mapData.setLogicData(JsonUtils.writeValueAsString(detail.getLogicDataNew()));
|
||||
if (detail.getCheckConfig() != null) {
|
||||
mapData.setCheckConfig(detail.getCheckConfig().toJson());
|
||||
} else {
|
||||
mapData.setCheckConfig(new MapCheckConfig().toJson());
|
||||
}
|
||||
mapData.setVersion(VersionUtil.generateNext(this.iMapService.findMapVersion(mapId)));
|
||||
mapData.setNote("处理进路信号显示");
|
||||
mapData.setTime(LocalDateTime.now());
|
||||
mapData.setUserId(1L);
|
||||
mapDataDAO.insert(mapData);
|
||||
// 更新地图当前使用的地图数据版本
|
||||
MapInfo map = new MapInfo();
|
||||
map.setId(mapId);
|
||||
map.setVersion(mapData.getVersion());
|
||||
mapInfoDAO.updateByPrimaryKeySelective(map);
|
||||
this.iMapService.removeCache(mapId);
|
||||
public void dataHandle() {
|
||||
List<MapInfo> mapInfos = this.queryMapInfos();
|
||||
for (MapInfo mapInfo : mapInfos) {
|
||||
this.handle(mapInfo);
|
||||
}
|
||||
}
|
||||
|
||||
public void xian3Handle() {
|
||||
MapInfoExample example = new MapInfoExample();
|
||||
example.createCriteria()
|
||||
.andLineCodeEqualTo("11")
|
||||
.andStatusNotEqualTo(MapStatus.Delete.getCode());
|
||||
List<MapInfo> mapInfos = this.mapInfoDAO.selectByExample(example);
|
||||
for (MapInfo mapInfo : mapInfos) {
|
||||
handleSignal(mapInfo);
|
||||
}
|
||||
@Transactional
|
||||
public void handle(MapInfo mapInfo) {
|
||||
Long mapId = mapInfo.getId();
|
||||
MapVO detail = this.iMapService.getMapDetail(mapId);
|
||||
MapGraphDataNewVO graphDataNew = detail.getGraphDataNew();
|
||||
List<MapSignalNewVO> signalList = graphDataNew.getSignalList();
|
||||
for (MapSignalNewVO signal : signalList) {
|
||||
Signal.SignalType type = signal.getType();
|
||||
switch (type) {
|
||||
case PROTECTION:
|
||||
case PASSING:
|
||||
signal.setSignalModel(SignalModel.RGY.name());
|
||||
break;
|
||||
case BLOCKING:
|
||||
signal.setSignalModel(SignalModel.R.name());
|
||||
break;
|
||||
case SHUNTING:
|
||||
signal.setSignalModel(SignalModel.BW.name());
|
||||
break;
|
||||
case ARRIVAL:
|
||||
signal.setSignalModel(SignalModel.YGRYW.name());
|
||||
break;
|
||||
case EXIT:
|
||||
signal.setSignalModel(SignalModel.YGRGW.name());
|
||||
break;
|
||||
}
|
||||
}
|
||||
MapLogicDataNewVO logicDataNew = detail.getLogicDataNew();
|
||||
List<MapRouteNewVO> routeList = logicDataNew.getRouteList();
|
||||
for (MapRouteNewVO route : routeList) {
|
||||
if (route.isGreenOpen()) {
|
||||
route.setAspect(SignalAspect.G);
|
||||
} else {
|
||||
route.setAspect(SignalAspect.Y);
|
||||
}
|
||||
}
|
||||
//地图数据
|
||||
MapDataWithBLOBs mapData = new MapDataWithBLOBs();
|
||||
mapData.setMapId(mapId);
|
||||
mapData.setGraphData(JsonUtils.writeValueAsString(graphDataNew));
|
||||
mapData.setLogicData(JsonUtils.writeValueAsString(detail.getLogicDataNew()));
|
||||
if (detail.getCheckConfig() != null) {
|
||||
mapData.setCheckConfig(detail.getCheckConfig().toJson());
|
||||
} else {
|
||||
mapData.setCheckConfig(new MapCheckConfig().toJson());
|
||||
}
|
||||
mapData.setVersion(VersionUtil.generateNext(this.iMapService.findMapVersion(mapId)));
|
||||
mapData.setNote("处理进路信号显示");
|
||||
mapData.setTime(LocalDateTime.now());
|
||||
mapData.setUserId(1L);
|
||||
mapDataDAO.insert(mapData);
|
||||
// 更新地图当前使用的地图数据版本
|
||||
MapInfo map = new MapInfo();
|
||||
map.setId(mapId);
|
||||
map.setVersion(mapData.getVersion());
|
||||
mapInfoDAO.updateByPrimaryKeySelective(map);
|
||||
this.iMapService.removeCache(mapId);
|
||||
}
|
||||
|
||||
private void handleSignal(MapInfo mapInfo) {
|
||||
Long mapId = mapInfo.getId();
|
||||
MapVO detail = this.iMapService.getMapDetail(mapId);
|
||||
MapGraphDataNewVO graphDataNew = detail.getGraphDataNew();
|
||||
List<MapSignalNewVO> signalList = graphDataNew.getSignalList();
|
||||
MapLogicDataNewVO logicDataNew = detail.getLogicDataNew();
|
||||
List<MapRouteNewVO> routeList = logicDataNew.getRouteList();
|
||||
Map<String, MapRouteNewVO> routeMap = new HashMap<>();
|
||||
for (MapRouteNewVO mapRouteNewVO : routeList) {
|
||||
if (mapRouteNewVO.getEndSignalCode() != null) {
|
||||
if (!routeMap.containsKey(mapRouteNewVO.getEndSignalCode())) {
|
||||
routeMap.put(mapRouteNewVO.getEndSignalCode(), mapRouteNewVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (MapSignalNewVO signalVO : signalList) {
|
||||
MapRouteNewVO route = routeMap.get(signalVO.getCode());
|
||||
if (route != null) {
|
||||
signalVO.setCtcSetOverlap(route.isSetOverlapInCtc());
|
||||
}
|
||||
}
|
||||
//地图数据
|
||||
MapDataWithBLOBs mapData = new MapDataWithBLOBs();
|
||||
mapData.setMapId(mapId);
|
||||
mapData.setGraphData(JsonUtils.writeValueAsString(graphDataNew));
|
||||
mapData.setLogicData(JsonUtils.writeValueAsString(detail.getLogicDataNew()));
|
||||
if (detail.getCheckConfig() != null) {
|
||||
mapData.setCheckConfig(detail.getCheckConfig().toJson());
|
||||
} else {
|
||||
mapData.setCheckConfig(new MapCheckConfig().toJson());
|
||||
}
|
||||
mapData.setVersion(VersionUtil.generateNext(this.iMapService.findMapVersion(mapId)));
|
||||
mapData.setNote("处理信号机CTC级别是否办理延续保护");
|
||||
mapData.setTime(LocalDateTime.now());
|
||||
mapData.setUserId(1L);
|
||||
mapDataDAO.insert(mapData);
|
||||
// 更新地图当前使用的地图数据版本
|
||||
MapInfo map = new MapInfo();
|
||||
map.setId(mapId);
|
||||
map.setVersion(mapData.getVersion());
|
||||
mapInfoDAO.updateByPrimaryKeySelective(map);
|
||||
this.iMapService.removeCache(mapId);
|
||||
public void xian3Handle() {
|
||||
MapInfoExample example = new MapInfoExample();
|
||||
example.createCriteria()
|
||||
.andLineCodeEqualTo("11")
|
||||
.andStatusNotEqualTo(MapStatus.Delete.getCode());
|
||||
List<MapInfo> mapInfos = this.mapInfoDAO.selectByExample(example);
|
||||
for (MapInfo mapInfo : mapInfos) {
|
||||
handleSignal(mapInfo);
|
||||
}
|
||||
}
|
||||
|
||||
public void signalShowDirection() {
|
||||
MapInfoExample example = new MapInfoExample();
|
||||
example.createCriteria()
|
||||
.andStatusNotEqualTo(MapStatus.Delete.getCode());
|
||||
List<MapInfo> mapInfos = this.mapInfoDAO.selectByExample(example);
|
||||
for (MapInfo mapInfo : mapInfos) {
|
||||
handleSignalShowDirection(mapInfo);
|
||||
private void handleSignal(MapInfo mapInfo) {
|
||||
Long mapId = mapInfo.getId();
|
||||
MapVO detail = this.iMapService.getMapDetail(mapId);
|
||||
MapGraphDataNewVO graphDataNew = detail.getGraphDataNew();
|
||||
List<MapSignalNewVO> signalList = graphDataNew.getSignalList();
|
||||
MapLogicDataNewVO logicDataNew = detail.getLogicDataNew();
|
||||
List<MapRouteNewVO> routeList = logicDataNew.getRouteList();
|
||||
Map<String, MapRouteNewVO> routeMap = new HashMap<>();
|
||||
for (MapRouteNewVO mapRouteNewVO : routeList) {
|
||||
if (mapRouteNewVO.getEndSignalCode() != null) {
|
||||
if (!routeMap.containsKey(mapRouteNewVO.getEndSignalCode())) {
|
||||
routeMap.put(mapRouteNewVO.getEndSignalCode(), mapRouteNewVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (MapSignalNewVO signalVO : signalList) {
|
||||
MapRouteNewVO route = routeMap.get(signalVO.getCode());
|
||||
if (route != null) {
|
||||
signalVO.setCtcSetOverlap(route.isSetOverlapInCtc());
|
||||
}
|
||||
}
|
||||
//地图数据
|
||||
MapDataWithBLOBs mapData = new MapDataWithBLOBs();
|
||||
mapData.setMapId(mapId);
|
||||
mapData.setGraphData(JsonUtils.writeValueAsString(graphDataNew));
|
||||
mapData.setLogicData(JsonUtils.writeValueAsString(detail.getLogicDataNew()));
|
||||
if (detail.getCheckConfig() != null) {
|
||||
mapData.setCheckConfig(detail.getCheckConfig().toJson());
|
||||
} else {
|
||||
mapData.setCheckConfig(new MapCheckConfig().toJson());
|
||||
}
|
||||
mapData.setVersion(VersionUtil.generateNext(this.iMapService.findMapVersion(mapId)));
|
||||
mapData.setNote("处理信号机CTC级别是否办理延续保护");
|
||||
mapData.setTime(LocalDateTime.now());
|
||||
mapData.setUserId(1L);
|
||||
mapDataDAO.insert(mapData);
|
||||
// 更新地图当前使用的地图数据版本
|
||||
MapInfo map = new MapInfo();
|
||||
map.setId(mapId);
|
||||
map.setVersion(mapData.getVersion());
|
||||
mapInfoDAO.updateByPrimaryKeySelective(map);
|
||||
this.iMapService.removeCache(mapId);
|
||||
}
|
||||
|
||||
private void handleSignalShowDirection(MapInfo mapInfo) {
|
||||
Long mapId = mapInfo.getId();
|
||||
MapVO detail = this.iMapService.getMapDetail(mapId);
|
||||
MapGraphDataNewVO graphDataNew = detail.getGraphDataNew();
|
||||
List<MapSignalNewVO> signalList = graphDataNew.getSignalList();
|
||||
for (MapSignalNewVO signalVO : signalList) {
|
||||
signalVO.setShowRight(signalVO.isRight());
|
||||
}
|
||||
//地图数据
|
||||
MapDataWithBLOBs mapData = new MapDataWithBLOBs();
|
||||
mapData.setMapId(mapId);
|
||||
mapData.setGraphData(JsonUtils.writeValueAsString(graphDataNew));
|
||||
mapData.setLogicData(JsonUtils.writeValueAsString(detail.getLogicDataNew()));
|
||||
if (detail.getCheckConfig() != null) {
|
||||
mapData.setCheckConfig(detail.getCheckConfig().toJson());
|
||||
} else {
|
||||
mapData.setCheckConfig(new MapCheckConfig().toJson());
|
||||
}
|
||||
mapData.setVersion(VersionUtil.generateNext(this.iMapService.findMapVersion(mapId)));
|
||||
mapData.setNote("处理信号机显示方向");
|
||||
mapData.setTime(LocalDateTime.now());
|
||||
mapData.setUserId(1L);
|
||||
mapDataDAO.insert(mapData);
|
||||
// 更新地图当前使用的地图数据版本
|
||||
MapInfo map = new MapInfo();
|
||||
map.setId(mapId);
|
||||
map.setVersion(mapData.getVersion());
|
||||
mapInfoDAO.updateByPrimaryKeySelective(map);
|
||||
this.iMapService.removeCache(mapId);
|
||||
public void signalShowDirection() {
|
||||
MapInfoExample example = new MapInfoExample();
|
||||
example.createCriteria()
|
||||
.andStatusNotEqualTo(MapStatus.Delete.getCode());
|
||||
List<MapInfo> mapInfos = this.mapInfoDAO.selectByExample(example);
|
||||
for (MapInfo mapInfo : mapInfos) {
|
||||
handleSignalShowDirection(mapInfo);
|
||||
}
|
||||
}
|
||||
|
||||
public void changeStationName(long mapId, Map<String, String> nameMap) {
|
||||
// 修改地图数据
|
||||
MapDataWithBLOBs mapData = getMapDataEntity(mapId);
|
||||
String graphData = mapData.getGraphData();
|
||||
String logicData = mapData.getLogicData();
|
||||
for (Map.Entry<String, String> entry : nameMap.entrySet()) {
|
||||
String k = entry.getKey();
|
||||
String v = entry.getValue();
|
||||
graphData = graphData.replace(k, v);
|
||||
logicData = logicData.replace(k, v);
|
||||
}
|
||||
mapData.setGraphData(graphData);
|
||||
mapData.setLogicData(logicData);
|
||||
mapDataDAO.updateByPrimaryKeyWithBLOBs(mapData);
|
||||
// 修改ISCS数据
|
||||
IscsExample iscsExample = new IscsExample();
|
||||
iscsExample.createCriteria().andMapIdEqualTo(mapId);
|
||||
List<Iscs> iscsList = iscsDAO.selectByExampleWithBLOBs(iscsExample);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(iscsList);
|
||||
for (Iscs iscs : iscsList) {
|
||||
String iscsGraphData = iscs.getGraphData();
|
||||
for (Map.Entry<String, String> entry : nameMap.entrySet()) {
|
||||
String k = entry.getKey();
|
||||
String v = entry.getValue();
|
||||
iscsGraphData = iscsGraphData.replace(k, v);
|
||||
}
|
||||
iscs.setGraphData(iscsGraphData);
|
||||
iscsDAO.updateByPrimaryKeyWithBLOBs(iscs);
|
||||
}
|
||||
// 刷新缓存
|
||||
iCacheService.remove(BusinessConsts.CachePrefix.Map + mapId);
|
||||
iMapService.getMapDetail(mapId);
|
||||
private void handleSignalShowDirection(MapInfo mapInfo) {
|
||||
Long mapId = mapInfo.getId();
|
||||
MapVO detail = this.iMapService.getMapDetail(mapId);
|
||||
MapGraphDataNewVO graphDataNew = detail.getGraphDataNew();
|
||||
List<MapSignalNewVO> signalList = graphDataNew.getSignalList();
|
||||
for (MapSignalNewVO signalVO : signalList) {
|
||||
signalVO.setShowRight(signalVO.isRight());
|
||||
}
|
||||
//地图数据
|
||||
MapDataWithBLOBs mapData = new MapDataWithBLOBs();
|
||||
mapData.setMapId(mapId);
|
||||
mapData.setGraphData(JsonUtils.writeValueAsString(graphDataNew));
|
||||
mapData.setLogicData(JsonUtils.writeValueAsString(detail.getLogicDataNew()));
|
||||
if (detail.getCheckConfig() != null) {
|
||||
mapData.setCheckConfig(detail.getCheckConfig().toJson());
|
||||
} else {
|
||||
mapData.setCheckConfig(new MapCheckConfig().toJson());
|
||||
}
|
||||
mapData.setVersion(VersionUtil.generateNext(this.iMapService.findMapVersion(mapId)));
|
||||
mapData.setNote("处理信号机显示方向");
|
||||
mapData.setTime(LocalDateTime.now());
|
||||
mapData.setUserId(1L);
|
||||
mapDataDAO.insert(mapData);
|
||||
// 更新地图当前使用的地图数据版本
|
||||
MapInfo map = new MapInfo();
|
||||
map.setId(mapId);
|
||||
map.setVersion(mapData.getVersion());
|
||||
mapInfoDAO.updateByPrimaryKeySelective(map);
|
||||
this.iMapService.removeCache(mapId);
|
||||
}
|
||||
|
||||
private MapDataWithBLOBs getMapDataEntity(long mapId) {
|
||||
MapInfo mapInfo = mapInfoDAO.selectByPrimaryKey(mapId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(mapInfo);
|
||||
return getMapDataEntity(mapId, mapInfo.getVersion());
|
||||
public void changeStationName(long mapId, Map<String, String> nameMap) {
|
||||
// 修改地图数据
|
||||
MapDataWithBLOBs mapData = getMapDataEntity(mapId);
|
||||
String graphData = mapData.getGraphData();
|
||||
String logicData = mapData.getLogicData();
|
||||
for (Map.Entry<String, String> entry : nameMap.entrySet()) {
|
||||
String k = entry.getKey();
|
||||
String v = entry.getValue();
|
||||
graphData = graphData.replace(k, v);
|
||||
logicData = logicData.replace(k, v);
|
||||
}
|
||||
mapData.setGraphData(graphData);
|
||||
mapData.setLogicData(logicData);
|
||||
mapDataDAO.updateByPrimaryKeyWithBLOBs(mapData);
|
||||
// 修改ISCS数据
|
||||
IscsExample iscsExample = new IscsExample();
|
||||
iscsExample.createCriteria().andMapIdEqualTo(mapId);
|
||||
List<Iscs> iscsList = iscsDAO.selectByExampleWithBLOBs(iscsExample);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(iscsList);
|
||||
for (Iscs iscs : iscsList) {
|
||||
String iscsGraphData = iscs.getGraphData();
|
||||
for (Map.Entry<String, String> entry : nameMap.entrySet()) {
|
||||
String k = entry.getKey();
|
||||
String v = entry.getValue();
|
||||
iscsGraphData = iscsGraphData.replace(k, v);
|
||||
}
|
||||
iscs.setGraphData(iscsGraphData);
|
||||
iscsDAO.updateByPrimaryKeyWithBLOBs(iscs);
|
||||
}
|
||||
// 刷新缓存
|
||||
iCacheService.remove(BusinessConsts.CachePrefix.Map + mapId);
|
||||
iMapService.getMapDetail(mapId);
|
||||
}
|
||||
|
||||
private MapDataWithBLOBs findMapDataEntity(long mapId, String version) {
|
||||
MapDataExample example = new MapDataExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId).andVersionEqualTo(version);
|
||||
List<MapDataWithBLOBs> list = mapDataDAO.selectByExampleWithBLOBs(example);
|
||||
return CollectionUtils.isEmpty(list) ? null : list.get(0);
|
||||
}
|
||||
private MapDataWithBLOBs getMapDataEntity(long mapId) {
|
||||
MapInfo mapInfo = mapInfoDAO.selectByPrimaryKey(mapId);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(mapInfo);
|
||||
return getMapDataEntity(mapId, mapInfo.getVersion());
|
||||
}
|
||||
|
||||
private MapDataWithBLOBs getMapDataEntity(long mapId, String version) {
|
||||
MapDataWithBLOBs entity = findMapDataEntity(mapId, version);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(entity);
|
||||
return entity;
|
||||
private MapDataWithBLOBs findMapDataEntity(long mapId, String version) {
|
||||
MapDataExample example = new MapDataExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId).andVersionEqualTo(version);
|
||||
List<MapDataWithBLOBs> list = mapDataDAO.selectByExampleWithBLOBs(example);
|
||||
return CollectionUtils.isEmpty(list) ? null : list.get(0);
|
||||
}
|
||||
|
||||
private MapDataWithBLOBs getMapDataEntity(long mapId, String version) {
|
||||
MapDataWithBLOBs entity = findMapDataEntity(mapId, version);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(entity);
|
||||
return entity;
|
||||
}
|
||||
|
||||
public void updateSectionLen(long mapId, int multiple) {
|
||||
MapDataExample example = new MapDataExample();
|
||||
example.setOrderByClause("id desc");
|
||||
example.setLimit(1);
|
||||
example.createCriteria().andMapIdEqualTo(mapId);
|
||||
MapDataWithBLOBs map = mapDataDAO.selectByExampleWithBLOBs(example).get(0);
|
||||
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);
|
||||
}
|
||||
}
|
||||
map.setGraphData(JsonUtils.writeValueAsString(data));
|
||||
mapDataDAO.updateByPrimaryKeyWithBLOBs(map);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,119 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,382 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,246 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
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();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,152 @@
|
|||
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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
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();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,203 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -7,82 +7,104 @@ 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 实训草稿转化为已发布实训,注意已发布实训的状态为上架且已发布实训的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 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 List<PublishedTraining2InfoRspVo> convertFrom(List<PublishedTraining2> froms) {
|
||||
List<PublishedTraining2InfoRspVo> list = Lists.newArrayList();
|
||||
froms.forEach(d -> list.add(convertFrom(d)));
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 实训草稿转化为已发布实训,注意已发布实训的状态为上架且已发布实训的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 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 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,82 +3,110 @@ 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.*;
|
||||
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.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;
|
||||
|
||||
/**
|
||||
* 草稿发布
|
||||
*/
|
||||
@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);
|
||||
@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(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;
|
||||
//根据要发布的草稿名称来查找已发布的实训
|
||||
//如果以有同名的则会被覆盖
|
||||
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);
|
||||
}
|
||||
|
||||
@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,9 +15,27 @@ 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.*;
|
||||
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 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;
|
||||
|
@ -25,491 +43,489 @@ 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;
|
||||
|
||||
@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;
|
||||
@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;
|
||||
}
|
||||
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 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);
|
||||
/**
|
||||
* 根据 组织,类型(单操作,实操) 获取标签
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 组织,类型(单操作,实操) 获取标签
|
||||
*/
|
||||
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;
|
||||
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());
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
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());
|
||||
}
|
||||
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()) {
|
||||
/**
|
||||
* 已发布实训分页列表
|
||||
*/
|
||||
@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);
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 已发布实训上架
|
||||
*/
|
||||
@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;
|
||||
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;
|
||||
}
|
||||
|
||||
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,"未知共享类型");
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 已发布实训下架
|
||||
*/
|
||||
@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 rsp;
|
||||
}
|
||||
|
||||
return rsp;
|
||||
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));
|
||||
}
|
||||
List<Long> findIds = t2.stream()
|
||||
.filter(d -> Objects.equals(d.getOrgId(), userInfoVO.getTopOrgId()))
|
||||
.map(d -> d.getId()).collect(Collectors.toList());
|
||||
return findIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除已发布实训
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
private PublishedTraining2Example.Criteria createQueryOrExample(PublishedTraining2Example example,
|
||||
PublishedTrainingListRspVo reqVO, List<Long> mapIdList) {
|
||||
|
||||
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 criteria = example.createCriteria();
|
||||
// PublishedTraining2Example.Criteria or = example.or();
|
||||
|
||||
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.getMapId() != null) {
|
||||
criteria.andMapIdEqualTo(reqVO.getMapId());
|
||||
} else {
|
||||
criteria.andMapIdIn(mapIdList);
|
||||
}
|
||||
/* private PublishedTraining2Example.Criteria createQueryExample(PublishedTraining2Example example ,PublishedTrainingListRspVo reqVO){
|
||||
|
||||
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;
|
||||
}*/
|
||||
|
||||
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()));
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据地图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());
|
||||
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();
|
||||
this.createQueryOrExample(example,reqVO,mapIdList);
|
||||
PublishedTraining2Example.Criteria or = example.or();
|
||||
or.andStateEqualTo(BusinessConsts.STATUS_USE_INT).andSharedEqualTo(BusinessConsts.STATUS_USE_INT);
|
||||
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 (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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据已发布实训的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;
|
||||
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列表修改生成实训的组织ID
|
||||
*/
|
||||
public void updatePublishTrainingOrgIdByMapId(Long orgId, List<Long> mapIdList) {
|
||||
if (!CollectionUtils.isEmpty(mapIdList)) {
|
||||
publishedDao.updateTrainingOrgByMapIdList(orgId, mapIdList);
|
||||
}
|
||||
/**
|
||||
* 根据地图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());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新实训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);
|
||||
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 updateTrainingLabel(PublishedTraining2 training2) {
|
||||
PublishedTraining2WithBLOBs blobs = new PublishedTraining2WithBLOBs();
|
||||
blobs.setId(training2.getId());
|
||||
blobs.setLabelJson(training2.getLabelJson());
|
||||
publishedDao.updateByPrimaryKeySelective(blobs);
|
||||
/**
|
||||
* 根据已发布实训的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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出实训信息
|
||||
* @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);
|
||||
/**
|
||||
* 根据地图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);
|
||||
}).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;
|
||||
}
|
||||
// 地图基本信息列表
|
||||
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());
|
||||
});
|
||||
publishedDao.insertList(t.getList());
|
||||
msgList.add(String.format("地图【%s】实训信息导入成功", t.getName()));
|
||||
} else {
|
||||
msgList.add(String.format("地图【%s】实训信息导入失败", t.getName()));
|
||||
}
|
||||
/**
|
||||
* 导入实训接口
|
||||
*
|
||||
* @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());
|
||||
});
|
||||
return msgList;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
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;
|
||||
|
@ -11,36 +9,29 @@ 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.*;
|
||||
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.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;
|
||||
|
||||
/**
|
||||
|
@ -85,7 +76,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("该地图正在生成实训!");
|
||||
|
@ -131,7 +122,6 @@ public class Training2RuleService {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param mapId
|
||||
* @param functionId
|
||||
* @return
|
||||
|
@ -144,7 +134,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());
|
||||
|
@ -223,7 +213,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);
|
||||
|
@ -237,7 +227,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());
|
||||
|
@ -246,8 +236,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;
|
||||
|
@ -255,7 +245,7 @@ public class Training2RuleService {
|
|||
// 需要删除的列表
|
||||
List<Long> delTrainingIdList = publishedTraining2DAO.selectTrainingIdByRuleNameAndMapId(ruleNameMapList, k);
|
||||
try {
|
||||
Simulation simulation = simulationService.createSimulationPojo(entities.get(0).getId(), loginUserInfoVO, false);
|
||||
Simulation simulation = simulationService.createSimulation(entities.get(0).getId(), loginUserInfoVO, false);
|
||||
errorMsgList.addAll(generateTraining(simulation, ruleList, delTrainingIdList, delPublishTrainingByIds));
|
||||
} catch (Exception e) {
|
||||
log.error("创建仿真失败", e);
|
||||
|
@ -288,7 +278,7 @@ public class Training2RuleService {
|
|||
bloBs.setId(rule.getId());
|
||||
bloBs.setScoreRule(JsonUtils.writeValueAsString(detailVOList));
|
||||
return bloBs;
|
||||
}).collect(Collectors.toList());
|
||||
}).collect(Collectors.toList());
|
||||
rtsTraining2RuleMapper.updateScoreRule(ruleScoreList);
|
||||
}
|
||||
|
||||
|
@ -302,7 +292,7 @@ public class Training2RuleService {
|
|||
List<RtsMapFunction> entities = getRtsMapFunctions(mapInfo.getId());
|
||||
if (!CollectionUtils.isEmpty(entities) && !CollectionUtils.isEmpty(lineCodeRuleMap.get(mapInfo.getLineCode()))) {
|
||||
try {
|
||||
Simulation simulation = simulationService.createSimulationPojo(entities.get(0).getId(), loginUserInfoVO, false);
|
||||
Simulation simulation = simulationService.createSimulation(entities.get(0).getId(), loginUserInfoVO, false);
|
||||
if (CollectionUtils.isEmpty(deleteTrainingIdMap)) {
|
||||
errorMsgList.addAll(generateTraining(simulation, lineCodeRuleMap.get(mapInfo.getLineCode()), null, delPublishTrainingByMapId));
|
||||
} else {
|
||||
|
@ -318,8 +308,9 @@ public class Training2RuleService {
|
|||
|
||||
/**
|
||||
* 生成实训方法
|
||||
* @param simulation 对应地图仿真
|
||||
* @param ruleList 生成规则
|
||||
*
|
||||
* @param simulation 对应地图仿真
|
||||
* @param ruleList 生成规则
|
||||
* @param delTrainingIds 要删除已发布的实训ID
|
||||
* @param delConsumer 删除实训方法
|
||||
* @return
|
||||
|
@ -358,11 +349,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,6 +5,7 @@ import club.joylink.rtss.entity.RtsMapFunction;
|
|||
import club.joylink.rtss.entity.SysAccount;
|
||||
import club.joylink.rtss.entity.UserSimulationRecord;
|
||||
import club.joylink.rtss.entity.UserSimulationRecordExample;
|
||||
import club.joylink.rtss.entity.UserSimulationRecordExample.Criteria;
|
||||
import club.joylink.rtss.event.UserSimulationRecordEvent;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.IMapService;
|
||||
|
@ -13,6 +14,7 @@ import club.joylink.rtss.services.mapFunction.RtsMapFunctionService;
|
|||
import club.joylink.rtss.simulation.cbtc.message.UserSimulationRecordManager;
|
||||
import club.joylink.rtss.util.TimeUnit;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.simulationUsage.SimulationUsageRecordQueryVO;
|
||||
import club.joylink.rtss.vo.client.simulationUsage.UserSimulationQueryVO;
|
||||
import club.joylink.rtss.vo.client.simulationUsage.UserSimulationRecordVO;
|
||||
import club.joylink.rtss.vo.client.simulationUsage.UserSimulationStatsVO;
|
||||
|
@ -66,7 +68,8 @@ public class UserSimulationRecordService {
|
|||
}
|
||||
|
||||
public List<UserSimulationRecord> queryByMapAndUserIds(Long mapId, List<Long> userIds) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(userIds, "用户列表不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(userIds,
|
||||
"用户列表不能为空");
|
||||
UserSimulationRecordExample example = new UserSimulationRecordExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId).andUserIdIn(userIds);
|
||||
return userSimulationRecordDAO.selectByExample(example);
|
||||
|
@ -165,6 +168,22 @@ public class UserSimulationRecordService {
|
|||
return statistic(startTime, endTime, timeUnit, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询仿真使用记录
|
||||
*/
|
||||
public List<UserSimulationRecord> listSimulationUsageRecords(
|
||||
SimulationUsageRecordQueryVO queryVO) {
|
||||
UserSimulationRecordExample example = new UserSimulationRecordExample();
|
||||
Criteria criteria = example.createCriteria();
|
||||
if (queryVO.getUid() != null) {
|
||||
criteria.andUserIdEqualTo(queryVO.getUid());
|
||||
}
|
||||
if (queryVO.getFunctionId() != null) {
|
||||
criteria.andFunctionIdEqualTo(queryVO.getFunctionId());
|
||||
}
|
||||
return userSimulationRecordDAO.selectByExample(example);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对使用记录按照时间单位、开始、结束时间分段统计
|
||||
*/
|
||||
|
@ -223,9 +242,12 @@ public class UserSimulationRecordService {
|
|||
}
|
||||
|
||||
private void checkParam(UserSimulationQueryVO queryVO) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getTimeUnit(), "缺少时间单位");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getStartTime(), "缺少开始时间");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getEndTime(), "缺少结束时间");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getTimeUnit(),
|
||||
"缺少时间单位");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getStartTime(),
|
||||
"缺少开始时间");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(queryVO.getEndTime(),
|
||||
"缺少结束时间");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
|
||||
!queryVO.getStartTime().isAfter(queryVO.getEndTime()), "开始时间不能晚于结束时间");
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import club.joylink.rtss.vo.client.PageQueryVO;
|
|||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.competition.VoiceErrorVO;
|
||||
import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult;
|
||||
import club.joylink.rtss.vo.voice.VoiceVerifyResultVO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
|
@ -11,9 +12,19 @@ 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);
|
||||
VoiceRecognitionResult voiceRecognition(byte[] bytes, String filePath);
|
||||
|
||||
/**
|
||||
* 校验语音识别结果
|
||||
*
|
||||
* @param contentType
|
||||
* @param file 需要校验的语音
|
||||
* @param text 正确的文本
|
||||
* @return 校验结果
|
||||
*/
|
||||
VoiceVerifyResultVO verifyVoice(String contentType, byte[] file, String text);
|
||||
}
|
||||
|
|
|
@ -19,66 +19,70 @@ 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);
|
||||
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);
|
||||
}
|
||||
String filePath = this.voiceSynthesisUtil.getDownLoadPath(fileName);
|
||||
return new VoiceCompose(filePath, md5Code, vo.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 语音识别
|
||||
* @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 byte[] synthesisSource(BaseVoiceSynthesisVO vo) {
|
||||
byte[] data = voiceService.voiceSynthesis(vo);
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 语音合成
|
||||
* @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;
|
||||
}
|
||||
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,63 +2,118 @@ package club.joylink.rtss.services.voice;
|
|||
|
||||
import club.joylink.rtss.dao.CompetitionErrorSetDAO;
|
||||
import club.joylink.rtss.entity.CompetitionErrorSet;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.simulation.cbtc.conversation.SimulationVoiceHandler;
|
||||
import club.joylink.rtss.util.StrUtils;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.competition.VoiceErrorVO;
|
||||
import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult;
|
||||
import club.joylink.rtss.vo.client.voice.VoiceRecognitionVO;
|
||||
import club.joylink.rtss.vo.voice.VoiceVerifyResultVO;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.sound.sampled.AudioFileFormat;
|
||||
import javax.sound.sampled.AudioFormat;
|
||||
import javax.sound.sampled.AudioInputStream;
|
||||
import javax.sound.sampled.AudioSystem;
|
||||
import javax.sound.sampled.UnsupportedAudioFileException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Service
|
||||
public class VoiceTrainingService implements IVoiceTrainingService {
|
||||
|
||||
@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 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);
|
||||
@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;
|
||||
}
|
||||
result.setResult(simulationVoiceHandler.handle(result.getResult()));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoiceRecognitionResult voiceRecognition(byte[] bytes, String filePath) {
|
||||
VoiceRecognitionVO vo = new VoiceRecognitionVO(bytes);
|
||||
VoiceRecognitionResult result = this.iVoiceService.voiceRecognition(vo);
|
||||
// VoiceRecognitionResult result = this.iVoiceService.voiceRecognition(bytes, filePath);
|
||||
result.setResult(simulationVoiceHandler.handle(result.getResult()));
|
||||
return result;
|
||||
private byte[] convertToMonoChannel(byte[] audioData) {
|
||||
try {
|
||||
// 假设输入和输出音频都存储在字节数组中
|
||||
byte[] outputAudioBytes;
|
||||
|
||||
// 将输入音频字节数组转换为音频输入流
|
||||
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(audioData);
|
||||
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(byteArrayInputStream);
|
||||
AudioFormat format = audioInputStream.getFormat();
|
||||
|
||||
// 确保输入音频是立体声
|
||||
if (format.getChannels() != 2) {
|
||||
System.out.println("Input audio is not stereo.");
|
||||
return audioData;
|
||||
}
|
||||
|
||||
// 创建单声道格式
|
||||
AudioFormat monoFormat = new AudioFormat(format.getEncoding(), format.getSampleRate(),
|
||||
format.getSampleSizeInBits(), 1, format.getFrameSize() / 2, format.getFrameRate(), false);
|
||||
|
||||
// 从立体声转换为单声道
|
||||
AudioInputStream monoInputStream = AudioSystem.getAudioInputStream(monoFormat,
|
||||
audioInputStream);
|
||||
|
||||
// 将单声道音频写入字节数组输出流
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
AudioSystem.write(monoInputStream, AudioFileFormat.Type.WAVE, byteArrayOutputStream);
|
||||
|
||||
// 获取输出音频的字节数组
|
||||
return byteArrayOutputStream.toByteArray();
|
||||
} catch (UnsupportedAudioFileException | IOException e) {
|
||||
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception(
|
||||
String.format("音频转单声道失败:%s", e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,78 +0,0 @@
|
|||
/*
|
||||
package club.joylink.rtss.services.voice.huawei;
|
||||
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.voice.IVoiceService;
|
||||
import club.joylink.rtss.util.VoiceFileUtils;
|
||||
import club.joylink.rtss.vo.client.VoiceRecognitionResult;
|
||||
import com.huawei.sis.bean.AuthInfo;
|
||||
import com.huawei.sis.bean.SisConfig;
|
||||
import com.huawei.sis.bean.request.AsrCustomShortRequest;
|
||||
import com.huawei.sis.bean.response.AsrCustomShortResponse;
|
||||
import com.huawei.sis.client.AsrCustomizationClient;
|
||||
import com.huawei.sis.exception.SisException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Base64;
|
||||
|
||||
@Slf4j
|
||||
@Service("HuaWeiVoiceService")
|
||||
public class HuaweiVoiceServiceImpl implements IVoiceService {
|
||||
|
||||
|
||||
@Override
|
||||
public String synthesis(String message, String per) {
|
||||
throw BusinessExceptionAssertEnum.THIRD_SERVICE_CALL_EXCEPTION.exception("功能暂未实现");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String synthesis(String message) {
|
||||
return this.synthesis(message, "0");
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* 华为语音识别配置
|
||||
*//*
|
||||
|
||||
private final String ak = "YDUXTXRYGAHGPHAIXZCU";
|
||||
private final String sk = "Kcbm3sTDCYEou8kGeAhKxfBkgWybIn6IjJyGBX3p";
|
||||
private final String region = "cn-north-4";
|
||||
private final String projectId = "0aada8176180f28c2f34c0196f5394e8";
|
||||
|
||||
@Override
|
||||
public VoiceRecognitionResult voiceRecognition(MultipartFile file, String lang) {
|
||||
String filePath = VoiceFileUtils.saveFile(file);
|
||||
try {
|
||||
return voiceRecognition(file.getBytes(), filePath);
|
||||
} catch (IOException e) {
|
||||
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("第三方服务调用异常");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoiceRecognitionResult voiceRecognition(byte[] bytes, String filePath) {
|
||||
AuthInfo authInfo = new AuthInfo(ak, sk, region, projectId);
|
||||
SisConfig sisConfig = new SisConfig();
|
||||
AsrCustomizationClient client = new AsrCustomizationClient(authInfo, sisConfig);
|
||||
String data = Base64.getEncoder().encodeToString(bytes);
|
||||
try {
|
||||
AsrCustomShortRequest request = new AsrCustomShortRequest(data, "pcm16k16bit", "chinese_16k_common");
|
||||
AsrCustomShortResponse response = client.getAsrShortResponse(request);
|
||||
return new VoiceRecognitionResult(filePath, response.getResult().getText());
|
||||
} catch (SisException e) {
|
||||
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("语音识别失败", e);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public VoiceRecognitionResult voiceRecognition(String fileBase64) {
|
||||
String base64 = fileBase64.substring(fileBase64.indexOf("base64,") + "base64,".length());
|
||||
byte[] bytes = Base64.getDecoder().decode(base64.trim());
|
||||
String filePath = VoiceFileUtils.saveFile(bytes);
|
||||
return voiceRecognition(bytes, filePath);
|
||||
}
|
||||
}
|
||||
*/
|
|
@ -1,154 +0,0 @@
|
|||
//package club.joylink.rtss.simulation;
|
||||
//
|
||||
//import club.joylink.rtss.simulation.operation.SimulationOperationDispatcher;
|
||||
//import club.joylink.rtss.simulation.vo.SimulationFaultVO;
|
||||
//import club.joylink.rtss.simulation.vo.SimulationInfoVO;
|
||||
//import club.joylink.rtss.simulation.vo.SimulationMemberVO;
|
||||
//import club.joylink.rtss.simulation.vo.SimulationUserVO;
|
||||
//import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
//import club.joylink.rtss.vo.client.simulationv1.SimulationInfoQueryVO;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.util.StringUtils;
|
||||
//import org.springframework.web.bind.annotation.*;
|
||||
//
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//import java.util.Objects;
|
||||
//import java.util.stream.Collectors;
|
||||
//import java.util.stream.Stream;
|
||||
//
|
||||
//import static club.joylink.rtss.controller.advice.AuthenticateInterceptor.LOGIN_INFO_KEY;
|
||||
//
|
||||
///**
|
||||
// * 仿真通用接口
|
||||
// */
|
||||
//@Slf4j
|
||||
//@RestController
|
||||
//@RequestMapping("/common/simulation")
|
||||
//public class SimulationCommonController {
|
||||
// @Autowired
|
||||
// private SimulationManager simulationManager;
|
||||
// @Autowired
|
||||
// private SimulationOperationDispatcher simulationOperationDispatcher;
|
||||
//
|
||||
// /**
|
||||
// * 监管仿真
|
||||
// * @param loginUserInfoVO
|
||||
// * @param queryVO
|
||||
// * @return
|
||||
// */
|
||||
// @GetMapping("/supervise")
|
||||
// public List<SimulationInfoVO> superviseSimulation(@RequestAttribute(name=LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO, SimulationInfoQueryVO queryVO) {
|
||||
// List<Simulation> simulationList = this.simulationManager.getSimulationList();
|
||||
// Stream<Simulation> stream = simulationList.stream();
|
||||
//
|
||||
// stream = stream.filter(simulation -> simulation instanceof club.joylink.rtss.simulation.cbtc.Simulation
|
||||
// && Objects.equals(loginUserInfoVO.getTopOrgId(),((club.joylink.rtss.simulation.cbtc.Simulation)simulation).getBuildParams().getLoginUserInfo().getTopOrgId()));
|
||||
//
|
||||
// if (StringUtils.hasText(queryVO.getGroup())) {
|
||||
// stream = stream.filter(simulation -> simulation.getId().contains(queryVO.getGroup()));
|
||||
// }
|
||||
// if (StringUtils.hasText(queryVO.getUserName())) {
|
||||
// stream = stream.filter(simulation -> simulation.getSimulationUsers().stream().anyMatch(user -> ((SimulationUser) user).getName().contains(queryVO.getUserName())));
|
||||
// }
|
||||
// if (StringUtils.hasText(queryVO.getPrdType())) {
|
||||
// stream = stream.filter(simulation -> simulation instanceof club.joylink.rtss.simulation.cbtc.Simulation
|
||||
// && queryVO.getPrdType().equals(((club.joylink.rtss.simulation.cbtc.Simulation) simulation).getBuildParams().getProdType().getCode()));
|
||||
// }
|
||||
// return stream.map(Simulation::convertToVO).collect(Collectors.toList());
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/list")
|
||||
// public List<SimulationInfoVO> queryInfo(SimulationInfoQueryVO queryVO) {
|
||||
// List<Simulation> simulationList = this.simulationManager.getSimulationList();
|
||||
// Stream<Simulation> stream = simulationList.stream();
|
||||
// if (StringUtils.hasText(queryVO.getGroup())) {
|
||||
// stream = stream.filter(simulation -> simulation.getId().contains(queryVO.getGroup()));
|
||||
// }
|
||||
// if (StringUtils.hasText(queryVO.getUserName())) {
|
||||
// stream = stream.filter(simulation -> simulation.getSimulationUsers().stream().anyMatch(user -> ((SimulationUser) user).getName().contains(queryVO.getUserName())));
|
||||
// }
|
||||
// if (StringUtils.hasText(queryVO.getPrdType())) {
|
||||
// stream = stream.filter(simulation -> simulation instanceof club.joylink.rtss.simulation.cbtc.Simulation
|
||||
// && queryVO.getPrdType().equals(((club.joylink.rtss.simulation.cbtc.Simulation) simulation).getBuildParams().getProdType().getCode()));
|
||||
// }
|
||||
// return stream.map(Simulation::convertToVO).collect(Collectors.toList());
|
||||
// }
|
||||
//
|
||||
// @PutMapping("/{id}/pause")
|
||||
// public void pause(@PathVariable String id) {
|
||||
// this.simulationManager.pause(id);
|
||||
// }
|
||||
//
|
||||
// @PutMapping("/{id}/start")
|
||||
// public void start(@PathVariable String id) {
|
||||
// this.simulationManager.start(id);
|
||||
// }
|
||||
//
|
||||
// @PutMapping("/{id}/init")
|
||||
// public void init(@PathVariable String id) {
|
||||
// this.simulationManager.init(id);
|
||||
// }
|
||||
//
|
||||
// @PutMapping("/{id}/updateSpeed/{speed}")
|
||||
// public void updateSpeed(@PathVariable String id, @PathVariable int speed) {
|
||||
// this.simulationManager.updateSpeed(id, speed);
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/{id}")
|
||||
// public SimulationInfoVO getSimulationInfo(@PathVariable String id) {
|
||||
// return this.simulationManager.getById(id).convertToVO();
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/{id}/users")
|
||||
// public List<SimulationUserVO> getSimulationUsers(@PathVariable String id) {
|
||||
// return this.simulationManager.getSimulationUsers(id).stream()
|
||||
// .map(SimulationUser::convertToVO)
|
||||
// .collect(Collectors.toList());
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/{id}/members")
|
||||
// public List<SimulationMemberVO> getSimulationMembers(@PathVariable String id, @RequestParam(required = false) String role) {
|
||||
// return this.simulationManager.getSimulationMembers(id).stream()
|
||||
// .map(SimulationMember::convertToVO)
|
||||
// .filter(member -> StringUtils.hasText(role) ? member.getRole().toString().equals(role) : true)
|
||||
// .collect(Collectors.toList());
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/{id}/member/playedBy/{userId}")
|
||||
// public SimulationMemberVO queryUserPlayedMember(@PathVariable String id, @PathVariable String userId) {
|
||||
// return this.simulationManager.getById(id)
|
||||
// .getSimulationMemberByUserId(userId).convertToVO();
|
||||
// }
|
||||
//
|
||||
// @PostMapping("/{id}/member/{memberId}/operate/{type}")
|
||||
// public Object operate(@PathVariable String id, @PathVariable String memberId,
|
||||
// @PathVariable String type, @RequestBody Map<String, Object> params) {
|
||||
// return this.simulationOperationDispatcher.doDispatch(id, memberId, type, params);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 故障注入
|
||||
// */
|
||||
// @PostMapping("/{id}/fault")
|
||||
// public void injectFault(@PathVariable String id, @RequestBody SimulationFaultVO faultVO) {
|
||||
// this.simulationManager.injectFault(id, faultVO);
|
||||
// }
|
||||
//
|
||||
// @DeleteMapping("/{id}/device/{deviceId}/fault/{fault}")
|
||||
// public void removeFault(@PathVariable String id, @PathVariable String deviceId, @PathVariable String fault) {
|
||||
// this.simulationManager.removeFault(id, deviceId, fault);
|
||||
// }
|
||||
//
|
||||
// @PutMapping("/{id}/member/{memberId}/playby/{userId}")
|
||||
// public void memberPlay(@PathVariable String id, @PathVariable String memberId, @PathVariable String userId) {
|
||||
// this.simulationManager.memberPlayedByUser(id, memberId, userId);
|
||||
// }
|
||||
//
|
||||
// @DeleteMapping("/{id}/destroy")
|
||||
// public void destroy(@PathVariable String id) {
|
||||
// this.simulationManager.destroy(id);
|
||||
// log.info(String.format("仿真通用接口销毁仿真[%s]", id));
|
||||
// }
|
||||
//}
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue