mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-06-07 01:34:05 +08:00
Compare commits
5 Commits
b4647458ba
...
b9f600d3bc
Author | SHA1 | Date | |
---|---|---|---|
|
b9f600d3bc | ||
|
05bad03d69 | ||
|
d25308beee | ||
|
590642320a | ||
|
370cc361f6 |
11
.env.example
11
.env.example
@ -6,13 +6,4 @@ PLAYEDU_ADMIN_PORT=9900
|
|||||||
PLAYEDU_JWT_KEY=playeduxyz
|
PLAYEDU_JWT_KEY=playeduxyz
|
||||||
|
|
||||||
################# MySQL ###################
|
################# MySQL ###################
|
||||||
MYSQL_PORT=3306
|
MYSQL_PORT=3306
|
||||||
|
|
||||||
################# Redis ###################
|
|
||||||
REDIS_PORT=6379
|
|
||||||
|
|
||||||
################# MINIO ###################
|
|
||||||
MINIO_ROOT_USERNAME=username
|
|
||||||
MINIO_ROOT_PASSWORD=password
|
|
||||||
MINIO_PORT=9002
|
|
||||||
MINIO_CONSOLE_PORT=50002
|
|
@ -1,11 +1,16 @@
|
|||||||
## 1.8 版本更新
|
## 1.9
|
||||||
|
|
||||||
|
- 优化:移除`Redis`运行依赖改为使用内存缓存
|
||||||
|
- 优化:移除本地存储方案`MinIO`的支持改为支持阿里云OSS和腾讯云COS
|
||||||
|
|
||||||
|
## 1.8
|
||||||
|
|
||||||
- 优化:[API]日志输出
|
- 优化:[API]日志输出
|
||||||
- 优化:[API]LDAP的部门同步逻辑
|
- 优化:[API]LDAP的部门同步逻辑
|
||||||
- 优化:[API]LDAP的用户同步逻辑
|
- 优化:[API]LDAP的用户同步逻辑
|
||||||
- 优化:[其它]`docker`镜像更换为阿里云加速
|
- 优化:[其它]`docker`镜像更换为阿里云加速
|
||||||
|
|
||||||
## 1.7 版本更新
|
## 1.7
|
||||||
|
|
||||||
- 新增:[API]MinIO配置信息增加环境变量的读取
|
- 新增:[API]MinIO配置信息增加环境变量的读取
|
||||||
- 新增:[API]学员学习权限优化
|
- 新增:[API]学员学习权限优化
|
||||||
|
@ -31,4 +31,4 @@ COPY --from=node-builder /app/h5/dist /app/h5
|
|||||||
|
|
||||||
COPY docker/nginx/conf/nginx.conf /etc/nginx/sites-enabled/default
|
COPY docker/nginx/conf/nginx.conf /etc/nginx/sites-enabled/default
|
||||||
|
|
||||||
CMD nginx; echo "Waiting for MySQL/Redis/MinIO to start..."; sleep 15; java -jar /app/api/app.jar --spring.profiles.active=prod --spring.datasource.url="jdbc:mysql://${DB_HOST}:${DB_PORT:-3306}/${DB_NAME}?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true" --spring.datasource.username=${DB_USER} --spring.datasource.password=${DB_PASS} --spring.data.redis.host=${REDIS_HOST} --spring.data.redis.port=${REDIS_PORT:-6379} --spring.data.redis.password=${REDIS_PASS} --spring.data.redis.database=${REDIS_DB:-0} --sa-token.is-concurrent=${SA_TOKEN_IS_CONCURRENT:-false} --sa-token.jwt-secret-key=${SA_TOKEN_JWT_SECRET_KEY}
|
CMD nginx; echo "Waiting for MySQL to start..."; sleep 15; java -jar /app/api/app.jar --spring.profiles.active=prod --spring.datasource.url="jdbc:mysql://${DB_HOST}:${DB_PORT:-3306}/${DB_NAME}?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true" --spring.datasource.username=${DB_USER} --spring.datasource.password=${DB_PASS} --sa-token.is-concurrent=${SA_TOKEN_IS_CONCURRENT:-false} --sa-token.jwt-secret-key=${SA_TOKEN_JWT_SECRET_KEY}
|
@ -45,7 +45,7 @@ cd playedu && docker-compose up -d
|
|||||||
|
|
||||||
## 📃 使用须知
|
## 📃 使用须知
|
||||||
|
|
||||||
- **1.版权归属**: PlayEdu 开源版版权归杭州白书科技有限公司所有。我们鼓励社区成员在遵守开源协议的前提下,对开源版进行合法的使用和贡献。
|
- **1.版权归属**: 杭州白书科技有限公司对 PlayEdu 开源版拥有完整版权,所有使用权保留。
|
||||||
- **2.代码修改**: 用户有权在遵守开源协议的前提下,对 PlayEdu 开源版的代码进行必要的修改和优化。需在修改处添加清晰备注,记录修改内容信息。
|
- **2.代码修改**: 在遵守相关开源协议的严格前提下,允许对 PlayEdu 开源版代码进行修改。修改时,必须在代码中加入明确备注,详细记录每一处修改的具体内容。
|
||||||
- **3.版权保护**: 严禁删除、修改或篡改源代码中的版权信息及开源说明文件。
|
- **3.版权保护**: 严令禁止删除、修改或篡改源代码中的版权信息及开源说明文件,侵犯版权的行为将面临法律追究。
|
||||||
- **4.商业化行为**: 在遵循开源协议的前提下,可以进行商用。但请注意,任何商业化行为都应明确标注 PlayEdu 开源版的版权信息。
|
- 在任何使用场景下,必须严格保留 PlayEdu 开源版页面及代码中的原有版权信息,包括不限于 “Designed By PlayEdu” 页面版权标识、官网链接以及代码中的开源说明等,一旦出现侵犯版权的行为,将承担相应法律责任。
|
||||||
|
44
compose.yml
44
compose.yml
@ -6,21 +6,14 @@ x-logging: &default-logging
|
|||||||
|
|
||||||
networks:
|
networks:
|
||||||
playedu:
|
playedu:
|
||||||
driver: bridge
|
driver: host
|
||||||
ipam:
|
|
||||||
driver: default
|
|
||||||
config:
|
|
||||||
- subnet: 172.10.10.0/24
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
mysql-data:
|
mysql-data:
|
||||||
redis-data:
|
|
||||||
minio-data:
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
playedu:
|
playedu:
|
||||||
# build: .
|
image: registry.cn-hangzhou.aliyuncs.com/playedu/light:1.9
|
||||||
image: registry.cn-hangzhou.aliyuncs.com/playedu/light:1.7
|
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
- DB_HOST=mysql
|
- DB_HOST=mysql
|
||||||
@ -28,10 +21,6 @@ services:
|
|||||||
- DB_NAME=playedu
|
- DB_NAME=playedu
|
||||||
- DB_USER=root
|
- DB_USER=root
|
||||||
- DB_PASS=playeduxyz
|
- DB_PASS=playeduxyz
|
||||||
- REDIS_HOST=redis
|
|
||||||
- REDIS_PASS=playeduxyz
|
|
||||||
- REDIS_PORT=6379
|
|
||||||
- REDIS_DB=2
|
|
||||||
- SA_TOKEN_IS_CONCURRENT=false
|
- SA_TOKEN_IS_CONCURRENT=false
|
||||||
- SA_TOKEN_JWT_SECRET_KEY=${PLAYEDU_JWT_KEY:-playeduxyz}
|
- SA_TOKEN_JWT_SECRET_KEY=${PLAYEDU_JWT_KEY:-playeduxyz}
|
||||||
ports:
|
ports:
|
||||||
@ -45,19 +34,6 @@ services:
|
|||||||
- playedu
|
- playedu
|
||||||
depends_on:
|
depends_on:
|
||||||
- mysql
|
- mysql
|
||||||
- redis
|
|
||||||
- minio
|
|
||||||
logging: *default-logging
|
|
||||||
|
|
||||||
redis:
|
|
||||||
build: ./docker/redis
|
|
||||||
restart: always
|
|
||||||
volumes:
|
|
||||||
- redis-data:/data
|
|
||||||
# ports:
|
|
||||||
# - "${REDIS_PORT:-6379}:6379"
|
|
||||||
networks:
|
|
||||||
- playedu
|
|
||||||
logging: *default-logging
|
logging: *default-logging
|
||||||
|
|
||||||
mysql:
|
mysql:
|
||||||
@ -71,22 +47,6 @@ services:
|
|||||||
- mysql-data:/var/lib/mysql
|
- mysql-data:/var/lib/mysql
|
||||||
# ports:
|
# ports:
|
||||||
# - "${MYSQL_PORT:-3306}:3306"
|
# - "${MYSQL_PORT:-3306}:3306"
|
||||||
networks:
|
|
||||||
- playedu
|
|
||||||
logging: *default-logging
|
|
||||||
|
|
||||||
minio:
|
|
||||||
image: registry.cn-hangzhou.aliyuncs.com/hzbs/bitnami-minio:2024.6.6
|
|
||||||
restart: always
|
|
||||||
environment:
|
|
||||||
- MINIO_ROOT_USER=${MINIO_ROOT_USERNAME:-username}
|
|
||||||
- MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD:-password}
|
|
||||||
- MINIO_DEFAULT_BUCKETS=playedu:public
|
|
||||||
volumes:
|
|
||||||
- minio-data:/bitnami/minio/data
|
|
||||||
ports:
|
|
||||||
- "${MINIO_PORT:-9002}:9000"
|
|
||||||
- "${MINIO_CONSOLE_PORT:-50002}:9001"
|
|
||||||
networks:
|
networks:
|
||||||
- playedu
|
- playedu
|
||||||
logging: *default-logging
|
logging: *default-logging
|
@ -1,5 +1,18 @@
|
|||||||
client_max_body_size 50m;
|
client_max_body_size 50m;
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 9700;
|
||||||
|
server_name _;
|
||||||
|
root /app/pc;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_pass http://127.0.0.1:9898/;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 9800;
|
listen 9800;
|
||||||
server_name _;
|
server_name _;
|
||||||
@ -73,18 +86,4 @@ server {
|
|||||||
location ~* ^/(?![api].*) {
|
location ~* ^/(?![api].*) {
|
||||||
try_files $uri /index.html;
|
try_files $uri /index.html;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 9700;
|
|
||||||
server_name _;
|
|
||||||
root /app/pc;
|
|
||||||
index index.html;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_pass http://127.0.0.1:9898/;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,3 +0,0 @@
|
|||||||
FROM registry.cn-hangzhou.aliyuncs.com/hzbs/redis:7.0.12
|
|
||||||
|
|
||||||
COPY redis.conf /usr/local/etc/redis/redis.conf
|
|
File diff suppressed because it is too large
Load Diff
@ -551,6 +551,10 @@ textarea.ant-input {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ant-btn-variant-link {
|
||||||
|
color: @primaryColor !important;
|
||||||
|
}
|
||||||
|
|
||||||
.b-link {
|
.b-link {
|
||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
&:hover {
|
&:hover {
|
||||||
|
@ -11,6 +11,7 @@ import {
|
|||||||
Checkbox,
|
Checkbox,
|
||||||
Slider,
|
Slider,
|
||||||
Space,
|
Space,
|
||||||
|
Select,
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import { appConfig, system } from "../../../api/index";
|
import { appConfig, system } from "../../../api/index";
|
||||||
import { UploadImageButton } from "../../../compenents";
|
import { UploadImageButton } from "../../../compenents";
|
||||||
@ -31,6 +32,7 @@ const SystemConfigPage = () => {
|
|||||||
const [thumb, setThumb] = useState("");
|
const [thumb, setThumb] = useState("");
|
||||||
const [avatar, setAvatar] = useState("");
|
const [avatar, setAvatar] = useState("");
|
||||||
const [tabKey, setTabKey] = useState(1);
|
const [tabKey, setTabKey] = useState(1);
|
||||||
|
const [s3Service, setS3Service] = useState("");
|
||||||
const [nameChecked, setNameChecked] = useState(false);
|
const [nameChecked, setNameChecked] = useState(false);
|
||||||
const [emailChecked, setEmailChecked] = useState(false);
|
const [emailChecked, setEmailChecked] = useState(false);
|
||||||
const [idCardchecked, setIdCardChecked] = useState(false);
|
const [idCardchecked, setIdCardChecked] = useState(false);
|
||||||
@ -136,25 +138,34 @@ const SystemConfigPage = () => {
|
|||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
"member.default_avatar": configData[i].key_value,
|
"member.default_avatar": configData[i].key_value,
|
||||||
});
|
});
|
||||||
} else if (configData[i].key_name === "minio.access_key") {
|
} else if (configData[i].key_name === "s3.service") {
|
||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
"minio.access_key": configData[i].key_value,
|
"s3.service": configData[i].key_value,
|
||||||
});
|
});
|
||||||
} else if (configData[i].key_name === "minio.secret_key") {
|
setS3Service(configData[i].key_value);
|
||||||
|
} else if (configData[i].key_name === "s3.access_key") {
|
||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
"minio.secret_key": configData[i].key_value,
|
"s3.access_key": configData[i].key_value,
|
||||||
});
|
});
|
||||||
} else if (configData[i].key_name === "minio.bucket") {
|
} else if (configData[i].key_name === "s3.secret_key") {
|
||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
"minio.bucket": configData[i].key_value,
|
"s3.secret_key": configData[i].key_value,
|
||||||
});
|
});
|
||||||
} else if (configData[i].key_name === "minio.endpoint") {
|
} else if (configData[i].key_name === "s3.bucket") {
|
||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
"minio.endpoint": configData[i].key_value,
|
"s3.bucket": configData[i].key_value,
|
||||||
});
|
});
|
||||||
} else if (configData[i].key_name === "minio.domain") {
|
} else if (configData[i].key_name === "s3.region") {
|
||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
"minio.domain": configData[i].key_value,
|
"s3.region": configData[i].key_value,
|
||||||
|
});
|
||||||
|
} else if (configData[i].key_name === "s3.endpoint") {
|
||||||
|
form.setFieldsValue({
|
||||||
|
"s3.endpoint": configData[i].key_value,
|
||||||
|
});
|
||||||
|
} else if (configData[i].key_name === "s3.domain") {
|
||||||
|
form.setFieldsValue({
|
||||||
|
"s3.domain": configData[i].key_value,
|
||||||
});
|
});
|
||||||
} else if (configData[i].key_name === "ldap.enabled") {
|
} else if (configData[i].key_name === "ldap.enabled") {
|
||||||
let value = 0;
|
let value = 0;
|
||||||
@ -620,7 +631,7 @@ const SystemConfigPage = () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "4",
|
key: "4",
|
||||||
label: `MinIO存储`,
|
label: `S3存储`,
|
||||||
children: (
|
children: (
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
@ -632,10 +643,28 @@ const SystemConfigPage = () => {
|
|||||||
onFinishFailed={onFinishFailed}
|
onFinishFailed={onFinishFailed}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
>
|
>
|
||||||
|
<Form.Item
|
||||||
|
style={{ marginBottom: 30 }}
|
||||||
|
label="服务商"
|
||||||
|
name="s3.service"
|
||||||
|
>
|
||||||
|
<Select
|
||||||
|
defaultValue={null}
|
||||||
|
style={{ width: 200 }}
|
||||||
|
placeholder="请选择服务商"
|
||||||
|
options={[
|
||||||
|
{ value: "oss", label: "阿里云OSS" },
|
||||||
|
{ value: "cos", label: "腾讯云COS" },
|
||||||
|
]}
|
||||||
|
onChange={(e: any) => {
|
||||||
|
setS3Service(e);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
style={{ marginBottom: 30 }}
|
style={{ marginBottom: 30 }}
|
||||||
label="AccessKey"
|
label="AccessKey"
|
||||||
name="minio.access_key"
|
name="s3.access_key"
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
style={{ width: 274 }}
|
style={{ width: 274 }}
|
||||||
@ -646,7 +675,7 @@ const SystemConfigPage = () => {
|
|||||||
<Form.Item
|
<Form.Item
|
||||||
style={{ marginBottom: 30 }}
|
style={{ marginBottom: 30 }}
|
||||||
label="SecretKey"
|
label="SecretKey"
|
||||||
name="minio.secret_key"
|
name="s3.secret_key"
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
style={{ width: 274 }}
|
style={{ width: 274 }}
|
||||||
@ -657,7 +686,7 @@ const SystemConfigPage = () => {
|
|||||||
<Form.Item
|
<Form.Item
|
||||||
style={{ marginBottom: 30 }}
|
style={{ marginBottom: 30 }}
|
||||||
label="Bucket"
|
label="Bucket"
|
||||||
name="minio.bucket"
|
name="s3.bucket"
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
style={{ width: 274 }}
|
style={{ width: 274 }}
|
||||||
@ -665,10 +694,21 @@ const SystemConfigPage = () => {
|
|||||||
placeholder="请填写Bucket"
|
placeholder="请填写Bucket"
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
style={{ marginBottom: 30 }}
|
||||||
|
label="Region"
|
||||||
|
name="s3.region"
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
style={{ width: 274 }}
|
||||||
|
allowClear
|
||||||
|
placeholder="请填写Region"
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
style={{ marginBottom: 30 }}
|
style={{ marginBottom: 30 }}
|
||||||
label="Endpoint"
|
label="Endpoint"
|
||||||
name="minio.endpoint"
|
name="s3.endpoint"
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
style={{ width: 274 }}
|
style={{ width: 274 }}
|
||||||
@ -679,7 +719,7 @@ const SystemConfigPage = () => {
|
|||||||
<Form.Item
|
<Form.Item
|
||||||
style={{ marginBottom: 30 }}
|
style={{ marginBottom: 30 }}
|
||||||
label="Domain"
|
label="Domain"
|
||||||
name="minio.domain"
|
name="s3.domain"
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
style={{ width: 274 }}
|
style={{ width: 274 }}
|
||||||
|
@ -6,35 +6,32 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>xyz.playedu</groupId>
|
<groupId>xyz.playedu</groupId>
|
||||||
<artifactId>playedu</artifactId>
|
<artifactId>playedu</artifactId>
|
||||||
<version>1.2</version>
|
<version>1.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>playedu-api</artifactId>
|
<artifactId>playedu-api</artifactId>
|
||||||
|
<version>1.9</version>
|
||||||
<properties>
|
|
||||||
<java.version>17</java.version>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>xyz.playedu</groupId>
|
<groupId>xyz.playedu</groupId>
|
||||||
<artifactId>playedu-common</artifactId>
|
<artifactId>playedu-common</artifactId>
|
||||||
<version>1.2</version>
|
<version>1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>xyz.playedu</groupId>
|
<groupId>xyz.playedu</groupId>
|
||||||
<artifactId>playedu-system</artifactId>
|
<artifactId>playedu-system</artifactId>
|
||||||
<version>1.2</version>
|
<version>1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>xyz.playedu</groupId>
|
<groupId>xyz.playedu</groupId>
|
||||||
<artifactId>playedu-course</artifactId>
|
<artifactId>playedu-course</artifactId>
|
||||||
<version>1.2</version>
|
<version>1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>xyz.playedu</groupId>
|
<groupId>xyz.playedu</groupId>
|
||||||
<artifactId>playedu-resource</artifactId>
|
<artifactId>playedu-resource</artifactId>
|
||||||
<version>1.2</version>
|
<version>1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
@ -44,7 +41,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<version>3.1.2</version>
|
<version>3.3.4</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<goals>
|
<goals>
|
||||||
|
@ -22,7 +22,6 @@ import org.springframework.context.annotation.ComponentScan;
|
|||||||
import org.springframework.scheduling.annotation.EnableAsync;
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
|
|
||||||
import xyz.playedu.common.config.UniqueNameGeneratorConfig;
|
import xyz.playedu.common.config.UniqueNameGeneratorConfig;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@ -15,13 +15,12 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.bus;
|
package xyz.playedu.api.bus;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import xyz.playedu.api.event.UserLoginEvent;
|
import xyz.playedu.api.event.UserLoginEvent;
|
||||||
import xyz.playedu.common.bus.LDAPBus;
|
import xyz.playedu.common.bus.LDAPBus;
|
||||||
import xyz.playedu.common.domain.User;
|
import xyz.playedu.common.domain.User;
|
||||||
@ -31,8 +30,6 @@ import xyz.playedu.common.util.IpUtil;
|
|||||||
import xyz.playedu.common.util.RequestUtil;
|
import xyz.playedu.common.util.RequestUtil;
|
||||||
import xyz.playedu.common.util.ldap.LdapTransformUser;
|
import xyz.playedu.common.util.ldap.LdapTransformUser;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class LoginBus {
|
public class LoginBus {
|
||||||
|
@ -15,11 +15,9 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.bus;
|
package xyz.playedu.api.bus;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import xyz.playedu.common.constant.ConfigConstant;
|
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import xyz.playedu.common.constant.ConfigConstant;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class UserBus {
|
public class UserBus {
|
||||||
|
@ -17,11 +17,10 @@ package xyz.playedu.api.cache;
|
|||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import xyz.playedu.common.config.PlayEduConfig;
|
import xyz.playedu.common.config.PlayEduConfig;
|
||||||
import xyz.playedu.common.exception.ServiceException;
|
import xyz.playedu.common.exception.ServiceException;
|
||||||
import xyz.playedu.common.service.RateLimiterService;
|
import xyz.playedu.common.service.RateLimiterService;
|
||||||
import xyz.playedu.common.util.RedisUtil;
|
import xyz.playedu.common.util.MemoryCacheUtil;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class LoginLimitCache {
|
public class LoginLimitCache {
|
||||||
@ -34,14 +33,14 @@ public class LoginLimitCache {
|
|||||||
String limitKey = cacheKey(email);
|
String limitKey = cacheKey(email);
|
||||||
Long reqCount = rateLimiterService.current(limitKey, 600L);
|
Long reqCount = rateLimiterService.current(limitKey, 600L);
|
||||||
if (reqCount >= 10 && !playEduConfig.getTesting()) {
|
if (reqCount >= 10 && !playEduConfig.getTesting()) {
|
||||||
Long exp = RedisUtil.ttlWithoutPrefix(limitKey);
|
Long exp = MemoryCacheUtil.ttlWithoutPrefix(limitKey);
|
||||||
String msg = String.format("您的账号已被锁定,请%s后重试", exp > 60 ? exp / 60 + "分钟" : exp + "秒");
|
String msg = String.format("您的账号已被锁定,请%s后重试", exp > 60 ? exp / 60 + "分钟" : exp + "秒");
|
||||||
throw new ServiceException(msg);
|
throw new ServiceException(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void destroy(String email) {
|
public void destroy(String email) {
|
||||||
RedisUtil.del(cacheKey(email));
|
MemoryCacheUtil.del(cacheKey(email));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String cacheKey(String email) {
|
private String cacheKey(String email) {
|
||||||
|
@ -15,25 +15,23 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.cache;
|
package xyz.playedu.api.cache;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import xyz.playedu.common.util.MemoryDistributedLock;
|
||||||
import xyz.playedu.common.util.RedisDistributedLock;
|
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class LoginLockCache {
|
public class LoginLockCache {
|
||||||
|
|
||||||
@Autowired private RedisDistributedLock redisDistributedLock;
|
@Autowired private MemoryDistributedLock distributedLock;
|
||||||
|
|
||||||
public boolean apply(String username) {
|
public boolean apply(String username) {
|
||||||
String key = cacheKey(username);
|
String key = cacheKey(username);
|
||||||
return redisDistributedLock.tryLock(key, 10L, TimeUnit.SECONDS);
|
return distributedLock.tryLock(key, 10L, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void release(String username) {
|
public void release(String username) {
|
||||||
redisDistributedLock.releaseLock(cacheKey(username));
|
distributedLock.releaseLock(cacheKey(username));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String cacheKey(String username) {
|
private String cacheKey(String username) {
|
||||||
|
@ -16,10 +16,8 @@
|
|||||||
package xyz.playedu.api.controller;
|
package xyz.playedu.api.controller;
|
||||||
|
|
||||||
import com.amazonaws.services.s3.model.AmazonS3Exception;
|
import com.amazonaws.services.s3.model.AmazonS3Exception;
|
||||||
|
import java.util.List;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.springframework.data.redis.RedisConnectionFailureException;
|
|
||||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||||
import org.springframework.validation.ObjectError;
|
import org.springframework.validation.ObjectError;
|
||||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||||
@ -28,14 +26,12 @@ import org.springframework.web.bind.MissingServletRequestParameterException;
|
|||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||||
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
|
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
|
||||||
|
import org.springframework.web.servlet.resource.NoResourceFoundException;
|
||||||
import xyz.playedu.common.exception.LimitException;
|
import xyz.playedu.common.exception.LimitException;
|
||||||
import xyz.playedu.common.exception.NotFoundException;
|
import xyz.playedu.common.exception.NotFoundException;
|
||||||
import xyz.playedu.common.exception.ServiceException;
|
import xyz.playedu.common.exception.ServiceException;
|
||||||
import xyz.playedu.common.types.JsonResponse;
|
import xyz.playedu.common.types.JsonResponse;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@RestControllerAdvice
|
@RestControllerAdvice
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ExceptionController {
|
public class ExceptionController {
|
||||||
@ -51,11 +47,6 @@ public class ExceptionController {
|
|||||||
return JsonResponse.error(e.getMessage(), 1);
|
return JsonResponse.error(e.getMessage(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExceptionHandler(RedisConnectionFailureException.class)
|
|
||||||
public JsonResponse serviceExceptionHandler(RedisConnectionFailureException e) {
|
|
||||||
return JsonResponse.error("redis服务连接失败", 500);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ExceptionHandler(HttpMessageNotReadableException.class)
|
@ExceptionHandler(HttpMessageNotReadableException.class)
|
||||||
public JsonResponse serviceExceptionHandler(HttpMessageNotReadableException e) {
|
public JsonResponse serviceExceptionHandler(HttpMessageNotReadableException e) {
|
||||||
log.error("error", e);
|
log.error("error", e);
|
||||||
@ -103,4 +94,9 @@ public class ExceptionController {
|
|||||||
log.error("s3错误={}", e.getMessage());
|
log.error("s3错误={}", e.getMessage());
|
||||||
return JsonResponse.error("存储配置有问题或存储无法无法正常访问", 500);
|
return JsonResponse.error("存储配置有问题或存储无法无法正常访问", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(NoResourceFoundException.class)
|
||||||
|
public JsonResponse serviceExceptionHandler(NoResourceFoundException e) {
|
||||||
|
return JsonResponse.error("资源不存在", 404);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,12 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.controller.backend;
|
package xyz.playedu.api.controller.backend;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.apache.commons.collections4.MapUtils;
|
import org.apache.commons.collections4.MapUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import xyz.playedu.common.annotation.BackendPermission;
|
import xyz.playedu.common.annotation.BackendPermission;
|
||||||
import xyz.playedu.common.annotation.Log;
|
import xyz.playedu.common.annotation.Log;
|
||||||
import xyz.playedu.common.bus.BackendBus;
|
import xyz.playedu.common.bus.BackendBus;
|
||||||
@ -34,8 +33,6 @@ import xyz.playedu.common.types.JsonResponse;
|
|||||||
import xyz.playedu.common.types.paginate.AdminLogPaginateFiler;
|
import xyz.playedu.common.types.paginate.AdminLogPaginateFiler;
|
||||||
import xyz.playedu.common.types.paginate.PaginationResult;
|
import xyz.playedu.common.types.paginate.PaginationResult;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequestMapping("/backend/v1/admin/log")
|
@RequestMapping("/backend/v1/admin/log")
|
||||||
|
@ -15,12 +15,15 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.controller.backend;
|
package xyz.playedu.api.controller.backend;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import xyz.playedu.api.request.backend.AdminRoleRequest;
|
import xyz.playedu.api.request.backend.AdminRoleRequest;
|
||||||
import xyz.playedu.common.annotation.BackendPermission;
|
import xyz.playedu.common.annotation.BackendPermission;
|
||||||
import xyz.playedu.common.annotation.Log;
|
import xyz.playedu.common.annotation.Log;
|
||||||
@ -34,12 +37,6 @@ import xyz.playedu.common.service.AdminPermissionService;
|
|||||||
import xyz.playedu.common.service.AdminRoleService;
|
import xyz.playedu.common.service.AdminRoleService;
|
||||||
import xyz.playedu.common.types.JsonResponse;
|
import xyz.playedu.common.types.JsonResponse;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/backend/v1/admin-role")
|
@RequestMapping("/backend/v1/admin-role")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -88,7 +85,7 @@ public class AdminRoleController {
|
|||||||
List<Integer> permissionIds = roleService.getPermissionIdsByRoleId(role.getId());
|
List<Integer> permissionIds = roleService.getPermissionIdsByRoleId(role.getId());
|
||||||
List<Integer> permAction = new ArrayList<>();
|
List<Integer> permAction = new ArrayList<>();
|
||||||
List<Integer> permData = new ArrayList<>();
|
List<Integer> permData = new ArrayList<>();
|
||||||
if (permissionIds != null && permissionIds.size() > 0) {
|
if (permissionIds != null && !permissionIds.isEmpty()) {
|
||||||
List<AdminPermission> permissions = permissionService.chunks(permissionIds);
|
List<AdminPermission> permissions = permissionService.chunks(permissionIds);
|
||||||
Map<String, List<AdminPermission>> permissionsGroup =
|
Map<String, List<AdminPermission>> permissionsGroup =
|
||||||
permissions.stream().collect(Collectors.groupingBy(AdminPermission::getType));
|
permissions.stream().collect(Collectors.groupingBy(AdminPermission::getType));
|
||||||
|
@ -15,13 +15,15 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.controller.backend;
|
package xyz.playedu.api.controller.backend;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.apache.commons.collections4.MapUtils;
|
import org.apache.commons.collections4.MapUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import xyz.playedu.api.request.backend.AdminUserRequest;
|
import xyz.playedu.api.request.backend.AdminUserRequest;
|
||||||
import xyz.playedu.common.annotation.BackendPermission;
|
import xyz.playedu.common.annotation.BackendPermission;
|
||||||
import xyz.playedu.common.annotation.Log;
|
import xyz.playedu.common.annotation.Log;
|
||||||
@ -37,11 +39,6 @@ import xyz.playedu.common.types.JsonResponse;
|
|||||||
import xyz.playedu.common.types.paginate.AdminUserPaginateFilter;
|
import xyz.playedu.common.types.paginate.AdminUserPaginateFilter;
|
||||||
import xyz.playedu.common.types.paginate.PaginationResult;
|
import xyz.playedu.common.types.paginate.PaginationResult;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequestMapping("/backend/v1/admin-user")
|
@RequestMapping("/backend/v1/admin-user")
|
||||||
@ -67,7 +64,7 @@ public class AdminUserController {
|
|||||||
PaginationResult<AdminUser> result = adminUserService.paginate(page, size, filter);
|
PaginationResult<AdminUser> result = adminUserService.paginate(page, size, filter);
|
||||||
|
|
||||||
Map<Integer, List<Integer>> userRoleIds = new HashMap<>();
|
Map<Integer, List<Integer>> userRoleIds = new HashMap<>();
|
||||||
if (result.getData() != null && result.getData().size() > 0) {
|
if (result.getData() != null && !result.getData().isEmpty()) {
|
||||||
userRoleIds =
|
userRoleIds =
|
||||||
adminUserService.getAdminUserRoleIds(
|
adminUserService.getAdminUserRoleIds(
|
||||||
result.getData().stream().map(AdminUser::getId).toList());
|
result.getData().stream().map(AdminUser::getId).toList());
|
||||||
@ -101,7 +98,7 @@ public class AdminUserController {
|
|||||||
@Log(title = "管理员-新建", businessType = BusinessTypeConstant.INSERT)
|
@Log(title = "管理员-新建", businessType = BusinessTypeConstant.INSERT)
|
||||||
public JsonResponse store(@RequestBody @Validated AdminUserRequest req)
|
public JsonResponse store(@RequestBody @Validated AdminUserRequest req)
|
||||||
throws ServiceException {
|
throws ServiceException {
|
||||||
if (req.getPassword().length() == 0) {
|
if (req.getPassword().isEmpty()) {
|
||||||
return JsonResponse.error("请输入密码");
|
return JsonResponse.error("请输入密码");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,9 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.controller.backend;
|
package xyz.playedu.api.controller.backend;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import xyz.playedu.api.request.backend.AppConfigRequest;
|
import xyz.playedu.api.request.backend.AppConfigRequest;
|
||||||
import xyz.playedu.common.annotation.BackendPermission;
|
import xyz.playedu.common.annotation.BackendPermission;
|
||||||
import xyz.playedu.common.annotation.Log;
|
import xyz.playedu.common.annotation.Log;
|
||||||
@ -30,10 +32,6 @@ import xyz.playedu.common.service.AppConfigService;
|
|||||||
import xyz.playedu.common.types.JsonResponse;
|
import xyz.playedu.common.types.JsonResponse;
|
||||||
import xyz.playedu.common.util.StringUtil;
|
import xyz.playedu.common.util.StringUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/backend/v1/app-config")
|
@RequestMapping("/backend/v1/app-config")
|
||||||
public class AppConfigController {
|
public class AppConfigController {
|
||||||
|
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 杭州白书科技有限公司
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package xyz.playedu.api.controller.backend;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import xyz.playedu.common.annotation.BackendPermission;
|
||||||
|
import xyz.playedu.common.annotation.Log;
|
||||||
|
import xyz.playedu.common.constant.BPermissionConstant;
|
||||||
|
import xyz.playedu.common.constant.BusinessTypeConstant;
|
||||||
|
import xyz.playedu.common.types.JsonResponse;
|
||||||
|
import xyz.playedu.common.util.MemoryCacheUtil;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@Slf4j
|
||||||
|
@RequestMapping("/backend/v1/cache")
|
||||||
|
public class CacheController {
|
||||||
|
|
||||||
|
@BackendPermission(slug = BPermissionConstant.CACHE_MANAGE)
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Log(title = "缓存列表", businessType = BusinessTypeConstant.GET)
|
||||||
|
public JsonResponse list(MemoryCacheUtil memoryCacheUtil) {
|
||||||
|
Map<String, Object> data = new HashMap<>();
|
||||||
|
data.put("keys", memoryCacheUtil.getAllKeys());
|
||||||
|
data.put("cache", memoryCacheUtil.getAllCache());
|
||||||
|
return JsonResponse.data(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@BackendPermission(slug = BPermissionConstant.CACHE_MANAGE)
|
||||||
|
@DeleteMapping("/clear")
|
||||||
|
@Log(title = "缓存删除key", businessType = BusinessTypeConstant.DELETE)
|
||||||
|
public JsonResponse clear(@RequestParam HashMap<String, Object> params) {
|
||||||
|
String cache_key = MapUtils.getString(params, "cache_key");
|
||||||
|
MemoryCacheUtil.del(cache_key);
|
||||||
|
return JsonResponse.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@BackendPermission(slug = BPermissionConstant.CACHE_MANAGE)
|
||||||
|
@DeleteMapping("/clear/all")
|
||||||
|
@Log(title = "缓存清空", businessType = BusinessTypeConstant.DELETE)
|
||||||
|
public JsonResponse clearAll(MemoryCacheUtil memoryCacheUtil) {
|
||||||
|
List<String> keys = memoryCacheUtil.getAllKeys();
|
||||||
|
for (String key : keys) {
|
||||||
|
MemoryCacheUtil.del(key);
|
||||||
|
}
|
||||||
|
return JsonResponse.success();
|
||||||
|
}
|
||||||
|
}
|
@ -15,13 +15,12 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.controller.backend;
|
package xyz.playedu.api.controller.backend;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import xyz.playedu.api.request.backend.CourseAttachmentMultiRequest;
|
import xyz.playedu.api.request.backend.CourseAttachmentMultiRequest;
|
||||||
import xyz.playedu.api.request.backend.CourseAttachmentRequest;
|
import xyz.playedu.api.request.backend.CourseAttachmentRequest;
|
||||||
import xyz.playedu.api.request.backend.CourseAttachmentSortRequest;
|
import xyz.playedu.api.request.backend.CourseAttachmentSortRequest;
|
||||||
@ -35,8 +34,6 @@ import xyz.playedu.common.types.JsonResponse;
|
|||||||
import xyz.playedu.course.domain.CourseAttachment;
|
import xyz.playedu.course.domain.CourseAttachment;
|
||||||
import xyz.playedu.course.service.CourseAttachmentService;
|
import xyz.playedu.course.service.CourseAttachmentService;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequestMapping("/backend/v1/course/{courseId}/attachment")
|
@RequestMapping("/backend/v1/course/{courseId}/attachment")
|
||||||
@ -65,9 +62,8 @@ public class CourseAttachmentController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CourseAttachment courseAttachment =
|
attachmentService.create(courseId, req.getSort(), req.getTitle(), type, req.getRid());
|
||||||
attachmentService.create(
|
|
||||||
courseId, req.getSort(), req.getTitle(), type, req.getRid());
|
|
||||||
return JsonResponse.success();
|
return JsonResponse.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +74,7 @@ public class CourseAttachmentController {
|
|||||||
public JsonResponse storeMulti(
|
public JsonResponse storeMulti(
|
||||||
@PathVariable(name = "courseId") Integer courseId,
|
@PathVariable(name = "courseId") Integer courseId,
|
||||||
@RequestBody @Validated CourseAttachmentMultiRequest req) {
|
@RequestBody @Validated CourseAttachmentMultiRequest req) {
|
||||||
if (req.getAttachments().size() == 0) {
|
if (req.getAttachments().isEmpty()) {
|
||||||
return JsonResponse.error("参数为空");
|
return JsonResponse.error("参数为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,12 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.controller.backend;
|
package xyz.playedu.api.controller.backend;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.apache.commons.collections4.MapUtils;
|
import org.apache.commons.collections4.MapUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import xyz.playedu.common.annotation.Log;
|
import xyz.playedu.common.annotation.Log;
|
||||||
import xyz.playedu.common.constant.BusinessTypeConstant;
|
import xyz.playedu.common.constant.BusinessTypeConstant;
|
||||||
import xyz.playedu.common.types.JsonResponse;
|
import xyz.playedu.common.types.JsonResponse;
|
||||||
@ -29,8 +28,6 @@ import xyz.playedu.common.types.paginate.PaginationResult;
|
|||||||
import xyz.playedu.course.domain.CourseAttachmentDownloadLog;
|
import xyz.playedu.course.domain.CourseAttachmentDownloadLog;
|
||||||
import xyz.playedu.course.service.CourseAttachmentDownloadLogService;
|
import xyz.playedu.course.service.CourseAttachmentDownloadLogService;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequestMapping("/backend/v1/course/attachment/download/log")
|
@RequestMapping("/backend/v1/course/attachment/download/log")
|
||||||
|
@ -19,7 +19,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import xyz.playedu.api.event.CourseChapterDestroyEvent;
|
import xyz.playedu.api.event.CourseChapterDestroyEvent;
|
||||||
import xyz.playedu.api.request.backend.CourseChapterRequest;
|
import xyz.playedu.api.request.backend.CourseChapterRequest;
|
||||||
import xyz.playedu.api.request.backend.CourseChapterSortRequest;
|
import xyz.playedu.api.request.backend.CourseChapterSortRequest;
|
||||||
|
@ -15,16 +15,18 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.controller.backend;
|
package xyz.playedu.api.controller.backend;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.apache.commons.collections4.MapUtils;
|
import org.apache.commons.collections4.MapUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import xyz.playedu.api.event.CourseDestroyEvent;
|
import xyz.playedu.api.event.CourseDestroyEvent;
|
||||||
import xyz.playedu.api.request.backend.CourseRequest;
|
import xyz.playedu.api.request.backend.CourseRequest;
|
||||||
import xyz.playedu.common.annotation.BackendPermission;
|
import xyz.playedu.common.annotation.BackendPermission;
|
||||||
@ -53,11 +55,6 @@ import xyz.playedu.course.service.CourseService;
|
|||||||
import xyz.playedu.resource.domain.Resource;
|
import xyz.playedu.resource.domain.Resource;
|
||||||
import xyz.playedu.resource.service.ResourceService;
|
import xyz.playedu.resource.service.ResourceService;
|
||||||
|
|
||||||
import java.text.ParseException;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequestMapping("/backend/v1/course")
|
@RequestMapping("/backend/v1/course")
|
||||||
|
@ -15,14 +15,13 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.controller.backend;
|
package xyz.playedu.api.controller.backend;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import xyz.playedu.api.event.CourseHourCreatedEvent;
|
import xyz.playedu.api.event.CourseHourCreatedEvent;
|
||||||
import xyz.playedu.api.event.CourseHourDestroyEvent;
|
import xyz.playedu.api.event.CourseHourDestroyEvent;
|
||||||
import xyz.playedu.api.request.backend.CourseHourMultiRequest;
|
import xyz.playedu.api.request.backend.CourseHourMultiRequest;
|
||||||
@ -42,8 +41,6 @@ import xyz.playedu.course.domain.CourseHour;
|
|||||||
import xyz.playedu.course.service.CourseChapterService;
|
import xyz.playedu.course.service.CourseChapterService;
|
||||||
import xyz.playedu.course.service.CourseHourService;
|
import xyz.playedu.course.service.CourseHourService;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
*
|
*
|
||||||
@ -135,7 +132,7 @@ public class CourseHourController {
|
|||||||
public JsonResponse storeMulti(
|
public JsonResponse storeMulti(
|
||||||
@PathVariable(name = "courseId") Integer courseId,
|
@PathVariable(name = "courseId") Integer courseId,
|
||||||
@RequestBody @Validated CourseHourMultiRequest req) {
|
@RequestBody @Validated CourseHourMultiRequest req) {
|
||||||
if (req.getHours().size() == 0) {
|
if (req.getHours().isEmpty()) {
|
||||||
return JsonResponse.error("参数为空");
|
return JsonResponse.error("参数为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,15 +15,17 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.controller.backend;
|
package xyz.playedu.api.controller.backend;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.apache.commons.collections4.MapUtils;
|
import org.apache.commons.collections4.MapUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import xyz.playedu.api.event.UserCourseRecordDestroyEvent;
|
import xyz.playedu.api.event.UserCourseRecordDestroyEvent;
|
||||||
import xyz.playedu.api.request.backend.CourseUserDestroyRequest;
|
import xyz.playedu.api.request.backend.CourseUserDestroyRequest;
|
||||||
import xyz.playedu.common.annotation.BackendPermission;
|
import xyz.playedu.common.annotation.BackendPermission;
|
||||||
@ -42,11 +44,6 @@ import xyz.playedu.course.service.CourseService;
|
|||||||
import xyz.playedu.course.service.UserCourseHourRecordService;
|
import xyz.playedu.course.service.UserCourseHourRecordService;
|
||||||
import xyz.playedu.course.service.UserCourseRecordService;
|
import xyz.playedu.course.service.UserCourseRecordService;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
*
|
*
|
||||||
@ -102,7 +99,7 @@ public class CourseUserController {
|
|||||||
});
|
});
|
||||||
} else { // 默认读取课程关联的全部部门
|
} else { // 默认读取课程关联的全部部门
|
||||||
List<Integer> depIds = courseService.getDepIdsByCourseId(courseId);
|
List<Integer> depIds = courseService.getDepIdsByCourseId(courseId);
|
||||||
if (depIds != null && depIds.size() > 0) {
|
if (depIds != null && !depIds.isEmpty()) {
|
||||||
filter.setDepIds(depIds);
|
filter.setDepIds(depIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -159,7 +156,7 @@ public class CourseUserController {
|
|||||||
public JsonResponse destroy(
|
public JsonResponse destroy(
|
||||||
@PathVariable(name = "courseId") Integer courseId,
|
@PathVariable(name = "courseId") Integer courseId,
|
||||||
@RequestBody @Validated CourseUserDestroyRequest req) {
|
@RequestBody @Validated CourseUserDestroyRequest req) {
|
||||||
if (req.getIds().size() == 0) {
|
if (req.getIds().isEmpty()) {
|
||||||
return JsonResponse.error("请选择需要删除的数据");
|
return JsonResponse.error("请选择需要删除的数据");
|
||||||
}
|
}
|
||||||
List<UserCourseRecord> records =
|
List<UserCourseRecord> records =
|
||||||
|
@ -15,11 +15,15 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.controller.backend;
|
package xyz.playedu.api.controller.backend;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import xyz.playedu.common.annotation.Log;
|
import xyz.playedu.common.annotation.Log;
|
||||||
import xyz.playedu.common.constant.BackendConstant;
|
import xyz.playedu.common.constant.BackendConstant;
|
||||||
import xyz.playedu.common.constant.BusinessTypeConstant;
|
import xyz.playedu.common.constant.BusinessTypeConstant;
|
||||||
@ -32,12 +36,6 @@ import xyz.playedu.course.service.CourseService;
|
|||||||
import xyz.playedu.course.service.UserLearnDurationStatsService;
|
import xyz.playedu.course.service.UserLearnDurationStatsService;
|
||||||
import xyz.playedu.resource.service.ResourceService;
|
import xyz.playedu.resource.service.ResourceService;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
*
|
*
|
||||||
|
@ -15,15 +15,15 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.controller.backend;
|
package xyz.playedu.api.controller.backend;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.apache.commons.collections4.MapUtils;
|
import org.apache.commons.collections4.MapUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import xyz.playedu.api.event.DepartmentDestroyEvent;
|
import xyz.playedu.api.event.DepartmentDestroyEvent;
|
||||||
import xyz.playedu.api.request.backend.DepartmentParentRequest;
|
import xyz.playedu.api.request.backend.DepartmentParentRequest;
|
||||||
import xyz.playedu.api.request.backend.DepartmentRequest;
|
import xyz.playedu.api.request.backend.DepartmentRequest;
|
||||||
@ -50,9 +50,6 @@ import xyz.playedu.course.service.CourseDepartmentService;
|
|||||||
import xyz.playedu.course.service.CourseService;
|
import xyz.playedu.course.service.CourseService;
|
||||||
import xyz.playedu.course.service.UserCourseRecordService;
|
import xyz.playedu.course.service.UserCourseRecordService;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequestMapping("/backend/v1/department")
|
@RequestMapping("/backend/v1/department")
|
||||||
|
@ -15,11 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.controller.backend;
|
package xyz.playedu.api.controller.backend;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import xyz.playedu.api.event.AdminUserLoginEvent;
|
import xyz.playedu.api.event.AdminUserLoginEvent;
|
||||||
import xyz.playedu.api.request.backend.LoginRequest;
|
import xyz.playedu.api.request.backend.LoginRequest;
|
||||||
import xyz.playedu.api.request.backend.PasswordChangeRequest;
|
import xyz.playedu.api.request.backend.PasswordChangeRequest;
|
||||||
@ -37,11 +37,9 @@ import xyz.playedu.common.service.RateLimiterService;
|
|||||||
import xyz.playedu.common.types.JsonResponse;
|
import xyz.playedu.common.types.JsonResponse;
|
||||||
import xyz.playedu.common.util.HelperUtil;
|
import xyz.playedu.common.util.HelperUtil;
|
||||||
import xyz.playedu.common.util.IpUtil;
|
import xyz.playedu.common.util.IpUtil;
|
||||||
import xyz.playedu.common.util.RedisUtil;
|
import xyz.playedu.common.util.MemoryCacheUtil;
|
||||||
import xyz.playedu.common.util.RequestUtil;
|
import xyz.playedu.common.util.RequestUtil;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/backend/v1/auth")
|
@RequestMapping("/backend/v1/auth")
|
||||||
public class LoginController {
|
public class LoginController {
|
||||||
@ -68,8 +66,8 @@ public class LoginController {
|
|||||||
|
|
||||||
String limitKey = "admin-login-limit:" + loginRequest.getEmail();
|
String limitKey = "admin-login-limit:" + loginRequest.getEmail();
|
||||||
Long reqCount = rateLimiterService.current(limitKey, 3600L);
|
Long reqCount = rateLimiterService.current(limitKey, 3600L);
|
||||||
if (reqCount > 5 && !playEduConfig.getTesting()) {
|
if (reqCount > 10 && !playEduConfig.getTesting()) {
|
||||||
Long exp = RedisUtil.ttlWithoutPrefix(limitKey);
|
Long exp = MemoryCacheUtil.ttlWithoutPrefix(limitKey);
|
||||||
return JsonResponse.error(
|
return JsonResponse.error(
|
||||||
String.format("您的账号已被锁定,请%s后重试", exp > 60 ? exp / 60 + "分钟" : exp + "秒"));
|
String.format("您的账号已被锁定,请%s后重试", exp > 60 ? exp / 60 + "分钟" : exp + "秒"));
|
||||||
}
|
}
|
||||||
@ -80,7 +78,7 @@ public class LoginController {
|
|||||||
return JsonResponse.error("邮箱或密码错误");
|
return JsonResponse.error("邮箱或密码错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
RedisUtil.del(limitKey);
|
MemoryCacheUtil.del(limitKey);
|
||||||
|
|
||||||
if (adminUser.getIsBanLogin().equals(1)) {
|
if (adminUser.getIsBanLogin().equals(1)) {
|
||||||
return JsonResponse.error("当前管理员已禁止登录");
|
return JsonResponse.error("当前管理员已禁止登录");
|
||||||
|
@ -15,11 +15,12 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.controller.backend;
|
package xyz.playedu.api.controller.backend;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import xyz.playedu.api.event.ResourceCategoryDestroyEvent;
|
import xyz.playedu.api.event.ResourceCategoryDestroyEvent;
|
||||||
import xyz.playedu.api.request.backend.ResourceCategoryParentRequest;
|
import xyz.playedu.api.request.backend.ResourceCategoryParentRequest;
|
||||||
import xyz.playedu.api.request.backend.ResourceCategoryRequest;
|
import xyz.playedu.api.request.backend.ResourceCategoryRequest;
|
||||||
@ -40,9 +41,6 @@ import xyz.playedu.resource.domain.Resource;
|
|||||||
import xyz.playedu.resource.service.ResourceCategoryService;
|
import xyz.playedu.resource.service.ResourceCategoryService;
|
||||||
import xyz.playedu.resource.service.ResourceService;
|
import xyz.playedu.resource.service.ResourceService;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
*
|
*
|
||||||
@ -128,7 +126,7 @@ public class ResourceCategoryController {
|
|||||||
data.put("videos", new ArrayList<>());
|
data.put("videos", new ArrayList<>());
|
||||||
data.put("images", new ArrayList<>());
|
data.put("images", new ArrayList<>());
|
||||||
|
|
||||||
if (courseIds != null && courseIds.size() > 0) {
|
if (courseIds != null && !courseIds.isEmpty()) {
|
||||||
data.put(
|
data.put(
|
||||||
"courses",
|
"courses",
|
||||||
courseService.chunks(
|
courseService.chunks(
|
||||||
@ -141,7 +139,7 @@ public class ResourceCategoryController {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rids != null && rids.size() > 0) {
|
if (rids != null && !rids.isEmpty()) {
|
||||||
Map<String, List<Resource>> resources =
|
Map<String, List<Resource>> resources =
|
||||||
resourceService
|
resourceService
|
||||||
.chunks(
|
.chunks(
|
||||||
|
@ -15,14 +15,14 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.controller.backend;
|
package xyz.playedu.api.controller.backend;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
|
|
||||||
import org.apache.commons.collections4.MapUtils;
|
import org.apache.commons.collections4.MapUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import xyz.playedu.api.request.backend.ResourceDestroyMultiRequest;
|
import xyz.playedu.api.request.backend.ResourceDestroyMultiRequest;
|
||||||
import xyz.playedu.api.request.backend.ResourceUpdateRequest;
|
import xyz.playedu.api.request.backend.ResourceUpdateRequest;
|
||||||
import xyz.playedu.common.annotation.Log;
|
import xyz.playedu.common.annotation.Log;
|
||||||
@ -47,9 +47,6 @@ import xyz.playedu.resource.domain.ResourceVideo;
|
|||||||
import xyz.playedu.resource.service.ResourceService;
|
import xyz.playedu.resource.service.ResourceService;
|
||||||
import xyz.playedu.resource.service.ResourceVideoService;
|
import xyz.playedu.resource.service.ResourceVideoService;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/backend/v1/resource")
|
@RequestMapping("/backend/v1/resource")
|
||||||
public class ResourceController {
|
public class ResourceController {
|
||||||
|
@ -15,13 +15,15 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.controller.backend;
|
package xyz.playedu.api.controller.backend;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import xyz.playedu.api.bus.UserBus;
|
import xyz.playedu.api.bus.UserBus;
|
||||||
import xyz.playedu.common.annotation.Log;
|
import xyz.playedu.common.annotation.Log;
|
||||||
import xyz.playedu.common.constant.BusinessTypeConstant;
|
import xyz.playedu.common.constant.BusinessTypeConstant;
|
||||||
@ -32,11 +34,6 @@ import xyz.playedu.common.service.DepartmentService;
|
|||||||
import xyz.playedu.common.types.JsonResponse;
|
import xyz.playedu.common.types.JsonResponse;
|
||||||
import xyz.playedu.common.util.RequestUtil;
|
import xyz.playedu.common.util.RequestUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/backend/v1/system")
|
@RequestMapping("/backend/v1/system")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@ -15,14 +15,13 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.controller.backend;
|
package xyz.playedu.api.controller.backend;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.apache.commons.collections4.MapUtils;
|
import org.apache.commons.collections4.MapUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import xyz.playedu.api.request.backend.UploadFileMergeRequest;
|
import xyz.playedu.api.request.backend.UploadFileMergeRequest;
|
||||||
import xyz.playedu.common.annotation.BackendPermission;
|
import xyz.playedu.common.annotation.BackendPermission;
|
||||||
import xyz.playedu.common.annotation.Log;
|
import xyz.playedu.common.annotation.Log;
|
||||||
@ -33,14 +32,13 @@ import xyz.playedu.common.context.BCtx;
|
|||||||
import xyz.playedu.common.exception.ServiceException;
|
import xyz.playedu.common.exception.ServiceException;
|
||||||
import xyz.playedu.common.service.AppConfigService;
|
import xyz.playedu.common.service.AppConfigService;
|
||||||
import xyz.playedu.common.types.JsonResponse;
|
import xyz.playedu.common.types.JsonResponse;
|
||||||
|
import xyz.playedu.common.types.config.S3Config;
|
||||||
import xyz.playedu.common.util.HelperUtil;
|
import xyz.playedu.common.util.HelperUtil;
|
||||||
import xyz.playedu.common.util.S3Util;
|
import xyz.playedu.common.util.S3Util;
|
||||||
import xyz.playedu.resource.domain.Resource;
|
import xyz.playedu.resource.domain.Resource;
|
||||||
import xyz.playedu.resource.service.ResourceService;
|
import xyz.playedu.resource.service.ResourceService;
|
||||||
import xyz.playedu.resource.service.UploadService;
|
import xyz.playedu.resource.service.UploadService;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequestMapping("/backend/v1/upload")
|
@RequestMapping("/backend/v1/upload")
|
||||||
@ -59,7 +57,12 @@ public class UploadController {
|
|||||||
@RequestParam HashMap<String, Object> params, MultipartFile file)
|
@RequestParam HashMap<String, Object> params, MultipartFile file)
|
||||||
throws ServiceException {
|
throws ServiceException {
|
||||||
String categoryIds = MapUtils.getString(params, "category_ids");
|
String categoryIds = MapUtils.getString(params, "category_ids");
|
||||||
Resource res = uploadService.storeMinio(BCtx.getId(), file, categoryIds);
|
Resource res =
|
||||||
|
uploadService.storeMinio(
|
||||||
|
appConfigService.getS3Config().getService(),
|
||||||
|
BCtx.getId(),
|
||||||
|
file,
|
||||||
|
categoryIds);
|
||||||
return JsonResponse.data(res);
|
return JsonResponse.data(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,7 +124,8 @@ public class UploadController {
|
|||||||
String originalFilename = req.getOriginalFilename().replaceAll("(?i)." + extension, "");
|
String originalFilename = req.getOriginalFilename().replaceAll("(?i)." + extension, "");
|
||||||
|
|
||||||
// 合并资源文件
|
// 合并资源文件
|
||||||
S3Util s3Util = new S3Util(appConfigService.getS3Config());
|
S3Config s3Config = appConfigService.getS3Config();
|
||||||
|
S3Util s3Util = new S3Util(s3Config);
|
||||||
String url = s3Util.merge(req.getFilename(), req.getUploadId());
|
String url = s3Util.merge(req.getFilename(), req.getUploadId());
|
||||||
|
|
||||||
// 资源素材保存
|
// 资源素材保存
|
||||||
@ -133,7 +137,7 @@ public class UploadController {
|
|||||||
originalFilename,
|
originalFilename,
|
||||||
extension,
|
extension,
|
||||||
req.getSize(),
|
req.getSize(),
|
||||||
BackendConstant.STORAGE_DRIVER_MINIO,
|
s3Config.getService(),
|
||||||
"",
|
"",
|
||||||
req.getFilename(),
|
req.getFilename(),
|
||||||
url);
|
url);
|
||||||
@ -142,7 +146,8 @@ public class UploadController {
|
|||||||
if (BackendConstant.RESOURCE_TYPE_VIDEO.equals(type)) {
|
if (BackendConstant.RESOURCE_TYPE_VIDEO.equals(type)) {
|
||||||
// 视频封面素材保存
|
// 视频封面素材保存
|
||||||
Resource posterResource =
|
Resource posterResource =
|
||||||
uploadService.storeBase64Image(BCtx.getId(), req.getPoster(), null);
|
uploadService.storeBase64Image(
|
||||||
|
s3Config.getService(), BCtx.getId(), req.getPoster(), null);
|
||||||
// 视频的封面素材改为[隐藏 && 属于视频的子素材]
|
// 视频的封面素材改为[隐藏 && 属于视频的子素材]
|
||||||
resourceService.changeParentId(posterResource.getId(), videoResource.getId());
|
resourceService.changeParentId(posterResource.getId(), videoResource.getId());
|
||||||
// 视频信息
|
// 视频信息
|
||||||
|
@ -16,18 +16,17 @@
|
|||||||
package xyz.playedu.api.controller.backend;
|
package xyz.playedu.api.controller.backend;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.apache.commons.collections4.MapUtils;
|
import org.apache.commons.collections4.MapUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import xyz.playedu.api.bus.UserBus;
|
import xyz.playedu.api.bus.UserBus;
|
||||||
import xyz.playedu.api.event.UserCourseHourRecordDestroyEvent;
|
import xyz.playedu.api.event.UserCourseHourRecordDestroyEvent;
|
||||||
import xyz.playedu.api.event.UserCourseRecordDestroyEvent;
|
import xyz.playedu.api.event.UserCourseRecordDestroyEvent;
|
||||||
@ -55,9 +54,6 @@ import xyz.playedu.common.util.StringUtil;
|
|||||||
import xyz.playedu.course.domain.*;
|
import xyz.playedu.course.domain.*;
|
||||||
import xyz.playedu.course.service.*;
|
import xyz.playedu.course.service.*;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
*
|
*
|
||||||
|
@ -15,19 +15,17 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.controller.frontend;
|
package xyz.playedu.api.controller.frontend;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import xyz.playedu.common.domain.Category;
|
import xyz.playedu.common.domain.Category;
|
||||||
import xyz.playedu.common.service.CategoryService;
|
import xyz.playedu.common.service.CategoryService;
|
||||||
import xyz.playedu.common.types.JsonResponse;
|
import xyz.playedu.common.types.JsonResponse;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/v1/category")
|
@RequestMapping("/api/v1/category")
|
||||||
public class CategoryController {
|
public class CategoryController {
|
||||||
|
@ -15,11 +15,15 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.controller.frontend;
|
package xyz.playedu.api.controller.frontend;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import xyz.playedu.common.context.FCtx;
|
import xyz.playedu.common.context.FCtx;
|
||||||
import xyz.playedu.common.types.JsonResponse;
|
import xyz.playedu.common.types.JsonResponse;
|
||||||
import xyz.playedu.common.util.IpUtil;
|
import xyz.playedu.common.util.IpUtil;
|
||||||
@ -28,13 +32,6 @@ import xyz.playedu.course.service.*;
|
|||||||
import xyz.playedu.resource.domain.Resource;
|
import xyz.playedu.resource.domain.Resource;
|
||||||
import xyz.playedu.resource.service.ResourceService;
|
import xyz.playedu.resource.service.ResourceService;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
*
|
*
|
||||||
|
@ -15,15 +15,13 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.controller.frontend;
|
package xyz.playedu.api.controller.frontend;
|
||||||
|
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import xyz.playedu.common.domain.Department;
|
import xyz.playedu.common.domain.Department;
|
||||||
import xyz.playedu.common.service.DepartmentService;
|
import xyz.playedu.common.service.DepartmentService;
|
||||||
import xyz.playedu.common.types.JsonResponse;
|
import xyz.playedu.common.types.JsonResponse;
|
||||||
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
*
|
*
|
||||||
|
@ -15,20 +15,19 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.controller.frontend;
|
package xyz.playedu.api.controller.frontend;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import xyz.playedu.api.event.UserCourseHourFinishedEvent;
|
import xyz.playedu.api.event.UserCourseHourFinishedEvent;
|
||||||
import xyz.playedu.api.event.UserLearnCourseUpdateEvent;
|
import xyz.playedu.api.event.UserLearnCourseUpdateEvent;
|
||||||
import xyz.playedu.api.request.frontend.CourseHourRecordRequest;
|
import xyz.playedu.api.request.frontend.CourseHourRecordRequest;
|
||||||
import xyz.playedu.common.context.FCtx;
|
import xyz.playedu.common.context.FCtx;
|
||||||
import xyz.playedu.common.types.JsonResponse;
|
import xyz.playedu.common.types.JsonResponse;
|
||||||
import xyz.playedu.common.util.RedisDistributedLock;
|
import xyz.playedu.common.util.MemoryDistributedLock;
|
||||||
import xyz.playedu.course.caches.CourseCache;
|
|
||||||
import xyz.playedu.course.caches.UserCanSeeCourseCache;
|
import xyz.playedu.course.caches.UserCanSeeCourseCache;
|
||||||
import xyz.playedu.course.caches.UserLastLearnTimeCache;
|
import xyz.playedu.course.caches.UserLastLearnTimeCache;
|
||||||
import xyz.playedu.course.domain.Course;
|
import xyz.playedu.course.domain.Course;
|
||||||
@ -40,9 +39,6 @@ import xyz.playedu.course.service.UserCourseHourRecordService;
|
|||||||
import xyz.playedu.resource.domain.Resource;
|
import xyz.playedu.resource.domain.Resource;
|
||||||
import xyz.playedu.resource.service.ResourceService;
|
import xyz.playedu.resource.service.ResourceService;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
*
|
*
|
||||||
@ -62,9 +58,8 @@ public class HourController {
|
|||||||
|
|
||||||
// ------- CACHE ----------
|
// ------- CACHE ----------
|
||||||
@Autowired private UserCanSeeCourseCache userCanSeeCourseCache;
|
@Autowired private UserCanSeeCourseCache userCanSeeCourseCache;
|
||||||
@Autowired private CourseCache courseCache;
|
|
||||||
|
|
||||||
@Autowired private RedisDistributedLock redisDistributedLock;
|
@Autowired private MemoryDistributedLock distributedLock;
|
||||||
|
|
||||||
@Autowired private UserLastLearnTimeCache userLastLearnTimeCache;
|
@Autowired private UserLastLearnTimeCache userLastLearnTimeCache;
|
||||||
|
|
||||||
@ -125,7 +120,7 @@ public class HourController {
|
|||||||
|
|
||||||
// 获取锁
|
// 获取锁
|
||||||
String lockKey = String.format("record:%d", FCtx.getId());
|
String lockKey = String.format("record:%d", FCtx.getId());
|
||||||
boolean tryLock = redisDistributedLock.tryLock(lockKey, 5, TimeUnit.SECONDS);
|
boolean tryLock = distributedLock.tryLock(lockKey, 5, TimeUnit.SECONDS);
|
||||||
if (!tryLock) {
|
if (!tryLock) {
|
||||||
return JsonResponse.success();
|
return JsonResponse.success();
|
||||||
}
|
}
|
||||||
@ -141,7 +136,7 @@ public class HourController {
|
|||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
// 此处未考虑上面代码执行失败释放锁
|
// 此处未考虑上面代码执行失败释放锁
|
||||||
redisDistributedLock.releaseLock(lockKey);
|
distributedLock.releaseLock(lockKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
return JsonResponse.success();
|
return JsonResponse.success();
|
||||||
@ -156,7 +151,7 @@ public class HourController {
|
|||||||
|
|
||||||
// 获取锁
|
// 获取锁
|
||||||
String lockKey = String.format("ping:%d", FCtx.getId());
|
String lockKey = String.format("ping:%d", FCtx.getId());
|
||||||
boolean tryLock = redisDistributedLock.tryLock(lockKey, 5, TimeUnit.SECONDS);
|
boolean tryLock = distributedLock.tryLock(lockKey, 5, TimeUnit.SECONDS);
|
||||||
if (!tryLock) {
|
if (!tryLock) {
|
||||||
return JsonResponse.success();
|
return JsonResponse.success();
|
||||||
}
|
}
|
||||||
@ -178,7 +173,7 @@ public class HourController {
|
|||||||
this, FCtx.getId(), courseId, id, lastTime, curTime));
|
this, FCtx.getId(), courseId, id, lastTime, curTime));
|
||||||
} finally {
|
} finally {
|
||||||
// 此处未考虑上面代码执行失败释放锁
|
// 此处未考虑上面代码执行失败释放锁
|
||||||
redisDistributedLock.releaseLock(lockKey);
|
distributedLock.releaseLock(lockKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
return JsonResponse.success();
|
return JsonResponse.success();
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.controller.frontend;
|
package xyz.playedu.api.controller.frontend;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -25,7 +25,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import xyz.playedu.api.bus.LoginBus;
|
import xyz.playedu.api.bus.LoginBus;
|
||||||
import xyz.playedu.api.cache.LoginLimitCache;
|
import xyz.playedu.api.cache.LoginLimitCache;
|
||||||
import xyz.playedu.api.cache.LoginLockCache;
|
import xyz.playedu.api.cache.LoginLockCache;
|
||||||
@ -43,8 +42,6 @@ import xyz.playedu.common.util.*;
|
|||||||
import xyz.playedu.common.util.ldap.LdapTransformUser;
|
import xyz.playedu.common.util.ldap.LdapTransformUser;
|
||||||
import xyz.playedu.common.util.ldap.LdapUtil;
|
import xyz.playedu.common.util.ldap.LdapUtil;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/v1/auth/login")
|
@RequestMapping("/api/v1/auth/login")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@ -15,18 +15,16 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.controller.frontend;
|
package xyz.playedu.api.controller.frontend;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import xyz.playedu.common.constant.ConfigConstant;
|
import xyz.playedu.common.constant.ConfigConstant;
|
||||||
import xyz.playedu.common.service.AppConfigService;
|
import xyz.playedu.common.service.AppConfigService;
|
||||||
import xyz.playedu.common.types.JsonResponse;
|
import xyz.playedu.common.types.JsonResponse;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/v1/system")
|
@RequestMapping("/api/v1/system")
|
||||||
public class SystemController {
|
public class SystemController {
|
||||||
|
@ -15,15 +15,15 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.controller.frontend;
|
package xyz.playedu.api.controller.frontend;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.apache.commons.collections4.MapUtils;
|
import org.apache.commons.collections4.MapUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import xyz.playedu.api.request.frontend.ChangePasswordRequest;
|
import xyz.playedu.api.request.frontend.ChangePasswordRequest;
|
||||||
import xyz.playedu.common.constant.FrontendConstant;
|
import xyz.playedu.common.constant.FrontendConstant;
|
||||||
import xyz.playedu.common.context.FCtx;
|
import xyz.playedu.common.context.FCtx;
|
||||||
@ -32,6 +32,7 @@ import xyz.playedu.common.domain.Department;
|
|||||||
import xyz.playedu.common.domain.User;
|
import xyz.playedu.common.domain.User;
|
||||||
import xyz.playedu.common.domain.UserUploadImageLog;
|
import xyz.playedu.common.domain.UserUploadImageLog;
|
||||||
import xyz.playedu.common.exception.ServiceException;
|
import xyz.playedu.common.exception.ServiceException;
|
||||||
|
import xyz.playedu.common.service.AppConfigService;
|
||||||
import xyz.playedu.common.service.CategoryService;
|
import xyz.playedu.common.service.CategoryService;
|
||||||
import xyz.playedu.common.service.DepartmentService;
|
import xyz.playedu.common.service.DepartmentService;
|
||||||
import xyz.playedu.common.service.UserService;
|
import xyz.playedu.common.service.UserService;
|
||||||
@ -43,9 +44,6 @@ import xyz.playedu.course.domain.*;
|
|||||||
import xyz.playedu.course.service.*;
|
import xyz.playedu.course.service.*;
|
||||||
import xyz.playedu.resource.service.UploadService;
|
import xyz.playedu.resource.service.UploadService;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/v1/user")
|
@RequestMapping("/api/v1/user")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -69,6 +67,8 @@ public class UserController {
|
|||||||
|
|
||||||
@Autowired private CategoryService categoryService;
|
@Autowired private CategoryService categoryService;
|
||||||
|
|
||||||
|
@Autowired private AppConfigService appConfigService;
|
||||||
|
|
||||||
@GetMapping("/detail")
|
@GetMapping("/detail")
|
||||||
public JsonResponse detail() {
|
public JsonResponse detail() {
|
||||||
User user = FCtx.getUser();
|
User user = FCtx.getUser();
|
||||||
@ -91,6 +91,7 @@ public class UserController {
|
|||||||
public JsonResponse changeAvatar(MultipartFile file) {
|
public JsonResponse changeAvatar(MultipartFile file) {
|
||||||
UserUploadImageLog log =
|
UserUploadImageLog log =
|
||||||
uploadService.userAvatar(
|
uploadService.userAvatar(
|
||||||
|
appConfigService.getS3Config().getService(),
|
||||||
FCtx.getId(),
|
FCtx.getId(),
|
||||||
file,
|
file,
|
||||||
FrontendConstant.USER_UPLOAD_IMAGE_TYPE_AVATAR,
|
FrontendConstant.USER_UPLOAD_IMAGE_TYPE_AVATAR,
|
||||||
|
@ -15,13 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.event;
|
package xyz.playedu.api.event;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import org.springframework.context.ApplicationEvent;
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public class AdminUserLoginEvent extends ApplicationEvent {
|
public class AdminUserLoginEvent extends ApplicationEvent {
|
||||||
|
@ -15,13 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.event;
|
package xyz.playedu.api.event;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import org.springframework.context.ApplicationEvent;
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
*
|
*
|
||||||
|
@ -15,13 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.event;
|
package xyz.playedu.api.event;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import org.springframework.context.ApplicationEvent;
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
*
|
*
|
||||||
|
@ -15,13 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.event;
|
package xyz.playedu.api.event;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import org.springframework.context.ApplicationEvent;
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
*
|
*
|
||||||
|
@ -15,13 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.event;
|
package xyz.playedu.api.event;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import org.springframework.context.ApplicationEvent;
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
*
|
*
|
||||||
|
@ -15,13 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.event;
|
package xyz.playedu.api.event;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import org.springframework.context.ApplicationEvent;
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
*
|
*
|
||||||
|
@ -15,13 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.event;
|
package xyz.playedu.api.event;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import org.springframework.context.ApplicationEvent;
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
*
|
*
|
||||||
|
@ -15,13 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.event;
|
package xyz.playedu.api.event;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import org.springframework.context.ApplicationEvent;
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
*
|
*
|
||||||
|
@ -15,13 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.event;
|
package xyz.playedu.api.event;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import org.springframework.context.ApplicationEvent;
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
*
|
*
|
||||||
|
@ -15,13 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.event;
|
package xyz.playedu.api.event;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import org.springframework.context.ApplicationEvent;
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
*
|
*
|
||||||
|
@ -15,13 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.event;
|
package xyz.playedu.api.event;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import org.springframework.context.ApplicationEvent;
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
*
|
*
|
||||||
|
@ -15,13 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.event;
|
package xyz.playedu.api.event;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import org.springframework.context.ApplicationEvent;
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
*
|
*
|
||||||
|
@ -17,7 +17,6 @@ package xyz.playedu.api.event;
|
|||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import org.springframework.context.ApplicationEvent;
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,14 +16,11 @@
|
|||||||
package xyz.playedu.api.event;
|
package xyz.playedu.api.event;
|
||||||
|
|
||||||
import cn.hutool.http.useragent.UserAgent;
|
import cn.hutool.http.useragent.UserAgent;
|
||||||
|
import java.util.Date;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import org.springframework.context.ApplicationEvent;
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
*
|
*
|
||||||
|
@ -15,13 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.event;
|
package xyz.playedu.api.event;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import org.springframework.context.ApplicationEvent;
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
*
|
*
|
||||||
|
@ -17,14 +17,13 @@ package xyz.playedu.api.interceptor;
|
|||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Map;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
|
||||||
import xyz.playedu.common.bus.BackendBus;
|
import xyz.playedu.common.bus.BackendBus;
|
||||||
import xyz.playedu.common.context.BCtx;
|
import xyz.playedu.common.context.BCtx;
|
||||||
import xyz.playedu.common.domain.AdminUser;
|
import xyz.playedu.common.domain.AdminUser;
|
||||||
@ -34,9 +33,6 @@ import xyz.playedu.common.service.BackendAuthService;
|
|||||||
import xyz.playedu.common.types.JsonResponse;
|
import xyz.playedu.common.types.JsonResponse;
|
||||||
import xyz.playedu.common.util.HelperUtil;
|
import xyz.playedu.common.util.HelperUtil;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Order(20)
|
@Order(20)
|
||||||
|
@ -17,14 +17,11 @@ package xyz.playedu.api.interceptor;
|
|||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
|
||||||
import xyz.playedu.common.config.PlayEduConfig;
|
import xyz.playedu.common.config.PlayEduConfig;
|
||||||
import xyz.playedu.common.constant.BackendConstant;
|
import xyz.playedu.common.constant.BackendConstant;
|
||||||
import xyz.playedu.common.service.RateLimiterService;
|
import xyz.playedu.common.service.RateLimiterService;
|
||||||
@ -45,20 +42,13 @@ public class ApiInterceptor implements HandlerInterceptor {
|
|||||||
public boolean preHandle(
|
public boolean preHandle(
|
||||||
HttpServletRequest request, HttpServletResponse response, Object handler)
|
HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
|
||||||
response.setHeader("Access-Control-Allow-Headers", "*");
|
|
||||||
response.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
|
|
||||||
response.setHeader("Access-Control-Max-Age", "86400");
|
|
||||||
|
|
||||||
if ("OPTIONS".equals(request.getMethod())) {
|
if ("OPTIONS".equals(request.getMethod())) {
|
||||||
response.setStatus(204);
|
|
||||||
// 返回false意味着整个请求执行到这里结束,不会继续乡下执行了
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 当前api的请求路径
|
// 当前api的请求路径
|
||||||
String path = request.getRequestURI();
|
String path = request.getRequestURI();
|
||||||
// 白名单过滤 || OPTIONS请求
|
// 白名单过滤
|
||||||
if (BackendConstant.API_LIMIT_WHITELIST.contains(path)) {
|
if (BackendConstant.API_LIMIT_WHITELIST.contains(path)) {
|
||||||
return HandlerInterceptor.super.preHandle(request, response, handler);
|
return HandlerInterceptor.super.preHandle(request, response, handler);
|
||||||
}
|
}
|
||||||
|
@ -17,14 +17,12 @@ package xyz.playedu.api.interceptor;
|
|||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
|
||||||
import xyz.playedu.common.constant.FrontendConstant;
|
import xyz.playedu.common.constant.FrontendConstant;
|
||||||
import xyz.playedu.common.context.FCtx;
|
import xyz.playedu.common.context.FCtx;
|
||||||
import xyz.playedu.common.domain.User;
|
import xyz.playedu.common.domain.User;
|
||||||
@ -33,8 +31,6 @@ import xyz.playedu.common.service.UserService;
|
|||||||
import xyz.playedu.common.types.JsonResponse;
|
import xyz.playedu.common.types.JsonResponse;
|
||||||
import xyz.playedu.common.util.HelperUtil;
|
import xyz.playedu.common.util.HelperUtil;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Order(20)
|
@Order(20)
|
||||||
|
@ -16,9 +16,9 @@
|
|||||||
package xyz.playedu.api.interceptor;
|
package xyz.playedu.api.interceptor;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
@ -38,4 +38,13 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
|||||||
registry.addInterceptor(adminInterceptor).addPathPatterns("/backend/**");
|
registry.addInterceptor(adminInterceptor).addPathPatterns("/backend/**");
|
||||||
registry.addInterceptor(frontInterceptor).addPathPatterns("/api/v1/**");
|
registry.addInterceptor(frontInterceptor).addPathPatterns("/api/v1/**");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addCorsMappings(CorsRegistry registry) {
|
||||||
|
registry.addMapping("/**")
|
||||||
|
.allowedOrigins("*")
|
||||||
|
.allowedMethods("*")
|
||||||
|
.allowedHeaders("*")
|
||||||
|
.maxAge(1_296_000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,9 @@
|
|||||||
package xyz.playedu.api.listener;
|
package xyz.playedu.api.listener;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import xyz.playedu.api.event.AdminUserLoginEvent;
|
import xyz.playedu.api.event.AdminUserLoginEvent;
|
||||||
import xyz.playedu.common.domain.AdminUser;
|
import xyz.playedu.common.domain.AdminUser;
|
||||||
import xyz.playedu.common.service.AdminUserService;
|
import xyz.playedu.common.service.AdminUserService;
|
||||||
|
@ -18,7 +18,6 @@ package xyz.playedu.api.listener;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import xyz.playedu.api.event.CourseCategoryDestroyEvent;
|
import xyz.playedu.api.event.CourseCategoryDestroyEvent;
|
||||||
import xyz.playedu.course.service.CourseService;
|
import xyz.playedu.course.service.CourseService;
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ package xyz.playedu.api.listener;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import xyz.playedu.api.event.CourseChapterDestroyEvent;
|
import xyz.playedu.api.event.CourseChapterDestroyEvent;
|
||||||
import xyz.playedu.course.service.CourseHourService;
|
import xyz.playedu.course.service.CourseHourService;
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ package xyz.playedu.api.listener;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import xyz.playedu.api.event.CourseDestroyEvent;
|
import xyz.playedu.api.event.CourseDestroyEvent;
|
||||||
import xyz.playedu.course.service.CourseAttachmentService;
|
import xyz.playedu.course.service.CourseAttachmentService;
|
||||||
import xyz.playedu.course.service.CourseCategoryService;
|
import xyz.playedu.course.service.CourseCategoryService;
|
||||||
|
@ -18,7 +18,6 @@ package xyz.playedu.api.listener;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import xyz.playedu.api.event.CourseHourCreatedEvent;
|
import xyz.playedu.api.event.CourseHourCreatedEvent;
|
||||||
import xyz.playedu.course.service.CourseHourService;
|
import xyz.playedu.course.service.CourseHourService;
|
||||||
import xyz.playedu.course.service.CourseService;
|
import xyz.playedu.course.service.CourseService;
|
||||||
|
@ -18,7 +18,6 @@ package xyz.playedu.api.listener;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import xyz.playedu.api.event.CourseHourDestroyEvent;
|
import xyz.playedu.api.event.CourseHourDestroyEvent;
|
||||||
import xyz.playedu.course.service.CourseHourService;
|
import xyz.playedu.course.service.CourseHourService;
|
||||||
import xyz.playedu.course.service.CourseService;
|
import xyz.playedu.course.service.CourseService;
|
||||||
|
@ -18,7 +18,6 @@ package xyz.playedu.api.listener;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import xyz.playedu.api.event.DepartmentDestroyEvent;
|
import xyz.playedu.api.event.DepartmentDestroyEvent;
|
||||||
import xyz.playedu.common.service.DepartmentService;
|
import xyz.playedu.common.service.DepartmentService;
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ package xyz.playedu.api.listener;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import xyz.playedu.api.event.UserCourseHourFinishedEvent;
|
import xyz.playedu.api.event.UserCourseHourFinishedEvent;
|
||||||
import xyz.playedu.course.service.CourseHourService;
|
import xyz.playedu.course.service.CourseHourService;
|
||||||
import xyz.playedu.course.service.UserCourseHourRecordService;
|
import xyz.playedu.course.service.UserCourseHourRecordService;
|
||||||
|
@ -16,11 +16,9 @@
|
|||||||
package xyz.playedu.api.listener;
|
package xyz.playedu.api.listener;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import xyz.playedu.api.event.UserCourseHourRecordDestroyEvent;
|
import xyz.playedu.api.event.UserCourseHourRecordDestroyEvent;
|
||||||
import xyz.playedu.course.service.UserCourseRecordService;
|
import xyz.playedu.course.service.UserCourseRecordService;
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ package xyz.playedu.api.listener;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import xyz.playedu.api.event.UserCourseRecordDestroyEvent;
|
import xyz.playedu.api.event.UserCourseRecordDestroyEvent;
|
||||||
import xyz.playedu.course.service.UserCourseHourRecordService;
|
import xyz.playedu.course.service.UserCourseHourRecordService;
|
||||||
|
|
||||||
|
@ -16,11 +16,9 @@
|
|||||||
package xyz.playedu.api.listener;
|
package xyz.playedu.api.listener;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import xyz.playedu.api.event.UserDestroyEvent;
|
import xyz.playedu.api.event.UserDestroyEvent;
|
||||||
import xyz.playedu.common.service.UserLoginRecordService;
|
import xyz.playedu.common.service.UserLoginRecordService;
|
||||||
import xyz.playedu.common.service.UserService;
|
import xyz.playedu.common.service.UserService;
|
||||||
|
@ -16,11 +16,9 @@
|
|||||||
package xyz.playedu.api.listener;
|
package xyz.playedu.api.listener;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import xyz.playedu.api.event.UserLearnCourseUpdateEvent;
|
import xyz.playedu.api.event.UserLearnCourseUpdateEvent;
|
||||||
import xyz.playedu.course.service.UserLearnDurationRecordService;
|
import xyz.playedu.course.service.UserLearnDurationRecordService;
|
||||||
import xyz.playedu.course.service.UserLearnDurationStatsService;
|
import xyz.playedu.course.service.UserLearnDurationStatsService;
|
||||||
|
@ -15,20 +15,17 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.listener;
|
package xyz.playedu.api.listener;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import xyz.playedu.api.event.UserLoginEvent;
|
import xyz.playedu.api.event.UserLoginEvent;
|
||||||
import xyz.playedu.common.service.FrontendAuthService;
|
import xyz.playedu.common.service.FrontendAuthService;
|
||||||
import xyz.playedu.common.service.UserLoginRecordService;
|
import xyz.playedu.common.service.UserLoginRecordService;
|
||||||
import xyz.playedu.common.util.IpUtil;
|
import xyz.playedu.common.util.IpUtil;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class UserLoginListener {
|
public class UserLoginListener {
|
||||||
|
@ -16,12 +16,10 @@
|
|||||||
package xyz.playedu.api.listener;
|
package xyz.playedu.api.listener;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import xyz.playedu.api.event.UserLogoutEvent;
|
import xyz.playedu.api.event.UserLogoutEvent;
|
||||||
import xyz.playedu.common.service.UserLoginRecordService;
|
import xyz.playedu.common.service.UserLoginRecordService;
|
||||||
|
|
||||||
|
@ -16,16 +16,12 @@
|
|||||||
package xyz.playedu.api.request.backend;
|
package xyz.playedu.api.request.backend;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import org.hibernate.validator.constraints.Length;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
|
@ -16,17 +16,13 @@
|
|||||||
package xyz.playedu.api.request.backend;
|
package xyz.playedu.api.request.backend;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import jakarta.validation.constraints.Email;
|
import jakarta.validation.constraints.Email;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import org.hibernate.validator.constraints.Length;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
|
@ -16,10 +16,8 @@
|
|||||||
package xyz.playedu.api.request.backend;
|
package xyz.playedu.api.request.backend;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
|
@ -16,10 +16,8 @@
|
|||||||
package xyz.playedu.api.request.backend;
|
package xyz.playedu.api.request.backend;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class CourseAttachmentMultiRequest {
|
public class CourseAttachmentMultiRequest {
|
||||||
|
@ -17,7 +17,6 @@ package xyz.playedu.api.request.backend;
|
|||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ -15,9 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.request.backend;
|
package xyz.playedu.api.request.backend;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class CourseAttachmentSortRequest {
|
public class CourseAttachmentSortRequest {
|
||||||
|
@ -16,16 +16,12 @@
|
|||||||
package xyz.playedu.api.request.backend;
|
package xyz.playedu.api.request.backend;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import org.hibernate.validator.constraints.Length;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
|
@ -17,9 +17,7 @@ package xyz.playedu.api.request.backend;
|
|||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import org.hibernate.validator.constraints.Length;
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,10 +16,8 @@
|
|||||||
package xyz.playedu.api.request.backend;
|
package xyz.playedu.api.request.backend;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
|
@ -16,12 +16,9 @@
|
|||||||
package xyz.playedu.api.request.backend;
|
package xyz.playedu.api.request.backend;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
|
@ -16,10 +16,8 @@
|
|||||||
package xyz.playedu.api.request.backend;
|
package xyz.playedu.api.request.backend;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,9 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.request.backend;
|
package xyz.playedu.api.request.backend;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
|
@ -16,14 +16,11 @@
|
|||||||
package xyz.playedu.api.request.backend;
|
package xyz.playedu.api.request.backend;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
|
@ -16,10 +16,8 @@
|
|||||||
package xyz.playedu.api.request.backend;
|
package xyz.playedu.api.request.backend;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
|
@ -16,12 +16,9 @@
|
|||||||
package xyz.playedu.api.request.backend;
|
package xyz.playedu.api.request.backend;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
|
@ -16,16 +16,12 @@
|
|||||||
package xyz.playedu.api.request.backend;
|
package xyz.playedu.api.request.backend;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import org.hibernate.validator.constraints.Length;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
|
@ -15,9 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.request.backend;
|
package xyz.playedu.api.request.backend;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
|
@ -16,11 +16,9 @@
|
|||||||
package xyz.playedu.api.request.backend;
|
package xyz.playedu.api.request.backend;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class LoginRequest implements Serializable {
|
public class LoginRequest implements Serializable {
|
||||||
|
@ -16,9 +16,7 @@
|
|||||||
package xyz.playedu.api.request.backend;
|
package xyz.playedu.api.request.backend;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,12 +16,9 @@
|
|||||||
package xyz.playedu.api.request.backend;
|
package xyz.playedu.api.request.backend;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ResourceCategoryChangeRequest {
|
public class ResourceCategoryChangeRequest {
|
||||||
|
@ -16,12 +16,9 @@
|
|||||||
package xyz.playedu.api.request.backend;
|
package xyz.playedu.api.request.backend;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
|
@ -16,12 +16,9 @@
|
|||||||
package xyz.playedu.api.request.backend;
|
package xyz.playedu.api.request.backend;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import org.hibernate.validator.constraints.Length;
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,10 +16,8 @@
|
|||||||
package xyz.playedu.api.request.backend;
|
package xyz.playedu.api.request.backend;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 杭州白书科技有限公司
|
* @Author 杭州白书科技有限公司
|
||||||
|
@ -15,9 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package xyz.playedu.api.request.backend;
|
package xyz.playedu.api.request.backend;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ResourceDestroyMultiRequest {
|
public class ResourceDestroyMultiRequest {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user