init
This commit is contained in:
47
.gitignore
vendored
Normal file
47
.gitignore
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
######################################################################
|
||||
# Build Tools
|
||||
|
||||
.gradle
|
||||
/build/
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
|
||||
######################################################################
|
||||
# IDE
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### JRebel ###
|
||||
rebel.xml
|
||||
|
||||
### NetBeans ###
|
||||
nbproject/private/
|
||||
build/*
|
||||
nbbuild/
|
||||
dist/
|
||||
nbdist/
|
||||
.nb-gradle/
|
||||
|
||||
######################################################################
|
||||
# Others
|
||||
*.log
|
||||
*.xml.versionsBackup
|
||||
*.swp
|
||||
|
||||
!*/build/*.java
|
||||
!*/build/*.html
|
||||
!*/build/*.xml
|
||||
BIN
2024财富中国500强.xlsx
Normal file
BIN
2024财富中国500强.xlsx
Normal file
Binary file not shown.
20
LICENSE
Normal file
20
LICENSE
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 RuoYi
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
191
buildAndStart.sh
Normal file
191
buildAndStart.sh
Normal file
@@ -0,0 +1,191 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 配置部分
|
||||
BASE_PATH=/root/ks
|
||||
DES_PATH=/root/ks
|
||||
JAR_PATH=${DES_PATH}/ruoyi-admin/target/ruoyi-admin.jar
|
||||
LOG_PATH=${DES_PATH}/logs
|
||||
LOG_FILE=${LOG_PATH}/backend.log
|
||||
BACK_LOG=${LOG_PATH}/back/backend-info.log
|
||||
MODEL_NAME=${JAR_PATH}
|
||||
PROFILE=dev
|
||||
|
||||
# JVM配置
|
||||
JVM_MEMORY=" -Xms2048M -Xmx2048M -XX:MaxDirectMemorySize=2048M"
|
||||
# 远程调试
|
||||
JVM_DEBUG=""
|
||||
# JVM_DEBUG=" -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=6011"
|
||||
JVM_OPTION="${JVM_MEMORY} ${JVM_DEBUG}"
|
||||
|
||||
_math() {
|
||||
printf "%s" "$(($@))"
|
||||
}
|
||||
|
||||
# 输出绿色文字
|
||||
__green() {
|
||||
printf '\33[1;32m%b\33[0m' "$1" "\n"
|
||||
}
|
||||
|
||||
# 输出红色文字
|
||||
__red() {
|
||||
printf '\33[1;31m%b\33[0m' "$1" "\n"
|
||||
}
|
||||
|
||||
__kill() {
|
||||
local jar_path="$1"
|
||||
local sleep_seconds=10
|
||||
local cur_sleep_second=1
|
||||
local pids=()
|
||||
|
||||
# 使用临时文件或直接遍历 jps 输出(避免进程替换)
|
||||
jps -l 2>/dev/null | while read -r pid main_class; do
|
||||
if [ "$main_class" = "$jar_path" ]; then
|
||||
echo "$pid"
|
||||
fi
|
||||
done > /tmp/ruoyi_pids.$$
|
||||
|
||||
# 读取匹配的 PID 到数组(在当前 shell 中)
|
||||
while IFS= read -r pid; do
|
||||
[ -n "$pid" ] && pids+=("$pid")
|
||||
done < /tmp/ruoyi_pids.$$
|
||||
|
||||
# 清理临时文件
|
||||
rm -f /tmp/ruoyi_pids.$$
|
||||
|
||||
if [ ${#pids[@]} -eq 0 ]; then
|
||||
__green "未找到运行中的进程: $jar_path"
|
||||
return 0
|
||||
fi
|
||||
|
||||
__green "找到 ${#pids[@]} 个匹配进程: ${pids[*]}"
|
||||
|
||||
# 发送 SIGTERM
|
||||
for pid in "${pids[@]}"; do
|
||||
__green "发送 SIGTERM 到 PID: $pid"
|
||||
kill "$pid" >/dev/null 2>&1
|
||||
done
|
||||
|
||||
# 等待退出
|
||||
while [ $cur_sleep_second -le $sleep_seconds ]; do
|
||||
remaining=()
|
||||
for pid in "${pids[@]}"; do
|
||||
if kill -0 "$pid" 2>/dev/null; then
|
||||
remaining+=("$pid")
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${#remaining[@]} -eq 0 ]; then
|
||||
__green "所有进程已成功停止"
|
||||
return 0
|
||||
fi
|
||||
|
||||
__green "等待进程退出... (${cur_sleep_second}/${sleep_seconds} 秒)"
|
||||
sleep 1
|
||||
cur_sleep_second=$((cur_sleep_second + 1))
|
||||
done
|
||||
|
||||
# 强制 kill -9
|
||||
__red "优雅关闭超时,强制终止剩余进程: ${remaining[*]}"
|
||||
for pid in "${remaining[@]}"; do
|
||||
kill -9 "$pid" 2>/dev/null
|
||||
done
|
||||
|
||||
# 检查是否还有存活
|
||||
still_alive=()
|
||||
for pid in "${remaining[@]}"; do
|
||||
if kill -0 "$pid" 2>/dev/null; then
|
||||
still_alive+=("$pid")
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${#still_alive[@]} -gt 0 ]; then
|
||||
__red "无法终止进程: ${still_alive[*]}"
|
||||
return 1
|
||||
else
|
||||
__green "所有进程已强制终止"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
# 获取本机IP
|
||||
__get_ip() {
|
||||
local ip=$(ifconfig | grep "10.0.0" | awk '{print $2}' | cut -d ':' -f 2 | head -n 1)
|
||||
if [[ -z "$ip" ]]; then
|
||||
ip=$(ifconfig -a | grep -E '172.|10.|192.' | grep -E 'Bcast|broadcast' | grep -E 'Mask|netmask' | awk '{print $2}' | cut -d ':' -f 2 | head -n 1)
|
||||
fi
|
||||
echo "$ip"
|
||||
}
|
||||
|
||||
# 创建日志目录
|
||||
__create_log_dir() {
|
||||
if [[ ! -d "$LOG_PATH" ]]; then
|
||||
mkdir -p "$LOG_PATH"
|
||||
__green "创建日志目录: $LOG_PATH"
|
||||
fi
|
||||
|
||||
if [[ ! -d "$(dirname "$BACK_LOG")" ]]; then
|
||||
mkdir -p "$(dirname "$BACK_LOG")"
|
||||
__green "创建备份日志目录: $(dirname "$BACK_LOG")"
|
||||
fi
|
||||
}
|
||||
|
||||
# 主函数
|
||||
main() {
|
||||
# 加载环境变量
|
||||
source /etc/profile
|
||||
|
||||
# 获取最新代码
|
||||
__green "拉取最新代码..."
|
||||
git --git-dir=${BASE_PATH}/.git --work-tree=${BASE_PATH} fetch origin main
|
||||
git --git-dir=${BASE_PATH}/.git --work-tree=${BASE_PATH} reset --hard origin/main
|
||||
git --git-dir=${BASE_PATH}/.git --work-tree=${BASE_PATH} pull origin main
|
||||
|
||||
# 构建项目
|
||||
__green "开始构建项目..."
|
||||
cd ${BASE_PATH} && mvn clean && mvn install -T 4
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
__red "Maven构建失败!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 检查JAR文件是否存在
|
||||
if [[ ! -f "$JAR_PATH" ]]; then
|
||||
__red "JAR文件不存在: $JAR_PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 停止现有进程
|
||||
__green "停止现有进程..."
|
||||
__kill "$MODEL_NAME"
|
||||
|
||||
# 创建日志目录
|
||||
__create_log_dir
|
||||
|
||||
# 获取本机IP
|
||||
SELF_IP=$(__get_ip)
|
||||
__green "本机IP: $SELF_IP"
|
||||
|
||||
# 启动应用
|
||||
__green "启动应用..."
|
||||
nohup java ${JVM_OPTION} -jar ${JAR_PATH} --spring.profiles.active=${PROFILE} >> ${LOG_FILE} 2>&1 &
|
||||
tail -f logs/backend.log
|
||||
# 等待应用启动
|
||||
sleep 3
|
||||
|
||||
# 检查进程是否启动成功
|
||||
local new_pid=$(ps -ef | grep "${MODEL_NAME}.jar" | grep -v grep | awk '{print $2}')
|
||||
if [[ -n "$new_pid" ]]; then
|
||||
__green "应用启动成功! PID: $new_pid"
|
||||
else
|
||||
__red "应用启动失败!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 跟踪日志
|
||||
__green "开始跟踪日志..."
|
||||
tail -f ${LOG_FILE}
|
||||
}
|
||||
|
||||
# 执行主函数
|
||||
main "$@"
|
||||
266
pom.xml
Normal file
266
pom.xml
Normal file
@@ -0,0 +1,266 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi</artifactId>
|
||||
<version>3.8.8</version>
|
||||
|
||||
<name>cms</name>
|
||||
<description>管理系统</description>
|
||||
|
||||
<properties>
|
||||
<ruoyi.version>3.8.8</ruoyi.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
||||
<spring-framework.version>5.3.33</spring-framework.version>
|
||||
<spring-security.version>5.7.12</spring-security.version>
|
||||
<druid.version>1.2.23</druid.version>
|
||||
<bitwalker.version>1.21</bitwalker.version>
|
||||
<swagger.version>3.0.0</swagger.version>
|
||||
<kaptcha.version>2.3.3</kaptcha.version>
|
||||
<pagehelper.boot.version>1.4.7</pagehelper.boot.version>
|
||||
<fastjson.version>2.0.43</fastjson.version>
|
||||
<oshi.version>6.6.1</oshi.version>
|
||||
<commons.io.version>2.13.0</commons.io.version>
|
||||
<poi.version>4.1.2</poi.version>
|
||||
<velocity.version>2.3</velocity.version>
|
||||
<jwt.version>0.9.1</jwt.version>
|
||||
<mybatis-plus.version>3.5.1</mybatis-plus.version>
|
||||
<qiniu.version>[7.2.0, 7.2.99]</qiniu.version>
|
||||
<aliyun.oss.version>2.5.0</aliyun.oss.version>
|
||||
<qcloud.cos.version>5.5.9</qcloud.cos.version>
|
||||
</properties>
|
||||
|
||||
<!-- 依赖声明 -->
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringFramework的依赖配置-->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-framework-bom</artifactId>
|
||||
<version>${spring-framework.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringSecurity的依赖配置-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-bom</artifactId>
|
||||
<version>${spring-security.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot的依赖配置-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>2.5.15</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里数据库连接池 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 解析客户端操作系统、浏览器等 -->
|
||||
<dependency>
|
||||
<groupId>eu.bitwalker</groupId>
|
||||
<artifactId>UserAgentUtils</artifactId>
|
||||
<version>${bitwalker.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- pagehelper 分页插件 -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>${pagehelper.boot.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 获取系统信息 -->
|
||||
<dependency>
|
||||
<groupId>com.github.oshi</groupId>
|
||||
<artifactId>oshi-core</artifactId>
|
||||
<version>${oshi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger3依赖 -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-boot-starter</artifactId>
|
||||
<version>${swagger.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- io常用工具类 -->
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>${commons.io.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- excel工具 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>${poi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- velocity代码生成使用模板 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity-engine-core</artifactId>
|
||||
<version>${velocity.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里JSON解析器 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
<artifactId>fastjson2</artifactId>
|
||||
<version>${fastjson.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Token生成与解析-->
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
<version>${jwt.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 验证码 -->
|
||||
<dependency>
|
||||
<groupId>pro.fessional</groupId>
|
||||
<artifactId>kaptcha</artifactId>
|
||||
<version>${kaptcha.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- mybatis-plus 增强CRUD -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>${mybatis-plus.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 定时任务-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-quartz</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 代码生成-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-generator</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 核心模块-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-framework</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 系统模块-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-system</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 业务模块-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-bussiness</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<modules>
|
||||
<module>ruoyi-admin</module>
|
||||
<module>ruoyi-framework</module>
|
||||
<module>ruoyi-system</module>
|
||||
<module>ruoyi-quartz</module>
|
||||
<module>ruoyi-generator</module>
|
||||
<module>ruoyi-common</module>
|
||||
<module>ruoyi-bussiness</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>public</id>
|
||||
<name>aliyun nexus</name>
|
||||
<url>https://maven.aliyun.com/repository/public</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>public</id>
|
||||
<name>aliyun nexus</name>
|
||||
<url>https://maven.aliyun.com/repository/public</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
</project>
|
||||
145
ruoyi-admin/pom.xml
Normal file
145
ruoyi-admin/pom.xml
Normal file
@@ -0,0 +1,145 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ruoyi</artifactId>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<version>3.8.8</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>ruoyi-admin</artifactId>
|
||||
|
||||
<description>
|
||||
web服务入口
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- spring-boot-devtools -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||
</dependency>
|
||||
|
||||
<!-- swagger3-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 -->
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql驱动包 -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>mysql</groupId>-->
|
||||
<!-- <groupId>mysql</groupId>-->
|
||||
<!-- <artifactId>mysql-connector-java</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<!--达梦驱动包-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.dameng</groupId>-->
|
||||
<!-- <artifactId>DmJdbcDriver18</artifactId>-->
|
||||
<!-- <version>8.1.2.192</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- 瀚高驱动包-->
|
||||
<dependency>
|
||||
<groupId>com.highgo</groupId>
|
||||
<artifactId>HgdbJdbc</artifactId>
|
||||
<version>6.2.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 核心模块-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-framework</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 定时任务-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-quartz</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 代码生成-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-generator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-bussiness</artifactId>
|
||||
</dependency>
|
||||
<!-- oss -->
|
||||
<dependency>
|
||||
<groupId>com.qiniu</groupId>
|
||||
<artifactId>qiniu-java-sdk</artifactId>
|
||||
<version>${qiniu.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>${aliyun.oss.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.qcloud</groupId>
|
||||
<artifactId>cos_api</artifactId>
|
||||
<version>${qcloud.cos.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
<artifactId>fastjson2</artifactId>
|
||||
<version>2.0.43</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.9.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.5.15</version>
|
||||
<configuration>
|
||||
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<warName>${project.artifactId}</warName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
32
ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
Normal file
32
ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.ruoyi;
|
||||
|
||||
import org.dromara.easyes.starter.register.EsMapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@EsMapperScan("com.ruoyi.cms.mapper.es")
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
public class RuoYiApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
SpringApplication.run(RuoYiApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||
" .-------. ____ __ \n" +
|
||||
" | _ _ \\ \\ \\ / / \n" +
|
||||
" | ( ' ) | \\ _. / ' \n" +
|
||||
" |(_ o _) / _( )_ .' \n" +
|
||||
" | (_,_).' __ ___(_ o _)' \n" +
|
||||
" | |\\ \\ | || |(_,_)' \n" +
|
||||
" | | \\ `' /| `-' / \n" +
|
||||
" | | \\ / \\ / \n" +
|
||||
" ''-' `'-' `-..-' ");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.ruoyi;
|
||||
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
|
||||
/**
|
||||
* web容器中进行部署
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class RuoYiServletInitializer extends SpringBootServletInitializer
|
||||
{
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
|
||||
{
|
||||
return application.sources(RuoYiApplication.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.ruoyi.web.controller.common;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.annotation.Resource;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.FastByteArrayOutputStream;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.google.code.kaptcha.Producer;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.utils.sign.Base64;
|
||||
import com.ruoyi.common.utils.uuid.IdUtils;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
|
||||
/**
|
||||
* 验证码操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
public class CaptchaController
|
||||
{
|
||||
@Resource(name = "captchaProducer")
|
||||
private Producer captchaProducer;
|
||||
|
||||
@Resource(name = "captchaProducerMath")
|
||||
private Producer captchaProducerMath;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
/**
|
||||
* 生成验证码
|
||||
*/
|
||||
@GetMapping("/captchaImage")
|
||||
public AjaxResult getCode(HttpServletResponse response) throws IOException
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
boolean captchaEnabled = configService.selectCaptchaEnabled();
|
||||
ajax.put("captchaEnabled", captchaEnabled);
|
||||
if (!captchaEnabled)
|
||||
{
|
||||
return ajax;
|
||||
}
|
||||
|
||||
// 保存验证码信息
|
||||
String uuid = IdUtils.simpleUUID();
|
||||
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
|
||||
|
||||
String capStr = null, code = null;
|
||||
BufferedImage image = null;
|
||||
|
||||
// 生成验证码
|
||||
String captchaType = RuoYiConfig.getCaptchaType();
|
||||
if ("math".equals(captchaType))
|
||||
{
|
||||
String capText = captchaProducerMath.createText();
|
||||
capStr = capText.substring(0, capText.lastIndexOf("@"));
|
||||
code = capText.substring(capText.lastIndexOf("@") + 1);
|
||||
image = captchaProducerMath.createImage(capStr);
|
||||
}
|
||||
else if ("char".equals(captchaType))
|
||||
{
|
||||
capStr = code = captchaProducer.createText();
|
||||
image = captchaProducer.createImage(capStr);
|
||||
}
|
||||
|
||||
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
|
||||
// 转换流信息写出
|
||||
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
|
||||
try
|
||||
{
|
||||
ImageIO.write(image, "jpg", os);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
|
||||
ajax.put("uuid", uuid);
|
||||
ajax.put("img", Base64.encode(os.toByteArray()));
|
||||
return ajax;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package com.ruoyi.web.controller.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.common.utils.file.FileUtils;
|
||||
import com.ruoyi.framework.config.ServerConfig;
|
||||
|
||||
/**
|
||||
* 通用请求处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/common")
|
||||
public class CommonController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
||||
|
||||
@Autowired
|
||||
private ServerConfig serverConfig;
|
||||
|
||||
private static final String FILE_DELIMETER = ",";
|
||||
|
||||
/**
|
||||
* 通用下载请求
|
||||
*
|
||||
* @param fileName 文件名称
|
||||
* @param delete 是否删除
|
||||
*/
|
||||
@GetMapping("/download")
|
||||
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!FileUtils.checkAllowDownload(fileName))
|
||||
{
|
||||
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
|
||||
}
|
||||
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
||||
String filePath = RuoYiConfig.getDownloadPath() + fileName;
|
||||
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
FileUtils.setAttachmentResponseHeader(response, realFileName);
|
||||
FileUtils.writeBytes(filePath, response.getOutputStream());
|
||||
if (delete)
|
||||
{
|
||||
FileUtils.deleteFile(filePath);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("下载文件失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用上传请求(单个)
|
||||
*/
|
||||
@PostMapping("/upload")
|
||||
public AjaxResult uploadFile(MultipartFile file) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("url", url);
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("newFileName", FileUtils.getName(fileName));
|
||||
ajax.put("originalFilename", file.getOriginalFilename());
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用上传请求(多个)
|
||||
*/
|
||||
@PostMapping("/uploads")
|
||||
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
List<String> urls = new ArrayList<String>();
|
||||
List<String> fileNames = new ArrayList<String>();
|
||||
List<String> newFileNames = new ArrayList<String>();
|
||||
List<String> originalFilenames = new ArrayList<String>();
|
||||
for (MultipartFile file : files)
|
||||
{
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
urls.add(url);
|
||||
fileNames.add(fileName);
|
||||
newFileNames.add(FileUtils.getName(fileName));
|
||||
originalFilenames.add(file.getOriginalFilename());
|
||||
}
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
|
||||
ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
|
||||
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
|
||||
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 本地资源通用下载
|
||||
*/
|
||||
@GetMapping("/download/resource")
|
||||
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
||||
throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!FileUtils.checkAllowDownload(resource))
|
||||
{
|
||||
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
|
||||
}
|
||||
// 本地资源路径
|
||||
String localPath = RuoYiConfig.getProfile();
|
||||
// 数据库资源地址
|
||||
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
|
||||
// 下载名称
|
||||
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
FileUtils.setAttachmentResponseHeader(response, downloadName);
|
||||
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("下载文件失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisCallback;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.domain.SysCache;
|
||||
|
||||
/**
|
||||
* 缓存监控
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/cache")
|
||||
public class CacheController
|
||||
{
|
||||
@Autowired
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
|
||||
private final static List<SysCache> caches = new ArrayList<SysCache>();
|
||||
{
|
||||
caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息"));
|
||||
caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息"));
|
||||
caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "数据字典"));
|
||||
caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码"));
|
||||
caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交"));
|
||||
caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理"));
|
||||
caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数"));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@GetMapping()
|
||||
public AjaxResult getInfo() throws Exception
|
||||
{
|
||||
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
|
||||
Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
|
||||
Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
|
||||
|
||||
Map<String, Object> result = new HashMap<>(3);
|
||||
result.put("info", info);
|
||||
result.put("dbSize", dbSize);
|
||||
|
||||
List<Map<String, String>> pieList = new ArrayList<>();
|
||||
commandStats.stringPropertyNames().forEach(key -> {
|
||||
Map<String, String> data = new HashMap<>(2);
|
||||
String property = commandStats.getProperty(key);
|
||||
data.put("name", StringUtils.removeStart(key, "cmdstat_"));
|
||||
data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
|
||||
pieList.add(data);
|
||||
});
|
||||
result.put("commandStats", pieList);
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@GetMapping("/getNames")
|
||||
public AjaxResult cache()
|
||||
{
|
||||
return AjaxResult.success(caches);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@GetMapping("/getKeys/{cacheName}")
|
||||
public AjaxResult getCacheKeys(@PathVariable String cacheName)
|
||||
{
|
||||
Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
|
||||
return AjaxResult.success(new TreeSet<>(cacheKeys));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@GetMapping("/getValue/{cacheName}/{cacheKey}")
|
||||
public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
|
||||
{
|
||||
String cacheValue = redisTemplate.opsForValue().get(cacheKey);
|
||||
SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
|
||||
return AjaxResult.success(sysCache);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@DeleteMapping("/clearCacheName/{cacheName}")
|
||||
public AjaxResult clearCacheName(@PathVariable String cacheName)
|
||||
{
|
||||
Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
|
||||
redisTemplate.delete(cacheKeys);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@DeleteMapping("/clearCacheKey/{cacheKey}")
|
||||
public AjaxResult clearCacheKey(@PathVariable String cacheKey)
|
||||
{
|
||||
redisTemplate.delete(cacheKey);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
||||
@DeleteMapping("/clearCacheAll")
|
||||
public AjaxResult clearCacheAll()
|
||||
{
|
||||
Collection<String> cacheKeys = redisTemplate.keys("*");
|
||||
redisTemplate.delete(cacheKeys);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.framework.web.domain.Server;
|
||||
|
||||
/**
|
||||
* 服务器监控
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/server")
|
||||
public class ServerController
|
||||
{
|
||||
@PreAuthorize("@ss.hasPermi('monitor:server:list')")
|
||||
@GetMapping()
|
||||
public AjaxResult getInfo() throws Exception
|
||||
{
|
||||
Server server = new Server();
|
||||
server.copyTo();
|
||||
return AjaxResult.success(server);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.web.service.SysPasswordService;
|
||||
import com.ruoyi.system.domain.SysLogininfor;
|
||||
import com.ruoyi.system.service.ISysLogininforService;
|
||||
|
||||
/**
|
||||
* 系统访问记录
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/logininfor")
|
||||
public class SysLogininforController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysLogininforService logininforService;
|
||||
|
||||
@Autowired
|
||||
private SysPasswordService passwordService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysLogininfor logininfor)
|
||||
{
|
||||
startPage();
|
||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysLogininfor logininfor)
|
||||
{
|
||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
||||
util.exportExcel(response, list, "登录日志");
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||
@Log(title = "登录日志", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{infoIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] infoIds)
|
||||
{
|
||||
return toAjax(logininforService.deleteLogininforByIds(infoIds));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/clean")
|
||||
public AjaxResult clean()
|
||||
{
|
||||
logininforService.cleanLogininfor();
|
||||
return success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')")
|
||||
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/unlock/{userName}")
|
||||
public AjaxResult unlock(@PathVariable("userName") String userName)
|
||||
{
|
||||
passwordService.clearLoginRecordCache(userName);
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.SysOperLog;
|
||||
import com.ruoyi.system.service.ISysOperLogService;
|
||||
|
||||
/**
|
||||
* 操作日志记录
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/operlog")
|
||||
public class SysOperlogController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysOperLogService operLogService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysOperLog operLog)
|
||||
{
|
||||
startPage();
|
||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysOperLog operLog)
|
||||
{
|
||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
|
||||
util.exportExcel(response, list, "操作日志");
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.DELETE)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||
@DeleteMapping("/{operIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] operIds)
|
||||
{
|
||||
return toAjax(operLogService.deleteOperLogByIds(operIds));
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||
@DeleteMapping("/clean")
|
||||
public AjaxResult clean()
|
||||
{
|
||||
operLogService.cleanOperLog();
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.domain.SysUserOnline;
|
||||
import com.ruoyi.system.service.ISysUserOnlineService;
|
||||
|
||||
/**
|
||||
* 在线用户监控
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/online")
|
||||
public class SysUserOnlineController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysUserOnlineService userOnlineService;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:online:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(String ipaddr, String userName)
|
||||
{
|
||||
Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
|
||||
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
|
||||
for (String key : keys)
|
||||
{
|
||||
LoginUser user = redisCache.getCacheObject(key);
|
||||
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
|
||||
{
|
||||
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(ipaddr))
|
||||
{
|
||||
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
|
||||
{
|
||||
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
|
||||
}
|
||||
else
|
||||
{
|
||||
userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
|
||||
}
|
||||
}
|
||||
Collections.reverse(userOnlineList);
|
||||
userOnlineList.removeAll(Collections.singleton(null));
|
||||
return getDataTable(userOnlineList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 强退用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
|
||||
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||
@DeleteMapping("/{tokenId}")
|
||||
public AjaxResult forceLogout(@PathVariable String tokenId)
|
||||
{
|
||||
redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.SysConfig;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
|
||||
/**
|
||||
* 参数配置 信息操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/config")
|
||||
public class SysConfigController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
/**
|
||||
* 获取参数配置列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysConfig config)
|
||||
{
|
||||
startPage();
|
||||
List<SysConfig> list = configService.selectConfigList(config);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:config:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysConfig config)
|
||||
{
|
||||
List<SysConfig> list = configService.selectConfigList(config);
|
||||
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
||||
util.exportExcel(response, list, "参数数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据参数编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:query')")
|
||||
@GetMapping(value = "/{configId}")
|
||||
public AjaxResult getInfo(@PathVariable Long configId)
|
||||
{
|
||||
return success(configService.selectConfigById(configId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据参数键名查询参数值
|
||||
*/
|
||||
@GetMapping(value = "/configKey/{configKey}")
|
||||
public AjaxResult getConfigKey(@PathVariable String configKey)
|
||||
{
|
||||
return success(configService.selectConfigByKey(configKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增参数配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:add')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysConfig config)
|
||||
{
|
||||
if (!configService.checkConfigKeyUnique(config))
|
||||
{
|
||||
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setCreateBy(getUsername());
|
||||
return toAjax(configService.insertConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改参数配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:edit')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysConfig config)
|
||||
{
|
||||
if (!configService.checkConfigKeyUnique(config))
|
||||
{
|
||||
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setUpdateBy(getUsername());
|
||||
return toAjax(configService.updateConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除参数配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{configIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] configIds)
|
||||
{
|
||||
configService.deleteConfigByIds(configIds);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新参数缓存
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/refreshCache")
|
||||
public AjaxResult refreshCache()
|
||||
{
|
||||
configService.resetConfigCache();
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.service.ISysDeptService;
|
||||
|
||||
/**
|
||||
* 部门信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/dept")
|
||||
public class SysDeptController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
/**
|
||||
* 获取部门列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(SysDept dept)
|
||||
{
|
||||
List<SysDept> depts = deptService.selectDeptList(dept);
|
||||
return success(depts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询部门列表(排除节点)
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||
@GetMapping("/list/exclude/{deptId}")
|
||||
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
|
||||
{
|
||||
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
||||
depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
|
||||
return success(depts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据部门编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:query')")
|
||||
@GetMapping(value = "/{deptId}")
|
||||
public AjaxResult getInfo(@PathVariable Long deptId)
|
||||
{
|
||||
deptService.checkDeptDataScope(deptId);
|
||||
return success(deptService.selectDeptById(deptId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增部门
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:add')")
|
||||
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysDept dept)
|
||||
{
|
||||
if (!deptService.checkDeptNameUnique(dept))
|
||||
{
|
||||
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
}
|
||||
dept.setCreateBy(getUsername());
|
||||
return toAjax(deptService.insertDept(dept));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改部门
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
|
||||
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysDept dept)
|
||||
{
|
||||
Long deptId = dept.getDeptId();
|
||||
deptService.checkDeptDataScope(deptId);
|
||||
if (!deptService.checkDeptNameUnique(dept))
|
||||
{
|
||||
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
}
|
||||
else if (dept.getParentId().equals(deptId))
|
||||
{
|
||||
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||
}
|
||||
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
|
||||
{
|
||||
return error("该部门包含未停用的子部门!");
|
||||
}
|
||||
dept.setUpdateBy(getUsername());
|
||||
return toAjax(deptService.updateDept(dept));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除部门
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
|
||||
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{deptId}")
|
||||
public AjaxResult remove(@PathVariable Long deptId)
|
||||
{
|
||||
if (deptService.hasChildByDeptId(deptId))
|
||||
{
|
||||
return warn("存在下级部门,不允许删除");
|
||||
}
|
||||
if (deptService.checkDeptExistUser(deptId))
|
||||
{
|
||||
return warn("部门存在用户,不允许删除");
|
||||
}
|
||||
deptService.checkDeptDataScope(deptId);
|
||||
return toAjax(deptService.deleteDeptById(deptId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.service.ISysDictDataService;
|
||||
import com.ruoyi.system.service.ISysDictTypeService;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/dict/data")
|
||||
public class SysDictDataController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysDictDataService dictDataService;
|
||||
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysDictData dictData)
|
||||
{
|
||||
startPage();
|
||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysDictData dictData)
|
||||
{
|
||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
|
||||
util.exportExcel(response, list, "字典数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典数据详细
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||
@GetMapping(value = "/{dictCode}")
|
||||
public AjaxResult getInfo(@PathVariable Long dictCode)
|
||||
{
|
||||
return success(dictDataService.selectDictDataById(dictCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典类型查询字典数据信息
|
||||
*/
|
||||
@GetMapping(value = "/type/{dictType}")
|
||||
public AjaxResult dictType(@PathVariable String dictType)
|
||||
{
|
||||
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
|
||||
if (StringUtils.isNull(data))
|
||||
{
|
||||
data = new ArrayList<SysDictData>();
|
||||
}
|
||||
return success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysDictData dict)
|
||||
{
|
||||
dict.setCreateBy(getUsername());
|
||||
return toAjax(dictDataService.insertDictData(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysDictData dict)
|
||||
{
|
||||
dict.setUpdateBy(getUsername());
|
||||
return toAjax(dictDataService.updateDictData(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictCodes}")
|
||||
public AjaxResult remove(@PathVariable Long[] dictCodes)
|
||||
{
|
||||
dictDataService.deleteDictDataByIds(dictCodes);
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysDictType;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.service.ISysDictTypeService;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/dict/type")
|
||||
public class SysDictTypeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysDictType dictType)
|
||||
{
|
||||
startPage();
|
||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysDictType dictType)
|
||||
{
|
||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
||||
util.exportExcel(response, list, "字典类型");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典类型详细
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||
@GetMapping(value = "/{dictId}")
|
||||
public AjaxResult getInfo(@PathVariable Long dictId)
|
||||
{
|
||||
return success(dictTypeService.selectDictTypeById(dictId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysDictType dict)
|
||||
{
|
||||
if (!dictTypeService.checkDictTypeUnique(dict))
|
||||
{
|
||||
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setCreateBy(getUsername());
|
||||
return toAjax(dictTypeService.insertDictType(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysDictType dict)
|
||||
{
|
||||
if (!dictTypeService.checkDictTypeUnique(dict))
|
||||
{
|
||||
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setUpdateBy(getUsername());
|
||||
return toAjax(dictTypeService.updateDictType(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] dictIds)
|
||||
{
|
||||
dictTypeService.deleteDictTypeByIds(dictIds);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新字典缓存
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/refreshCache")
|
||||
public AjaxResult refreshCache()
|
||||
{
|
||||
dictTypeService.resetDictCache();
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典选择框列表
|
||||
*/
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect()
|
||||
{
|
||||
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
|
||||
return success(dictTypes);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* 首页
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
public class SysIndexController
|
||||
{
|
||||
/** 系统基础配置 */
|
||||
@Autowired
|
||||
private RuoYiConfig ruoyiConfig;
|
||||
|
||||
/**
|
||||
* 访问首页,提示语
|
||||
*/
|
||||
@RequestMapping("/")
|
||||
public String index()
|
||||
{
|
||||
return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,230 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.tymh.wwToken.WwTokenResult;
|
||||
import com.ruoyi.common.core.domain.entity.tymh.wwToken.WwUserLogin;
|
||||
import com.ruoyi.common.core.domain.model.RegisterBody;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.framework.web.service.OauthLoginHlwService;
|
||||
import com.ruoyi.framework.web.service.OauthLoginService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysMenu;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginBody;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.framework.web.service.SysLoginService;
|
||||
import com.ruoyi.framework.web.service.SysPermissionService;
|
||||
import com.ruoyi.system.service.ISysMenuService;
|
||||
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
public class SysLoginController
|
||||
{
|
||||
@Autowired
|
||||
private SysLoginService loginService;
|
||||
|
||||
@Autowired
|
||||
private ISysMenuService menuService;
|
||||
|
||||
@Autowired
|
||||
private SysPermissionService permissionService;
|
||||
@Autowired
|
||||
private OauthLoginService oauthLoginService;
|
||||
@Autowired
|
||||
private OauthLoginHlwService oauthLoginHlwService;
|
||||
|
||||
/**
|
||||
* 登录方法
|
||||
*
|
||||
* @param loginBody 登录信息
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/login")
|
||||
public AjaxResult login(@RequestBody LoginBody loginBody)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
// 生成令牌
|
||||
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
|
||||
loginBody.getUuid());
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return ajax;
|
||||
}
|
||||
@PostMapping("/app/login")
|
||||
public AjaxResult loginApp(@RequestBody LoginBody loginBody)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
// 生成令牌
|
||||
String token = loginService.loginApp("admin", "admin123");
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信小程序登录
|
||||
* @param loginBody
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/app/appLogin")
|
||||
public AjaxResult appLogin(@RequestBody LoginBody loginBody)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
//ajax=loginService.appLogin(loginBody);
|
||||
ajax=loginService.appLoginNew(loginBody);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 一体机身份证登录
|
||||
* @param loginBody
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/app/idCardLogin")
|
||||
public AjaxResult idCardLogin(@RequestBody LoginBody loginBody)
|
||||
{
|
||||
if(loginBody==null||StringUtils.isBlank(loginBody.getIdCard())){
|
||||
return AjaxResult.error("请输入有效的身份证号!");
|
||||
}
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax=loginService.idCardLogin(loginBody);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 一体机手机号/密码登录
|
||||
* @param loginBody
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/app/phoneLogin")
|
||||
public AjaxResult phoneLogin(@RequestBody LoginBody loginBody)
|
||||
{
|
||||
if(loginBody == null){
|
||||
return AjaxResult.error("登录参数不能为空!");
|
||||
}
|
||||
if(StringUtils.isBlank(loginBody.getUsername())){
|
||||
return AjaxResult.error("用户名为空,请输入用户名!");
|
||||
}
|
||||
if(StringUtils.isBlank(loginBody.getPassword())){
|
||||
return AjaxResult.error("密码为空,请输入密码!");
|
||||
}
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax=loginService.phoneLogin(loginBody);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
@GetMapping("getInfo")
|
||||
public AjaxResult getInfo()
|
||||
{
|
||||
SysUser user = SecurityUtils.getLoginUser().getUser();
|
||||
// 角色集合
|
||||
Set<String> roles = permissionService.getRolePermission(user);
|
||||
// 权限集合
|
||||
Set<String> permissions = permissionService.getMenuPermission(user);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("user", user);
|
||||
ajax.put("roles", roles);
|
||||
ajax.put("permissions", permissions);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取路由信息
|
||||
*
|
||||
* @return 路由信息
|
||||
*/
|
||||
@GetMapping("getRouters")
|
||||
public AjaxResult getRouters()
|
||||
{
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
|
||||
return AjaxResult.success(menuService.buildMenus(menus));
|
||||
}
|
||||
@GetMapping("/sso/callback")
|
||||
public String ssoCallback(@RequestParam("ticket") String ticket) {
|
||||
String frontendIndexUrl = "http://domain.com";
|
||||
|
||||
String ruoyiJwtToken = loginService.loginOss(ticket);
|
||||
|
||||
String redirectUrl = frontendIndexUrl + "/index?token=" + ruoyiJwtToken;
|
||||
|
||||
// 返回 "redirect:" 即可触发 302 重定向
|
||||
return "redirect:" + redirectUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存简历-重新返回token
|
||||
*/
|
||||
@ApiOperation("保存注册信息")
|
||||
@PostMapping("/registerUser")
|
||||
public AjaxResult registerUser(@RequestBody RegisterBody registerBody)
|
||||
{
|
||||
String token=loginService.registerAppUser(registerBody);
|
||||
return AjaxResult.success().put("token",token);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取统一门户token
|
||||
*/
|
||||
@GetMapping("/getTjmhToken")
|
||||
public AjaxResult getTjmhToken(@RequestParam("code") String code){
|
||||
System.out.println("参数code==========================="+code);
|
||||
if(StringUtils.isBlank(code)){
|
||||
return AjaxResult.error("参数code为空,请传递code参数");
|
||||
}
|
||||
String token = oauthLoginService.oauthLogin(code);
|
||||
return AjaxResult.success("门户登录成功")
|
||||
.put("token", token)
|
||||
.put("accessUrl", "");
|
||||
}
|
||||
|
||||
/**
|
||||
*互联网获取token
|
||||
* @param wwUserLogin
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getWwTjmhToken")
|
||||
public AjaxResult getWwTjmhToken(@RequestBody WwUserLogin wwUserLogin){
|
||||
if(wwUserLogin==null){
|
||||
return AjaxResult.error("参数wwUserLogin为空,请传递wwUserLogin实体参数");
|
||||
}
|
||||
String token = oauthLoginHlwService.getWwTjmhToken(wwUserLogin);
|
||||
return AjaxResult.success("门户登录成功")
|
||||
.put("token", token)
|
||||
.put("accessUrl", "");
|
||||
}
|
||||
|
||||
/**
|
||||
*互联网获取token
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getWwTjmHlwToken")
|
||||
public AjaxResult getWwTjmHlwToken(@RequestParam("token") String token){
|
||||
System.out.println("互联网token================================"+token);
|
||||
if (StringUtils.isNotBlank(token)) {
|
||||
WwTokenResult wwTokenResult=new WwTokenResult();
|
||||
wwTokenResult.setAccessToken(token);
|
||||
String localToken = oauthLoginHlwService.getWwTjmHlwToken(wwTokenResult);
|
||||
return AjaxResult.success("门户登录成功")
|
||||
.put("token", localToken)
|
||||
.put("accessUrl", "");
|
||||
} else {
|
||||
return AjaxResult.error("token为空!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysMenu;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.service.ISysMenuService;
|
||||
|
||||
/**
|
||||
* 菜单信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/menu")
|
||||
public class SysMenuController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysMenuService menuService;
|
||||
|
||||
/**
|
||||
* 获取菜单列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:list')")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(SysMenu menu)
|
||||
{
|
||||
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
||||
return success(menus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据菜单编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:query')")
|
||||
@GetMapping(value = "/{menuId}")
|
||||
public AjaxResult getInfo(@PathVariable Long menuId)
|
||||
{
|
||||
return success(menuService.selectMenuById(menuId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单下拉树列表
|
||||
*/
|
||||
@GetMapping("/treeselect")
|
||||
public AjaxResult treeselect(SysMenu menu)
|
||||
{
|
||||
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
||||
return success(menuService.buildMenuTreeSelect(menus));
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载对应角色菜单列表树
|
||||
*/
|
||||
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
|
||||
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
|
||||
{
|
||||
List<SysMenu> menus = menuService.selectMenuList(getUserId());
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
|
||||
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增菜单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:add')")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysMenu menu)
|
||||
{
|
||||
if (!menuService.checkMenuNameUnique(menu))
|
||||
{
|
||||
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
}
|
||||
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
||||
{
|
||||
return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||
}
|
||||
menu.setCreateBy(getUsername());
|
||||
return toAjax(menuService.insertMenu(menu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:edit')")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysMenu menu)
|
||||
{
|
||||
if (!menuService.checkMenuNameUnique(menu))
|
||||
{
|
||||
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
}
|
||||
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
||||
{
|
||||
return error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||
}
|
||||
else if (menu.getMenuId().equals(menu.getParentId()))
|
||||
{
|
||||
return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
|
||||
}
|
||||
menu.setUpdateBy(getUsername());
|
||||
return toAjax(menuService.updateMenu(menu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:remove')")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{menuId}")
|
||||
public AjaxResult remove(@PathVariable("menuId") Long menuId)
|
||||
{
|
||||
if (menuService.hasChildByMenuId(menuId))
|
||||
{
|
||||
return warn("存在子菜单,不允许删除");
|
||||
}
|
||||
if (menuService.checkMenuExistRole(menuId))
|
||||
{
|
||||
return warn("菜单已分配,不允许删除");
|
||||
}
|
||||
return toAjax(menuService.deleteMenuById(menuId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.system.domain.SysNotice;
|
||||
import com.ruoyi.system.service.ISysNoticeService;
|
||||
|
||||
/**
|
||||
* 公告 信息操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/notice")
|
||||
public class SysNoticeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
|
||||
/**
|
||||
* 获取通知公告列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysNotice notice)
|
||||
{
|
||||
startPage();
|
||||
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据通知公告编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:query')")
|
||||
@GetMapping(value = "/{noticeId}")
|
||||
public AjaxResult getInfo(@PathVariable Long noticeId)
|
||||
{
|
||||
return success(noticeService.selectNoticeById(noticeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增通知公告
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:add')")
|
||||
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysNotice notice)
|
||||
{
|
||||
notice.setCreateBy(getUsername());
|
||||
return toAjax(noticeService.insertNotice(notice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改通知公告
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:edit')")
|
||||
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysNotice notice)
|
||||
{
|
||||
notice.setUpdateBy(getUsername());
|
||||
return toAjax(noticeService.updateNotice(notice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除通知公告
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:remove')")
|
||||
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{noticeIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] noticeIds)
|
||||
{
|
||||
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.framework.web.exception.user.OssException;
|
||||
import com.ruoyi.system.domain.SysOss;
|
||||
import com.ruoyi.system.service.ISysOssService;
|
||||
import com.ruoyi.web.controller.system.cloud.CloudStorageService;
|
||||
import com.ruoyi.web.controller.system.cloud.OSSFactory;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/app/oss")
|
||||
@Api(tags = "移动端:文件上传")
|
||||
public class SysOssController extends BaseController
|
||||
{
|
||||
|
||||
@Autowired
|
||||
private ISysOssService sysOssService;
|
||||
@ApiOperation("文件上传")
|
||||
@PostMapping("/upload")
|
||||
public AjaxResult upload(@RequestParam("file") MultipartFile file) throws Exception
|
||||
{
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
String formattedDate = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
if (file.isEmpty())
|
||||
{
|
||||
throw new OssException("上传文件不能为空");
|
||||
}
|
||||
// 上传文件
|
||||
String fileName = file.getOriginalFilename();
|
||||
String suffix = fileName.substring(fileName.lastIndexOf("."));
|
||||
CloudStorageService storage = OSSFactory.build();
|
||||
String url = storage.uploadSuffix(file.getBytes(), suffix);
|
||||
// 保存文件信息
|
||||
SysOss ossEntity = new SysOss();
|
||||
ossEntity.setUrl(url);
|
||||
ossEntity.setFileSuffix(suffix);
|
||||
ossEntity.setCreateBy(SecurityUtils.getUsername());
|
||||
ossEntity.setFileName(fileName);
|
||||
ossEntity.setCreateTime(formattedDate);
|
||||
ossEntity.setService(storage.getService());
|
||||
return toAjax(sysOssService.save(ossEntity)).put("url", ossEntity.getUrl()).put("fileName",ossEntity.getFileName());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.SysPost;
|
||||
import com.ruoyi.system.service.ISysPostService;
|
||||
|
||||
/**
|
||||
* 岗位信息操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/post")
|
||||
public class SysPostController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysPostService postService;
|
||||
|
||||
/**
|
||||
* 获取岗位列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysPost post)
|
||||
{
|
||||
startPage();
|
||||
List<SysPost> list = postService.selectPostList(post);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:post:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysPost post)
|
||||
{
|
||||
List<SysPost> list = postService.selectPostList(post);
|
||||
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
|
||||
util.exportExcel(response, list, "岗位数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据岗位编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:query')")
|
||||
@GetMapping(value = "/{postId}")
|
||||
public AjaxResult getInfo(@PathVariable Long postId)
|
||||
{
|
||||
return success(postService.selectPostById(postId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增岗位
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:add')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysPost post)
|
||||
{
|
||||
if (!postService.checkPostNameUnique(post))
|
||||
{
|
||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
}
|
||||
else if (!postService.checkPostCodeUnique(post))
|
||||
{
|
||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
post.setCreateBy(getUsername());
|
||||
return toAjax(postService.insertPost(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改岗位
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:edit')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysPost post)
|
||||
{
|
||||
if (!postService.checkPostNameUnique(post))
|
||||
{
|
||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
}
|
||||
else if (!postService.checkPostCodeUnique(post))
|
||||
{
|
||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
post.setUpdateBy(getUsername());
|
||||
return toAjax(postService.updatePost(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除岗位
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:remove')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{postIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] postIds)
|
||||
{
|
||||
return toAjax(postService.deletePostByIds(postIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取岗位选择框列表
|
||||
*/
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect()
|
||||
{
|
||||
List<SysPost> posts = postService.selectPostAll();
|
||||
return success(posts);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.common.utils.file.MimeTypeUtils;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
|
||||
/**
|
||||
* 个人信息 业务处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/user/profile")
|
||||
public class SysProfileController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
/**
|
||||
* 个人信息
|
||||
*/
|
||||
@GetMapping
|
||||
public AjaxResult profile()
|
||||
{
|
||||
LoginUser loginUser = getLoginUser();
|
||||
SysUser user = loginUser.getUser();
|
||||
AjaxResult ajax = AjaxResult.success(user);
|
||||
ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
|
||||
ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult updateProfile(@RequestBody SysUser user)
|
||||
{
|
||||
LoginUser loginUser = getLoginUser();
|
||||
SysUser currentUser = loginUser.getUser();
|
||||
currentUser.setNickName(user.getNickName());
|
||||
currentUser.setEmail(user.getEmail());
|
||||
currentUser.setPhonenumber(user.getPhonenumber());
|
||||
currentUser.setSex(user.getSex());
|
||||
if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser))
|
||||
{
|
||||
return error("修改用户'" + loginUser.getUsername() + "'失败,手机号码已存在");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser))
|
||||
{
|
||||
return error("修改用户'" + loginUser.getUsername() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
if (userService.updateUserProfile(currentUser) > 0)
|
||||
{
|
||||
// 更新缓存用户信息
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return success();
|
||||
}
|
||||
return error("修改个人信息异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/updatePwd")
|
||||
public AjaxResult updatePwd(String oldPassword, String newPassword)
|
||||
{
|
||||
LoginUser loginUser = getLoginUser();
|
||||
String userName = loginUser.getUsername();
|
||||
String password = loginUser.getPassword();
|
||||
if (!SecurityUtils.matchesPassword(oldPassword, password))
|
||||
{
|
||||
return error("修改密码失败,旧密码错误");
|
||||
}
|
||||
if (SecurityUtils.matchesPassword(newPassword, password))
|
||||
{
|
||||
return error("新密码不能与旧密码相同");
|
||||
}
|
||||
newPassword = SecurityUtils.encryptPassword(newPassword);
|
||||
if (userService.resetUserPwd(userName, newPassword) > 0)
|
||||
{
|
||||
// 更新缓存用户密码
|
||||
loginUser.getUser().setPassword(newPassword);
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return success();
|
||||
}
|
||||
return error("修改密码异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 头像上传
|
||||
*/
|
||||
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/avatar")
|
||||
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception
|
||||
{
|
||||
if (!file.isEmpty())
|
||||
{
|
||||
LoginUser loginUser = getLoginUser();
|
||||
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
|
||||
if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("imgUrl", avatar);
|
||||
// 更新缓存用户头像
|
||||
loginUser.getUser().setAvatar(avatar);
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return ajax;
|
||||
}
|
||||
}
|
||||
return error("上传图片异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.model.RegisterBody;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.framework.web.service.SysRegisterService;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
|
||||
/**
|
||||
* 注册验证
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
public class SysRegisterController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private SysRegisterService registerService;
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
@PostMapping("/register")
|
||||
public AjaxResult register(@RequestBody RegisterBody user)
|
||||
{
|
||||
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
|
||||
{
|
||||
return error("当前系统没有开启注册功能!");
|
||||
}
|
||||
String msg = registerService.register(user);
|
||||
return StringUtils.isEmpty(msg) ? success() : error(msg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,262 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.web.service.SysPermissionService;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import com.ruoyi.system.domain.SysUserRole;
|
||||
import com.ruoyi.system.service.ISysDeptService;
|
||||
import com.ruoyi.system.service.ISysRoleService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
|
||||
/**
|
||||
* 角色信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/role")
|
||||
public class SysRoleController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysRoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private SysPermissionService permissionService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysRole role)
|
||||
{
|
||||
startPage();
|
||||
List<SysRole> list = roleService.selectRoleList(role);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:role:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysRole role)
|
||||
{
|
||||
List<SysRole> list = roleService.selectRoleList(role);
|
||||
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
|
||||
util.exportExcel(response, list, "角色数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||
@GetMapping(value = "/{roleId}")
|
||||
public AjaxResult getInfo(@PathVariable Long roleId)
|
||||
{
|
||||
roleService.checkRoleDataScope(roleId);
|
||||
return success(roleService.selectRoleById(roleId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增角色
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:add')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysRole role)
|
||||
{
|
||||
if (!roleService.checkRoleNameUnique(role))
|
||||
{
|
||||
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
}
|
||||
else if (!roleService.checkRoleKeyUnique(role))
|
||||
{
|
||||
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}
|
||||
role.setCreateBy(getUsername());
|
||||
return toAjax(roleService.insertRole(role));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存角色
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysRole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
if (!roleService.checkRoleNameUnique(role))
|
||||
{
|
||||
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
}
|
||||
else if (!roleService.checkRoleKeyUnique(role))
|
||||
{
|
||||
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}
|
||||
role.setUpdateBy(getUsername());
|
||||
|
||||
if (roleService.updateRole(role) > 0)
|
||||
{
|
||||
// 更新缓存用户权限
|
||||
LoginUser loginUser = getLoginUser();
|
||||
if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
|
||||
{
|
||||
loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
|
||||
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
|
||||
tokenService.setLoginUser(loginUser);
|
||||
}
|
||||
return success();
|
||||
}
|
||||
return error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存数据权限
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/dataScope")
|
||||
public AjaxResult dataScope(@RequestBody SysRole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
return toAjax(roleService.authDataScope(role));
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态修改
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public AjaxResult changeStatus(@RequestBody SysRole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
role.setUpdateBy(getUsername());
|
||||
return toAjax(roleService.updateRoleStatus(role));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除角色
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:remove')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{roleIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] roleIds)
|
||||
{
|
||||
return toAjax(roleService.deleteRoleByIds(roleIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色选择框列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect()
|
||||
{
|
||||
return success(roleService.selectRoleAll());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询已分配用户角色列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||
@GetMapping("/authUser/allocatedList")
|
||||
public TableDataInfo allocatedList(SysUser user)
|
||||
{
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectAllocatedList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询未分配用户角色列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||
@GetMapping("/authUser/unallocatedList")
|
||||
public TableDataInfo unallocatedList(SysUser user)
|
||||
{
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectUnallocatedList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消授权用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/cancel")
|
||||
public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
|
||||
{
|
||||
return toAjax(roleService.deleteAuthUser(userRole));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量取消授权用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/cancelAll")
|
||||
public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
|
||||
{
|
||||
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量选择用户授权
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/selectAll")
|
||||
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
|
||||
{
|
||||
roleService.checkRoleDataScope(roleId);
|
||||
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取对应角色部门树列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||
@GetMapping(value = "/deptTree/{roleId}")
|
||||
public AjaxResult deptTree(@PathVariable("roleId") Long roleId)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
|
||||
ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));
|
||||
return ajax;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,292 @@
|
||||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import com.ruoyi.cms.service.ICompanyService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.service.ISysDeptService;
|
||||
import com.ruoyi.system.service.ISysPostService;
|
||||
import com.ruoyi.system.service.ISysRoleService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/user")
|
||||
public class SysUserController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private ISysRoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
@Autowired
|
||||
private ISysPostService postService;
|
||||
|
||||
@Autowired
|
||||
private ICompanyService companyService;
|
||||
/**
|
||||
* 获取用户列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysUser user)
|
||||
{
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectUserList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:user:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysUser user)
|
||||
{
|
||||
List<SysUser> list = userService.selectUserList(user);
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
util.exportExcel(response, list, "用户数据");
|
||||
}
|
||||
|
||||
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:user:import')")
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
||||
{
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
List<SysUser> userList = util.importExcel(file.getInputStream());
|
||||
String operName = getUsername();
|
||||
String message = userService.importUser(userList, updateSupport, operName);
|
||||
return success(message);
|
||||
}
|
||||
|
||||
@PostMapping("/importTemplate")
|
||||
public void importTemplate(HttpServletResponse response)
|
||||
{
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
util.importTemplateExcel(response, "用户数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
||||
@GetMapping(value = { "/", "/{userId}" })
|
||||
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
|
||||
{
|
||||
userService.checkUserDataScope(userId);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
List<SysRole> roles = roleService.selectRoleAll();
|
||||
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||
ajax.put("posts", postService.selectPostAll());
|
||||
if (StringUtils.isNotNull(userId))
|
||||
{
|
||||
SysUser sysUser = userService.selectUserById(userId);
|
||||
ajax.put(AjaxResult.DATA_TAG, sysUser);
|
||||
ajax.put("postIds", postService.selectPostListByUserId(userId));
|
||||
ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
|
||||
}
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:add')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysUser user)
|
||||
{
|
||||
deptService.checkDeptDataScope(user.getDeptId());
|
||||
roleService.checkRoleDataScope(user.getRoleIds());
|
||||
if (!userService.checkUserNameUnique(user))
|
||||
{
|
||||
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
||||
{
|
||||
return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
||||
{
|
||||
return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setCreateBy(getUsername());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
return toAjax(userService.insertUser(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysUser user)
|
||||
{
|
||||
userService.checkUserAllowed(user);
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
deptService.checkDeptDataScope(user.getDeptId());
|
||||
roleService.checkRoleDataScope(user.getRoleIds());
|
||||
if (!userService.checkUserNameUnique(user))
|
||||
{
|
||||
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
||||
{
|
||||
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
||||
{
|
||||
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setUpdateBy(getUsername());
|
||||
return toAjax(userService.updateUser(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:remove')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{userIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] userIds)
|
||||
{
|
||||
if (ArrayUtils.contains(userIds, getUserId()))
|
||||
{
|
||||
return error("当前用户不能删除");
|
||||
}
|
||||
return toAjax(userService.deleteUserByIds(userIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/resetPwd")
|
||||
public AjaxResult resetPwd(@RequestBody SysUser user)
|
||||
{
|
||||
userService.checkUserAllowed(user);
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
user.setUpdateBy(getUsername());
|
||||
return toAjax(userService.resetPwd(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态修改
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public AjaxResult changeStatus(@RequestBody SysUser user)
|
||||
{
|
||||
userService.checkUserAllowed(user);
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
user.setUpdateBy(getUsername());
|
||||
return toAjax(userService.updateUserStatus(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户编号获取授权角色
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
||||
@GetMapping("/authRole/{userId}")
|
||||
public AjaxResult authRole(@PathVariable("userId") Long userId)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
SysUser user = userService.selectUserById(userId);
|
||||
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
||||
ajax.put("user", user);
|
||||
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户授权角色
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authRole")
|
||||
public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
|
||||
{
|
||||
userService.checkUserDataScope(userId);
|
||||
roleService.checkRoleDataScope(roleIds);
|
||||
userService.insertUserAuth(userId, roleIds);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门树列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:list')")
|
||||
@GetMapping("/deptTree")
|
||||
public AjaxResult deptTree(SysDept dept)
|
||||
{
|
||||
return success(deptService.selectDeptTreeList(dept));
|
||||
}
|
||||
|
||||
@ApiOperation("企业资质审核")
|
||||
@PreAuthorize("@ss.hasPermi('app:company:approval:list')")
|
||||
@PostMapping("/approval")
|
||||
public AjaxResult approval(@RequestBody Company company)
|
||||
{
|
||||
Company company1 = companyService.approval(company);
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setNickName(company1.getContactPerson());
|
||||
sysUser.setDeptId(101L);
|
||||
String contactPersonPhone = company1.getContactPersonPhone();
|
||||
if(StringUtils.isNotEmpty(contactPersonPhone)){
|
||||
String lastSixDigits = contactPersonPhone.substring(contactPersonPhone.length() - 6);
|
||||
sysUser.setPassword(lastSixDigits);
|
||||
sysUser.setUserName(company1.getContactPersonPhone());
|
||||
sysUser.setPhonenumber(company1.getContactPersonPhone());
|
||||
sysUser.setNickName(company1.getContactPersonPhone());
|
||||
}else{
|
||||
sysUser.setPassword("123456");
|
||||
sysUser.setUserName(company1.getName());
|
||||
sysUser.setNickName(company1.getName());
|
||||
}
|
||||
sysUser.setPhonenumber(getUsername());
|
||||
Long[] postIds = {1L};
|
||||
Long[] roleIds = {1102L};
|
||||
sysUser.setPostIds(postIds);
|
||||
sysUser.setRoleIds(roleIds);
|
||||
userService.insertUser(sysUser);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.web.controller.system.cloud;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
|
||||
import com.aliyun.oss.OSSClient;
|
||||
import com.ruoyi.framework.web.exception.user.OssException;
|
||||
|
||||
/**
|
||||
* 阿里云存储
|
||||
*/
|
||||
public class AliyunCloudStorageService extends CloudStorageService
|
||||
{
|
||||
private OSSClient client;
|
||||
|
||||
public AliyunCloudStorageService(CloudStorageConfig config)
|
||||
{
|
||||
this.config = config;
|
||||
// 初始化
|
||||
init();
|
||||
}
|
||||
|
||||
private void init()
|
||||
{
|
||||
client = new OSSClient(config.getAliyunEndPoint(), config.getAliyunAccessKeyId(),
|
||||
config.getAliyunAccessKeySecret());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String upload(byte[] data, String path)
|
||||
{
|
||||
return upload(new ByteArrayInputStream(data), path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String upload(InputStream inputStream, String path)
|
||||
{
|
||||
try
|
||||
{
|
||||
client.putObject(config.getAliyunBucketName(), path, inputStream);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new OssException("上传文件失败,请检查配置信息");
|
||||
}
|
||||
return config.getAliyunDomain() + "/" + path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadSuffix(byte[] data, String suffix)
|
||||
{
|
||||
return upload(data, getPath(config.getAliyunPrefix(), suffix));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadSuffix(InputStream inputStream, String suffix)
|
||||
{
|
||||
return upload(inputStream, getPath(config.getAliyunPrefix(), suffix));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.ruoyi.web.controller.system.cloud;
|
||||
|
||||
public class CloudConstant
|
||||
{
|
||||
/**
|
||||
* 云存储配置KEY
|
||||
*/
|
||||
public final static String CLOUD_STORAGE_CONFIG_KEY = "sys.oss.cloudStorage";
|
||||
|
||||
/**
|
||||
* 云服务商
|
||||
*/
|
||||
public enum CloudService
|
||||
{
|
||||
/**
|
||||
* 七牛云
|
||||
*/
|
||||
QINIU(1),
|
||||
/**
|
||||
* 阿里云
|
||||
*/
|
||||
ALIYUN(2),
|
||||
/**
|
||||
* 腾讯云
|
||||
*/
|
||||
QCLOUD(3);
|
||||
private int value;
|
||||
|
||||
CloudService(int value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getValue()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
package com.ruoyi.web.controller.system.cloud;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
import org.hibernate.validator.constraints.URL;
|
||||
|
||||
import com.ruoyi.web.controller.system.cloud.valdator.AliyunGroup;
|
||||
import com.ruoyi.web.controller.system.cloud.valdator.QcloudGroup;
|
||||
import com.ruoyi.web.controller.system.cloud.valdator.QiniuGroup;
|
||||
|
||||
/**
|
||||
* 云存储配置信息
|
||||
*/
|
||||
public class CloudStorageConfig implements Serializable
|
||||
{
|
||||
//
|
||||
private static final long serialVersionUID = 9035033846176792944L;
|
||||
|
||||
// 类型 1:七牛 2:阿里云 3:腾讯云
|
||||
@Range(min = 1, max = 3, message = "类型错误")
|
||||
private Integer type;
|
||||
|
||||
// 七牛绑定的域名
|
||||
@NotBlank(message = "七牛绑定的域名不能为空", groups = QiniuGroup.class)
|
||||
@URL(message = "七牛绑定的域名格式不正确", groups = QiniuGroup.class)
|
||||
private String qiniuDomain;
|
||||
|
||||
// 七牛路径前缀
|
||||
private String qiniuPrefix;
|
||||
|
||||
// 七牛ACCESS_KEY
|
||||
@NotBlank(message = "七牛AccessKey不能为空", groups = QiniuGroup.class)
|
||||
private String qiniuAccessKey;
|
||||
|
||||
// 七牛SECRET_KEY
|
||||
@NotBlank(message = "七牛SecretKey不能为空", groups = QiniuGroup.class)
|
||||
private String qiniuSecretKey;
|
||||
|
||||
// 七牛存储空间名
|
||||
@NotBlank(message = "七牛空间名不能为空", groups = QiniuGroup.class)
|
||||
private String qiniuBucketName;
|
||||
|
||||
// 阿里云绑定的域名
|
||||
@NotBlank(message = "阿里云绑定的域名不能为空", groups = AliyunGroup.class)
|
||||
@URL(message = "阿里云绑定的域名格式不正确", groups = AliyunGroup.class)
|
||||
private String aliyunDomain;
|
||||
|
||||
// 阿里云路径前缀
|
||||
@Pattern(regexp="^[^(/|\\)](.*[^(/|\\)])?$",message="阿里云路径前缀不能'/'或者'\'开头或者结尾",groups = AliyunGroup.class)
|
||||
private String aliyunPrefix;
|
||||
|
||||
// 阿里云EndPoint
|
||||
@NotBlank(message = "阿里云EndPoint不能为空", groups = AliyunGroup.class)
|
||||
private String aliyunEndPoint;
|
||||
|
||||
// 阿里云AccessKeyId
|
||||
@NotBlank(message = "阿里云AccessKeyId不能为空", groups = AliyunGroup.class)
|
||||
private String aliyunAccessKeyId;
|
||||
|
||||
// 阿里云AccessKeySecret
|
||||
@NotBlank(message = "阿里云AccessKeySecret不能为空", groups = AliyunGroup.class)
|
||||
private String aliyunAccessKeySecret;
|
||||
|
||||
// 阿里云BucketName
|
||||
@NotBlank(message = "阿里云BucketName不能为空", groups = AliyunGroup.class)
|
||||
private String aliyunBucketName;
|
||||
|
||||
// 腾讯云绑定的域名
|
||||
@NotBlank(message = "腾讯云绑定的域名不能为空", groups = QcloudGroup.class)
|
||||
@URL(message = "腾讯云绑定的域名格式不正确", groups = QcloudGroup.class)
|
||||
private String qcloudDomain;
|
||||
|
||||
// 腾讯云路径前缀
|
||||
private String qcloudPrefix;
|
||||
|
||||
// 腾讯云AppId
|
||||
@NotNull(message = "腾讯云AppId不能为空", groups = QcloudGroup.class)
|
||||
private Integer qcloudAppId;
|
||||
|
||||
// 腾讯云SecretId
|
||||
@NotBlank(message = "腾讯云SecretId不能为空", groups = QcloudGroup.class)
|
||||
private String qcloudSecretId;
|
||||
|
||||
// 腾讯云SecretKey
|
||||
@NotBlank(message = "腾讯云SecretKey不能为空", groups = QcloudGroup.class)
|
||||
private String qcloudSecretKey;
|
||||
|
||||
// 腾讯云BucketName
|
||||
@NotBlank(message = "腾讯云BucketName不能为空", groups = QcloudGroup.class)
|
||||
private String qcloudBucketName;
|
||||
|
||||
// 腾讯云COS所属地区
|
||||
@NotBlank(message = "所属地区不能为空", groups = QcloudGroup.class)
|
||||
private String qcloudRegion;
|
||||
|
||||
public Integer getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Integer type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getQiniuDomain()
|
||||
{
|
||||
return qiniuDomain;
|
||||
}
|
||||
|
||||
public void setQiniuDomain(String qiniuDomain)
|
||||
{
|
||||
this.qiniuDomain = qiniuDomain;
|
||||
}
|
||||
|
||||
public String getQiniuAccessKey()
|
||||
{
|
||||
return qiniuAccessKey;
|
||||
}
|
||||
|
||||
public void setQiniuAccessKey(String qiniuAccessKey)
|
||||
{
|
||||
this.qiniuAccessKey = qiniuAccessKey;
|
||||
}
|
||||
|
||||
public String getQiniuSecretKey()
|
||||
{
|
||||
return qiniuSecretKey;
|
||||
}
|
||||
|
||||
public void setQiniuSecretKey(String qiniuSecretKey)
|
||||
{
|
||||
this.qiniuSecretKey = qiniuSecretKey;
|
||||
}
|
||||
|
||||
public String getQiniuBucketName()
|
||||
{
|
||||
return qiniuBucketName;
|
||||
}
|
||||
|
||||
public void setQiniuBucketName(String qiniuBucketName)
|
||||
{
|
||||
this.qiniuBucketName = qiniuBucketName;
|
||||
}
|
||||
|
||||
public String getQiniuPrefix()
|
||||
{
|
||||
return qiniuPrefix;
|
||||
}
|
||||
|
||||
public void setQiniuPrefix(String qiniuPrefix)
|
||||
{
|
||||
this.qiniuPrefix = qiniuPrefix;
|
||||
}
|
||||
|
||||
public String getAliyunDomain()
|
||||
{
|
||||
return aliyunDomain;
|
||||
}
|
||||
|
||||
public void setAliyunDomain(String aliyunDomain)
|
||||
{
|
||||
this.aliyunDomain = aliyunDomain;
|
||||
}
|
||||
|
||||
public String getAliyunPrefix()
|
||||
{
|
||||
return aliyunPrefix;
|
||||
}
|
||||
|
||||
public void setAliyunPrefix(String aliyunPrefix)
|
||||
{
|
||||
this.aliyunPrefix = aliyunPrefix;
|
||||
}
|
||||
|
||||
public String getAliyunEndPoint()
|
||||
{
|
||||
return aliyunEndPoint;
|
||||
}
|
||||
|
||||
public void setAliyunEndPoint(String aliyunEndPoint)
|
||||
{
|
||||
this.aliyunEndPoint = aliyunEndPoint;
|
||||
}
|
||||
|
||||
public String getAliyunAccessKeyId()
|
||||
{
|
||||
return aliyunAccessKeyId;
|
||||
}
|
||||
|
||||
public void setAliyunAccessKeyId(String aliyunAccessKeyId)
|
||||
{
|
||||
this.aliyunAccessKeyId = aliyunAccessKeyId;
|
||||
}
|
||||
|
||||
public String getAliyunAccessKeySecret()
|
||||
{
|
||||
return aliyunAccessKeySecret;
|
||||
}
|
||||
|
||||
public void setAliyunAccessKeySecret(String aliyunAccessKeySecret)
|
||||
{
|
||||
this.aliyunAccessKeySecret = aliyunAccessKeySecret;
|
||||
}
|
||||
|
||||
public String getAliyunBucketName()
|
||||
{
|
||||
return aliyunBucketName;
|
||||
}
|
||||
|
||||
public void setAliyunBucketName(String aliyunBucketName)
|
||||
{
|
||||
this.aliyunBucketName = aliyunBucketName;
|
||||
}
|
||||
|
||||
public String getQcloudDomain()
|
||||
{
|
||||
return qcloudDomain;
|
||||
}
|
||||
|
||||
public void setQcloudDomain(String qcloudDomain)
|
||||
{
|
||||
this.qcloudDomain = qcloudDomain;
|
||||
}
|
||||
|
||||
public String getQcloudPrefix()
|
||||
{
|
||||
return qcloudPrefix;
|
||||
}
|
||||
|
||||
public void setQcloudPrefix(String qcloudPrefix)
|
||||
{
|
||||
this.qcloudPrefix = qcloudPrefix;
|
||||
}
|
||||
|
||||
public Integer getQcloudAppId()
|
||||
{
|
||||
return qcloudAppId;
|
||||
}
|
||||
|
||||
public void setQcloudAppId(Integer qcloudAppId)
|
||||
{
|
||||
this.qcloudAppId = qcloudAppId;
|
||||
}
|
||||
|
||||
public String getQcloudSecretId()
|
||||
{
|
||||
return qcloudSecretId;
|
||||
}
|
||||
|
||||
public void setQcloudSecretId(String qcloudSecretId)
|
||||
{
|
||||
this.qcloudSecretId = qcloudSecretId;
|
||||
}
|
||||
|
||||
public String getQcloudSecretKey()
|
||||
{
|
||||
return qcloudSecretKey;
|
||||
}
|
||||
|
||||
public void setQcloudSecretKey(String qcloudSecretKey)
|
||||
{
|
||||
this.qcloudSecretKey = qcloudSecretKey;
|
||||
}
|
||||
|
||||
public String getQcloudBucketName()
|
||||
{
|
||||
return qcloudBucketName;
|
||||
}
|
||||
|
||||
public void setQcloudBucketName(String qcloudBucketName)
|
||||
{
|
||||
this.qcloudBucketName = qcloudBucketName;
|
||||
}
|
||||
|
||||
public String getQcloudRegion()
|
||||
{
|
||||
return qcloudRegion;
|
||||
}
|
||||
|
||||
public void setQcloudRegion(String qcloudRegion)
|
||||
{
|
||||
this.qcloudRegion = qcloudRegion;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.ruoyi.web.controller.system.cloud;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
|
||||
/**
|
||||
* 云存储(支持七牛、阿里云、腾讯云、又拍云)
|
||||
*/
|
||||
public abstract class CloudStorageService
|
||||
{
|
||||
/** 云存储配置信息 */
|
||||
CloudStorageConfig config;
|
||||
|
||||
public int getService()
|
||||
{
|
||||
return config.getType();
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件路径
|
||||
* @param prefix 前缀
|
||||
* @param suffix 后缀
|
||||
* @return 返回上传路径
|
||||
*/
|
||||
public String getPath(String prefix, String suffix)
|
||||
{
|
||||
// 生成uuid
|
||||
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
// 文件路径
|
||||
String path = DateUtils.dateTime() + "/" + uuid;
|
||||
if (StringUtils.isNotBlank(prefix))
|
||||
{
|
||||
path = prefix + "/" + path;
|
||||
}
|
||||
return path + suffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
* @param data 文件字节数组
|
||||
* @param path 文件路径,包含文件名
|
||||
* @return 返回http地址
|
||||
*/
|
||||
public abstract String upload(byte[] data, String path);
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
* @param data 文件字节数组
|
||||
* @param suffix 后缀
|
||||
* @return 返回http地址
|
||||
*/
|
||||
public abstract String uploadSuffix(byte[] data, String suffix);
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
* @param inputStream 字节流
|
||||
* @param path 文件路径,包含文件名
|
||||
* @return 返回http地址
|
||||
*/
|
||||
public abstract String upload(InputStream inputStream, String path);
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
* @param inputStream 字节流
|
||||
* @param suffix 后缀
|
||||
* @return 返回http地址
|
||||
*/
|
||||
public abstract String uploadSuffix(InputStream inputStream, String suffix);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.ruoyi.web.controller.system.cloud;
|
||||
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import com.ruoyi.web.controller.system.cloud.CloudConstant.CloudService;
|
||||
|
||||
/**
|
||||
* 文件上传Factory
|
||||
*/
|
||||
public final class OSSFactory
|
||||
{
|
||||
private static ISysConfigService sysConfigService;
|
||||
static
|
||||
{
|
||||
OSSFactory.sysConfigService = (ISysConfigService) SpringUtils.getBean(ISysConfigService.class);
|
||||
}
|
||||
|
||||
public static CloudStorageService build()
|
||||
{
|
||||
String jsonconfig = sysConfigService.selectConfigByKey(CloudConstant.CLOUD_STORAGE_CONFIG_KEY);
|
||||
// 获取云存储配置信息
|
||||
CloudStorageConfig config = JSON.parseObject(jsonconfig, CloudStorageConfig.class);
|
||||
if (config.getType() == CloudService.QINIU.getValue())
|
||||
{
|
||||
return new QiniuCloudStorageService(config);
|
||||
}
|
||||
else if (config.getType() == CloudService.ALIYUN.getValue())
|
||||
{
|
||||
return new AliyunCloudStorageService(config);
|
||||
}
|
||||
else if (config.getType() == CloudService.QCLOUD.getValue())
|
||||
{
|
||||
return new QcloudCloudStorageService(config);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.ruoyi.web.controller.system.cloud;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import com.qcloud.cos.COSClient;
|
||||
import com.qcloud.cos.ClientConfig;
|
||||
import com.qcloud.cos.auth.BasicCOSCredentials;
|
||||
import com.qcloud.cos.auth.COSCredentials;
|
||||
import com.qcloud.cos.model.PutObjectRequest;
|
||||
import com.qcloud.cos.model.PutObjectResult;
|
||||
import com.qcloud.cos.region.Region;
|
||||
import com.ruoyi.common.utils.file.FileUtils;
|
||||
import com.ruoyi.framework.web.exception.user.OssException;
|
||||
|
||||
/**
|
||||
* 腾讯云存储
|
||||
*/
|
||||
public class QcloudCloudStorageService extends CloudStorageService
|
||||
{
|
||||
private COSClient client;
|
||||
|
||||
public QcloudCloudStorageService(CloudStorageConfig config)
|
||||
{
|
||||
this.config = config;
|
||||
// 初始化
|
||||
init();
|
||||
}
|
||||
|
||||
private void init()
|
||||
{
|
||||
COSCredentials credentials = new BasicCOSCredentials(config.getQcloudSecretId(),
|
||||
config.getQcloudSecretKey());
|
||||
// 设置bucket所在的区域,最新sdk不再支持简写,请填写完整
|
||||
Region region = new Region(config.getQcloudRegion());
|
||||
ClientConfig clientConfig = new ClientConfig(region);
|
||||
client = new COSClient(credentials, clientConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String upload(byte[] data, String path)
|
||||
{
|
||||
if (!path.startsWith("/"))
|
||||
{
|
||||
path = "/" + path;
|
||||
}
|
||||
File file = null;
|
||||
// 创建一个临时目录文件,结束后删除,腾讯云这个操作跟SB没区别,用流上传麻烦更多,权衡以后先这么做
|
||||
try
|
||||
{
|
||||
file = FileUtils.createTempFile(path, data);
|
||||
PutObjectRequest putObjectRequest = new PutObjectRequest(config.getQcloudBucketName(), path, file);
|
||||
PutObjectResult putObjectResult = client.putObject(putObjectRequest);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new OssException("文件上传失败," + e.getMessage());
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (null != file) file.delete();
|
||||
}
|
||||
return config.getQcloudDomain() + path;
|
||||
}
|
||||
public static String getTemp()
|
||||
{
|
||||
return System.getProperty("java.io.tmpdir");
|
||||
}
|
||||
@Override
|
||||
public String upload(InputStream inputStream, String path)
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] data = IOUtils.toByteArray(inputStream);
|
||||
return this.upload(data, path);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new OssException("上传文件失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadSuffix(byte[] data, String suffix)
|
||||
{
|
||||
return upload(data, getPath(config.getQcloudPrefix(), suffix));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadSuffix(InputStream inputStream, String suffix)
|
||||
{
|
||||
return upload(inputStream, getPath(config.getQcloudPrefix(), suffix));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.ruoyi.web.controller.system.cloud;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import com.qiniu.http.Response;
|
||||
import com.qiniu.storage.Configuration;
|
||||
import com.qiniu.storage.Region;
|
||||
import com.qiniu.storage.UploadManager;
|
||||
import com.qiniu.util.Auth;
|
||||
import com.ruoyi.framework.web.exception.user.OssException;
|
||||
|
||||
/**
|
||||
* 七牛云存储
|
||||
*/
|
||||
public class QiniuCloudStorageService extends CloudStorageService
|
||||
{
|
||||
private UploadManager uploadManager;
|
||||
|
||||
private String token;
|
||||
|
||||
public QiniuCloudStorageService(CloudStorageConfig config)
|
||||
{
|
||||
this.config = config;
|
||||
// 初始化
|
||||
init();
|
||||
}
|
||||
|
||||
private void init()
|
||||
{
|
||||
uploadManager = new UploadManager(new Configuration(Region.autoRegion()));
|
||||
token = Auth.create(config.getQiniuAccessKey(), config.getQiniuSecretKey())
|
||||
.uploadToken(config.getQiniuBucketName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String upload(byte[] data, String path)
|
||||
{
|
||||
try
|
||||
{
|
||||
Response res = uploadManager.put(data, path, token);
|
||||
if (!res.isOK())
|
||||
{
|
||||
throw new RuntimeException("上传七牛出错:" + res.toString());
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new OssException("上传文件失败,请核对七牛配置信息");
|
||||
}
|
||||
return config.getQiniuDomain() + "/" + path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String upload(InputStream inputStream, String path)
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] data = IOUtils.toByteArray(inputStream);
|
||||
return this.upload(data, path);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new OssException("上传文件失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadSuffix(byte[] data, String suffix)
|
||||
{
|
||||
return upload(data, getPath(config.getQiniuPrefix(), suffix));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadSuffix(InputStream inputStream, String suffix)
|
||||
{
|
||||
return upload(inputStream, getPath(config.getQiniuPrefix(), suffix));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ruoyi.web.controller.system.cloud.valdator;
|
||||
|
||||
/**
|
||||
* 阿里云
|
||||
*/
|
||||
public interface AliyunGroup
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ruoyi.web.controller.system.cloud.valdator;
|
||||
|
||||
/**
|
||||
* 腾讯云
|
||||
*/
|
||||
public interface QcloudGroup
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ruoyi.web.controller.system.cloud.valdator;
|
||||
|
||||
/**
|
||||
* 七牛
|
||||
*/
|
||||
public interface QiniuGroup
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.ruoyi.web.core.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.models.auth.In;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.ApiKey;
|
||||
import springfox.documentation.service.AuthorizationScope;
|
||||
import springfox.documentation.service.Contact;
|
||||
import springfox.documentation.service.SecurityReference;
|
||||
import springfox.documentation.service.SecurityScheme;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
|
||||
/**
|
||||
* Swagger2的接口配置
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Configuration
|
||||
public class SwaggerConfig
|
||||
{
|
||||
/** 系统基础配置 */
|
||||
@Autowired
|
||||
private RuoYiConfig ruoyiConfig;
|
||||
|
||||
/** 是否开启swagger */
|
||||
@Value("${swagger.enabled}")
|
||||
private boolean enabled;
|
||||
|
||||
/** 设置请求的统一前缀 */
|
||||
@Value("${swagger.pathMapping}")
|
||||
private String pathMapping;
|
||||
|
||||
/**
|
||||
* 创建API
|
||||
*/
|
||||
@Bean
|
||||
public Docket createRestApi()
|
||||
{
|
||||
return new Docket(DocumentationType.OAS_30)
|
||||
// 是否启用Swagger
|
||||
.enable(enabled)
|
||||
// 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
|
||||
.apiInfo(apiInfo())
|
||||
// 设置哪些接口暴露给Swagger展示
|
||||
.select()
|
||||
// 扫描所有有注解的api,用这种方式更灵活
|
||||
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||
// 扫描指定包中的swagger注解
|
||||
// .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
|
||||
.apis(RequestHandlerSelectors.any())
|
||||
// .paths(PathSelectors.any())
|
||||
.build()
|
||||
/* 设置安全模式,swagger可以设置访问token */
|
||||
.securitySchemes(securitySchemes())
|
||||
.securityContexts(securityContexts())
|
||||
.pathMapping(pathMapping);
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全模式,这里指定token通过Authorization头请求头传递
|
||||
*/
|
||||
private List<SecurityScheme> securitySchemes()
|
||||
{
|
||||
List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
|
||||
apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue()));
|
||||
return apiKeyList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全上下文
|
||||
*/
|
||||
private List<SecurityContext> securityContexts()
|
||||
{
|
||||
List<SecurityContext> securityContexts = new ArrayList<>();
|
||||
securityContexts.add(
|
||||
SecurityContext.builder()
|
||||
.securityReferences(defaultAuth())
|
||||
.operationSelector(o -> o.requestMappingPattern().matches("/.*"))
|
||||
.build());
|
||||
return securityContexts;
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认的安全上引用
|
||||
*/
|
||||
private List<SecurityReference> defaultAuth()
|
||||
{
|
||||
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
|
||||
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
|
||||
authorizationScopes[0] = authorizationScope;
|
||||
List<SecurityReference> securityReferences = new ArrayList<>();
|
||||
securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
|
||||
return securityReferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加摘要信息
|
||||
*/
|
||||
private ApiInfo apiInfo()
|
||||
{
|
||||
// 用ApiInfoBuilder进行定制
|
||||
return new ApiInfoBuilder()
|
||||
// 设置标题
|
||||
.title("标题:管理系统_接口文档")
|
||||
// 描述
|
||||
// .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
|
||||
// 作者信息
|
||||
.contact(new Contact(ruoyiConfig.getName(), null, null))
|
||||
// 版本
|
||||
.version("版本号:" + ruoyiConfig.getVersion())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
restart.include.json=/com.alibaba.fastjson2.*.jar
|
||||
96
ruoyi-admin/src/main/resources/application-dev.yml
Normal file
96
ruoyi-admin/src/main/resources/application-dev.yml
Normal file
@@ -0,0 +1,96 @@
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.highgo.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:highgo://127.0.0.1:5866/highgo?useUnicode=true&characterEncoding=utf8¤tSchema=ks_db4&stringtype=unspecified
|
||||
#username: syssso
|
||||
username: sysdba
|
||||
password: ZKR2024@comzkr
|
||||
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# 初始连接数
|
||||
initialSize: 10
|
||||
# 最小连接池数量
|
||||
minIdle: 30
|
||||
# 最大连接池数量
|
||||
maxActive: 50
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置连接超时时间
|
||||
connectTimeout: 30000
|
||||
# 配置网络超时时间
|
||||
socketTimeout: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT version()
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: ruoyi
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
redis:
|
||||
# 地址
|
||||
host: 127.0.0.1
|
||||
# 端口,默认为6379
|
||||
port: 5379
|
||||
# 数据库索引
|
||||
database: 5
|
||||
# 密码
|
||||
password: ZKR2024@@.com
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
|
||||
# easy-es
|
||||
easy-es:
|
||||
enable: true
|
||||
banner: false
|
||||
address: 127.0.0.1:9200
|
||||
global-config:
|
||||
process-index-mode: manual
|
||||
db-config:
|
||||
refresh-policy: immediate
|
||||
username: elastic
|
||||
password: zkr2024@@.com
|
||||
93
ruoyi-admin/src/main/resources/application-local.yml
Normal file
93
ruoyi-admin/src/main/resources/application-local.yml
Normal file
@@ -0,0 +1,93 @@
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.highgo.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:highgo://124.243.245.42:5866/highgo?useUnicode=true&characterEncoding=utf8¤tSchema=ks_db4&stringtype=unspecified
|
||||
username: sysdba
|
||||
password: ZKR2024@comzkr
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# 初始连接数
|
||||
initialSize: 10
|
||||
# 最小连接池数量
|
||||
minIdle: 30
|
||||
# 最大连接池数量
|
||||
maxActive: 50
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置连接超时时间
|
||||
connectTimeout: 30000
|
||||
# 配置网络超时时间
|
||||
socketTimeout: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT version()
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: ruoyi
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
redis:
|
||||
# 地址
|
||||
host: 124.243.245.42
|
||||
# 端口,默认为6379
|
||||
port: 5379
|
||||
# 数据库索引
|
||||
database: 5
|
||||
# 密码
|
||||
password: ZKR2024@@.com
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
# easy-es
|
||||
easy-es:
|
||||
enable: true
|
||||
banner: false
|
||||
address: 124.243.245.42:9200
|
||||
global-config:
|
||||
process-index-mode: manual
|
||||
db-config:
|
||||
refresh-policy: immediate
|
||||
username: elastic
|
||||
password: zkr2024@@.com
|
||||
206
ruoyi-admin/src/main/resources/application.yml
Normal file
206
ruoyi-admin/src/main/resources/application.yml
Normal file
@@ -0,0 +1,206 @@
|
||||
# 项目相关配置
|
||||
ruoyi:
|
||||
# 名称
|
||||
name: RuoYi
|
||||
# 版本
|
||||
version: 3.8.8
|
||||
# 版权年份
|
||||
copyrightYear: 2024
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: D:/ruoyi/uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 9091
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
# 连接数满后的排队数,默认为100
|
||||
accept-count: 1000
|
||||
threads:
|
||||
# tomcat最大线程数,默认为200
|
||||
max: 800
|
||||
# Tomcat启动初始化的线程数,默认值10
|
||||
min-spare: 100
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.ruoyi: debug
|
||||
org.springframework: warn
|
||||
|
||||
# 用户配置
|
||||
user:
|
||||
password:
|
||||
# 密码最大错误次数
|
||||
maxRetryCount: 5
|
||||
# 密码锁定时间(默认10分钟)
|
||||
lockTime: 10
|
||||
|
||||
# Spring配置
|
||||
spring:
|
||||
# 资源信息
|
||||
messages:
|
||||
# 国际化资源文件路径
|
||||
basename: i18n/messages
|
||||
profiles:
|
||||
active: local
|
||||
# 文件上传
|
||||
servlet:
|
||||
multipart:
|
||||
# 单个文件大小
|
||||
max-file-size: 10MB
|
||||
# 设置总上传的文件大小
|
||||
max-request-size: 20MB
|
||||
# 服务模块
|
||||
devtools:
|
||||
restart:
|
||||
# 热部署开关
|
||||
enabled: true
|
||||
# redis 配置
|
||||
# token配置
|
||||
token:
|
||||
# 令牌自定义标识
|
||||
header: Authorization
|
||||
# 令牌密钥
|
||||
secret: Abc123!@#Def456$%^Ghi789&*()Jkl0+-=MnoPqrStuVwxYz987$%^654@#$321!@#ZyxWvu
|
||||
# 令牌有效期(默认30分钟)
|
||||
expireTime: 30
|
||||
|
||||
## MyBatis配置
|
||||
#mybatis:
|
||||
# # 搜索指定包别名
|
||||
# typeAliasesPackage: com.ruoyi.**.domain
|
||||
# # 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||
# mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||
# # 加载全局的配置文件
|
||||
# configLocation: classpath:mybatis/mybatis-config.xml
|
||||
|
||||
# PageHelper分页插件
|
||||
pagehelper:
|
||||
helperDialect: oracle
|
||||
supportMethodsArguments: true
|
||||
params: count=countSql
|
||||
|
||||
# Swagger配置
|
||||
swagger:
|
||||
# 是否开启swagger
|
||||
enabled: true
|
||||
# 请求前缀
|
||||
pathMapping:
|
||||
|
||||
# 防止XSS攻击
|
||||
xss:
|
||||
# 过滤开关
|
||||
enabled: true
|
||||
# 排除链接(多个用逗号分隔)
|
||||
excludes: /system/notice
|
||||
# 匹配链接
|
||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||
|
||||
|
||||
createSqlSessionFactory:
|
||||
# 选择MyBatis配置方式,mybatis / mybatis-plus
|
||||
use: mybatis-plus
|
||||
|
||||
# MyBatis配置
|
||||
mybatis:
|
||||
# 搜索指定包别名
|
||||
typeAliasesPackage: com.ruoyi.**.domain
|
||||
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||
# 加载全局的配置文件
|
||||
configLocation: classpath:mybatis/mybatis-config.xml
|
||||
|
||||
# MyBatis Plus配置
|
||||
mybatis-plus:
|
||||
# 搜索指定包别名
|
||||
typeAliasesPackage: com.ruoyi.**.domain
|
||||
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||
# 加载全局的配置文件
|
||||
configLocation: classpath:mybatis/mybatis-config.xml
|
||||
global-config:
|
||||
db-config:
|
||||
# 标识逻辑删除的数据库字段名称
|
||||
logic-delete-field: delFlag
|
||||
# 表示已逻辑删除的值(默认也是如此)
|
||||
logic-delete-value: 2
|
||||
# 表示未逻辑删除的值(默认也是如此)
|
||||
logic-not-delete-value: 0
|
||||
|
||||
file:
|
||||
upload-dir: /data/file
|
||||
|
||||
#微信小程序
|
||||
wx:
|
||||
appid: wx4aa34488b965a331
|
||||
secret: 558780ecc2750f87e556b0e5496773c9
|
||||
|
||||
#统一门户认证
|
||||
oauth:
|
||||
#客户端的ID
|
||||
appid: 251112100000000015
|
||||
#授权码
|
||||
clientsecretkey: 2a44cb8d21dcf4b0777881ca11ea0d83ebea94bbe1ab1f405508db0873cdcc99
|
||||
#内网
|
||||
usptnw:
|
||||
#获取访问令牌
|
||||
nwGatewayGetTokenUrl: http://10.98.80.146/uspt/serviceAPI/getToken
|
||||
#获取用户信息
|
||||
nwGatewayGetUserInfoUrl: http://10.98.80.146/uspt/serviceAPI/getUserInfo
|
||||
#外网
|
||||
usptww:
|
||||
#门户注册
|
||||
wwRegisterPostUrl: http://10.98.80.50/uspt/webWhiteListServiceAPI/doWebRegister
|
||||
#门户登录
|
||||
wwTokenPostUrl: http://10.98.80.50/uspt/webWhiteListServiceAPI/doWebLogon
|
||||
#查询用户信息
|
||||
wwQueryWebUserInfo: http://10.98.80.50/uspt/webWhiteListServiceAPI/queryWebUserInfo
|
||||
#查询个人信息
|
||||
wwQueryWebPersonalInfoPostUrl: http://10.98.80.50/uspt/webWhiteListServiceAPI/queryWebPersonalInfo
|
||||
#查询单位信息
|
||||
wwQueryWebEnterpriseInfoPostUrl: http://10.98.80.50/uspt//webWhiteListServiceAPI/queryWebEnterpriseInfo
|
||||
#用户新增接口
|
||||
tyAddUserUrl: http://10.98.80.146/qxgl_backend/security/add_user
|
||||
#获取当前用户有权系统列表
|
||||
tyQueryUserSysListUrl: http://10.98.80.146/qxgl_backend/security/get_effective_app_list
|
||||
#获取当前用户有权角色列表
|
||||
tyQueryUserRoleListUrl: http://10.98.80.146/qxgl_backend/security/get_role_by_userid
|
||||
#获取角色功能权限信息
|
||||
tyQueryRoleInfoUrl: http://10.98.80.146/qxgl_backend/security/get_path_by_role
|
||||
#获取用户详细信息
|
||||
tyQueryUserInfo: http://10.98.80.146/qxgl_backend/security/get_user_by_userid
|
||||
#获取机构详细信息
|
||||
tyQueryUnitInfo: http://10.98.80.146/qxgl_backend/security/get_organization_by_organizationid
|
||||
connect-timeout: 10
|
||||
read-timeout: 30
|
||||
write-timeout: 30
|
||||
|
||||
#ai
|
||||
chat:
|
||||
baseUrl: http://39.98.44.136:8082
|
||||
chatUrl: /v1/chat/completions
|
||||
chatDetailUrl: /core/chat/getPaginationRecords
|
||||
chatHistoryUrl: /core/chat/getHistories
|
||||
updateNameUrl: /core/chat/updateHistory
|
||||
stickChatUrl: /core/chat/updateHistory
|
||||
delChatUrl: /core/chat/delHistory
|
||||
delAllChatUrl: /core/chat/clearHistories
|
||||
guestUrl: /v1/chat/completions
|
||||
praiseUrl: /core/chat/feedback/updateUserFeedback
|
||||
appId: 67cd49095e947ae0ca7fadd8
|
||||
apiKey: fastgpt-qMl63276wPZvKAxEkW77bur0sSJpmuC6Ngg9lzyEjufLhsBAurjT55j
|
||||
model: qd-job-turbo
|
||||
|
||||
audioText:
|
||||
asr: http://127.0.0.1:8001/asr/file
|
||||
tts: http://127.0.0.1:19527/synthesize
|
||||
24
ruoyi-admin/src/main/resources/banner.txt
Normal file
24
ruoyi-admin/src/main/resources/banner.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
Application Version: ${ruoyi.version}
|
||||
Spring Boot Version: ${spring-boot.version}
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// _ooOoo_ //
|
||||
// o8888888o //
|
||||
// 88" . "88 //
|
||||
// (| ^_^ |) //
|
||||
// O\ = /O //
|
||||
// ____/`---'\____ //
|
||||
// .' \\| |// `. //
|
||||
// / \\||| : |||// \ //
|
||||
// / _||||| -:- |||||- \ //
|
||||
// | | \\\ - /// | | //
|
||||
// | \_| ''\---/'' | | //
|
||||
// \ .-\__ `-` ___/-. / //
|
||||
// ___`. .' /--.--\ `. . ___ //
|
||||
// ."" '< `.___\_<|>_/___.' >'"". //
|
||||
// | | : `- \`.;`\ _ /`;.`/ - ` : | | //
|
||||
// \ \ `-. \_ __\ /__ _/ .-` / / //
|
||||
// ========`-.____`-.___\_____/___.-`____.-'======== //
|
||||
// `=---=' //
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
|
||||
// 佛祖保佑 永不宕机 永无BUG //
|
||||
////////////////////////////////////////////////////////////////////
|
||||
38
ruoyi-admin/src/main/resources/i18n/messages.properties
Normal file
38
ruoyi-admin/src/main/resources/i18n/messages.properties
Normal file
@@ -0,0 +1,38 @@
|
||||
#错误消息
|
||||
not.null=* 必须填写
|
||||
user.jcaptcha.error=验证码错误
|
||||
user.jcaptcha.expire=验证码已失效
|
||||
user.not.exists=用户不存在/密码错误
|
||||
user.password.not.match=用户不存在/密码错误
|
||||
user.password.retry.limit.count=密码输入错误{0}次
|
||||
user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟
|
||||
user.password.delete=对不起,您的账号已被删除
|
||||
user.blocked=用户已封禁,请联系管理员
|
||||
role.blocked=角色已封禁,请联系管理员
|
||||
login.blocked=很遗憾,访问IP已被列入系统黑名单
|
||||
user.logout.success=退出成功
|
||||
|
||||
length.not.valid=长度必须在{min}到{max}个字符之间
|
||||
|
||||
user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头
|
||||
user.password.not.valid=* 5-50个字符
|
||||
|
||||
user.email.not.valid=邮箱格式错误
|
||||
user.mobile.phone.number.not.valid=手机号格式错误
|
||||
user.login.success=登录成功
|
||||
user.register.success=注册成功
|
||||
user.notfound=请重新登录
|
||||
user.forcelogout=管理员强制退出,请重新登录
|
||||
user.unknown.error=未知错误,请重新登录
|
||||
|
||||
##文件上传消息
|
||||
upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB!
|
||||
upload.filename.exceed.length=上传的文件名最长{0}个字符
|
||||
|
||||
##权限
|
||||
no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]
|
||||
93
ruoyi-admin/src/main/resources/logback.xml
Normal file
93
ruoyi-admin/src/main/resources/logback.xml
Normal file
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="/home/lapuda/logs" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 用户访问日志输出 -->
|
||||
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-user.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 按天回滚 daily -->
|
||||
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.ruoyi" level="info" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
</root>
|
||||
|
||||
<!--系统用户操作日志-->
|
||||
<logger name="sys-user" level="info">
|
||||
<appender-ref ref="sys-user"/>
|
||||
</logger>
|
||||
</configuration>
|
||||
20
ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml
Normal file
20
ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE configuration
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
<!-- 全局参数 -->
|
||||
<settings>
|
||||
<!-- 使全局的映射器启用或禁用缓存 -->
|
||||
<setting name="cacheEnabled" value="true" />
|
||||
<!-- 允许JDBC 支持自动生成主键 -->
|
||||
<setting name="useGeneratedKeys" value="true" />
|
||||
<!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
|
||||
<setting name="defaultExecutorType" value="SIMPLE" />
|
||||
<!-- 指定 MyBatis 所用日志的具体实现 -->
|
||||
<setting name="logImpl" value="SLF4J" />
|
||||
<!-- 使用驼峰命名法转换字段 -->
|
||||
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
|
||||
</settings>
|
||||
|
||||
</configuration>
|
||||
121
ruoyi-bussiness/pom.xml
Normal file
121
ruoyi-bussiness/pom.xml
Normal file
@@ -0,0 +1,121 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ruoyi</artifactId>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<version>3.8.8</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ruoyi-bussiness</artifactId>
|
||||
|
||||
<description>
|
||||
bussiness系统模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nls</groupId>
|
||||
<artifactId>nls-sdk-tts</artifactId>
|
||||
<version>2.2.14</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nls</groupId>
|
||||
<artifactId>nls-sdk-common</artifactId>
|
||||
<version>2.2.14</version>
|
||||
</dependency>
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nls</groupId>
|
||||
<artifactId>nls-sdk-recognizer</artifactId>
|
||||
<version>2.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.6.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-spring-web</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
<version>1.6.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.ruoyi</groupId>-->
|
||||
<!-- <artifactId>ruoyi-framework</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>4.0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.elasticsearch</groupId>
|
||||
<artifactId>elasticsearch</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||
<version>7.14.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch</groupId>
|
||||
<artifactId>elasticsearch</artifactId>
|
||||
<version>7.14.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.easy-es</groupId>
|
||||
<artifactId>easy-es-boot-starter</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.7.22</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
<!--localDate-->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,296 @@
|
||||
package com.ruoyi.cms.config;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ruoyi.cms.domain.chat.ChatRequest;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import lombok.var;
|
||||
import okhttp3.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Component
|
||||
public class ChatClient {
|
||||
// 超时设置(单位:秒)
|
||||
private static final int CONNECT_TIMEOUT = 30;
|
||||
private static final int WRITE_TIMEOUT = 30;
|
||||
private static final int READ_TIMEOUT = 300; // 流式响应不设置读取超时
|
||||
|
||||
// 单例 OkHttp 客户端(复用连接池)
|
||||
private static final OkHttpClient client = new OkHttpClient.Builder()
|
||||
.connectTimeout(CONNECT_TIMEOUT, TimeUnit.SECONDS)
|
||||
.writeTimeout(WRITE_TIMEOUT, TimeUnit.SECONDS)
|
||||
.readTimeout(READ_TIMEOUT, TimeUnit.SECONDS)
|
||||
.build();
|
||||
|
||||
private static final String CHAT_ENDPOINT = "chat";
|
||||
|
||||
private static final String CHAT_HISTORY = "history";
|
||||
public static final List<String> TEXT_FILE_EXTENSIONS= Arrays.asList(".txt", ".md", ".html", ".doc", ".docx", ".pdf", ".ppt", ".pptx", ".csv", ".xls", ".xlsx");
|
||||
public static final List<String> IMAGE_FILE_EXTENSIONS=Arrays.asList(".jpg", ".jpeg", ".png", ".gif", ".bmp", ".webp");
|
||||
|
||||
|
||||
private ChatConfig chatConfig;
|
||||
@Autowired
|
||||
public void setChatConfig(ChatConfig chatConfig) {
|
||||
this.chatConfig = chatConfig;
|
||||
}
|
||||
@Value("${spring.profiles.active}")
|
||||
private String env;
|
||||
/**
|
||||
* 发送流式聊天请求
|
||||
* @param chatRequest 查询请求体
|
||||
* @param callback 流式响应回调接口
|
||||
*/
|
||||
public void sendStreamingChat(ChatRequest chatRequest, StreamCallback callback) {
|
||||
String url=chatConfig.getBaseUrl()+chatConfig.getChatUrl();
|
||||
// 构建请求体
|
||||
String jsonBody = buildChatRequestBody(chatRequest, CHAT_ENDPOINT);
|
||||
// 构建请求
|
||||
Request request = null;
|
||||
|
||||
try {
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"),jsonBody);
|
||||
request = new Request.Builder()
|
||||
.url(url)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Authorization", "Bearer " + chatConfig.getApiKey())
|
||||
.post(body).build();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
callback.onError(new RuntimeException("构建请求失败: " + e.getMessage(), e));
|
||||
return;
|
||||
}
|
||||
|
||||
// 发送异步请求
|
||||
client.newCall(request).enqueue(new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
callback.onError(new RuntimeException("请求发送失败: " + e.getMessage(), e));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException {
|
||||
try {
|
||||
if (!response.isSuccessful()) {
|
||||
String errorBody = response.body() != null ? response.body().string() : "无错误信息";
|
||||
String errorMsg = String.format("API 响应错误: 状态码=%d, 错误信息=%s",
|
||||
response.code(), errorBody);
|
||||
System.err.println(errorMsg); // 打印详细错误
|
||||
callback.onError(new RuntimeException(errorMsg));
|
||||
return;
|
||||
}
|
||||
|
||||
// 处理流式响应
|
||||
ResponseBody body = response.body();
|
||||
if (body == null) {
|
||||
callback.onError(new RuntimeException("响应体为空"));
|
||||
return;
|
||||
}
|
||||
|
||||
// 逐行读取 SSE 格式的响应
|
||||
try (var bufferedSource = body.source()) {
|
||||
while (!bufferedSource.exhausted()) {
|
||||
String chunk = bufferedSource.readUtf8Line();
|
||||
if (chunk != null && !chunk.trim().isEmpty()) {
|
||||
callback.onData(chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 通知流结束
|
||||
callback.onComplete();
|
||||
|
||||
} catch (Exception e) {
|
||||
String errorMsg = "处理响应失败: " + e.getMessage();
|
||||
System.err.println(errorMsg);
|
||||
callback.onError(new RuntimeException(errorMsg, e));
|
||||
} finally {
|
||||
response.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建聊天请求的 JSON 体
|
||||
*/
|
||||
/**
|
||||
* 构建聊天请求的 JSON 体
|
||||
* 根据文档 [cite: 162-172] 修改为 Vision API 兼容格式
|
||||
*/
|
||||
private String buildChatRequestBody(ChatRequest chatRequest, String key) {
|
||||
JSONObject chatObject = new JSONObject();
|
||||
|
||||
// 1. 设置会话ID (如果有)
|
||||
if(StringUtils.isNotEmpty(chatRequest.getSessionId())){
|
||||
chatObject.put("chatId", chatRequest.getSessionId());
|
||||
}
|
||||
|
||||
if("chat".equals(key)){
|
||||
// 基础参数设置
|
||||
chatObject.put("stream", true);
|
||||
chatObject.put("model", chatConfig.getModel()); // 需确保为 "qd-job-turbo"
|
||||
chatObject.put("user", chatRequest.getSessionId());
|
||||
|
||||
// 2. 获取历史消息列表,如果为空则初始化
|
||||
JSONArray messages = chatRequest.getMessages();
|
||||
if (messages == null) {
|
||||
messages = new JSONArray();
|
||||
}
|
||||
|
||||
// 3. 构建当前用户的多模态消息内容 (Multimodal Content) [cite: 162]
|
||||
JSONArray contentArray = new JSONArray();
|
||||
|
||||
// 3.1 添加文本内容 [cite: 166, 172]
|
||||
if(StringUtils.isNotEmpty(chatRequest.getData())){
|
||||
JSONObject textPart = new JSONObject();
|
||||
textPart.put("type", "text");
|
||||
textPart.put("text", chatRequest.getData());
|
||||
contentArray.add(textPart);
|
||||
}
|
||||
|
||||
// 3.2 添加文件内容 (图片、PDF、Excel等) [cite: 174, 180, 232]
|
||||
// 文档说明:image_url 字段兼容 PDF, Excel, PPT 等所有 OCR 支持的文件
|
||||
if(!CollectionUtils.isEmpty(chatRequest.getFileUrl())){
|
||||
for(String url : chatRequest.getFileUrl()){
|
||||
String finalUrl = "";
|
||||
if(Objects.equals(env, "pro")){
|
||||
finalUrl = url.replace("https://fw.rc.qingdao.gov.cn/rgpp-api/api/ng", "http://10.213.6.207:19010");
|
||||
}else {
|
||||
finalUrl = url;
|
||||
}
|
||||
// 处理内网/外网地址映射 (保留你原有的逻辑)
|
||||
|
||||
JSONObject filePart = new JSONObject();
|
||||
filePart.put("type", "image_url"); // 固定为 image_url [cite: 174]
|
||||
|
||||
JSONObject imageUrlObj = new JSONObject();
|
||||
imageUrlObj.put("url", finalUrl); // 文件地址 [cite: 172]
|
||||
|
||||
filePart.put("image_url", imageUrlObj);
|
||||
contentArray.add(filePart);
|
||||
}
|
||||
}
|
||||
|
||||
// 4. 将当前消息封装为 User Message 对象并加入消息列表 [cite: 151, 163]
|
||||
// 只有当有内容(文本或文件)时才添加
|
||||
if (!contentArray.isEmpty()) {
|
||||
JSONObject currentUserMessage = new JSONObject();
|
||||
currentUserMessage.put("role", "user");
|
||||
currentUserMessage.put("content", contentArray); // content 为数组格式
|
||||
messages.add(currentUserMessage);
|
||||
}
|
||||
|
||||
// 5. 将完整的消息列表放入请求体 [cite: 135]
|
||||
chatObject.put("messages", messages);
|
||||
|
||||
} else {
|
||||
// 非 chat 场景的逻辑保留
|
||||
chatObject.put("appId", chatConfig.getAppId());
|
||||
}
|
||||
|
||||
return chatObject.toJSONString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 简单的 JSON 转义处理(防止特殊字符破坏 JSON 格式)
|
||||
*/
|
||||
private String escapeJson(String value) {
|
||||
if (value == null) return "";
|
||||
return value
|
||||
.replace("\\", "\\\\")
|
||||
.replace("\"", "\\\"")
|
||||
.replace("\b", "\\b")
|
||||
.replace("\f", "\\f")
|
||||
.replace("\n", "\\n")
|
||||
.replace("\r", "\\r")
|
||||
.replace("\t", "\\t");
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送聊天请求并返回完整JSON响应
|
||||
* @param chatRequest 用户输入的查询内容
|
||||
* @return 完整的JSON响应字符串
|
||||
* @throws IOException 网络请求异常
|
||||
*/
|
||||
public String sendChatGuest(ChatRequest chatRequest) throws IOException {
|
||||
String url=chatConfig.getBaseUrl()+chatConfig.getGuestUrl();
|
||||
|
||||
JSONArray array = chatRequest.getMessages();
|
||||
if(array==null||array.isEmpty()||array.size()==0){
|
||||
array = new JSONArray();
|
||||
}
|
||||
JSONObject contentObject = new JSONObject();
|
||||
contentObject.put("content","你是一个岗位招聘专家,请根据用户的问题生成用户下一步想要提出的问题。需要以用户的口吻进行生成。结合上下文中用户提出的问题以及助手回复的答案,需要猜测用户更进一步的需求,例如期望的薪资,期望的工作地点,掌握的技能。生成的问题举例:有没有薪资在9000以上的工作?我的学历是本科。我希望找国企。注意不仅限于这些,还要根据上下文。其次所有的问题应该限定在青岛。并且只生成3到4个。");
|
||||
contentObject.put("role","system");
|
||||
array.add(contentObject);
|
||||
JSONObject jsonBody = new JSONObject();
|
||||
jsonBody.put("stream",false);
|
||||
jsonBody.put("model",chatConfig.getModel());
|
||||
jsonBody.put("messages",array);
|
||||
|
||||
// 构建请求(使用非流式响应模式)
|
||||
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), String.valueOf(jsonBody));
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Authorization", "Bearer " + chatConfig.getApiKey())
|
||||
.post(requestBody).build();
|
||||
|
||||
// 发送同步请求
|
||||
try (Response response = client.newCall(request).execute()) {
|
||||
if (!response.isSuccessful()) {
|
||||
String errorBody = response.body() != null ? response.body().string() : "无错误信息";
|
||||
String errorMsg = String.format("API 响应错误: 状态码=%d, 错误信息=%s",
|
||||
response.code(), errorBody);
|
||||
throw new IOException(errorMsg);
|
||||
}
|
||||
ResponseBody body = response.body();
|
||||
if (body == null) {
|
||||
throw new IOException("响应体为空");
|
||||
}
|
||||
JSONObject object = JSONObject.parseObject(body.string());
|
||||
String choices = object.getString("choices");
|
||||
if (choices != null && !choices.trim().isEmpty()) {
|
||||
JSONArray jsonArray = JSONArray.parseArray(choices);
|
||||
object = JSONObject.parseObject(jsonArray.getString(0));
|
||||
object = object.getJSONObject("message");
|
||||
String content = object.getString("content");// 消息内容
|
||||
|
||||
return content;
|
||||
}
|
||||
return body.string();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 流式响应回调接口
|
||||
*/
|
||||
public interface StreamCallback {
|
||||
/**
|
||||
* 接收分片数据
|
||||
* @param chunk SSE 格式的分片数据
|
||||
*/
|
||||
void onData(String chunk);
|
||||
|
||||
/**
|
||||
* 响应结束
|
||||
*/
|
||||
void onComplete();
|
||||
|
||||
/**
|
||||
* 发生错误
|
||||
* @param e 异常信息
|
||||
*/
|
||||
void onError(Throwable e);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.ruoyi.cms.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "chat")
|
||||
public class ChatConfig {
|
||||
private String baseUrl;
|
||||
private String chatUrl;
|
||||
private String chatDetailUrl;
|
||||
private String chatHistoryUrl;
|
||||
private String updateNameUrl;
|
||||
private String delChatUrl;
|
||||
private String delAllChatUrl;
|
||||
private String guestUrl;
|
||||
private String praiseUrl;
|
||||
private String apiKey;
|
||||
private String appId;
|
||||
private String model;
|
||||
public String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
public void setBaseUrl(String baseUrl) {
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
public String getChatUrl() {
|
||||
return chatUrl;
|
||||
}
|
||||
|
||||
public void setChatUrl(String chatUrl) {
|
||||
this.chatUrl = chatUrl;
|
||||
}
|
||||
|
||||
public String getChatDetailUrl() {
|
||||
return chatDetailUrl;
|
||||
}
|
||||
|
||||
public void setChatDetailUrl(String chatDetailUrl) {
|
||||
this.chatDetailUrl = chatDetailUrl;
|
||||
}
|
||||
|
||||
public String getChatHistoryUrl() {
|
||||
return chatHistoryUrl;
|
||||
}
|
||||
|
||||
public void setChatHistoryUrl(String chatHistoryUrl) {
|
||||
this.chatHistoryUrl = chatHistoryUrl;
|
||||
}
|
||||
|
||||
public String getUpdateNameUrl() {
|
||||
return updateNameUrl;
|
||||
}
|
||||
|
||||
public void setUpdateNameUrl(String updateNameUrl) {
|
||||
this.updateNameUrl = updateNameUrl;
|
||||
}
|
||||
|
||||
public String getDelChatUrl() {
|
||||
return delChatUrl;
|
||||
}
|
||||
|
||||
public void setDelChatUrl(String delChatUrl) {
|
||||
this.delChatUrl = delChatUrl;
|
||||
}
|
||||
|
||||
public String getDelAllChatUrl() {
|
||||
return delAllChatUrl;
|
||||
}
|
||||
|
||||
public void setDelAllChatUrl(String delAllChatUrl) {
|
||||
this.delAllChatUrl = delAllChatUrl;
|
||||
}
|
||||
|
||||
public String getGuestUrl() {
|
||||
return guestUrl;
|
||||
}
|
||||
|
||||
public void setGuestUrl(String guestUrl) {
|
||||
this.guestUrl = guestUrl;
|
||||
}
|
||||
|
||||
public String getPraiseUrl() {
|
||||
return praiseUrl;
|
||||
}
|
||||
|
||||
public void setPraiseUrl(String praiseUrl) {
|
||||
this.praiseUrl = praiseUrl;
|
||||
}
|
||||
|
||||
public String getApiKey() {
|
||||
return apiKey;
|
||||
}
|
||||
|
||||
public void setApiKey(String apiKey) {
|
||||
this.apiKey = apiKey;
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
public String getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public void setModel(String model) {
|
||||
this.model = model;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.cms.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
|
||||
|
||||
@Configuration
|
||||
public class WebSocketConfig {
|
||||
|
||||
/**
|
||||
* 注册 WebSocket 端点
|
||||
*/
|
||||
@Bean
|
||||
public ServerEndpointExporter serverEndpointExporter() {
|
||||
return new ServerEndpointExporter();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.ruoyi.cms.constant;
|
||||
|
||||
public class CommonConstant {
|
||||
/**
|
||||
* 地铁线路缓存
|
||||
*/
|
||||
public static final String SUBWAY_LINE_CACHE = "common_cache:subway";
|
||||
public static final String COMMERICIAL_AREA = "common_cache:comericial_area";
|
||||
public static final String JOB_TITLE = "common_cache:job_titile";
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.ruoyi.cms.controller.app;
|
||||
|
||||
import com.ruoyi.cms.domain.BussinessDictData;
|
||||
import com.ruoyi.cms.domain.CommercialArea;
|
||||
import com.ruoyi.cms.domain.SubwayLine;
|
||||
import com.ruoyi.cms.service.*;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.TreeSelect;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/app/common")
|
||||
@Api(tags = "移动端:常用参数查询")
|
||||
public class AppCommonController extends BaseController {
|
||||
@Autowired
|
||||
private ISubwayLineService iSubwayLineService;
|
||||
@Autowired
|
||||
private ICommercialAreaService iCommercialAreaService;
|
||||
@Autowired
|
||||
private IJobTitleService iJobTitleService;
|
||||
@Autowired
|
||||
private IIndustryService industryService;
|
||||
@Autowired
|
||||
private IBussinessDictTypeService iBussinessDictTypeService;
|
||||
@ApiOperation("查询地铁")
|
||||
@GetMapping("/subway")
|
||||
public AjaxResult subway()
|
||||
{
|
||||
List<SubwayLine> list = iSubwayLineService.appSubway();
|
||||
return success(list);
|
||||
}
|
||||
@ApiOperation("查询商圈")
|
||||
@GetMapping("/commercialArea")
|
||||
public AjaxResult commercialArea()
|
||||
{
|
||||
List<CommercialArea> list = iCommercialAreaService.appCommercialArea();
|
||||
return success(list);
|
||||
}
|
||||
@ApiOperation("查询职业 树结构")
|
||||
@GetMapping("/jobTitle/treeselect")
|
||||
public AjaxResult jobTitle()
|
||||
{
|
||||
List<TreeSelect> jobTitleList = iJobTitleService.appJobTitle();
|
||||
return success(jobTitleList);
|
||||
}
|
||||
@ApiOperation("查询行业 树结构")
|
||||
@GetMapping("/industry/treeselect")
|
||||
public AjaxResult industry()
|
||||
{
|
||||
List<TreeSelect> industryList = industryService.appIndustry();
|
||||
return success(industryList);
|
||||
}
|
||||
@ApiOperation("查询字典")
|
||||
@GetMapping("/dict/{dictType}")
|
||||
public AjaxResult listDict(@PathVariable String dictType)
|
||||
{
|
||||
List<BussinessDictData> dictData = iBussinessDictTypeService.selectDictDataByType(dictType);
|
||||
return success(dictData);
|
||||
}
|
||||
@ApiOperation("字段标准")
|
||||
@GetMapping("/standar/filed")
|
||||
public AjaxResult standarFiled()
|
||||
{
|
||||
Map<String,Object> filed = iBussinessDictTypeService.standarFiled();
|
||||
return success(filed);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.ruoyi.cms.controller.app;
|
||||
|
||||
|
||||
import com.ruoyi.cms.domain.vo.CompanyContactVo;
|
||||
import com.ruoyi.cms.service.CompanyContactService;
|
||||
import com.ruoyi.cms.util.ListUtil;
|
||||
import com.ruoyi.common.annotation.BussinessLog;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.CompanyContact;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 公司联系人
|
||||
*
|
||||
* @author
|
||||
* @email
|
||||
* @date 2025-09-30 15:57:06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/companycontact")
|
||||
@Api(tags = "移动端:公司联系人")
|
||||
public class AppCompanyContactController extends BaseController {
|
||||
@Autowired
|
||||
private CompanyContactService companyContactService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@ApiOperation("公司联系人列表")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(CompanyContact companyContact){
|
||||
List<CompanyContact> list=companyContactService.getSelectList(companyContact);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@BussinessLog(title = "移动端保存企业联系人")
|
||||
@PostMapping("/batchInsertUpdate")
|
||||
public AjaxResult batchInsertUpdate(@RequestBody CompanyContactVo contactVo)
|
||||
{
|
||||
if (contactVo == null) {
|
||||
return AjaxResult.error("请求参数不能为空");
|
||||
}
|
||||
List<CompanyContact> contactList = contactVo.getCompanyContactList();
|
||||
if (ListUtil.isListObjectEmptyOrNull(contactList)) { // 假设 ListUtil 工具类判断 null 或空集合
|
||||
return AjaxResult.error("请至少填写一条联系人信息");
|
||||
}
|
||||
companyContactService.insertUpadteCompanyContact(contactList);
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
package com.ruoyi.cms.controller.app;
|
||||
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import com.ruoyi.cms.domain.CompanyCard;
|
||||
import com.ruoyi.cms.domain.query.LabelQuery;
|
||||
import com.ruoyi.cms.mapper.CompanyCardMapper;
|
||||
import com.ruoyi.cms.service.ICompanyCardService;
|
||||
import com.ruoyi.cms.service.ICompanyCollectionService;
|
||||
import com.ruoyi.cms.service.ICompanyService;
|
||||
import com.ruoyi.common.annotation.BussinessLog;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 公司Controller
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/company")
|
||||
@Api(tags = "移动端:公司")
|
||||
public class AppCompanyController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ICompanyService companyService;
|
||||
@Autowired
|
||||
private ICompanyCollectionService companyCollectionService;
|
||||
@Autowired
|
||||
private ICompanyCardService companyCardService;
|
||||
@Autowired
|
||||
private CompanyCardMapper companyCardMapper;
|
||||
/**
|
||||
* 获取公司详细信息
|
||||
*/
|
||||
@ApiOperation("获取公司详细信息")
|
||||
@GetMapping(value = "/{companyId}")
|
||||
public AjaxResult getInfo(@PathVariable("companyId") Long companyId)
|
||||
{
|
||||
return success(companyService.selectCompanyByCompanyId(companyId));
|
||||
}
|
||||
/**
|
||||
* 用户收藏公司
|
||||
*/
|
||||
@BussinessLog(title = "用户收藏公司")
|
||||
@PostMapping("/collection/{companyId}")
|
||||
@ApiOperation("用户收藏公司")
|
||||
public AjaxResult companyCollection(@PathVariable("companyId") Long companyId)
|
||||
{
|
||||
return toAjax(companyCollectionService.companyCollection(companyId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户取消收藏公司
|
||||
*/
|
||||
@BussinessLog(title = "用户取消收藏公司")
|
||||
@DeleteMapping("/collection/{companyId}")
|
||||
@ApiOperation("用户取消收藏公司")
|
||||
public AjaxResult companyCancel(@PathVariable("companyId") Long companyId)
|
||||
{
|
||||
return toAjax(companyCollectionService.companyCancel(companyId));
|
||||
}
|
||||
/**
|
||||
* 公司下的岗位
|
||||
*/
|
||||
@GetMapping("/job/{companyId}")
|
||||
@ApiOperation("公司下的岗位")
|
||||
public TableDataInfo jobCompany(@ApiParam("公司id") @PathVariable Long companyId)
|
||||
{
|
||||
startPage();
|
||||
return getDataTable(companyCollectionService.jobCompany(companyId));
|
||||
}
|
||||
@GetMapping("/card")
|
||||
@ApiOperation("查看企业卡片")
|
||||
public TableDataInfo card()
|
||||
{
|
||||
startPage();
|
||||
return getDataTable(companyCardService.cardApp());
|
||||
}
|
||||
@BussinessLog(title = "收藏企业卡片")
|
||||
@PutMapping("/card/collection/{companyCardId}")
|
||||
@ApiOperation("收藏企业卡片")
|
||||
public AjaxResult cardCollection(@PathVariable Long companyCardId)
|
||||
{
|
||||
companyCardService.cardCollection(companyCardId);
|
||||
return success();
|
||||
}
|
||||
@BussinessLog(title = "取消收藏企业卡片")
|
||||
@DeleteMapping("/card/collection/{companyCardId}")
|
||||
@ApiOperation("取消收藏公司卡片")
|
||||
public AjaxResult cardCancel(@PathVariable Long companyCardId)
|
||||
{
|
||||
companyCardService.cardCancel(companyCardId);
|
||||
return success();
|
||||
}
|
||||
@GetMapping("/count/{companyId}")
|
||||
@ApiOperation("公司招聘的岗位数量")
|
||||
public AjaxResult count(@PathVariable Long companyId)
|
||||
{
|
||||
Integer count = companyService.count(companyId);
|
||||
return success(count);
|
||||
}
|
||||
@GetMapping("/label")
|
||||
@ApiOperation("公司标签下的公司")
|
||||
public TableDataInfo label(LabelQuery labelQuery)
|
||||
{
|
||||
CompanyCard companyCard = companyCardMapper.selectById(labelQuery.getCardId());
|
||||
startPage();
|
||||
List<Company> companyList = companyService.label(companyCard,labelQuery);
|
||||
return getDataTable(companyList);
|
||||
}
|
||||
@PostMapping("/register")
|
||||
@ApiOperation("招聘企业登记")
|
||||
@BussinessLog(title = "招聘企业登记")
|
||||
public AjaxResult register(Company company)
|
||||
{
|
||||
companyService.register(company);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
@GetMapping("/register/status")
|
||||
@ApiOperation("招聘企业登记进度查询")
|
||||
public AjaxResult registerStatus()
|
||||
{
|
||||
Company status = companyService.registerStatus();
|
||||
return AjaxResult.success(status);
|
||||
}
|
||||
|
||||
@GetMapping("/queryCodeCompany")
|
||||
@ApiOperation("根据社会信用代码查询企业")
|
||||
public AjaxResult queryCodeCompany(@RequestParam("code") String code)
|
||||
{
|
||||
if (!StringUtils.hasText(code)) {
|
||||
return AjaxResult.error("社会信用代码不能为空");
|
||||
}
|
||||
return AjaxResult.success(companyService.queryCodeCompany(code));
|
||||
}
|
||||
|
||||
@ApiOperation("模糊查询公司列表")
|
||||
@GetMapping("/likeList")
|
||||
public TableDataInfo likeList(Company company)
|
||||
{
|
||||
List<Company> list = companyService.selectLikeCompanyList(company);
|
||||
return getDataTable(list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.ruoyi.cms.controller.app;
|
||||
|
||||
|
||||
import com.ruoyi.cms.domain.JobFair;
|
||||
import com.ruoyi.cms.service.IFairCollectionService;
|
||||
import com.ruoyi.cms.service.IJobFairService;
|
||||
import com.ruoyi.common.annotation.BussinessLog;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 招聘会Controller
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/fair")
|
||||
@Api(tags = "移动端:招聘会")
|
||||
public class AppFairController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IJobFairService jobFairService;
|
||||
@Autowired
|
||||
private IFairCollectionService fairCollectionService;
|
||||
/**
|
||||
* 招聘会列表
|
||||
*/
|
||||
@BussinessLog(title = "招聘会列表")
|
||||
@GetMapping
|
||||
public TableDataInfo list(JobFair jobFair)
|
||||
{
|
||||
startPage();
|
||||
List<JobFair> results = jobFairService.appList(jobFair);
|
||||
return getDataTable(results);
|
||||
}
|
||||
|
||||
/**
|
||||
* 招聘会详情
|
||||
*/
|
||||
@BussinessLog(title = "招聘会详情")
|
||||
@GetMapping("/{fairId}")
|
||||
public AjaxResult appDetail(@ApiParam("招聘会id") @PathVariable Long fairId)
|
||||
{
|
||||
return success(jobFairService.appDetail(fairId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户收藏招聘会
|
||||
*/
|
||||
@BussinessLog(title = "用户收藏招聘会")
|
||||
@PostMapping("/collection/{fairId}")
|
||||
public AjaxResult companyCollection(@ApiParam("招聘会id") @PathVariable Long fairId)
|
||||
{
|
||||
return toAjax(fairCollectionService.fairCollection(fairId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户取消收藏招聘会
|
||||
*/
|
||||
@BussinessLog(title = "用户取消收藏招聘会")
|
||||
@DeleteMapping("/collection/{fairId}")
|
||||
public AjaxResult companyCancel(@ApiParam("招聘会id") @PathVariable Long fairId)
|
||||
{
|
||||
return toAjax(fairCollectionService.cancel(fairId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.ruoyi.cms.controller.app;
|
||||
|
||||
import com.ruoyi.cms.util.IdGenerator;
|
||||
import com.ruoyi.cms.util.ProxyServerUtil;
|
||||
import com.ruoyi.common.core.domain.entity.File;
|
||||
import com.ruoyi.cms.service.IFileService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.SiteSecurityUtils;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/app/file")
|
||||
public class AppFileController extends BaseController {
|
||||
@Autowired
|
||||
private IFileService fileService;
|
||||
@Autowired
|
||||
private IdGenerator idGenerator;
|
||||
|
||||
@ApiOperation("上传文件")
|
||||
@PostMapping("/upload")
|
||||
public AjaxResult upload(@RequestParam("file") MultipartFile file, @RequestParam(value = "bussinessid",required = false) Long bussinessId) {
|
||||
if(!(SiteSecurityUtils.isLogin() || SecurityUtils.isLogin())){
|
||||
return AjaxResult.error("未登录,请登录后在上传文件!");
|
||||
}
|
||||
return fileService.upload(file,bussinessId);
|
||||
}
|
||||
|
||||
@ApiOperation("获取附件列表")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(File file)
|
||||
{
|
||||
List<File> results = fileService.selectFileList(file);
|
||||
return getDataTable(results);
|
||||
}
|
||||
|
||||
@ApiOperation("删除附件")
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult remove(@PathVariable Long id)
|
||||
{
|
||||
return toAjax(fileService.deleteFileByIds(new Long[]{id}));
|
||||
}
|
||||
|
||||
@ApiOperation("上传文件")
|
||||
@PostMapping("/uploadFile")
|
||||
public AjaxResult uploadFile(@RequestParam("file") MultipartFile file, @RequestParam(value = "bussinessid",required = false) Long bussinessId, HttpServletRequest request) {
|
||||
String proxyServer = ProxyServerUtil.getProxyServer(request);
|
||||
System.out.println("获取服务器地址======================"+proxyServer);
|
||||
if(!(SiteSecurityUtils.isLogin() || SecurityUtils.isLogin())){
|
||||
return AjaxResult.error("未登录,请登录后在上传文件!");
|
||||
}
|
||||
if(bussinessId==null){
|
||||
bussinessId=idGenerator.generateId();
|
||||
}
|
||||
return fileService.uploadFile(file,bussinessId,request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
package com.ruoyi.cms.controller.app;
|
||||
|
||||
import com.ruoyi.cms.domain.ESJobDocument;
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.domain.query.ESJobSearch;
|
||||
import com.ruoyi.cms.service.ICompanyService;
|
||||
import com.ruoyi.cms.service.IESJobSearchService;
|
||||
import com.ruoyi.cms.service.IJobCollectionService;
|
||||
import com.ruoyi.cms.service.IJobService;
|
||||
import com.ruoyi.cms.util.RoleUtils;
|
||||
import com.ruoyi.cms.util.sensitiveWord.SensitiveWordChecker;
|
||||
import com.ruoyi.common.annotation.BussinessLog;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.dromara.easyes.core.biz.EsPageInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 岗位Controller
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-03
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/job")
|
||||
@Api(tags = "移动端:岗位相关接口")
|
||||
public class AppJobController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IJobService jobService;
|
||||
@Autowired
|
||||
private IJobCollectionService jobCollectionService;
|
||||
@Autowired
|
||||
private IESJobSearchService esJobSearchService;
|
||||
@Autowired
|
||||
private SensitiveWordChecker sensitiveWordChecker;
|
||||
|
||||
/**
|
||||
* 查询岗位列表
|
||||
*/
|
||||
@ApiOperation("查询岗位列表")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ESJobSearch job)
|
||||
{
|
||||
EsPageInfo<ESJobDocument> list = jobService.appList(job);
|
||||
return getTableDataInfo2(list,job);
|
||||
}
|
||||
|
||||
private TableDataInfo getTableDataInfo2(EsPageInfo<ESJobDocument> list, ESJobSearch job) {
|
||||
long total = list.getTotal();
|
||||
TableDataInfo rspData = new TableDataInfo();
|
||||
rspData.setCode(200);
|
||||
rspData.setRows(list.getList());
|
||||
rspData.setTotal(total > 200 ? 200 : total);
|
||||
job.setCompany(null);
|
||||
rspData.setData(job);
|
||||
return rspData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取5条推荐岗位
|
||||
*/
|
||||
@ApiOperation("获取推荐岗位")
|
||||
@GetMapping("/recommend")
|
||||
public AjaxResult recommend(ESJobSearch esJobSearch)
|
||||
{
|
||||
if (RoleUtils.getAppCurrentUseridCard() != null) {
|
||||
esJobSearch.setCode(RoleUtils.getAppCurrentUseridCard());
|
||||
esJobSearch.setUserType(RoleUtils.getAppIscompanyUser());
|
||||
}
|
||||
List<ESJobDocument> jobList = jobService.recommend(esJobSearch);
|
||||
return success(jobList);
|
||||
}
|
||||
@ApiOperation("获取短视频")
|
||||
@GetMapping("/littleVideo")
|
||||
public AjaxResult littleVideo(ESJobSearch esJobSearch)
|
||||
{
|
||||
List<ESJobDocument> jobList = jobService.littleVideo(esJobSearch);
|
||||
return success(jobList);
|
||||
}
|
||||
|
||||
@ApiOperation("随机获取短视频")
|
||||
@GetMapping("/littleVideo/random")
|
||||
public AjaxResult littleVideo(@RequestParam(required = true) String uuid,@RequestParam(required = false) Integer count,@RequestParam(required = false) String jobTitle)
|
||||
{
|
||||
List<ESJobDocument> jobList = jobService.littleVideoRandom(uuid,count,jobTitle);
|
||||
return success(jobList);
|
||||
}
|
||||
/**
|
||||
* 附件工作
|
||||
*/
|
||||
@ApiOperation("附近工作")
|
||||
@PostMapping(value = "/nearJob")
|
||||
public TableDataInfo nearJob(@RequestBody ESJobSearch jobQuery)
|
||||
{
|
||||
EsPageInfo<ESJobDocument> list = esJobSearchService.nearJob(jobQuery);
|
||||
List<ESJobDocument> jobList = list.getList();
|
||||
list.setList(jobList);
|
||||
return getTableDataInfo(list);
|
||||
}
|
||||
/**
|
||||
* 附件工作
|
||||
*/
|
||||
@ApiOperation("区县工作")
|
||||
@PostMapping(value = "/countyJob")
|
||||
public TableDataInfo countyJob(@RequestBody ESJobSearch job)
|
||||
{
|
||||
EsPageInfo<ESJobDocument> list = jobService.countyJobList(job);
|
||||
List<ESJobDocument> jobList = list.getList();
|
||||
list.setList(jobList);
|
||||
return getTableDataInfo(list);
|
||||
}
|
||||
/**
|
||||
* 地铁周边
|
||||
*/
|
||||
@ApiOperation("地铁周边")
|
||||
@PostMapping(value = "/subway")
|
||||
public TableDataInfo subway(@RequestBody ESJobSearch jobQuery)
|
||||
{
|
||||
EsPageInfo<ESJobDocument> list = jobService.subway(jobQuery);
|
||||
List<ESJobDocument> jobList = list.getList();
|
||||
list.setList(jobList);
|
||||
return getTableDataInfo(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 商圈周边
|
||||
*/
|
||||
@ApiOperation("商圈周边")
|
||||
@PostMapping(value = "/commercialArea")
|
||||
public TableDataInfo commercialArea(@RequestBody ESJobSearch jobQuery)
|
||||
{
|
||||
EsPageInfo<ESJobDocument> list = jobService.commercialArea(jobQuery);
|
||||
List<ESJobDocument> jobList = list.getList();
|
||||
list.setList(jobList);
|
||||
return getTableDataInfo(list);
|
||||
}
|
||||
/**
|
||||
* 获取岗位详细信息
|
||||
*/
|
||||
@ApiOperation("获取岗位详细信息")
|
||||
@GetMapping(value = "/{jobId}")
|
||||
public AjaxResult getInfo(@PathVariable("jobId") Long jobId, HttpServletRequest request)
|
||||
{
|
||||
if (jobId == null) {
|
||||
return AjaxResult.error("jobId不能为空");
|
||||
}
|
||||
//Job job = jobService.selectJobByJobIdApp(jobId);
|
||||
Job job = jobService.selectHttpJobByJobIdApp(jobId,request);
|
||||
return success(job);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户收藏岗位
|
||||
*/
|
||||
@BussinessLog(title = "用户收藏岗位")
|
||||
@PostMapping("/collection/{jobId}")
|
||||
@ApiOperation("用户收藏")
|
||||
public AjaxResult jobCollection(@ApiParam("岗位id") @PathVariable Long jobId)
|
||||
{
|
||||
return toAjax(jobCollectionService.jobCollection(jobId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户取消收藏岗位
|
||||
*/
|
||||
@BussinessLog(title = "用户取消收藏岗位")
|
||||
@DeleteMapping("/collection/{jobId}")
|
||||
@ApiOperation("用户取消收藏岗位")
|
||||
public AjaxResult cancel(@ApiParam("岗位id") @PathVariable Long jobId)
|
||||
{
|
||||
return toAjax(jobCollectionService.cancel(jobId));
|
||||
}
|
||||
/**
|
||||
* 用户申请岗位
|
||||
*/
|
||||
@BussinessLog(title = "用户申请岗位")
|
||||
@GetMapping("/apply/{jobId}")
|
||||
@ApiOperation("用户申请岗位")
|
||||
public AjaxResult apply(@ApiParam("岗位id") @PathVariable Long jobId)
|
||||
{
|
||||
return toAjax(jobCollectionService.apply(jobId));
|
||||
}
|
||||
@GetMapping("/competitiveness/{jobId}")
|
||||
@ApiOperation("竞争力分析")
|
||||
public AjaxResult competitiveness(@ApiParam("岗位id") @PathVariable Long jobId) {
|
||||
return success(jobCollectionService.competitiveness(jobId));
|
||||
}
|
||||
private TableDataInfo getTableDataInfo(EsPageInfo<ESJobDocument> result){
|
||||
long total = result.getTotal();
|
||||
TableDataInfo rspData = new TableDataInfo();
|
||||
rspData.setCode(200);
|
||||
rspData.setRows(result.getList());
|
||||
rspData.setTotal(total > 200 ? 200 : total);
|
||||
return rspData;
|
||||
}
|
||||
@BussinessLog(title = "移动端发布岗位")
|
||||
@PostMapping("/publishJob")
|
||||
public AjaxResult fix(@RequestBody Job job)
|
||||
{
|
||||
// 校验描述中的敏感词
|
||||
List<String> sensitiveWords = sensitiveWordChecker.checkSensitiveWords(job.getDescription());
|
||||
if (!sensitiveWords.isEmpty()) {
|
||||
String errorMsg = "描述中包含敏感词:" + String.join("、", sensitiveWords);
|
||||
return AjaxResult.error(errorMsg);
|
||||
}
|
||||
jobService.publishJob(job);
|
||||
return success();
|
||||
}
|
||||
|
||||
@GetMapping("/jobCompare")
|
||||
@ApiOperation("根据多个岗位id查询岗位详情")
|
||||
public AjaxResult jobCompare(@ApiParam("岗位ID数组") @RequestParam("jobIds") Long[] jobIds) {
|
||||
if (ArrayUtils.isEmpty(jobIds)) {
|
||||
return AjaxResult.error("请传递岗位ID参数(jobIds),多个ID用&分隔");
|
||||
}
|
||||
if (jobIds.length > 5) {
|
||||
return AjaxResult.error("最多支持对比5个岗位,请减少参数数量");
|
||||
}
|
||||
return success(esJobSearchService.selectByIds(jobIds));
|
||||
}
|
||||
|
||||
@GetMapping("/applyJobList")
|
||||
@ApiOperation("根据岗位id查询岗位申请人员")
|
||||
public AjaxResult applyJobList(@ApiParam("岗位id") @RequestParam("jobId") Long jobId) {
|
||||
if (jobId==null) {
|
||||
return AjaxResult.error("请传递岗位ID");
|
||||
}
|
||||
return success(jobService.selectApplyJobUserList(jobId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.ruoyi.cms.controller.app;
|
||||
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.domain.Notice;
|
||||
import com.ruoyi.cms.service.IAppNoticeService;
|
||||
import com.ruoyi.common.annotation.BussinessLog;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/app/notice")
|
||||
@Api(tags = "移动端:消息")
|
||||
public class AppNoticeInfoController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IAppNoticeService appNoticeService;
|
||||
@ApiOperation("消息列表")
|
||||
@GetMapping("/info")
|
||||
public AjaxResult listNotRead(@RequestParam(required = false) Integer isRead)
|
||||
{
|
||||
List<Notice> appNoticeVO = appNoticeService.listNotRead(isRead);
|
||||
return AjaxResult.success(appNoticeVO);
|
||||
}
|
||||
@ApiOperation("推荐岗位列表")
|
||||
@GetMapping("/recommend")
|
||||
public TableDataInfo recommend(@RequestParam(required = false)String jobTitle)
|
||||
{
|
||||
startPage();
|
||||
List<Job> list = appNoticeService.recommend(jobTitle);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@ApiOperation("系统通知已读")
|
||||
@PostMapping("/read/sysNotice")
|
||||
@BussinessLog(title = "系统通知标记已读")
|
||||
public AjaxResult sysNotice(@RequestParam String id)
|
||||
{
|
||||
appNoticeService.sysNotice(id);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
@ApiOperation("岗位推荐、招聘会已读")
|
||||
@PostMapping("/read")
|
||||
@BussinessLog(title = "岗位推荐、招聘会已读标记已读")
|
||||
public AjaxResult read(@RequestParam String id)
|
||||
{
|
||||
appNoticeService.read(id);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
@ApiOperation("系统通知列表")
|
||||
@GetMapping("/sysNotice")
|
||||
public TableDataInfo sysNoticeList()
|
||||
{
|
||||
startPage();
|
||||
List<Notice> list = appNoticeService.sysNoticeList();
|
||||
return getDataTable(list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.cms.controller.app;
|
||||
|
||||
import com.ruoyi.cms.service.ICompanyService;
|
||||
import com.ruoyi.cms.service.IJobService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 岗位Controller
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-03
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/script")
|
||||
@Api(tags = "移动端:脚本")
|
||||
public class AppScriptController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IJobService jobService;
|
||||
@Autowired
|
||||
private ICompanyService companyService;
|
||||
//更新经纬度
|
||||
@GetMapping("/updateLon")
|
||||
public void updateLon()
|
||||
{
|
||||
jobService.updateLon();
|
||||
}
|
||||
//导入数据
|
||||
@GetMapping("/import")
|
||||
public AjaxResult importData()
|
||||
{
|
||||
jobService.importData();
|
||||
return success();
|
||||
}
|
||||
//导入原始数据
|
||||
@GetMapping("/importRow")
|
||||
public AjaxResult importRow(@RequestParam String path)
|
||||
{
|
||||
jobService.importRow(path);
|
||||
return success();
|
||||
}
|
||||
// 导入500强
|
||||
@GetMapping("/importLabel500")
|
||||
public void importLabel()
|
||||
{
|
||||
companyService.importLabel();
|
||||
}
|
||||
// 随机导入3个公司到银行标签
|
||||
@GetMapping("/importLabelBank")
|
||||
public void importLabelBank()
|
||||
{
|
||||
companyService.importLabelBank();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.ruoyi.cms.controller.app;
|
||||
|
||||
|
||||
import com.ruoyi.cms.service.AppSkillService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.AppSkill;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.SiteSecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 用户技能信息
|
||||
*
|
||||
* @author
|
||||
* @email
|
||||
* @date 2025-10-21 12:22:09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/appskill")
|
||||
@Api(tags = "移动端:用户技能")
|
||||
public class AppSkillController extends BaseController {
|
||||
@Autowired
|
||||
private AppSkillService appSkillService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@ApiOperation("获取技能列表")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AppSkill appSkill){
|
||||
startPage();
|
||||
List<AppSkill> list=appSkillService.getList(appSkill);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@ApiOperation("获取技能详细信息")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult info(@PathVariable("id") Long id){
|
||||
return success(appSkillService.getAppskillById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@ApiOperation("新增技能信息")
|
||||
@PostMapping("/add")
|
||||
public AjaxResult save(@RequestBody AppSkill appSkill){
|
||||
if(StringUtils.isEmpty(appSkill.getName())){
|
||||
return AjaxResult.error("技能名称为空!");
|
||||
}
|
||||
if(StringUtils.isEmpty(appSkill.getLevels())){
|
||||
return AjaxResult.error("技能等级为空!");
|
||||
}
|
||||
if(appSkill.getUserId()==null){
|
||||
appSkill.setUserId(SiteSecurityUtils.getUserId());
|
||||
}
|
||||
return toAjax(appSkillService.insertAppskill(appSkill));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@ApiOperation("修改技能详细信息")
|
||||
@PutMapping("/edit")
|
||||
public AjaxResult update(@RequestBody AppSkill appSkill){
|
||||
if(appSkill.getId()==null){
|
||||
return AjaxResult.error("技能id为空!");
|
||||
}
|
||||
if(StringUtils.isEmpty(appSkill.getName())){
|
||||
return AjaxResult.error("技能名称为空!");
|
||||
}
|
||||
if(StringUtils.isEmpty(appSkill.getLevels())){
|
||||
return AjaxResult.error("技能等级为空!");
|
||||
}
|
||||
if(appSkill.getUserId()==null){
|
||||
appSkill.setUserId(SiteSecurityUtils.getUserId());
|
||||
}
|
||||
return toAjax(appSkillService.updateAppskillById(appSkill));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@ApiOperation("删除技能详细信息")
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult delete(@ApiParam("主键id") @PathVariable Long id){
|
||||
if(id==null){
|
||||
return AjaxResult.error("参数id未传递!");
|
||||
}
|
||||
return toAjax(appSkillService.removeAppskillIds(new Long[]{id}));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.ruoyi.cms.controller.app;
|
||||
|
||||
import com.ruoyi.common.annotation.BussinessLog;
|
||||
import com.ruoyi.common.config.AudioTextRequestClient;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import static com.ruoyi.common.enums.BusinessType.OTHER;
|
||||
|
||||
/**
|
||||
* app语音Controller
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-03
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/speech")
|
||||
@Api(tags = "移动端:用户相关")
|
||||
public class AppSpeechController extends BaseController
|
||||
{
|
||||
/*private String appKey = "4lFYn2yPsQymwGu8";
|
||||
private String id = "LTAI5t9hhSqdDHqwH3RjgyYj";
|
||||
private String secret = "ni5aW3vxrWouMwcGqJPfh9Uu56PBuv";
|
||||
private String url = System.getenv().getOrDefault("NLS_GATEWAY_URL", AliyunNlsUtils.getNlsUrl()+"/ws/v1/");*/
|
||||
|
||||
@Autowired
|
||||
AudioTextRequestClient audioTextRequestClient;
|
||||
|
||||
@BussinessLog(title = "语音转文字",businessType = OTHER)
|
||||
@ApiOperation("语音转文字")
|
||||
@PostMapping(value = "/asr")
|
||||
public AjaxResult asr(@RequestParam("file") MultipartFile file){
|
||||
try {
|
||||
return AjaxResult.success("请求成功",audioTextRequestClient.getTextFromAudioFile(file));
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@BussinessLog(title = "文字转语音",businessType = OTHER)
|
||||
@ApiOperation("文字转语音")
|
||||
@GetMapping(value = "/tts")
|
||||
public ResponseEntity<byte[]> tts(@RequestParam("text") String text) throws UnsupportedEncodingException {
|
||||
byte[] wavData = audioTextRequestClient.getAudioInputStreamFromText(text);
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
// WAV音频的标准MIME类型
|
||||
headers.setContentType(MediaType.parseMediaType("audio/wav"));
|
||||
// inline:让浏览器在线播放(而非下载)
|
||||
headers.setContentDispositionFormData("inline", System.currentTimeMillis() + ".wav");
|
||||
// 设置内容长度
|
||||
headers.setContentLength(wavData.length);
|
||||
// 4. 返回音频数据
|
||||
return new ResponseEntity<>(wavData, headers, HttpStatus.OK);
|
||||
}
|
||||
|
||||
/*@ApiOperation("统计")
|
||||
@GetMapping("/getToken")
|
||||
public AjaxResult getToken()
|
||||
{
|
||||
SpeechRecognizerAI recognizerDemo = new SpeechRecognizerAI(appKey, id, secret, url);
|
||||
AccessToken accessToken = recognizerDemo.getAccessToken();
|
||||
String token = AliyunNlsUtils.getNlsUrl()+"/ws/v1/?appkey="+appKey+"&token="+accessToken.getToken();
|
||||
return AjaxResult.success(token);
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
package com.ruoyi.cms.controller.app;
|
||||
|
||||
import com.ruoyi.cms.domain.AppReviewJob;
|
||||
import com.ruoyi.common.core.domain.entity.AppUser;
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.domain.JobFair;
|
||||
import com.ruoyi.cms.domain.query.MineJobQuery;
|
||||
import com.ruoyi.cms.service.*;
|
||||
import com.ruoyi.common.annotation.BussinessLog;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.cms.domain.vo.AppUserLky;
|
||||
import com.ruoyi.common.core.domain.model.RegisterBody;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SiteSecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* app用户Controller
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-03
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/user")
|
||||
@Api(tags = "移动端:用户相关")
|
||||
public class AppUserController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IAppUserService appUserService;
|
||||
@Autowired
|
||||
private IAppReviewJobService appReviewJobService;
|
||||
@Autowired
|
||||
private IJobCollectionService jobCollectionService;
|
||||
@Autowired
|
||||
private ICompanyCollectionService companyCollectionService;
|
||||
@Autowired
|
||||
private IJobApplyService jobApplyService;
|
||||
@Autowired
|
||||
private IFairCollectionService fairCollectionService;
|
||||
/**
|
||||
* 查询岗位列表
|
||||
*/
|
||||
@ApiOperation("保存注册信息")
|
||||
@PostMapping("/registerUser")
|
||||
@BussinessLog(title = "保存简历")
|
||||
public AjaxResult registerUser(@RequestBody RegisterBody registerBody)
|
||||
{
|
||||
appUserService.registerAppUser(registerBody);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("保存简历")
|
||||
@PostMapping("/resume")
|
||||
public AjaxResult saveResume(@RequestBody AppUser appUser)
|
||||
{
|
||||
appUser.setUserId(SiteSecurityUtils.getUserId());
|
||||
appUserService.updateAppUser(appUser);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("查看简历")
|
||||
@GetMapping("/resume")
|
||||
public AjaxResult getResume()
|
||||
{
|
||||
AppUser appUser = appUserService.selectAppUserByUserId(SiteSecurityUtils.getUserId());
|
||||
return AjaxResult.success(appUser);
|
||||
}
|
||||
|
||||
@ApiOperation("企业查看简历")
|
||||
@GetMapping("/userResume/{id}")
|
||||
public AjaxResult getResume(@PathVariable(name = "id", required = true) Long userId)
|
||||
{
|
||||
if(userId==null){
|
||||
return AjaxResult.error("用户id为空!");
|
||||
}
|
||||
AppUser appUser = appUserService.selectAppUserByUserId(userId);
|
||||
return AjaxResult.success(appUser);
|
||||
}
|
||||
|
||||
@ApiOperation("我的浏览")
|
||||
@GetMapping("/review")
|
||||
public TableDataInfo review(MineJobQuery jobQuery)
|
||||
{
|
||||
startPage();
|
||||
List<Job> jobs = appReviewJobService.review(jobQuery);
|
||||
return getDataTable(jobs);
|
||||
}
|
||||
@ApiOperation("我的浏览-日期数组")
|
||||
@GetMapping("/review/array")
|
||||
public AjaxResult reviewArray(MineJobQuery jobQuery)
|
||||
{
|
||||
|
||||
List<String> dateList = appReviewJobService.reviewArray();
|
||||
return AjaxResult.success(dateList);
|
||||
}
|
||||
@ApiOperation("我的岗位收藏")
|
||||
@GetMapping("/collection/job")
|
||||
public TableDataInfo collectionJob()
|
||||
{
|
||||
startPage();
|
||||
List<Job> jobs = jobCollectionService.collectionJob();
|
||||
return getDataTable(jobs);
|
||||
}
|
||||
@ApiOperation("我的公司收藏")
|
||||
@GetMapping("/collection/company")
|
||||
public TableDataInfo collectionCompany()
|
||||
{
|
||||
startPage();
|
||||
List<Company> jobs = companyCollectionService.collectionCompany();
|
||||
return getDataTable(jobs);
|
||||
}
|
||||
@ApiOperation("我的招聘会收藏")
|
||||
@GetMapping("/collection/fair")
|
||||
public TableDataInfo collectionFair(@RequestParam(name = "type") Integer type)
|
||||
{
|
||||
startPage();
|
||||
List<JobFair> jobs = fairCollectionService.appCollectionFair(type);
|
||||
return getDataTable(jobs);
|
||||
}
|
||||
@ApiOperation("我申请的岗位")
|
||||
@GetMapping("/apply/job")
|
||||
public TableDataInfo applyJob()
|
||||
{
|
||||
startPage();
|
||||
List<Job> jobs = jobApplyService.applyJob();
|
||||
return getDataTable(jobs);
|
||||
}
|
||||
@ApiOperation("统计")
|
||||
@GetMapping("/statistics")
|
||||
public AjaxResult statistics()
|
||||
{
|
||||
HashMap<String,Integer> result = jobApplyService.statistics();
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
@ApiOperation("根据条件查询用户信息")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult getUserList(AppUser appUser)
|
||||
{
|
||||
List<AppUser> list = appUserService.selectAppUserList(appUser);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@ApiOperation("返回求职者劳科院-当前职位名称、技能标签")
|
||||
@GetMapping("/appUserInfo")
|
||||
public AjaxResult appUserInfo(AppUser appUser)
|
||||
{
|
||||
if(!SiteSecurityUtils.isLogin()){
|
||||
return AjaxResult.error("未登录!");
|
||||
}
|
||||
appUser.setUserId(SiteSecurityUtils.getUserId());
|
||||
AppUserLky appUserLky = appUserService.selectAppUserInfo(appUser);
|
||||
return AjaxResult.success(appUserLky);
|
||||
}
|
||||
|
||||
@PostMapping("/browse")
|
||||
@ApiOperation("用户浏览")
|
||||
public AjaxResult browse(@RequestBody AppReviewJob appReviewJob)
|
||||
{
|
||||
if(appReviewJob.getJobId()==null){
|
||||
return AjaxResult.error("岗位id为空");
|
||||
}
|
||||
if(!SiteSecurityUtils.isLogin()){
|
||||
return AjaxResult.error("用户未登录!");
|
||||
}
|
||||
if(StringUtils.isEmpty(appReviewJob.getReviewDate())){
|
||||
appReviewJob.setReviewDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,new Date()));
|
||||
}
|
||||
appReviewJob.setUserId(SiteSecurityUtils.getUserId());
|
||||
return toAjax(appReviewJobService.insertAppReviewJob(appReviewJob));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.ruoyi.cms.controller.app;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.UserWorkExperiences;
|
||||
import com.ruoyi.cms.service.UserWorkExperiencesService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.SiteSecurityUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 用户工作经历表
|
||||
*
|
||||
* @author
|
||||
* @email
|
||||
* @date 2025-10-10 16:26:26
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/userworkexperiences")
|
||||
@Api(tags = "移动端:用户工作经历")
|
||||
public class AppUserWorkExperiencesController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private UserWorkExperiencesService userWorkExperiencesService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@ApiOperation("工作经历列表信息")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(UserWorkExperiences userWorkExperiences){
|
||||
if(userWorkExperiences.getUserId()==null){
|
||||
userWorkExperiences.setUserId(SiteSecurityUtils.getUserId());
|
||||
}
|
||||
startPage();
|
||||
List<UserWorkExperiences> list=userWorkExperiencesService.getWorkExperiencesList(userWorkExperiences);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取详细信息
|
||||
*/
|
||||
@ApiOperation("获取工作经历详细信息")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult query(@PathVariable("id") Long id){
|
||||
return success(userWorkExperiencesService.getWorkExperiencesById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@ApiOperation("新增工作经历")
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody UserWorkExperiences userWorkExperiences){
|
||||
if(userWorkExperiences.getUserId()==null){
|
||||
userWorkExperiences.setUserId(SiteSecurityUtils.getUserId());
|
||||
}
|
||||
return toAjax(userWorkExperiencesService.insertWorkExperiences(userWorkExperiences));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@ApiOperation("修改工作经历")
|
||||
@PutMapping("/edit")
|
||||
public AjaxResult update(@RequestBody UserWorkExperiences userWorkExperiences){
|
||||
return toAjax(userWorkExperiencesService.updateWorkExperiencesById(userWorkExperiences));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@ApiOperation("删除工作经历")
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult remove(@ApiParam("招聘会id") @PathVariable Long id){
|
||||
|
||||
return toAjax(userWorkExperiencesService.deleteWorkExperiencesIds(new Long[]{id}));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
package com.ruoyi.cms.controller.app;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ruoyi.cms.domain.ai.AiChatHistory;
|
||||
import com.ruoyi.cms.domain.chat.ChatRequest;
|
||||
import com.ruoyi.cms.service.AiChatHistoryService;
|
||||
import com.ruoyi.common.annotation.BussinessLog;
|
||||
import com.ruoyi.cms.config.ChatClient;
|
||||
import com.ruoyi.cms.config.ChatConfig;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.SiteSecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.ruoyi.common.enums.BusinessType.QUERY;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/app/chat")
|
||||
@Slf4j
|
||||
@Api(tags = "移动端:ai对话")
|
||||
public class ChatController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
ChatClient chatClient;
|
||||
@Autowired
|
||||
ChatConfig chatConfig;
|
||||
@Autowired
|
||||
AiChatHistoryService aiChatHistoryService;
|
||||
|
||||
//private final ExecutorService executor = Executors.newCachedThreadPool();
|
||||
// 可优化线程池配置,避免无限创建线程
|
||||
private final ExecutorService executor = new ThreadPoolExecutor(
|
||||
2, // 核心线程数
|
||||
10, // 最大线程数
|
||||
30, TimeUnit.SECONDS,
|
||||
new LinkedBlockingQueue<>(50), // 任务队列
|
||||
new ThreadPoolExecutor.CallerRunsPolicy() // 拒绝策略(避免任务丢失)
|
||||
);
|
||||
|
||||
@BussinessLog(title = "查询用户的聊天历史记录",businessType = QUERY)
|
||||
@ApiOperation("查询用户的聊天历史记录")
|
||||
@GetMapping(value = "/getHistory")
|
||||
public AjaxResult getChatHistoryList(AiChatHistory chatHistory) {
|
||||
return AjaxResult.success(aiChatHistoryService.getList(chatHistory));
|
||||
}
|
||||
|
||||
@BussinessLog(title = "查询用户的聊天详情",businessType = QUERY)
|
||||
@ApiOperation("查询用户的聊天详情")
|
||||
@GetMapping(value = "/detail")
|
||||
public AjaxResult getChatDetail(ChatRequest request) {
|
||||
return AjaxResult.success(aiChatHistoryService.getDetailList(request.getSessionId()));
|
||||
}
|
||||
|
||||
// 处理前端聊天请求,返回 SSE 发射器
|
||||
@ApiOperation("用户AI聊天")
|
||||
@PostMapping("/chat")
|
||||
@ResponseBody
|
||||
@BussinessLog(title = "用户AI聊天",businessType = QUERY)
|
||||
public SseEmitter chatStream(@RequestBody ChatRequest request) {
|
||||
// 设置超时时间(30分钟)
|
||||
SseEmitter emitter = new SseEmitter(1800000L);
|
||||
long userId = 0;
|
||||
if(ObjectUtil.isNotEmpty(request.getUserId())&&request.getUserId()!=0){
|
||||
userId = request.getUserId();
|
||||
}else{
|
||||
try {
|
||||
userId = SiteSecurityUtils.getLoginUser().getUserId();
|
||||
}catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject contentObject = new JSONObject();
|
||||
contentObject.put("content",request.getData());
|
||||
contentObject.put("role","user");
|
||||
JSONArray array = aiChatHistoryService.getChatHistoryData(request.getSessionId());
|
||||
if(array==null||array.isEmpty()||array.size()==0){
|
||||
array = new JSONArray();
|
||||
}
|
||||
array.add(contentObject);
|
||||
request.setMessages(array);
|
||||
|
||||
List<String> answerList = new ArrayList<>();
|
||||
long[] timeStart = {0};
|
||||
// 异步处理请求并推送数据
|
||||
executor.submit(() -> {
|
||||
try {
|
||||
// 2. 调用ChatClient的流式聊天方法,正确传递参数
|
||||
chatClient.sendStreamingChat(
|
||||
request,
|
||||
new ChatClient.StreamCallback() { // 使用内部类完整路径
|
||||
@Override
|
||||
public void onData(String chunk) {
|
||||
try {
|
||||
if(timeStart[0] == 0){
|
||||
timeStart[0] = System.currentTimeMillis();
|
||||
}
|
||||
// 1. 处理SSE协议格式
|
||||
String processedChunk = chunk.trim();
|
||||
// 解析返回的chunk数据
|
||||
String content = parseChatChunk(processedChunk);
|
||||
if (StringUtils.isNotEmpty(content)) {
|
||||
answerList.add(content);
|
||||
}
|
||||
emitter.send(processedChunk, MediaType.TEXT_EVENT_STREAM);
|
||||
} catch (IOException e) {
|
||||
emitter.completeWithError(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
emitter.complete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
try {
|
||||
emitter.send(SseEmitter.event()
|
||||
.data("{\"status\":\"error\",\"message\":\"" + e.getMessage() + "\"}")
|
||||
.name("error"));
|
||||
} catch (IOException ex) {
|
||||
// 记录日志
|
||||
} finally {
|
||||
emitter.completeWithError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
} catch (Exception e) {
|
||||
emitter.completeWithError(e);
|
||||
}
|
||||
});
|
||||
|
||||
// 处理连接关闭
|
||||
long finalUserId = userId;
|
||||
emitter.onCompletion(() -> {
|
||||
// 此处仅做资源清理,不关闭线程池
|
||||
log.info("连接关闭,清理资源");
|
||||
long timeEnd = System.currentTimeMillis();
|
||||
double duration = (timeEnd - timeStart[0]) / 1000.0;
|
||||
AiChatHistory chatHistory = new AiChatHistory();
|
||||
chatHistory.setChatId(request.getSessionId());
|
||||
chatHistory.setUserId((finalUserId==0)?null:finalUserId);
|
||||
chatHistory.setAppId(chatConfig.getAppId());
|
||||
chatHistory.setDataId(request.getDataId());
|
||||
chatHistory.setTitle(request.getData());
|
||||
chatHistory.setAnswerStringList(answerList);
|
||||
chatHistory.setDurationSeconds(duration);
|
||||
aiChatHistoryService.saveChatHistory(chatHistory);
|
||||
});
|
||||
return emitter;
|
||||
}
|
||||
|
||||
@BussinessLog(title = "提供推测出的问询建议",businessType = QUERY)
|
||||
@ApiOperation("提供推测出的问询建议")
|
||||
@PostMapping(value = "/guest")
|
||||
public AjaxResult getChatGuest(@RequestBody ChatRequest request) throws IOException {
|
||||
JSONArray array = aiChatHistoryService.getChatHistoryData(request.getSessionId());
|
||||
request.setMessages(array);
|
||||
String result = chatClient.sendChatGuest(request);
|
||||
try {
|
||||
String[] strList = result.split("?");
|
||||
List<String> list = new ArrayList<>();
|
||||
for(String str:strList){
|
||||
if(StringUtils.isNotEmpty(str)){
|
||||
str = str+"?";
|
||||
list.add(str);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
}catch (Exception e) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 解析返回的流式数据
|
||||
private String parseChatChunk(String chunk) {
|
||||
try {
|
||||
String processed = chunk.trim();
|
||||
if (processed.startsWith("data:")) {
|
||||
processed = processed.substring("data:".length()).trim();
|
||||
}
|
||||
if (processed.isEmpty() || "[DONE]".equals(processed)) {
|
||||
return null;
|
||||
}
|
||||
JSONObject json = JSONObject.parseObject(processed);
|
||||
String choices = json.getString("choices");
|
||||
if (choices != null && !choices.trim().isEmpty()) {
|
||||
JSONArray jsonArray = JSONArray.parseArray(choices);
|
||||
json = JSONObject.parseObject(jsonArray.getString(0));
|
||||
json = json.getJSONObject("delta");
|
||||
String content = json.getString("content");// 消息内容
|
||||
|
||||
return content;
|
||||
}
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
public void destroy() {
|
||||
executor.shutdown(); // 应用退出前关闭线程池
|
||||
try {
|
||||
if (!executor.awaitTermination(5, TimeUnit.SECONDS)) {
|
||||
executor.shutdownNow(); // 强制关闭未完成的任务
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
executor.shutdownNow();
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import com.ruoyi.cms.domain.BussinessDictData;
|
||||
import com.ruoyi.cms.service.IBussinessDictDataService;
|
||||
import com.ruoyi.cms.service.IBussinessDictTypeService;
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/dict/data")
|
||||
@Anonymous
|
||||
public class BussinessDictDataController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IBussinessDictDataService dictDataService;
|
||||
|
||||
@Autowired
|
||||
private IBussinessDictTypeService dictTypeService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BussinessDictData dictData)
|
||||
{
|
||||
startPage();
|
||||
List<BussinessDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BussinessDictData dictData)
|
||||
{
|
||||
List<BussinessDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
ExcelUtil<BussinessDictData> util = new ExcelUtil<BussinessDictData>(BussinessDictData.class);
|
||||
util.exportExcel(response, list, "字典数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典数据详细
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||
@GetMapping(value = "/{dictCode}")
|
||||
public AjaxResult getInfo(@PathVariable Long dictCode)
|
||||
{
|
||||
return success(dictDataService.selectDictDataById(dictCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典类型查询字典数据信息
|
||||
*/
|
||||
@GetMapping(value = "/type/{dictType}")
|
||||
public AjaxResult dictType(@PathVariable String dictType)
|
||||
{
|
||||
List<BussinessDictData> data = dictTypeService.selectDictDataByType(dictType);
|
||||
if (StringUtils.isNull(data))
|
||||
{
|
||||
data = new ArrayList<BussinessDictData>();
|
||||
}
|
||||
return success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody BussinessDictData dict)
|
||||
{
|
||||
dict.setCreateBy(getUsername());
|
||||
return toAjax(dictDataService.insertDictData(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody BussinessDictData dict)
|
||||
{
|
||||
dict.setUpdateBy(getUsername());
|
||||
return toAjax(dictDataService.updateDictData(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictCodes}")
|
||||
public AjaxResult remove(@PathVariable Long[] dictCodes)
|
||||
{
|
||||
dictDataService.deleteDictDataByIds(dictCodes);
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
|
||||
import com.ruoyi.cms.service.BussinessDictJobCategoryService;
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.ruoyi.common.core.domain.entity.BussinessDictJobCategory;
|
||||
|
||||
|
||||
/**
|
||||
* 技能字典表
|
||||
*
|
||||
* @author
|
||||
* @email
|
||||
* @date 2025-10-30 19:25:48
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/dict")
|
||||
@Anonymous
|
||||
public class BussinessDictJobCategoryController {
|
||||
@Autowired
|
||||
private BussinessDictJobCategoryService bussinessDictJobCategoryService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@GetMapping("/jobCategory")
|
||||
public AjaxResult jobCategory(BussinessDictJobCategory bussinessDictJobCategory){
|
||||
if (!hasAnyQueryCondition(bussinessDictJobCategory)) {
|
||||
return AjaxResult.error("请传递至少一个查询条件(大类、中类、小类、名称),避免数据量过大!");
|
||||
}
|
||||
return AjaxResult.success(bussinessDictJobCategoryService.getList(bussinessDictJobCategory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否包含至少一个有效的查询条件
|
||||
*/
|
||||
private boolean hasAnyQueryCondition(BussinessDictJobCategory queryParam) {
|
||||
// 避免空指针(若 queryParam 可能为 null,需先判断)
|
||||
if (queryParam == null) {
|
||||
return false;
|
||||
}
|
||||
// 检查四个字段中是否有非空值
|
||||
return StringUtils.isNotEmpty(queryParam.getLabd())
|
||||
|| StringUtils.isNotEmpty(queryParam.getLabz())
|
||||
|| StringUtils.isNotEmpty(queryParam.getLabx())
|
||||
|| StringUtils.isNotEmpty(queryParam.getName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import com.ruoyi.cms.domain.BussinessDictType;
|
||||
import com.ruoyi.cms.service.IBussinessDictTypeService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/dict/type")
|
||||
public class BussinessDictTypeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IBussinessDictTypeService dictTypeService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BussinessDictType dictType)
|
||||
{
|
||||
startPage();
|
||||
List<BussinessDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BussinessDictType dictType)
|
||||
{
|
||||
List<BussinessDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
ExcelUtil<BussinessDictType> util = new ExcelUtil<BussinessDictType>(BussinessDictType.class);
|
||||
util.exportExcel(response, list, "字典类型");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典类型详细
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||
@GetMapping(value = "/{dictId}")
|
||||
public AjaxResult getInfo(@PathVariable Long dictId)
|
||||
{
|
||||
return success(dictTypeService.selectDictTypeById(dictId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody BussinessDictType dict)
|
||||
{
|
||||
if (!dictTypeService.checkDictTypeUnique(dict))
|
||||
{
|
||||
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setCreateBy(getUsername());
|
||||
return toAjax(dictTypeService.insertDictType(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody BussinessDictType dict)
|
||||
{
|
||||
if (!dictTypeService.checkDictTypeUnique(dict))
|
||||
{
|
||||
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setUpdateBy(getUsername());
|
||||
return toAjax(dictTypeService.updateDictType(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] dictIds)
|
||||
{
|
||||
dictTypeService.deleteDictTypeByIds(dictIds);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新字典缓存
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/refreshCache")
|
||||
public AjaxResult refreshCache()
|
||||
{
|
||||
dictTypeService.resetDictCache();
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典选择框列表
|
||||
*/
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect()
|
||||
{
|
||||
List<BussinessDictType> dictTypes = dictTypeService.selectDictTypeAll();
|
||||
return success(dictTypes);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import com.ruoyi.cms.domain.BussinessOperLog;
|
||||
import com.ruoyi.cms.service.IBussinessOperLogService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 操作日志记录
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/operlog")
|
||||
@Api(tags = "后台:App用户操作日志")
|
||||
public class BussinessOperlogController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IBussinessOperLogService operLogService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("日志列表")
|
||||
public TableDataInfo list(BussinessOperLog operLog)
|
||||
{
|
||||
startPage();
|
||||
List<BussinessOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
|
||||
@PostMapping("/export")
|
||||
@ApiOperation("日志导出excel")
|
||||
public void export(HttpServletResponse response, BussinessOperLog operLog)
|
||||
{
|
||||
List<BussinessOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
ExcelUtil<BussinessOperLog> util = new ExcelUtil<BussinessOperLog>(BussinessOperLog.class);
|
||||
util.exportExcel(response, list, "操作日志");
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.DELETE)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||
@DeleteMapping("/{operIds}")
|
||||
@ApiOperation("删除操作日志")
|
||||
public AjaxResult remove(@PathVariable Long[] operIds)
|
||||
{
|
||||
return toAjax(operLogService.deleteOperLogByIds(operIds));
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||
@DeleteMapping("/clean")
|
||||
@ApiOperation("清空操作日志")
|
||||
public AjaxResult clean()
|
||||
{
|
||||
operLogService.cleanOperLog();
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,276 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.cms.domain.AppReviewJob;
|
||||
import com.ruoyi.cms.domain.vo.AppUserLky;
|
||||
import com.ruoyi.cms.service.IAppReviewJobService;
|
||||
import com.ruoyi.cms.util.DateValidateUtil;
|
||||
import com.ruoyi.cms.util.RoleUtils;
|
||||
import com.ruoyi.cms.util.StringUtil;
|
||||
import com.ruoyi.common.annotation.BussinessLog;
|
||||
import com.ruoyi.common.core.domain.entity.AppUserShow;
|
||||
import com.ruoyi.common.core.domain.model.RegisterBody;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.SiteSecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.ruoyi.common.core.domain.entity.AppUser;
|
||||
import com.ruoyi.cms.service.IAppUserService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* APP用户Controller
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-03
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/appUser")
|
||||
@Api(tags = "后台:APP用户管理")
|
||||
public class CmsAppUserController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IAppUserService appUserService;
|
||||
@Autowired
|
||||
private IAppReviewJobService appReviewJobService;
|
||||
|
||||
/**
|
||||
* 查询APP用户列表
|
||||
*/
|
||||
@ApiOperation("查询APP用户列表")
|
||||
@PreAuthorize("@ss.hasPermi('cms:appUser:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AppUser appUser)
|
||||
{
|
||||
startPage();
|
||||
List<AppUser> list = appUserService.selectAppUserList(appUser);
|
||||
//身份证脱敏
|
||||
list.forEach(it->{
|
||||
it.setIdCard(StringUtil.desensitizeIdCard(it.getIdCard()));
|
||||
});
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出APP用户列表
|
||||
*/
|
||||
@ApiOperation("导出APP用户列表")
|
||||
@PreAuthorize("@ss.hasPermi('cms:appUser:export')")
|
||||
@Log(title = "APP用户", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, AppUser appUser)
|
||||
{
|
||||
List<AppUser> list = appUserService.selectAppUserList(appUser);
|
||||
ExcelUtil<AppUser> util = new ExcelUtil<AppUser>(AppUser.class);
|
||||
util.exportExcel(response, list, "APP用户数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取APP用户详细信息
|
||||
*/
|
||||
@ApiOperation("获取APP用户详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('bussiness:user:query')")
|
||||
@GetMapping(value = "/{userId}")
|
||||
public AjaxResult getInfo(@PathVariable("userId") Long userId)
|
||||
{
|
||||
return success(appUserService.selectAppUserByUserId(userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增APP用户
|
||||
*/
|
||||
@ApiOperation("新增APP用户")
|
||||
@PreAuthorize("@ss.hasPermi('bussiness:user:add')")
|
||||
@Log(title = "APP用户", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AppUser appUser)
|
||||
{
|
||||
return toAjax(appUserService.insertAppUser(appUser));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改APP用户
|
||||
*/
|
||||
@ApiOperation("修改APP用户")
|
||||
@Log(title = "APP用户", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AppUser appUser)
|
||||
{
|
||||
if(appUser.getUserId()==null){
|
||||
return AjaxResult.error("参数userId为空");
|
||||
}
|
||||
return toAjax(appUserService.updateAppUser(appUser));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除APP用户
|
||||
*/
|
||||
@ApiOperation("删除APP用户")
|
||||
@PreAuthorize("@ss.hasPermi('bussiness:user:remove')")
|
||||
@Log(title = "APP用户", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{userIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] userIds)
|
||||
{
|
||||
return toAjax(appUserService.deleteAppUserByUserIds(userIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取APP用户详细信息(pc端获取移动端简历信息)
|
||||
*/
|
||||
@ApiOperation("pc端个人简历信息-获取APP用户详细信息")
|
||||
@GetMapping(value = "/getUserInfo")
|
||||
public AjaxResult getUserInfo()
|
||||
{
|
||||
if(!SecurityUtils.isLogin()){
|
||||
return AjaxResult.error("未登录!");
|
||||
}
|
||||
return success(appUserService.getUserInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户简历信息-(技能信息、经历信息)
|
||||
*/
|
||||
@ApiOperation("修改用户简历信息")
|
||||
@PostMapping("/editRegisterUser")
|
||||
@BussinessLog(title = "保存简历")
|
||||
public AjaxResult editRegisterUser(@RequestBody RegisterBody registerBody)
|
||||
{
|
||||
if (registerBody == null) {
|
||||
return AjaxResult.error("入参registerBody不能为空!");
|
||||
}
|
||||
if(registerBody.getAppUser()==null){
|
||||
return AjaxResult.error("用户信息为空!");
|
||||
}
|
||||
return AjaxResult.success(appUserService.editRegisterUser(registerBody));
|
||||
}
|
||||
|
||||
@ApiOperation("查询APP用户列表")
|
||||
@GetMapping("/noTmlist")
|
||||
public TableDataInfo noTmlist(AppUser appUser)
|
||||
{
|
||||
startPage();
|
||||
List<AppUser> list = appUserService.selectNoTmAppUserList(appUser);
|
||||
//身份证脱敏
|
||||
list.forEach(it->{
|
||||
it.setIdCard(StringUtil.desensitizeIdCard(it.getIdCard()));
|
||||
});
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("查询我的中(已经投递的,收藏的,足迹,预约)")
|
||||
@GetMapping("/getMyTj")
|
||||
public AjaxResult getMyTj()
|
||||
{
|
||||
if(!SecurityUtils.isLogin()){
|
||||
return AjaxResult.error("未登录!");
|
||||
}
|
||||
if(StringUtils.isEmpty(RoleUtils.getCurrentUseridCard())){
|
||||
return AjaxResult.error("用户信息为空!");
|
||||
}
|
||||
AppUser appUser=appUserService.selectAppuserByIdcard(RoleUtils.getCurrentUseridCard());
|
||||
if (Objects.isNull(appUser)) {
|
||||
return AjaxResult.error("未查询到用户信息(身份证号:" + RoleUtils.getCurrentUseridCard() + ")!");
|
||||
}
|
||||
return AjaxResult.success(appUserService.getMyTj(appUser.getUserId()));
|
||||
}
|
||||
|
||||
@ApiOperation("返回求职者劳科院-当前职位名称、技能标签")
|
||||
@GetMapping("/appUserInfo")
|
||||
public AjaxResult appUserInfo(AppUser appUser)
|
||||
{
|
||||
if(!SecurityUtils.isLogin()){
|
||||
return AjaxResult.error("未登录!");
|
||||
}
|
||||
if(StringUtils.isEmpty(RoleUtils.getCurrentUseridCard())){
|
||||
return AjaxResult.error("用户信息为空!");
|
||||
}
|
||||
appUser=appUserService.selectAppuserByIdcard(RoleUtils.getCurrentUseridCard());
|
||||
if (Objects.isNull(appUser)) {
|
||||
return AjaxResult.error("未查询到用户信息(身份证号:" + RoleUtils.getCurrentUseridCard() + ")!");
|
||||
}
|
||||
AppUserLky appUserLky = appUserService.selectAppUserInfo(appUser);
|
||||
return AjaxResult.success(appUserLky);
|
||||
}
|
||||
|
||||
@ApiOperation("查询APP申请用户列表")
|
||||
//@PreAuthorize("@ss.hasPermi('cms:appUser:userApplyList')")
|
||||
@GetMapping("/userApplyList")
|
||||
public TableDataInfo userApplyList(AppUser appUser)
|
||||
{
|
||||
String birthDateError = DateValidateUtil.validateBirthDate(appUser.getBirthDate());
|
||||
|
||||
if (birthDateError != null) {
|
||||
TableDataInfo errorResult = new TableDataInfo();
|
||||
errorResult.setCode(400);
|
||||
errorResult.setMsg(birthDateError);
|
||||
errorResult.setRows(null);
|
||||
errorResult.setTotal(0);
|
||||
return errorResult;
|
||||
}
|
||||
startPage();
|
||||
List<AppUserShow> list = appUserService.selectUserApplyList(appUser);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加足迹信息
|
||||
* @param appReviewJob
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/browse")
|
||||
@ApiOperation("用户浏览")
|
||||
public AjaxResult browse(@RequestBody AppReviewJob appReviewJob)
|
||||
{
|
||||
if (Objects.isNull(appReviewJob) || Objects.isNull(appReviewJob.getJobId())) {
|
||||
return AjaxResult.error("岗位id为空");
|
||||
}
|
||||
|
||||
if (!SecurityUtils.isLogin()) {
|
||||
return AjaxResult.error("用户未登录!");
|
||||
}
|
||||
|
||||
Long frontUserId = appReviewJob.getUserId();
|
||||
String useridCard = RoleUtils.getCurrentUseridCard();
|
||||
|
||||
Long targetUserId;
|
||||
if (Objects.nonNull(frontUserId)) {
|
||||
targetUserId = frontUserId;
|
||||
} else {
|
||||
if (StringUtils.isEmpty(useridCard)) {
|
||||
return AjaxResult.error("用户身份证信息为空,无法获取用户ID!");
|
||||
}
|
||||
AppUser appUser = appUserService.selectAppuserByIdcard(useridCard);
|
||||
if (Objects.isNull(appUser)) {
|
||||
return AjaxResult.error("未查询到用户信息(身份证号:" + useridCard + ")!");
|
||||
}
|
||||
targetUserId = appUser.getUserId();
|
||||
}
|
||||
|
||||
appReviewJob.setUserId(targetUserId);
|
||||
if(StringUtils.isEmpty(appReviewJob.getReviewDate())){
|
||||
appReviewJob.setReviewDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,new Date()));
|
||||
}
|
||||
return toAjax(appReviewJobService.insertAppReviewJob(appReviewJob));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,361 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ruoyi.cms.domain.*;
|
||||
import com.ruoyi.cms.domain.query.ESJobSearch;
|
||||
import com.ruoyi.cms.domain.vo.CandidateVO;
|
||||
import com.ruoyi.cms.domain.vo.CompanyVo;
|
||||
import com.ruoyi.cms.service.*;
|
||||
import com.ruoyi.cms.util.RoleUtils;
|
||||
import com.ruoyi.cms.util.StringUtil;
|
||||
import com.ruoyi.cms.util.sensitiveWord.SensitiveWordChecker;
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.AppUser;
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 岗位Controller
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-03
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/job")
|
||||
@Api(tags = "后台:岗位管理")
|
||||
@Anonymous
|
||||
public class CmsJobController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IJobService jobService;
|
||||
@Autowired
|
||||
SensitiveWordChecker sensitiveWordChecker;
|
||||
@Autowired
|
||||
private ICompanyService companyService;
|
||||
@Autowired
|
||||
private IJobCollectionService jobCollectionService;
|
||||
@Autowired
|
||||
private IAppUserService appUserService;
|
||||
@Autowired
|
||||
private IJobApplyService iJobApplyService;
|
||||
@Autowired
|
||||
private IAppReviewJobService iAppReviewJobService;
|
||||
/**
|
||||
* 查询岗位列表
|
||||
*/
|
||||
@ApiOperation("查询岗位列表")
|
||||
// @PreAuthorize("@ss.hasPermi('cms:job:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Job job,HttpServletRequest request)
|
||||
{
|
||||
if (RoleUtils.isCompanyAdmin()) {
|
||||
Company company = companyService.queryCodeCompany(RoleUtils.getCurrentUseridCard());
|
||||
job.setCompanyId(Objects.nonNull(company) ? company.getCompanyId() : null);
|
||||
}
|
||||
startPage();
|
||||
//List<Job> list = jobService.selectJobList(job);
|
||||
List<Job> list = jobService.selectHttpJobList(job,request);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取岗位详细信息
|
||||
*/
|
||||
@ApiOperation("获取岗位详细信息")
|
||||
// @PreAuthorize("@ss.hasPermi('bussiness:job:query')")
|
||||
@GetMapping(value = "/{jobId}")
|
||||
public AjaxResult getInfo(@PathVariable("jobId") Long jobId, HttpServletRequest request)
|
||||
{
|
||||
if (jobId == null) {
|
||||
return AjaxResult.error("jobId不能为空");
|
||||
}
|
||||
//return success(jobService.selectJobByJobId(jobId));
|
||||
return success(jobService.selectHttpJobByJobId(jobId,request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出岗位列表
|
||||
*/
|
||||
@ApiOperation("导出岗位列表")
|
||||
// @PreAuthorize("@ss.hasPermi('bussiness:job:export')")
|
||||
@Log(title = "岗位", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Job job)
|
||||
{
|
||||
List<Job> list = jobService.selectJobList(job);
|
||||
ExcelUtil<Job> util = new ExcelUtil<Job>(Job.class);
|
||||
util.exportExcel(response, list, "岗位数据");
|
||||
}
|
||||
/**
|
||||
* 新增岗位
|
||||
*/
|
||||
@ApiOperation("新增岗位")
|
||||
// @PreAuthorize("@ss.hasPermi('bussiness:job:add')")
|
||||
@Log(title = "岗位", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Job job)
|
||||
{
|
||||
// 校验描述中的敏感词
|
||||
List<String> sensitiveWords = sensitiveWordChecker.checkSensitiveWords(job.getDescription());
|
||||
if (!sensitiveWords.isEmpty()) {
|
||||
String errorMsg = "描述中包含敏感词:" + String.join("、", sensitiveWords);
|
||||
return AjaxResult.error(errorMsg);
|
||||
}
|
||||
// 无敏感词,执行插入
|
||||
return toAjax(jobService.insertJob(job));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改岗位
|
||||
*/
|
||||
@ApiOperation("修改岗位")
|
||||
// @PreAuthorize("@ss.hasPermi('bussiness:job:edit')")
|
||||
@Log(title = "岗位", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Job job)
|
||||
{
|
||||
// 校验描述中的敏感词
|
||||
List<String> sensitiveWords = sensitiveWordChecker.checkSensitiveWords(job.getDescription());
|
||||
if (!sensitiveWords.isEmpty()) {
|
||||
String errorMsg = "描述中包含敏感词:" + String.join("、", sensitiveWords);
|
||||
return AjaxResult.error(errorMsg);
|
||||
}
|
||||
return toAjax(jobService.updateJob(job));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除岗位
|
||||
*/
|
||||
@ApiOperation("删除岗位")
|
||||
// @PreAuthorize("@ss.hasPermi('bussiness:job:remove')")
|
||||
@Log(title = "岗位", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{jobIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] jobIds)
|
||||
{
|
||||
return toAjax(jobService.deleteJobByJobIds(jobIds));
|
||||
}
|
||||
|
||||
@ApiOperation("候选人查询")
|
||||
@Log(title = "岗位", businessType = BusinessType.DELETE)
|
||||
@GetMapping("/candidates")
|
||||
@PreAuthorize("@ss.hasPermi('bussiness:job:candidates')")
|
||||
public TableDataInfo candidates(Long jobId)
|
||||
{
|
||||
startPage();
|
||||
List<CandidateVO> list = jobService.candidates(jobId);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("获取推荐岗位")
|
||||
@GetMapping("/recommend")
|
||||
public AjaxResult recommend(ESJobSearch esJobSearch)
|
||||
{
|
||||
if (RoleUtils.isCompanyAdmin()) {
|
||||
esJobSearch.setCode(RoleUtils.getCurrentUseridCard());
|
||||
esJobSearch.setUserType(StringUtil.IS_COMPANY_USER);
|
||||
}
|
||||
//判断pageSize
|
||||
Integer pageSize=esJobSearch.getPageSize();
|
||||
if (pageSize == null || pageSize <= 0) {
|
||||
esJobSearch.setPageSize(20);
|
||||
}
|
||||
List<ESJobDocument> jobList = jobService.sysRecommend(esJobSearch);
|
||||
List<Job> jobs=new ArrayList<>();
|
||||
jobList.stream().forEach(it->{
|
||||
Job job=new Job();
|
||||
BeanUtils.copyBeanProp(job, it);
|
||||
job.setCompanyVo(JSON.parseObject(it.getCompanyVoJson(), CompanyVo.class));
|
||||
jobs.add(job);
|
||||
});
|
||||
return success(jobs);
|
||||
}
|
||||
|
||||
@ApiOperation("获取所有岗位")
|
||||
@GetMapping("/selectAllJob")
|
||||
public AjaxResult selectAllJob()
|
||||
{
|
||||
List<Job> jobList = jobService.selectAllJob();
|
||||
return success(jobList);
|
||||
}
|
||||
|
||||
@PostMapping("/collection")
|
||||
@ApiOperation("用户收藏")
|
||||
public AjaxResult jobCollection(@RequestBody JobCollection jobCollection)
|
||||
{
|
||||
if(jobCollection.getJobId()==null){
|
||||
return AjaxResult.error("岗位id为空");
|
||||
}
|
||||
if(!SecurityUtils.isLogin()){
|
||||
return AjaxResult.error("用户未登录!");
|
||||
}
|
||||
if(jobCollection.getUserId()==null){
|
||||
String idCard=RoleUtils.getCurrentUseridCard();
|
||||
AppUser appUser=appUserService.selectAppuserByIdcard(idCard);
|
||||
if(appUser==null){
|
||||
return AjaxResult.error("用户信息未完善,请完善身份证信息!");
|
||||
}else{
|
||||
jobCollection.setUserId(appUser.getUserId());
|
||||
}
|
||||
}
|
||||
return toAjax(jobCollectionService.pcJobCollection(jobCollection));
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户岗位收藏列表")
|
||||
@GetMapping("/getAppUserYhsc")
|
||||
public AjaxResult getAppUserYhsc(JobCollection jobCollection)
|
||||
{
|
||||
if(!SecurityUtils.isLogin()){
|
||||
return AjaxResult.error("用户未登录!");
|
||||
}
|
||||
if(jobCollection.getUserId()==null){
|
||||
String idCard=RoleUtils.getCurrentUseridCard();
|
||||
AppUser appUser=appUserService.selectAppuserByIdcard(idCard);
|
||||
if(appUser==null){
|
||||
return AjaxResult.error("用户信息未完善,请完善身份证信息!");
|
||||
}else{
|
||||
jobCollection.setUserId(appUser.getUserId());
|
||||
}
|
||||
}
|
||||
return success(jobCollectionService.selectJobCollectionListJob(jobCollection));
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户岗位申请列表")
|
||||
@GetMapping("/getAppUserYhsq")
|
||||
public AjaxResult getAppUserYhsq(JobApply jobApply)
|
||||
{
|
||||
if(!SecurityUtils.isLogin()){
|
||||
return AjaxResult.error("用户未登录!");
|
||||
}
|
||||
if(jobApply.getUserId()==null){
|
||||
String idCard=RoleUtils.getCurrentUseridCard();
|
||||
AppUser appUser=appUserService.selectAppuserByIdcard(idCard);
|
||||
if(appUser==null){
|
||||
return AjaxResult.error("用户信息未完善,请完善身份证信息!");
|
||||
}else{
|
||||
jobApply.setUserId(appUser.getUserId());
|
||||
}
|
||||
}
|
||||
return success(iJobApplyService.selectJobApplyListJob(jobApply));
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户岗位访问足迹列表")
|
||||
@GetMapping("/getAppUserYhfwzj")
|
||||
public AjaxResult getAppUserYhfwzj(AppReviewJob appReviewJob)
|
||||
{
|
||||
if(!SecurityUtils.isLogin()){
|
||||
return AjaxResult.error("用户未登录!");
|
||||
}
|
||||
if(appReviewJob.getUserId()==null){
|
||||
String idCard=RoleUtils.getCurrentUseridCard();
|
||||
AppUser appUser=appUserService.selectAppuserByIdcard(idCard);
|
||||
if(appUser==null){
|
||||
return AjaxResult.error("用户信息未完善,请完善身份证信息!");
|
||||
}else{
|
||||
appReviewJob.setUserId(appUser.getUserId());
|
||||
}
|
||||
}
|
||||
return success(iAppReviewJobService.selectAppReviewJobListJob(appReviewJob));
|
||||
}
|
||||
|
||||
@PostMapping("/collectionCancel")
|
||||
@ApiOperation("取消收藏")
|
||||
public AjaxResult pcCancel(@RequestBody JobCollection jobCollection)
|
||||
{
|
||||
if(jobCollection.getJobId()==null){
|
||||
return AjaxResult.error("岗位id为空");
|
||||
}
|
||||
if(!SecurityUtils.isLogin()){
|
||||
return AjaxResult.error("用户未登录!");
|
||||
}
|
||||
if(jobCollection.getUserId()==null){
|
||||
String idCard=RoleUtils.getCurrentUseridCard();
|
||||
AppUser appUser=appUserService.selectAppuserByIdcard(idCard);
|
||||
if(appUser==null){
|
||||
return AjaxResult.error("用户信息未完善,请完善身份证信息!");
|
||||
}else{
|
||||
jobCollection.setUserId(appUser.getUserId());
|
||||
}
|
||||
}
|
||||
return toAjax(jobCollectionService.pcCancel(jobCollection));
|
||||
}
|
||||
|
||||
@PostMapping("/browse")
|
||||
@ApiOperation("岗位浏览")
|
||||
public AjaxResult browse(@RequestBody AppReviewJob appReviewJob)
|
||||
{
|
||||
if(appReviewJob.getJobId()==null){
|
||||
return AjaxResult.error("岗位id为空");
|
||||
}
|
||||
if(!SecurityUtils.isLogin()){
|
||||
return AjaxResult.error("用户未登录!");
|
||||
}
|
||||
if(StringUtils.isEmpty(appReviewJob.getReviewDate())){
|
||||
appReviewJob.setReviewDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,new Date()));
|
||||
}
|
||||
if(appReviewJob.getUserId()==null){
|
||||
String idCard=RoleUtils.getCurrentUseridCard();
|
||||
AppUser appUser=appUserService.selectAppuserByIdcard(idCard);
|
||||
if(appUser==null){
|
||||
return AjaxResult.error("用户信息未完善,请完善身份证信息!");
|
||||
}else{
|
||||
appReviewJob.setUserId(appUser.getUserId());
|
||||
}
|
||||
}
|
||||
return toAjax(iAppReviewJobService.insertAppReviewJob(appReviewJob));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("获取推荐岗位-给数据底座的")
|
||||
@GetMapping("/recommendTosjdz")
|
||||
public AjaxResult recommendTosjdz(ESJobSearch esJobSearch)
|
||||
{
|
||||
if (RoleUtils.isCompanyAdmin()) {
|
||||
esJobSearch.setCode(RoleUtils.getCurrentUseridCard());
|
||||
esJobSearch.setUserType(StringUtil.IS_COMPANY_USER);
|
||||
}
|
||||
esJobSearch.setPageSize(20);
|
||||
List<ESJobDocument> jobList = jobService.sysRecommend(esJobSearch);
|
||||
jobList.stream().forEach(it->{
|
||||
it.setAppJobUrl(StringUtil.BASE_WW_GW+it.getJobId());
|
||||
});
|
||||
return success(jobList);
|
||||
}
|
||||
|
||||
@PostMapping("/wechat")
|
||||
@ApiOperation("微信抓取功能调用的新增")
|
||||
public AjaxResult wechatInsert(@RequestBody Job job) {
|
||||
// 不发布
|
||||
job.setIsPublish(0);
|
||||
if (job.getJobContactList() == null) {
|
||||
job.setJobContactList(new ArrayList<>());
|
||||
}
|
||||
Integer total=jobService.getTotals(job);
|
||||
int totalNum = total != null ? total : 0;
|
||||
System.out.println("岗位条数======================"+totalNum);
|
||||
if (totalNum == 0) {
|
||||
return toAjax(jobService.insertJob(job));
|
||||
}
|
||||
return AjaxResult.success("此岗位已存在!");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import com.ruoyi.cms.domain.AppNotice;
|
||||
import com.ruoyi.cms.domain.Notice;
|
||||
import com.ruoyi.cms.domain.vo.NoticeTotal;
|
||||
import com.ruoyi.cms.service.IAppNoticeService;
|
||||
import com.ruoyi.cms.service.IAppUserService;
|
||||
import com.ruoyi.cms.util.notice.NoticeUtils;
|
||||
import com.ruoyi.cms.util.RoleUtils;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.AppUser;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 公告 信息操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/notice")
|
||||
public class CmsNoticeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IAppNoticeService noticeService;
|
||||
@Autowired
|
||||
private IAppUserService appUserService;
|
||||
|
||||
/**
|
||||
* 获取通知公告列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AppNotice notice)
|
||||
{
|
||||
startPage();
|
||||
List<AppNotice> list = noticeService.selectNoticeList(notice);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据通知公告编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:query')")
|
||||
@GetMapping(value = "/{noticeId}")
|
||||
public AjaxResult getInfo(@PathVariable Long noticeId)
|
||||
{
|
||||
return success(noticeService.selectNoticeById(noticeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增通知公告
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:add')")
|
||||
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody AppNotice notice)
|
||||
{
|
||||
notice.setCreateBy(getUsername());
|
||||
return toAjax(noticeService.insertNotice(notice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改通知公告
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:edit')")
|
||||
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody AppNotice notice)
|
||||
{
|
||||
notice.setUpdateBy(getUsername());
|
||||
return toAjax(noticeService.updateNotice(notice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除通知公告
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:remove')")
|
||||
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{noticeIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] noticeIds)
|
||||
{
|
||||
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
|
||||
}
|
||||
|
||||
@ApiOperation("pc端获取消息列表")
|
||||
@GetMapping("/appNoticList")
|
||||
public TableDataInfo selectListAppNotics(Notice notice)
|
||||
{
|
||||
if(!SecurityUtils.isLogin()){
|
||||
error(HttpStatus.ERROR,"未登录!");
|
||||
}
|
||||
if(notice.getUserId()==null){
|
||||
String idCard= RoleUtils.getCurrentUseridCard();
|
||||
AppUser appUser=appUserService.selectAppuserByIdcard(idCard);
|
||||
if(appUser==null){
|
||||
error(HttpStatus.ERROR,"用户信息未完善,请完善身份证信息!");
|
||||
}else{
|
||||
notice.setUserId(appUser.getUserId());
|
||||
}
|
||||
}
|
||||
startPage();
|
||||
List<Notice> notices = noticeService.selectListAppNotics(notice);
|
||||
return getDataTable(notices);
|
||||
}
|
||||
|
||||
@ApiOperation("pc端获取未读消息列表")
|
||||
@GetMapping("/appNoticReadList")
|
||||
public TableDataInfo appNoticReadList(Notice notice)
|
||||
{
|
||||
if(!SecurityUtils.isLogin()){
|
||||
error(HttpStatus.ERROR,"未登录!");
|
||||
}
|
||||
if(notice.getUserId()==null){
|
||||
String idCard= RoleUtils.getCurrentUseridCard();
|
||||
AppUser appUser=appUserService.selectAppuserByIdcard(idCard);
|
||||
if(appUser==null){
|
||||
error(HttpStatus.ERROR,"用户信息未完善,请完善身份证信息!");
|
||||
}else{
|
||||
notice.setUserId(appUser.getUserId());
|
||||
}
|
||||
}
|
||||
startPage();
|
||||
List<Notice> notices = noticeService.selectListAppNotRead(notice);
|
||||
return getDataTable(notices);
|
||||
}
|
||||
|
||||
@ApiOperation("pc端获已读消息列表")
|
||||
@GetMapping("/appNoticYdList")
|
||||
public TableDataInfo appNoticYdList(Notice notice)
|
||||
{
|
||||
if(!SecurityUtils.isLogin()){
|
||||
error(HttpStatus.ERROR,"未登录!");
|
||||
}
|
||||
if(notice.getUserId()==null){
|
||||
String idCard= RoleUtils.getCurrentUseridCard();
|
||||
AppUser appUser=appUserService.selectAppuserByIdcard(idCard);
|
||||
if(appUser==null){
|
||||
error(HttpStatus.ERROR,"用户信息未完善,请完善身份证信息!");
|
||||
}else{
|
||||
notice.setUserId(appUser.getUserId());
|
||||
}
|
||||
}
|
||||
startPage();
|
||||
notice.setIsRead(NoticeUtils.NOTICE_YD);
|
||||
notice.setRemark(NoticeUtils.NOTICE_REMARK);
|
||||
List<Notice> notices = noticeService.selectListAppNotices(notice);
|
||||
return getDataTable(notices);
|
||||
}
|
||||
|
||||
@ApiOperation("系统通知标记已读")
|
||||
@PostMapping("/read/sysNotice")
|
||||
public AjaxResult sysNotice(@RequestParam String id)
|
||||
{
|
||||
Long userId=null;
|
||||
if(!SecurityUtils.isLogin()){
|
||||
return AjaxResult.error("未登录!");
|
||||
}
|
||||
if(userId==null){
|
||||
String idCard= RoleUtils.getCurrentUseridCard();
|
||||
AppUser appUser=appUserService.selectAppuserByIdcard(idCard);
|
||||
if(appUser==null){
|
||||
return AjaxResult.error("用户信息未完善,请完善身份证信息!");
|
||||
}else{
|
||||
userId=appUser.getUserId();
|
||||
}
|
||||
}
|
||||
noticeService.readSysNotices(id,userId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取消息条数
|
||||
*/
|
||||
@ApiOperation("获取移动端用户消息条数")
|
||||
@GetMapping("/noticTotal")
|
||||
public AjaxResult getNoticTotal(Notice notice){
|
||||
if(!SecurityUtils.isLogin()){
|
||||
return AjaxResult.success("未登录!,返回为空");
|
||||
}
|
||||
if(notice.getUserId()==null){
|
||||
String idCard= RoleUtils.getCurrentUseridCard();
|
||||
AppUser appUser=appUserService.selectAppuserByIdcard(idCard);
|
||||
if(appUser==null){
|
||||
error(HttpStatus.ERROR,"用户信息未完善,请完善身份证信息!");
|
||||
}else{
|
||||
notice.setUserId(appUser.getUserId());
|
||||
}
|
||||
}
|
||||
startPage();
|
||||
NoticeTotal notices = noticeService.noticTotal(notice);
|
||||
return success(notices);
|
||||
}
|
||||
|
||||
@ApiOperation("获取移动端用户消息条数")
|
||||
@DeleteMapping("/deleteNotice/{ids}")
|
||||
public AjaxResult deleteNotice(@PathVariable Long[] ids){
|
||||
return success(noticeService.removeNotice(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
|
||||
import com.ruoyi.cms.service.AppSkillService;
|
||||
import com.ruoyi.cms.service.IAppUserService;
|
||||
import com.ruoyi.cms.util.RoleUtils;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.AppSkill;
|
||||
import com.ruoyi.common.core.domain.entity.AppUser;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 用户技能信息
|
||||
*
|
||||
* @author
|
||||
* @email
|
||||
* @date 2025-10-21 12:22:09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/appskill")
|
||||
@Api(tags = "后台:用户技能")
|
||||
public class CmsSkillController extends BaseController {
|
||||
@Autowired
|
||||
private AppSkillService appSkillService;
|
||||
@Autowired
|
||||
private IAppUserService appUserService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@ApiOperation("获取技能列表")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AppSkill appSkill){
|
||||
startPage();
|
||||
List<AppSkill> list=appSkillService.getList(appSkill);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@ApiOperation("获取技能详情")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult info(@PathVariable("id") Long id){
|
||||
return success(appSkillService.getAppskillById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@ApiOperation("新增技能")
|
||||
@Log(title = "技能", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
public AjaxResult save(@RequestBody AppSkill appSkill){
|
||||
if(SecurityUtils.isLogin()){
|
||||
AppUser appUser=appUserService.selectAppuserByIdcard(RoleUtils.getCurrentUseridCard());
|
||||
if(appUser==null){
|
||||
return AjaxResult.error("未传递userId!");
|
||||
}
|
||||
appSkill.setUserId(appUser.getUserId());
|
||||
}else {
|
||||
return AjaxResult.error("未登录!");
|
||||
}
|
||||
return toAjax(appSkillService.insertAppskill(appSkill));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@ApiOperation("修改技能")
|
||||
@Log(title = "技能", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/edit")
|
||||
public AjaxResult update(@RequestBody AppSkill appSkill){
|
||||
if (appSkill.getId()==null){
|
||||
return AjaxResult.error("参数id未传递!");
|
||||
}
|
||||
return toAjax(appSkillService.updateAppskillById(appSkill));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@Log(title = "删除技能", businessType = BusinessType.DELETE)
|
||||
@ApiOperation("技能")
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult delete(@ApiParam("主键ids") @PathVariable Long[] ids){
|
||||
if(ids==null){
|
||||
return AjaxResult.error("参数ids未传递!");
|
||||
}
|
||||
return toAjax(appSkillService.removeAppskillIds(ids));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.ruoyi.cms.domain.CommercialArea;
|
||||
import com.ruoyi.cms.service.ICommercialAreaService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 商圈Controller
|
||||
*
|
||||
* @author Lishundong
|
||||
* @date 2024-11-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/area")
|
||||
@Api(tags = "后台:商圈")
|
||||
public class CommercialAreaController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ICommercialAreaService commercialAreaService;
|
||||
|
||||
/**
|
||||
* 查询商圈列表
|
||||
*/
|
||||
@ApiOperation("查询商圈列表")
|
||||
@PreAuthorize("@ss.hasPermi('cms:area:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(CommercialArea commercialArea)
|
||||
{
|
||||
startPage();
|
||||
List<CommercialArea> list = commercialAreaService.selectCommercialAreaList(commercialArea);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出商圈列表
|
||||
*/
|
||||
@ApiOperation("导出商圈列表")
|
||||
@PreAuthorize("@ss.hasPermi('cms:area:export')")
|
||||
@Log(title = "商圈", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, CommercialArea commercialArea)
|
||||
{
|
||||
List<CommercialArea> list = commercialAreaService.selectCommercialAreaList(commercialArea);
|
||||
ExcelUtil<CommercialArea> util = new ExcelUtil<CommercialArea>(CommercialArea.class);
|
||||
util.exportExcel(response, list, "商圈数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商圈详细信息
|
||||
*/
|
||||
@ApiOperation("获取商圈详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('cms:area:query')")
|
||||
@GetMapping(value = "/{commercialAreaId}")
|
||||
public AjaxResult getInfo(@PathVariable("commercialAreaId") Long commercialAreaId)
|
||||
{
|
||||
return success(commercialAreaService.selectCommercialAreaByCommercialAreaId(commercialAreaId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商圈
|
||||
*/
|
||||
@ApiOperation("新增商圈")
|
||||
@PreAuthorize("@ss.hasPermi('cms:area:add')")
|
||||
@Log(title = "商圈", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody CommercialArea commercialArea)
|
||||
{
|
||||
return toAjax(commercialAreaService.insertCommercialArea(commercialArea));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商圈
|
||||
*/
|
||||
@ApiOperation("修改商圈")
|
||||
@PreAuthorize("@ss.hasPermi('cms:area:edit')")
|
||||
@Log(title = "商圈", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody CommercialArea commercialArea)
|
||||
{
|
||||
return toAjax(commercialAreaService.updateCommercialArea(commercialArea));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商圈
|
||||
*/
|
||||
@ApiOperation("删除商圈")
|
||||
@PreAuthorize("@ss.hasPermi('cms:area:remove')")
|
||||
@Log(title = "商圈", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{commercialAreaIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] commercialAreaIds)
|
||||
{
|
||||
return toAjax(commercialAreaService.deleteCommercialAreaByCommercialAreaIds(commercialAreaIds));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import com.ruoyi.cms.domain.CommunityUser;
|
||||
import com.ruoyi.cms.service.ICommunityUserService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/cms/communityUser")
|
||||
@Api(tags = "后台:工作人员管理")
|
||||
public class CommunityUserController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ICommunityUserService communityUserService;
|
||||
|
||||
|
||||
@ApiOperation("查询工作人员列表")
|
||||
@PreAuthorize("@ss.hasPermi('application:mgmt:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(CommunityUser communityUser) {
|
||||
startPage();
|
||||
List<CommunityUser> list = communityUserService.selectCommunityUserList(communityUser);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("新增工作人员")
|
||||
@PreAuthorize("@ss.hasPermi('application:mgmt:add')")
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody CommunityUser communityUser) {
|
||||
return toAjax(communityUserService.save(communityUser));
|
||||
}
|
||||
|
||||
@ApiOperation("修改工作人员")
|
||||
@PreAuthorize("@ss.hasPermi('application:mgmt:edit')")
|
||||
@PutMapping
|
||||
public AjaxResult update(@RequestBody CommunityUser communityUser) {
|
||||
return toAjax(communityUserService.updateById(communityUser));
|
||||
}
|
||||
|
||||
@ApiOperation("删除工作人员")
|
||||
@PreAuthorize("@ss.hasPermi('application:mgmt:del')")
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable("ids") Long[] ids) {
|
||||
return toAjax(communityUserService.delCommunityUser(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import java.sql.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.ruoyi.cms.domain.CompanyCard;
|
||||
import com.ruoyi.cms.service.ICompanyCardService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 公司卡片Controller
|
||||
*
|
||||
* @author ${author}
|
||||
* @date 2025-02-18
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/card")
|
||||
@Api(tags = "公司卡片")
|
||||
public class CompanyCardController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ICompanyCardService companyCardService;
|
||||
|
||||
/**
|
||||
* 查询公司卡片列表
|
||||
*/
|
||||
@ApiOperation("查询公司卡片列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:card:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(CompanyCard companyCard)
|
||||
{
|
||||
startPage();
|
||||
List<CompanyCard> list = companyCardService.selectCompanyCardList(companyCard);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出公司卡片列表
|
||||
*/
|
||||
@ApiOperation("导出公司卡片列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:card:export')")
|
||||
@Log(title = "公司卡片", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, CompanyCard companyCard)
|
||||
{
|
||||
List<CompanyCard> list = companyCardService.selectCompanyCardList(companyCard);
|
||||
ExcelUtil<CompanyCard> util = new ExcelUtil<CompanyCard>(CompanyCard.class);
|
||||
util.exportExcel(response, list, "公司卡片数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取公司卡片详细信息
|
||||
*/
|
||||
@ApiOperation("获取公司卡片详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('system:card:query')")
|
||||
@GetMapping(value = "/{companyCardId}")
|
||||
public AjaxResult getInfo(@PathVariable("companyCardId") Long companyCardId)
|
||||
{
|
||||
return success(companyCardService.selectCompanyCardByCompanyCardId(companyCardId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增公司卡片
|
||||
*/
|
||||
@ApiOperation("新增公司卡片")
|
||||
@PreAuthorize("@ss.hasPermi('system:card:add')")
|
||||
@Log(title = "公司卡片", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody CompanyCard companyCard)
|
||||
{
|
||||
return toAjax(companyCardService.insertCompanyCard(companyCard));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改公司卡片
|
||||
*/
|
||||
@ApiOperation("修改公司卡片")
|
||||
@PreAuthorize("@ss.hasPermi('system:card:edit')")
|
||||
@Log(title = "公司卡片", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody CompanyCard companyCard)
|
||||
{
|
||||
return toAjax(companyCardService.updateCompanyCard(companyCard));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除公司卡片
|
||||
*/
|
||||
@ApiOperation("删除公司卡片")
|
||||
@PreAuthorize("@ss.hasPermi('system:card:remove')")
|
||||
@Log(title = "公司卡片", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{companyCardIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] companyCardIds)
|
||||
{
|
||||
return toAjax(companyCardService.deleteCompanyCardByCompanyCardIds(companyCardIds));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.CompanyContact;
|
||||
import com.ruoyi.cms.service.CompanyContactService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 公司联系人
|
||||
*
|
||||
* @author
|
||||
* @email
|
||||
* @date 2025-09-30 15:57:06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/companycontact")
|
||||
@Api(tags = "后台:公司联系人")
|
||||
public class CompanyContactController extends BaseController {
|
||||
@Autowired
|
||||
private CompanyContactService companyContactService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@ApiOperation("公司联系人列表")
|
||||
@PreAuthorize("@ss.hasPermi('cms:companycontact:list')")
|
||||
@RequestMapping("/list")
|
||||
public TableDataInfo list(CompanyContact companyContact){
|
||||
List<CompanyContact> list=companyContactService.getSelectList(companyContact);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
|
||||
import com.ruoyi.cms.util.RoleUtils;
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import com.ruoyi.cms.service.ICompanyService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 公司Controller
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/company")
|
||||
@Api(tags = "后台:公司管理")
|
||||
public class CompanyController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ICompanyService companyService;
|
||||
|
||||
/**
|
||||
* 查询公司列表
|
||||
*/
|
||||
@ApiOperation("查询公司列表")
|
||||
// @PreAuthorize("@ss.hasPermi('cms:company:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Company company)
|
||||
{
|
||||
if (RoleUtils.isCompanyAdmin()) {
|
||||
System.out.println("企业社会信用代码============================="+RoleUtils.getCurrentUseridCard());
|
||||
company.setCode(RoleUtils.getCurrentUseridCard());
|
||||
}
|
||||
startPage();
|
||||
List<Company> list = companyService.selectCompanyList(company);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出公司列表
|
||||
*/
|
||||
@ApiOperation("导出公司列表")
|
||||
// @PreAuthorize("@ss.hasPermi('app:company:export')")
|
||||
@Log(title = "公司", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Company company)
|
||||
{
|
||||
List<Company> list = companyService.selectCompanyList(company);
|
||||
ExcelUtil<Company> util = new ExcelUtil<Company>(Company.class);
|
||||
util.exportExcel(response, list, "公司数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取公司详细信息
|
||||
*/
|
||||
@ApiOperation("获取公司详细信息")
|
||||
// @PreAuthorize("@ss.hasPermi('app:company:query')")
|
||||
@GetMapping(value = "/{companyId}")
|
||||
public AjaxResult getInfo(@PathVariable("companyId") Long companyId)
|
||||
{
|
||||
return success(companyService.selectCompanyByCompanyId(companyId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增公司
|
||||
*/
|
||||
@ApiOperation("新增公司")
|
||||
// @PreAuthorize("@ss.hasPermi('app:company:add')")
|
||||
@Log(title = "公司", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Company company)
|
||||
{
|
||||
return toAjax(companyService.insertCompany(company));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改公司
|
||||
*/
|
||||
@ApiOperation("修改公司")
|
||||
// @PreAuthorize("@ss.hasPermi('app:company:edit')")
|
||||
@Log(title = "公司", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Company company)
|
||||
{
|
||||
return toAjax(companyService.updateCompany(company));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除公司
|
||||
*/
|
||||
@ApiOperation("删除公司")
|
||||
// @PreAuthorize("@ss.hasPermi('app:company:remove')")
|
||||
@Log(title = "公司", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{companyIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] companyIds)
|
||||
{
|
||||
return toAjax(companyService.deleteCompanyByCompanyIds(companyIds));
|
||||
}
|
||||
|
||||
@ApiOperation("企业资质审核列表")
|
||||
@PreAuthorize("@ss.hasPermi('app:company:approval:list')")
|
||||
@GetMapping("/approval/list")
|
||||
public TableDataInfo approvalList(Company company)
|
||||
{
|
||||
startPage();
|
||||
List<Company> list = companyService.approvalList(company);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@ApiOperation("企业资质修改")
|
||||
// @PreAuthorize("@ss.hasPermi('app:company:approval:edit')")
|
||||
@GetMapping("/approval/edit")
|
||||
public AjaxResult approvalEdit(Company company)
|
||||
{
|
||||
startPage();
|
||||
List<Company> list = companyService.approvalList(company);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ApiOperation("查询公司列表")
|
||||
// @PreAuthorize("@ss.hasPermi('cms:company:list')")
|
||||
@GetMapping("/listPage")
|
||||
public TableDataInfo listPage(Company company)
|
||||
{
|
||||
startPage();
|
||||
List<Company> list = companyService.selectCompanyList(company);
|
||||
return getDataTable(list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import com.ruoyi.cms.domain.EmployeeConfirm;
|
||||
import com.ruoyi.cms.service.EmployeeConfirmService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 新入职员工确认信息
|
||||
*
|
||||
* @author
|
||||
* @email
|
||||
* @date 2025-10-10 10:42:16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/employeeConfirm")
|
||||
@Api(tags = "后台:新入职员工确认信息")
|
||||
public class EmployeeConfirmController extends BaseController {
|
||||
@Autowired
|
||||
private EmployeeConfirmService employeeConfirmService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@ApiOperation("新入职员工确认信息列表")
|
||||
// @PreAuthorize("@ss.hasPermi('cms:employeeConfirm:list')")
|
||||
@RequestMapping("/list")
|
||||
public TableDataInfo list(EmployeeConfirm employeeConfirm){
|
||||
List<EmployeeConfirm> list=employeeConfirmService.getEmployeeConfirmList(employeeConfirm);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@ApiOperation("新增新入职员工确认信息")
|
||||
// @PreAuthorize("@ss.hasPermi('cms:employeeConfirm:add')")
|
||||
@Log(title = "职员工确认信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EmployeeConfirm employeeConfirm){
|
||||
return toAjax(employeeConfirmService.insertEmployeeConfirm(employeeConfirm));
|
||||
}
|
||||
|
||||
@ApiOperation("修改新入职员工确认信息")
|
||||
// @PreAuthorize("@ss.hasPermi('cms:employeeConfirm:edit')")
|
||||
@Log(title = "职员工确认信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody EmployeeConfirm employeeConfirm){
|
||||
return toAjax(employeeConfirmService.updateEmployeeConfirm(employeeConfirm));
|
||||
}
|
||||
|
||||
@ApiOperation("删除新入职员工确认信息")
|
||||
// @PreAuthorize("@ss.hasPermi('app:employeeConfirm:remove')")
|
||||
@Log(title = "公司", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{employeeConfirmIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] employeeConfirmIds)
|
||||
{
|
||||
return toAjax(employeeConfirmService.deleteEmployeeConfirmIds(employeeConfirmIds));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.Industry;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.ruoyi.cms.service.IIndustryService;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 行业Controller
|
||||
*
|
||||
* @author LishunDong
|
||||
* @date 2024-11-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/industry")
|
||||
@Api(tags = "后台:行业管理")
|
||||
public class IndustryController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IIndustryService industryService;
|
||||
|
||||
/**
|
||||
* 查询行业列表
|
||||
*/
|
||||
@ApiOperation("查询行业列表")
|
||||
@PreAuthorize("@ss.hasPermi('cms:industry:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Industry industry)
|
||||
{
|
||||
startPage();
|
||||
List<Industry> list = industryService.selectIndustryList(industry);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@ApiOperation("行业树结构")
|
||||
// @PreAuthorize("@ss.hasPermi('cms:industry:list')")
|
||||
@GetMapping("/treeselect")
|
||||
public AjaxResult treeselect(Industry industry)
|
||||
{
|
||||
List<Industry> industryList = industryService.selectIndustryList(industry);
|
||||
return success(industryService.buildIndustryTreeSelect(industryList));
|
||||
}
|
||||
/**
|
||||
* 导出行业列表
|
||||
*/
|
||||
@ApiOperation("导出行业列表")
|
||||
@PreAuthorize("@ss.hasPermi('cms:industry:export')")
|
||||
@Log(title = "行业", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Industry industry)
|
||||
{
|
||||
List<Industry> list = industryService.selectIndustryList(industry);
|
||||
ExcelUtil<Industry> util = new ExcelUtil<Industry>(Industry.class);
|
||||
util.exportExcel(response, list, "行业数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取行业详细信息
|
||||
*/
|
||||
@ApiOperation("获取行业详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('cms:industry:query')")
|
||||
@GetMapping(value = "/{industryId}")
|
||||
public AjaxResult getInfo(@PathVariable("industryId") Long industryId)
|
||||
{
|
||||
return success(industryService.selectIndustryByIndustryId(industryId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增行业
|
||||
*/
|
||||
@ApiOperation("新增行业")
|
||||
@PreAuthorize("@ss.hasPermi('cms:industry:add')")
|
||||
@Log(title = "行业", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Industry industry)
|
||||
{
|
||||
return toAjax(industryService.insertIndustry(industry));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改行业
|
||||
*/
|
||||
@ApiOperation("修改行业")
|
||||
@PreAuthorize("@ss.hasPermi('cms:industry:edit')")
|
||||
@Log(title = "行业", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Industry industry)
|
||||
{
|
||||
return toAjax(industryService.updateIndustry(industry));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除行业
|
||||
*/
|
||||
@ApiOperation("删除行业")
|
||||
@PreAuthorize("@ss.hasPermi('cms:industry:remove')")
|
||||
@Log(title = "行业", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{industryId}")
|
||||
public AjaxResult remove(@PathVariable Long industryId)
|
||||
{
|
||||
if (industryService.hasChildByIndustryId(industryId))
|
||||
{
|
||||
return warn("存在子行业,不允许删除");
|
||||
}
|
||||
Long[] industryIds = {industryId};
|
||||
return toAjax(industryService.deleteIndustryByIndustryIds(industryIds));
|
||||
}
|
||||
@GetMapping("/import")
|
||||
public AjaxResult importData()
|
||||
{
|
||||
industryService.importData();
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改行业父级代码
|
||||
* select * from industry where length(remark)=1 order by order_num;
|
||||
* select * from industry where length(remark)=3 and remark like 'A%' order by order_num;
|
||||
* select * from industry where length(remark)=4 and remark like 'A01%' order by order_num;
|
||||
* select * from industry where length(remark)=5 and remark like 'A011%' order by order_num;
|
||||
*/
|
||||
@PostMapping("/updateParentHierarchy")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateParentHierarchy() {
|
||||
// 第一层:所有1位长度的大类(orderNum=1 → LENGTH(remark)=1),无前缀过滤(包含20个大类)
|
||||
Industry queryLevel1 = new Industry();
|
||||
queryLevel1.setOrderNum(1L); // 对应 SQL:LENGTH(remark)=1
|
||||
List<Industry> level1List = industryService.selectIndustryList(queryLevel1);
|
||||
|
||||
if (level1List.isEmpty()) {
|
||||
throw new RuntimeException("未查询到1位长度的大类数据");
|
||||
}
|
||||
System.out.println("共查询到 " + level1List.size() + " 个1位大类,开始更新层级关系...");
|
||||
|
||||
// 遍历每个1位大类,处理其下的3位子级
|
||||
for (Industry level1 : level1List) {
|
||||
Long level1Id = level1.getIndustryId();
|
||||
String level1Remark = level1.getRemark();
|
||||
|
||||
// 跳过无效数据(ID或remark为空)
|
||||
if (level1Id == null || level1Remark == null) {
|
||||
System.out.println("跳过无效大类:ID=" + level1Id + ",remark=" + level1Remark);
|
||||
continue;
|
||||
}
|
||||
System.out.println("处理大类:remark=" + level1Remark + ",ID=" + level1Id);
|
||||
|
||||
// 第二层:3位长度(orderNum=3) + 前缀=当前大类remark(比如" B"→"B%")
|
||||
Industry queryLevel2 = new Industry();
|
||||
queryLevel2.setOrderNum(3L); // LENGTH(remark)=3
|
||||
queryLevel2.setRemark(level1Remark); // remark like 'B%'(自动匹配当前大类前缀)
|
||||
List<Industry> level2List = industryService.selectIndustryList(queryLevel2);
|
||||
|
||||
if (level2List.isEmpty()) {
|
||||
System.out.println("大类 " + level1Remark + " 无3位子级,跳过");
|
||||
continue;
|
||||
}
|
||||
|
||||
// 遍历3位子级,处理其下的4位孙级
|
||||
for (Industry level2 : level2List) {
|
||||
Long level2Id = level2.getIndustryId();
|
||||
String level2Remark = level2.getRemark();
|
||||
|
||||
if (level2Id == null || level2Remark == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 第三层:4位长度(orderNum=4) + 前缀=当前3位子级remark(比如"B02"→"B02%")
|
||||
Industry queryLevel3 = new Industry();
|
||||
queryLevel3.setOrderNum(4L); // LENGTH(remark)=4
|
||||
queryLevel3.setRemark(level2Remark); // remark like 'B02%'
|
||||
List<Industry> level3List = industryService.selectIndustryList(queryLevel3);
|
||||
|
||||
if (level3List.isEmpty()) {
|
||||
// 无4位孙级,直接更新3位子级的父ID=1位大类ID
|
||||
updateParentId(level2Id, level1Id);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 遍历4位孙级,处理其下的5位曾孙级
|
||||
for (Industry level3 : level3List) {
|
||||
Long level3Id = level3.getIndustryId();
|
||||
String level3Remark = level3.getRemark();
|
||||
|
||||
if (level3Id == null || level3Remark == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 第四层:5位长度(orderNum=5) + 前缀=当前4位孙级remark(比如"B021"→"B021%")
|
||||
Industry queryLevel4 = new Industry();
|
||||
queryLevel4.setOrderNum(5L); // LENGTH(remark)=5
|
||||
queryLevel4.setRemark(level3Remark); // remark like 'B021%'
|
||||
List<Industry> level4List = industryService.selectIndustryList(queryLevel4);
|
||||
|
||||
// 更新5位曾孙级的父ID=4位孙级ID
|
||||
for (Industry level4 : level4List) {
|
||||
if (level4.getIndustryId() != null && level4.getRemark() != null) {
|
||||
updateParentId(level4.getIndustryId(), level3Id);
|
||||
System.out.println("更新5位数据:" + level4.getRemark() + " → 父ID=" + level3Id);
|
||||
}
|
||||
}
|
||||
|
||||
// 更新4位孙级的父ID=3位子级ID
|
||||
updateParentId(level3Id, level2Id);
|
||||
System.out.println("更新4位数据:" + level3Remark + " → 父ID=" + level2Id);
|
||||
}
|
||||
|
||||
// 更新3位子级的父ID=1位大类ID
|
||||
updateParentId(level2Id, level1Id);
|
||||
System.out.println("更新3位数据:" + level2Remark + " → 父ID=" + level1Id);
|
||||
}
|
||||
}
|
||||
System.out.println("层级关系更新完成!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改行业父级代码
|
||||
* @param targetIndustryId
|
||||
* @param parentId
|
||||
*/
|
||||
private void updateParentId(Long targetIndustryId, Long parentId) {
|
||||
Industry updateIndustry = new Industry();
|
||||
updateIndustry.setIndustryId(targetIndustryId);
|
||||
updateIndustry.setParentId(parentId);
|
||||
industryService.updateIndustry(updateIndustry);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import com.alibaba.excel.util.StringUtils;
|
||||
import com.ruoyi.cms.domain.Job;
|
||||
import com.ruoyi.cms.domain.JobApply;
|
||||
import com.ruoyi.cms.domain.vo.CandidateVO;
|
||||
import com.ruoyi.cms.service.IAppUserService;
|
||||
import com.ruoyi.cms.service.IJobApplyService;
|
||||
import com.ruoyi.cms.util.RoleUtils;
|
||||
import com.ruoyi.cms.util.StringUtil;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.AppUser;
|
||||
import com.ruoyi.common.core.domain.entity.Company;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/cms/jobApply")
|
||||
@Api(tags = "后台:岗位申请")
|
||||
public class JobApplyController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
IJobApplyService iJobApplyService;
|
||||
@Autowired
|
||||
private IAppUserService appUserService;
|
||||
|
||||
@GetMapping("/trendChart")
|
||||
public AjaxResult trendChart(JobApply jobApply)
|
||||
{
|
||||
HashMap<String,Integer> result = iJobApplyService.trendChart(jobApply);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出APP用户列表
|
||||
*/
|
||||
@ApiOperation("导出岗位申请APP用户")
|
||||
@PreAuthorize("@ss.hasPermi('cms:jobApply:export')")
|
||||
@Log(title = "APP用户", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Job job)
|
||||
{
|
||||
List<CandidateVO> list = iJobApplyService.selectAppUserList(job);
|
||||
ExcelUtil<CandidateVO> util = new ExcelUtil<CandidateVO>(CandidateVO.class);
|
||||
util.exportExcel(response, list, "APP用户数据");
|
||||
}
|
||||
|
||||
@ApiOperation("获取求职者列表")
|
||||
@PreAuthorize("@ss.hasPermi('cms:jobApply:applyJobUserList')")
|
||||
@GetMapping("/applyJobUserList")
|
||||
public TableDataInfo applyJobList(AppUser appUser)
|
||||
{
|
||||
if (RoleUtils.isCompanyAdmin()) {
|
||||
Company company=new Company();
|
||||
company.setCode(RoleUtils.getCurrentUseridCard());
|
||||
}
|
||||
startPage();
|
||||
List<CandidateVO> list = iJobApplyService.selectApplyJobUserList(appUser);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log(title = "岗位", businessType = BusinessType.UPDATE)
|
||||
@ApiOperation("用户申请岗位")
|
||||
public AjaxResult apply(@RequestBody JobApply jobApply)
|
||||
{
|
||||
if(jobApply.getJobId()==null){
|
||||
return AjaxResult.error("岗位id为空");
|
||||
}
|
||||
if(!SecurityUtils.isLogin()){
|
||||
return AjaxResult.error("用户未登录!");
|
||||
}
|
||||
if(jobApply.getUserId()==null){
|
||||
String idCard=RoleUtils.getCurrentUseridCard();
|
||||
AppUser appUser=appUserService.selectAppuserByIdcard(idCard);
|
||||
if(appUser==null){
|
||||
return AjaxResult.error("用户信息未完善,请完善身份证信息!");
|
||||
}else{
|
||||
jobApply.setUserId(appUser.getUserId());
|
||||
}
|
||||
}
|
||||
return success(iJobApplyService.applyComJob(jobApply));
|
||||
}
|
||||
|
||||
@Log(title = "岗位", businessType = BusinessType.UPDATE)
|
||||
@ApiOperation("求职者管理-用户列表录用")
|
||||
@PutMapping("/applyAgree")
|
||||
public AjaxResult applyAgree(@RequestBody JobApply jobApply)
|
||||
{
|
||||
if(jobApply.getId()==null){
|
||||
return AjaxResult.error("参数id为空");
|
||||
}
|
||||
jobApply.setHire(StringUtil.HIRE_LY);
|
||||
jobApply.setHireSource(StringUtil.HIRE_SOURCE_SYSTEM);
|
||||
return success(iJobApplyService.updateJobApply(jobApply));
|
||||
}
|
||||
|
||||
@Log(title = "岗位", businessType = BusinessType.INSERT)
|
||||
@ApiOperation("招聘会-岗位申请")
|
||||
@PostMapping("/zphApply")
|
||||
public AjaxResult zphApply(@RequestBody JobApply jobApply)
|
||||
{
|
||||
if(jobApply.getJobId()==null){
|
||||
return AjaxResult.error("岗位id为空");
|
||||
}
|
||||
String idCard = jobApply.getIdCard();
|
||||
if(StringUtils.isBlank(idCard)){
|
||||
return AjaxResult.error("身份证为空!");
|
||||
}
|
||||
if (!idCard.matches(StringUtil.SFZ_VALID_REGEX)) {
|
||||
return AjaxResult.error("身份证格式不正确");
|
||||
}
|
||||
AppUser appUser=appUserService.selectAppuserByIdcard(idCard);
|
||||
if(appUser==null){
|
||||
return AjaxResult.error("在系统库中未查询到当前用户信息!");
|
||||
}
|
||||
jobApply.setUserId(appUser.getUserId());
|
||||
JobApply parm=new JobApply();
|
||||
parm.setJobId(jobApply.getJobId());
|
||||
parm.setUserId(appUser.getUserId());
|
||||
List<JobApply> applies=iJobApplyService.selectJobApplyList(parm);
|
||||
if(applies!=null&&applies.size()>0){
|
||||
return AjaxResult.error("当前用户,已申请过该岗位,请勿重复申请!");
|
||||
}
|
||||
return success(iJobApplyService.applyComJob(jobApply));
|
||||
}
|
||||
|
||||
@Log(title = "岗位", businessType = BusinessType.INSERT)
|
||||
@ApiOperation("招聘会-岗位录用")
|
||||
@PostMapping("/zphApplyAgree")
|
||||
public AjaxResult zphApplyAgree(@RequestBody JobApply jobApply)
|
||||
{
|
||||
if(jobApply.getJobId()==null){
|
||||
return AjaxResult.error("岗位id为空");
|
||||
}
|
||||
String idCard = jobApply.getIdCard();
|
||||
if(StringUtils.isBlank(idCard)){
|
||||
return AjaxResult.error("身份证为空!");
|
||||
}
|
||||
if (!idCard.matches(StringUtil.SFZ_VALID_REGEX)) {
|
||||
return AjaxResult.error("身份证格式不正确");
|
||||
}
|
||||
AppUser appUser=appUserService.selectAppuserByIdcard(idCard);
|
||||
if(appUser==null){
|
||||
return AjaxResult.error("在系统库中未查询到当前用户信息!");
|
||||
}
|
||||
jobApply.setUserId(appUser.getUserId());
|
||||
jobApply.setHire(StringUtil.HIRE_LY);
|
||||
jobApply.setHireSource(StringUtil.HIRE_SOURCE_ZPH);
|
||||
return success(iJobApplyService.updateJobZphApply(jobApply));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import com.ruoyi.cms.domain.JobContact;
|
||||
import com.ruoyi.cms.service.JobContactService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 岗位联系人
|
||||
*
|
||||
* @author
|
||||
* @email
|
||||
* @date 2025-09-30 15:57:06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/jobcontact")
|
||||
@Api(tags = "后台:岗位联系人")
|
||||
public class JobContactController extends BaseController {
|
||||
@Autowired
|
||||
private JobContactService jobContactService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@ApiOperation("岗位联系人列表")
|
||||
@PreAuthorize("@ss.hasPermi('cms:jobcontact:list')")
|
||||
@RequestMapping("/list")
|
||||
public TableDataInfo list(JobContact jobContact){
|
||||
startPage();
|
||||
List<JobContact> list = jobContactService.getSelectList(jobContact);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.ruoyi.cms.domain.JobFair;
|
||||
import com.ruoyi.cms.service.IJobFairService;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 招聘会信息Controller
|
||||
*
|
||||
* @author lishundong
|
||||
* @date 2024-09-04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/fair")
|
||||
@Api(tags = "后台:招聘会信息")
|
||||
public class JobFairController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IJobFairService jobFairService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询招聘会信息列表
|
||||
*/
|
||||
@ApiOperation("查询招聘会信息列表")
|
||||
@PreAuthorize("@ss.hasPermi('jobfair:list:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(JobFair jobFair)
|
||||
{
|
||||
startPage();
|
||||
List<JobFair> list = jobFairService.selectJobFairList(jobFair);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出招聘会信息列表
|
||||
*/
|
||||
@ApiOperation("导出招聘会信息列表")
|
||||
@PreAuthorize("@ss.hasPermi('app:fair:export')")
|
||||
@Log(title = "招聘会信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, JobFair jobFair)
|
||||
{
|
||||
List<JobFair> list = jobFairService.selectJobFairList(jobFair);
|
||||
ExcelUtil<JobFair> util = new ExcelUtil<JobFair>(JobFair.class);
|
||||
util.exportExcel(response, list, "招聘会信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取招聘会信息详细信息
|
||||
*/
|
||||
@ApiOperation("获取招聘会信息详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('app:fair:query')")
|
||||
@GetMapping(value = "/{jobFairId}")
|
||||
public AjaxResult getInfo(@PathVariable("jobFairId") Long jobFairId)
|
||||
{
|
||||
return success(jobFairService.selectJobFairByJobFairId(jobFairId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增招聘会信息
|
||||
*/
|
||||
@ApiOperation("新增招聘会信息")
|
||||
@PreAuthorize("@ss.hasPermi('app:fair:add')")
|
||||
@Log(title = "招聘会信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody JobFair jobFair)
|
||||
{
|
||||
return toAjax(jobFairService.insertJobFair(jobFair));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改招聘会信息
|
||||
*/
|
||||
@ApiOperation("修改招聘会信息")
|
||||
@PreAuthorize("@ss.hasPermi('app:fair:edit')")
|
||||
@Log(title = "招聘会信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody JobFair jobFair)
|
||||
{
|
||||
return toAjax(jobFairService.updateJobFair(jobFair));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除招聘会信息
|
||||
*/
|
||||
@ApiOperation("删除招聘会信息")
|
||||
@PreAuthorize("@ss.hasPermi('app:fair:remove')")
|
||||
@Log(title = "招聘会信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{jobFairIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] jobFairIds)
|
||||
{
|
||||
return toAjax(jobFairService.deleteJobFairByJobFairIds(jobFairIds));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.cms.domain.BussinessDictData;
|
||||
import com.ruoyi.common.core.domain.entity.Industry;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.ruoyi.common.core.domain.entity.JobTitle;
|
||||
import com.ruoyi.cms.service.IJobTitleService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 岗位Controller
|
||||
*
|
||||
* @author Lishundong
|
||||
* @date 2024-11-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/job/titile")
|
||||
@Api(tags = "后台:职位接口")
|
||||
public class JobTitleController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IJobTitleService jobTitleService;
|
||||
|
||||
/**
|
||||
* 查询岗位列表
|
||||
*/
|
||||
@ApiOperation("查询岗位列表")
|
||||
@PreAuthorize("@ss.hasPermi('cms:title:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(JobTitle jobTitle)
|
||||
{
|
||||
startPage();
|
||||
List<JobTitle> list = jobTitleService.selectJobTitleList(jobTitle);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出岗位列表
|
||||
*/
|
||||
@ApiOperation("导出岗位列表")
|
||||
@PreAuthorize("@ss.hasPermi('cms:title:export')")
|
||||
@Log(title = "岗位", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, JobTitle jobTitle)
|
||||
{
|
||||
List<JobTitle> list = jobTitleService.selectJobTitleList(jobTitle);
|
||||
ExcelUtil<JobTitle> util = new ExcelUtil<JobTitle>(JobTitle.class);
|
||||
util.exportExcel(response, list, "岗位数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取岗位详细信息
|
||||
*/
|
||||
@ApiOperation("获取岗位详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('cms:title:query')")
|
||||
@GetMapping(value = "/{jobId}")
|
||||
public AjaxResult getInfo(@PathVariable("jobId") Long jobId)
|
||||
{
|
||||
return success(jobTitleService.selectJobTitleByJobId(jobId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增岗位
|
||||
*/
|
||||
@ApiOperation("新增岗位")
|
||||
@PreAuthorize("@ss.hasPermi('cms:title:add')")
|
||||
@Log(title = "岗位", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody JobTitle jobTitle)
|
||||
{
|
||||
return toAjax(jobTitleService.insertJobTitle(jobTitle));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改岗位
|
||||
*/
|
||||
@ApiOperation("修改岗位")
|
||||
@PreAuthorize("@ss.hasPermi('cms:title:edit')")
|
||||
@Log(title = "岗位", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody JobTitle jobTitle)
|
||||
{
|
||||
return toAjax(jobTitleService.updateJobTitle(jobTitle));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除岗位
|
||||
*/
|
||||
@ApiOperation("删除岗位")
|
||||
@PreAuthorize("@ss.hasPermi('cms:title:remove')")
|
||||
@Log(title = "岗位", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{jobId}")
|
||||
public AjaxResult remove(@PathVariable Long jobId)
|
||||
{
|
||||
if (jobTitleService.hasChildByJobId(jobId))
|
||||
{
|
||||
return warn("存在子岗位,不允许删除");
|
||||
}
|
||||
Long[] jobIds = {jobId};
|
||||
return toAjax(jobTitleService.deleteJobTitleByJobIds(jobIds));
|
||||
}
|
||||
@ApiOperation("行业树结构")
|
||||
@GetMapping("/treeselect")
|
||||
public AjaxResult treeselect(JobTitle jobTitle)
|
||||
{
|
||||
List<JobTitle> jobTitleList = jobTitleService.selectJobTitleList(jobTitle);
|
||||
return success(jobTitleService.buildJobTitleTreeSelect(jobTitleList));
|
||||
}
|
||||
|
||||
@GetMapping("/import")
|
||||
public AjaxResult importJobTitle()
|
||||
{
|
||||
jobTitleService.importJobTitle();
|
||||
return success();
|
||||
}
|
||||
|
||||
@GetMapping("/levelOne")
|
||||
public AjaxResult levelOne()
|
||||
{
|
||||
List<JobTitle> result = jobTitleService.levelOne();
|
||||
return success(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import com.ruoyi.cms.domain.SensitiveWordData;
|
||||
import com.ruoyi.cms.service.SensitiveWordDataService;
|
||||
import com.ruoyi.cms.util.EasyExcelUtils;
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 敏感词库
|
||||
*
|
||||
* @author
|
||||
* @email
|
||||
* @date 2025-10-10 10:42:16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/sensitiveworddata")
|
||||
@Api(tags = "后台:敏感词库")
|
||||
@Anonymous
|
||||
public class SensitiveWordDataController extends BaseController {
|
||||
@Autowired
|
||||
private SensitiveWordDataService sensitiveWordDataService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@ApiOperation("敏感词库详细信息")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SensitiveWordData sensitiveWordData){
|
||||
startPage();
|
||||
List<SensitiveWordData> list = sensitiveWordDataService.selectSensitiveworddataList(sensitiveWordData);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取详细信息
|
||||
*/
|
||||
@ApiOperation("获取敏感词库详细信息")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult list(@PathVariable("id") Long id){
|
||||
return success(sensitiveWordDataService.selectById(id));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@ApiOperation("新增敏感词")
|
||||
@Log(title = "敏感词", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult save(@RequestBody SensitiveWordData sensitiveWordData){
|
||||
|
||||
return toAjax(sensitiveWordDataService.insertSensitiveworddata(sensitiveWordData));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@ApiOperation("修改敏感词")
|
||||
@Log(title = "敏感词", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SensitiveWordData sensitiveWordData){
|
||||
return toAjax(sensitiveWordDataService.updateSensitiveworddata(sensitiveWordData));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除敏感词
|
||||
*/
|
||||
@ApiOperation("删除敏感词")
|
||||
@Log(title = "敏感词", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
if(ids.length==0){
|
||||
return AjaxResult.error("请传递参数!");
|
||||
}
|
||||
return toAjax(sensitiveWordDataService.deleteSensitiveworddataIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用上传请求(单个)
|
||||
*/
|
||||
@PostMapping("/exoprt")
|
||||
public AjaxResult uploadFile(@RequestParam("file") MultipartFile file) throws Exception
|
||||
{
|
||||
// 参数校验
|
||||
if (file.isEmpty()) {
|
||||
return AjaxResult.error("上传文件不能为空");
|
||||
}
|
||||
String fileName = file.getOriginalFilename();
|
||||
//类型验证
|
||||
if (fileName == null || !fileName.endsWith(".xlsx") && !fileName.endsWith(".xls")) {
|
||||
return AjaxResult.error("请上传Excel格式的文件");
|
||||
}
|
||||
//名称验证
|
||||
if (fileName == null || !"mgc.xlsx".equals(fileName)) {
|
||||
return AjaxResult.error("请上传正确的模板文件:mgc.xlsx");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
InputStream inputStream = file.getInputStream();
|
||||
EasyExcelUtils.readExcelByBatch(inputStream, SensitiveWordData.class, 100, list -> {
|
||||
// 处理逻辑:如批量保存到数据库
|
||||
sensitiveWordDataService.batchInsert(list);
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/downloadModel")
|
||||
public void downloadModel(HttpServletRequest request, HttpServletResponse response)throws Exception{
|
||||
String name = "mgc.xlsx";
|
||||
String pathFile="/data/downloadmodel/"+name;
|
||||
File url = new File(pathFile);
|
||||
|
||||
String resMsg = "";
|
||||
try {
|
||||
request.setCharacterEncoding("utf-8");
|
||||
} catch (UnsupportedEncodingException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
try {
|
||||
name = new String(name.getBytes("gb2312"), "ISO8859-1");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
response.reset();
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment; filename="+ name);
|
||||
response.setHeader("Pragma", "public");
|
||||
response.setHeader("Cache-Control", "max-age=0");
|
||||
InputStream in = null;
|
||||
try {
|
||||
in = new FileInputStream(url);
|
||||
} catch (FileNotFoundException e1) {
|
||||
resMsg = "文件未找到";
|
||||
e1.printStackTrace();
|
||||
response.getWriter().write(resMsg + ":" + name);
|
||||
}
|
||||
OutputStream ou = response.getOutputStream();
|
||||
byte[] buffer = new byte[1024];
|
||||
int i = -1;
|
||||
while ((i = in.read(buffer)) != -1) {
|
||||
ou.write(buffer, 0, i);
|
||||
}
|
||||
ou.flush();
|
||||
ou.close();
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import com.ruoyi.cms.domain.BussinessDictType;
|
||||
import com.ruoyi.cms.domain.query.Staticsquery;
|
||||
import com.ruoyi.cms.service.StaticsqueryService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/cms/statics")
|
||||
public class StaticsController extends BaseController {
|
||||
@Autowired
|
||||
private StaticsqueryService service;
|
||||
//分行业趋势分析
|
||||
@GetMapping("/industry")
|
||||
public AjaxResult industry(Staticsquery staticsquery)
|
||||
{
|
||||
Map<String,Object> result = service.industry(staticsquery);
|
||||
return success(result);
|
||||
}
|
||||
//分行业趋势分析
|
||||
@GetMapping("/industryGen")
|
||||
public AjaxResult industryGen()
|
||||
{
|
||||
service.industryGen();
|
||||
return success();
|
||||
}
|
||||
//分行业趋势分析
|
||||
@GetMapping("/industryAreaGen")
|
||||
public AjaxResult industryAreaGen()
|
||||
{
|
||||
service.areaGen();
|
||||
return success();
|
||||
}
|
||||
//分行业趋势分析
|
||||
@GetMapping("/salaryGen")
|
||||
public AjaxResult salarysalaryGen()
|
||||
{
|
||||
service.salarysalaryGen();
|
||||
return success();
|
||||
}
|
||||
@GetMapping("/salary")
|
||||
public AjaxResult salary(Staticsquery staticsquery)
|
||||
{
|
||||
Map<String,Object> result = service.salary(staticsquery);
|
||||
return success(result);
|
||||
}
|
||||
@GetMapping("/industryArea")
|
||||
public AjaxResult industryArea(Staticsquery staticsquery)
|
||||
{
|
||||
Map<String,Object> result = service.industryArea(staticsquery);
|
||||
return success(result);
|
||||
}
|
||||
//分行业趋势分析
|
||||
@GetMapping("/workYearGen")
|
||||
public AjaxResult workYearGen()
|
||||
{
|
||||
service.workYearGen();
|
||||
return success();
|
||||
}
|
||||
@GetMapping("/workYear")
|
||||
public AjaxResult workYear(Staticsquery staticsquery)
|
||||
{
|
||||
Map<String,Object> result = service.workYear(staticsquery);
|
||||
return success(result);
|
||||
}
|
||||
//分行业趋势分析
|
||||
@GetMapping("/educationGen")
|
||||
public AjaxResult educationGen()
|
||||
{
|
||||
service.educationGen();
|
||||
return success();
|
||||
}
|
||||
@GetMapping("/education")
|
||||
public AjaxResult education(Staticsquery staticsquery)
|
||||
{
|
||||
Map<String,Object> result = service.education(staticsquery);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
//分学历-分薪资
|
||||
@GetMapping("/educationSalaryGen")
|
||||
public AjaxResult educationSalaryGen()
|
||||
{
|
||||
service.educationSalaryGen();
|
||||
return success();
|
||||
}
|
||||
|
||||
@GetMapping("/educationSalary")
|
||||
public AjaxResult educationSalary(Staticsquery staticsquery)
|
||||
{
|
||||
Map<String,Object> result = service.educationSalary(staticsquery);
|
||||
return success(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.annotation.BussinessLog;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.ruoyi.cms.domain.SubwayLine;
|
||||
import com.ruoyi.cms.service.ISubwayLineService;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 地铁线路Controller
|
||||
*
|
||||
* @author Lishundong
|
||||
* @date 2024-11-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/line")
|
||||
@Api(tags = "后台:地铁线路")
|
||||
public class SubwayLineController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISubwayLineService subwayLineService;
|
||||
|
||||
/**
|
||||
* 查询地铁线路列表
|
||||
*/
|
||||
@ApiOperation("查询地铁线路列表")
|
||||
@GetMapping("/list")
|
||||
@BussinessLog(title = "查询地铁线路列表", businessType = BusinessType.CLEAN)
|
||||
public TableDataInfo list(SubwayLine subwayLine)
|
||||
{
|
||||
startPage();
|
||||
List<SubwayLine> list = subwayLineService.selectSubwayLineList(subwayLine);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取地铁线路详细信息
|
||||
*/
|
||||
@ApiOperation("获取地铁线路详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('system:line:query')")
|
||||
@GetMapping(value = "/{lineId}")
|
||||
public AjaxResult getInfo(@PathVariable("lineId") Long lineId)
|
||||
{
|
||||
return success(subwayLineService.selectSubwayLineByLineId(lineId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增地铁线路
|
||||
*/
|
||||
@ApiOperation("新增地铁线路")
|
||||
@PreAuthorize("@ss.hasPermi('system:line:add')")
|
||||
@Log(title = "地铁线路", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SubwayLine subwayLine)
|
||||
{
|
||||
return toAjax(subwayLineService.insertSubwayLine(subwayLine));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改地铁线路
|
||||
*/
|
||||
@ApiOperation("修改地铁线路")
|
||||
@PreAuthorize("@ss.hasPermi('system:line:edit')")
|
||||
@Log(title = "地铁线路", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SubwayLine subwayLine)
|
||||
{
|
||||
return toAjax(subwayLineService.updateSubwayLine(subwayLine));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除地铁线路
|
||||
*/
|
||||
@ApiOperation("删除地铁线路")
|
||||
@PreAuthorize("@ss.hasPermi('system:line:remove')")
|
||||
@Log(title = "地铁线路", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{lineId}")
|
||||
public AjaxResult remove(@PathVariable Long lineId)
|
||||
{
|
||||
return toAjax(subwayLineService.deleteSubwayLineByLineIds(lineId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.ruoyi.cms.domain.SubwayStation;
|
||||
import com.ruoyi.cms.service.ISubwayStationService;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 地铁站点Controller
|
||||
*
|
||||
* @author Lishundong
|
||||
* @date 2024-11-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/station")
|
||||
@Api(tags = "后台:地铁站点")
|
||||
public class SubwayStationController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISubwayStationService subwayStationService;
|
||||
|
||||
/**
|
||||
* 查询地铁站点列表
|
||||
*/
|
||||
@ApiOperation("查询地铁站点列表")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SubwayStation subwayStation)
|
||||
{
|
||||
startPage();
|
||||
List<SubwayStation> list = subwayStationService.selectSubwayStationList(subwayStation);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取地铁站点详细信息
|
||||
*/
|
||||
@ApiOperation("获取地铁站点详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('system:station:query')")
|
||||
@GetMapping(value = "/{stationId}")
|
||||
public AjaxResult getInfo(@PathVariable("stationId") Long stationId)
|
||||
{
|
||||
return success(subwayStationService.selectSubwayStationByStationId(stationId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增地铁站点
|
||||
*/
|
||||
@ApiOperation("新增地铁站点")
|
||||
@PreAuthorize("@ss.hasPermi('system:station:add')")
|
||||
@Log(title = "地铁站点", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SubwayStation subwayStation)
|
||||
{
|
||||
return toAjax(subwayStationService.insertSubwayStation(subwayStation));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改地铁站点
|
||||
*/
|
||||
@ApiOperation("修改地铁站点")
|
||||
@PreAuthorize("@ss.hasPermi('system:station:edit')")
|
||||
@Log(title = "地铁站点", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SubwayStation subwayStation)
|
||||
{
|
||||
return toAjax(subwayStationService.updateSubwayStation(subwayStation));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除地铁站点
|
||||
*/
|
||||
@ApiOperation("删除地铁站点")
|
||||
@PreAuthorize("@ss.hasPermi('system:station:remove')")
|
||||
@Log(title = "地铁站点", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{stationIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] stationIds)
|
||||
{
|
||||
return toAjax(subwayStationService.deleteSubwayStationByStationIds(stationIds));
|
||||
}
|
||||
@GetMapping("/import")
|
||||
public AjaxResult importStation(){
|
||||
subwayStationService.importStation();
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
|
||||
import com.ruoyi.cms.service.SysAreaService;
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysArea;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 地区层级表
|
||||
*
|
||||
* @author
|
||||
* @email
|
||||
* @date 2025-11-10 15:56:00
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/dict/sysarea")
|
||||
@Anonymous
|
||||
public class SysAreaController {
|
||||
|
||||
@Autowired
|
||||
private SysAreaService sysAreaService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public AjaxResult jobCategory(SysArea sysArea){
|
||||
return AjaxResult.success(sysAreaService.getList(sysArea));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import com.ruoyi.cms.service.IAppUserService;
|
||||
import com.ruoyi.cms.util.RoleUtils;
|
||||
import com.ruoyi.common.core.domain.entity.AppUser;
|
||||
import com.ruoyi.common.core.domain.entity.UserWorkExperiences;
|
||||
import com.ruoyi.cms.service.UserWorkExperiencesService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 用户工作经历表
|
||||
*
|
||||
* @author
|
||||
* @email
|
||||
* @date 2025-10-10 16:26:26
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/userworkexperiences")
|
||||
@Api(tags = "后台:用户工作经历")
|
||||
public class UserWorkExperiencesController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private UserWorkExperiencesService userWorkExperiencesService;
|
||||
@Autowired
|
||||
private IAppUserService appUserService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@ApiOperation("工作经历列表信息")
|
||||
@PreAuthorize("@ss.hasPermi('management:match:details')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(UserWorkExperiences userWorkExperiences){
|
||||
startPage();
|
||||
List<UserWorkExperiences> list=userWorkExperiencesService.getWorkExperiencesList(userWorkExperiences);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
/**
|
||||
* 获取详细信息
|
||||
*/
|
||||
@ApiOperation("获取工作经历详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('management:match:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult query(@PathVariable("id") Long id){
|
||||
return success(userWorkExperiencesService.getWorkExperiencesById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@ApiOperation("新增工作经历")
|
||||
@Log(title = "工作经历", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody UserWorkExperiences userWorkExperiences){
|
||||
if(userWorkExperiences.getUserId()==null){
|
||||
AppUser appUser=appUserService.selectAppuserByIdcard(RoleUtils.getCurrentUseridCard());
|
||||
if(appUser==null){
|
||||
return AjaxResult.error("未传递userId!");
|
||||
}
|
||||
userWorkExperiences.setUserId(appUser.getUserId());
|
||||
}
|
||||
return toAjax(userWorkExperiencesService.insertWorkExperiences(userWorkExperiences));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@ApiOperation("修改工作经历")
|
||||
@Log(title = "工作经历", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult update(@RequestBody UserWorkExperiences userWorkExperiences){
|
||||
if (userWorkExperiences.getId()==null){
|
||||
return AjaxResult.error("参数id未传递!");
|
||||
}
|
||||
return toAjax(userWorkExperiencesService.updateWorkExperiencesById(userWorkExperiences));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@ApiOperation("删除工作经历")
|
||||
@Log(title = "工作经历", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids){
|
||||
if(ids.length==0){
|
||||
return AjaxResult.error("参数ids未传递!");
|
||||
}
|
||||
return toAjax(userWorkExperiencesService.deleteWorkExperiencesIds(ids));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.ruoyi.cms.domain.WechatGroup;
|
||||
import com.ruoyi.cms.domain.vo.WechatGroupVo;
|
||||
import com.ruoyi.cms.service.IWechatGroupService;
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/cms/wechatGroup")
|
||||
@Api(tags = "后台:转发对象管理")
|
||||
public class WechatGroupController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IWechatGroupService wechatGroupService;
|
||||
|
||||
|
||||
@ApiOperation("查询转发对象列表")
|
||||
@PreAuthorize("@ss.hasPermi('application:group:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WechatGroup wechatGroup) {
|
||||
startPage();
|
||||
List<WechatGroupVo> list = wechatGroupService.selectWechatGroupList(wechatGroup);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("新增转发对象")
|
||||
@PreAuthorize("@ss.hasPermi('application:group:add')")
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WechatGroup wechatGroup) {
|
||||
return toAjax(wechatGroupService.save(wechatGroup));
|
||||
}
|
||||
|
||||
@ApiOperation("修改转发对象")
|
||||
@PreAuthorize("@ss.hasPermi('application:group:update')")
|
||||
@PutMapping
|
||||
public AjaxResult update(@RequestBody WechatGroup wechatGroup) {
|
||||
return toAjax(wechatGroupService.updateById(wechatGroup));
|
||||
}
|
||||
|
||||
@ApiOperation("删除转发对象")
|
||||
@PreAuthorize("@ss.hasPermi('application:group:del')")
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable("ids") Long[] ids) {
|
||||
return toAjax(wechatGroupService.removeBatchByIds(CollUtil.newArrayList(ids)));
|
||||
}
|
||||
|
||||
@GetMapping("/enableList")
|
||||
@Anonymous
|
||||
public List<WechatGroupVo> enableList() {
|
||||
WechatGroup wechatGroup = new WechatGroup();
|
||||
wechatGroup.setIsPush(1);
|
||||
return wechatGroupService.selectWechatGroupList(wechatGroup)
|
||||
.stream().peek(e->e.setPhoneNumber(""))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.ruoyi.cms.cron;
|
||||
|
||||
import com.ruoyi.cms.mapper.JobMapper;
|
||||
import com.ruoyi.cms.service.IBussinessOperLogService;
|
||||
import com.ruoyi.cms.service.ICompanyService;
|
||||
import com.ruoyi.cms.service.IESJobSearchService;
|
||||
import com.ruoyi.cms.service.IJobService;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
public class JobCron {
|
||||
public void isHot(){
|
||||
SpringUtils.getBean(JobMapper.class).isHot();
|
||||
}
|
||||
public void resetEs(){
|
||||
SpringUtils.getBean(IESJobSearchService.class).resetTextCache();
|
||||
}
|
||||
//查看索引是否存在,如果不存在,就更新
|
||||
public void checkEsAndFix(){
|
||||
SpringUtils.getBean(IESJobSearchService.class).checkEsAndFix();
|
||||
}
|
||||
//更新公司的招聘数量
|
||||
public void updateJobCountOfCompany(){
|
||||
SpringUtils.getBean(ICompanyService.class).updateJobCountOfCompany();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.ruoyi.cms.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import com.ruoyi.common.xss.Xss;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
@Data
|
||||
@ApiModel("APP通知")
|
||||
@TableName(value = "app_notice")
|
||||
public class AppNotice extends BaseEntity
|
||||
{
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "notice_id",type = IdType.AUTO)
|
||||
@ApiModelProperty("公司id")
|
||||
private Long noticeId;
|
||||
|
||||
@Xss(message = "消息标题不能包含脚本字符")
|
||||
@NotBlank(message = "消息标题不能为空")
|
||||
@Size(min = 0, max = 50, message = "消息标题不能超过50个字符")
|
||||
private String noticeTitle;
|
||||
|
||||
@ApiModelProperty("消息类型")
|
||||
private String noticeType;
|
||||
|
||||
@ApiModelProperty("消息内容")
|
||||
private String noticeContent;
|
||||
|
||||
@ApiModelProperty("消息状态 0正常 1关闭")
|
||||
private String status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.ruoyi.cms.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
/**
|
||||
* 用户岗位浏览记录对象 app_review_job
|
||||
* @author ${author}
|
||||
* @date 2025-02-14
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("用户岗位浏览记录")
|
||||
@TableName(value = "app_review_job")
|
||||
public class AppReviewJob extends BaseEntity
|
||||
{
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("用户id")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("岗位id")
|
||||
private Long jobId;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "浏览日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty("浏览日期")
|
||||
private String reviewDate;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.ruoyi.cms.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.annotation.Excel.ColumnType;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
|
||||
@Data
|
||||
@ApiModel("业务数据表")
|
||||
@TableName(value = "bussiness_dict_data")
|
||||
public class BussinessDictData extends BaseEntity
|
||||
{
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("字典编码")
|
||||
@Excel(name = "字典编码", cellType = ColumnType.NUMERIC)
|
||||
@TableId(value = "dict_code",type = IdType.AUTO)
|
||||
private Long dictCode;
|
||||
|
||||
@ApiModelProperty("字典排序")
|
||||
@Excel(name = "字典排序", cellType = ColumnType.NUMERIC)
|
||||
private Long dictSort;
|
||||
|
||||
@Excel(name = "字典标签")
|
||||
@ApiModelProperty("字典标签")
|
||||
@NotBlank(message = "字典标签不能为空")
|
||||
@Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符")
|
||||
private String dictLabel;
|
||||
|
||||
@Excel(name = "字典键值")
|
||||
@ApiModelProperty("字典键值")
|
||||
@NotBlank(message = "字典键值不能为空")
|
||||
@Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符")
|
||||
private String dictValue;
|
||||
|
||||
@ApiModelProperty("字典类型")
|
||||
@Excel(name = "字典类型")
|
||||
@NotBlank(message = "字典类型不能为空")
|
||||
@Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符")
|
||||
private String dictType;
|
||||
|
||||
@ApiModelProperty("样式属性(其他样式扩展)")
|
||||
@Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符")
|
||||
private String cssClass;
|
||||
|
||||
@ApiModelProperty("表格字典样式")
|
||||
@Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符")
|
||||
private String listClass;
|
||||
|
||||
@ApiModelProperty("是否默认(Y是 N否)")
|
||||
@Excel(name = "是否默认", readConverterExp = "Y=是,N=否")
|
||||
private String isDefault;
|
||||
|
||||
@ApiModelProperty("状态 0=正常,1=停用 ")
|
||||
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.ruoyi.cms.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.annotation.Excel.ColumnType;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
|
||||
@Data
|
||||
@ApiModel("字典类型表")
|
||||
@TableName(value = "bussiness_dict_type")
|
||||
public class BussinessDictType extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 字典主键 */
|
||||
@Excel(name = "字典主键", cellType = ColumnType.NUMERIC)
|
||||
private Long dictId;
|
||||
|
||||
/** 字典名称 */
|
||||
@Excel(name = "字典名称")
|
||||
@NotBlank(message = "字典名称不能为空")
|
||||
@Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符")
|
||||
private String dictName;
|
||||
|
||||
/** 字典类型 */
|
||||
@Excel(name = "字典类型")
|
||||
@NotBlank(message = "字典类型不能为空")
|
||||
@Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符")
|
||||
@Pattern(regexp = "^[a-z][a-z0-9_]*$", message = "字典类型必须以字母开头,且只能为(小写字母,数字,下滑线)")
|
||||
private String dictType;
|
||||
|
||||
/** 状态(0正常 1停用) */
|
||||
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.ruoyi.cms.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
/**
|
||||
* app操作日志记录对象 bussiness_oper_log
|
||||
* @author ${author}
|
||||
* @date 2024-11-13
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("app操作日志记录")
|
||||
@TableName(value = "bussiness_oper_log")
|
||||
public class BussinessOperLog extends BaseEntity
|
||||
{
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "oper_id",type = IdType.AUTO)
|
||||
@ApiModelProperty("日志主键")
|
||||
private Long operId;
|
||||
|
||||
@Excel(name = "模块标题")
|
||||
@ApiModelProperty("模块标题")
|
||||
private String title;
|
||||
|
||||
@Excel(name = "业务类型", readConverterExp = "0=其它,1=新增,2=修改,3=删除")
|
||||
@ApiModelProperty("业务类型(0其它 1新增 2修改 3删除)")
|
||||
private Integer businessType;
|
||||
|
||||
@Excel(name = "方法名称")
|
||||
@ApiModelProperty("方法名称")
|
||||
private String method;
|
||||
|
||||
@Excel(name = "请求方式")
|
||||
@ApiModelProperty("请求方式")
|
||||
private String requestMethod;
|
||||
|
||||
@Excel(name = "操作类别", readConverterExp = "0=其它,1=后台用户,2=手机端用户")
|
||||
@ApiModelProperty("操作类别(0其它 1后台用户 2手机端用户)")
|
||||
private Integer operatorType;
|
||||
|
||||
@Excel(name = "操作人员")
|
||||
@ApiModelProperty("操作人员")
|
||||
private String operName;
|
||||
|
||||
@Excel(name = "部门名称")
|
||||
@ApiModelProperty("部门名称")
|
||||
private String deptName;
|
||||
|
||||
@Excel(name = "请求URL")
|
||||
@ApiModelProperty("请求URL")
|
||||
private String operUrl;
|
||||
|
||||
@Excel(name = "主机地址")
|
||||
@ApiModelProperty("主机地址")
|
||||
private String operIp;
|
||||
|
||||
@Excel(name = "操作地点")
|
||||
@ApiModelProperty("操作地点")
|
||||
private String operLocation;
|
||||
|
||||
@Excel(name = "请求参数")
|
||||
@ApiModelProperty("请求参数")
|
||||
private String operParam;
|
||||
|
||||
@Excel(name = "返回参数")
|
||||
@ApiModelProperty("返回参数")
|
||||
private String jsonResult;
|
||||
|
||||
@Excel(name = "操作状态", readConverterExp = "0=正常,1=异常")
|
||||
@ApiModelProperty("操作状态(0正常 1异常)")
|
||||
private Integer status;
|
||||
|
||||
@Excel(name = "错误消息")
|
||||
@ApiModelProperty("错误消息")
|
||||
private String errorMsg;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty("操作时间")
|
||||
private Date operTime;
|
||||
|
||||
@Excel(name = "消耗时间")
|
||||
@ApiModelProperty("消耗时间")
|
||||
private Long costTime;
|
||||
|
||||
@ApiModelProperty("业务类型数组")
|
||||
private Integer[] businessTypes;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.ruoyi.cms.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
/**
|
||||
* 商圈对象 commercial_area
|
||||
* @author Lishundong
|
||||
* @date 2024-11-12
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("商圈")
|
||||
@TableName(value = "commercial_area")
|
||||
public class CommercialArea extends BaseEntity
|
||||
{
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "commercial_area_id",type = IdType.AUTO)
|
||||
@ApiModelProperty("id")
|
||||
private Long commercialAreaId;
|
||||
|
||||
@Excel(name = "商圈名称")
|
||||
@ApiModelProperty("商圈名称")
|
||||
private String commercialAreaName;
|
||||
|
||||
@Excel(name = "纬度")
|
||||
@ApiModelProperty("纬度")
|
||||
private BigDecimal latitude;
|
||||
|
||||
@Excel(name = "经度")
|
||||
@ApiModelProperty("经度")
|
||||
private BigDecimal longitude;
|
||||
|
||||
@Excel(name = "地址")
|
||||
@ApiModelProperty("地址")
|
||||
private String address;
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user