WechatGroup

This commit is contained in:
Lishundong
2025-09-22 17:06:47 +08:00
commit 410182ec79
542 changed files with 155561 additions and 0 deletions

47
.gitignore vendored Normal file
View 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

Binary file not shown.

20
LICENSE Normal file
View 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.

61
buildAndStart.sh Normal file
View File

@@ -0,0 +1,61 @@
#!/usr/bin/env bash
_math() {
_m_opts="$@"
printf "%s" "$(($_m_opts))"
}
#输出绿色文字
__green() {
printf '\33[1;32m%b\33[0m' "$1" "\n"
return
}
#输出红色文字
__red() {
printf '\33[1;31m%b\33[0m' "$1" "\n"
return
}
__kill() {
PID=`ps -ef | grep ${1}.jar | grep -v grep |awk '{print $2}' | xargs`
sleepSeconds=10
curSleepSecond=1
while [[ -n "$PID" && "$sleepSeconds" -ge "$curSleepSecond" ]]; do
__green "尝试kill PID : ${PID}"
if [ "$sleepSeconds" -eq "$curSleepSecond" ]; then
__red "强制关闭: ${curSleepSecond}"
kill -9 $PID >> /dev/null 2>&1
fi
kill $PID >> /dev/null 2>&1
__green "停止程序计时:${curSleepSecond}"
sleep 1
curSleepSecond="$(_math "$curSleepSecond" + 1)"
PID=`ps -ef | grep ${1}.jar | grep -v grep |awk '{print $2}' | xargs`
done
}
source /etc/profile
git --git-dir=/root/backend/.git --work-tree=/root/backend fetch origin main
git --git-dir=/root/backend/.git --work-tree=/root/backend reset --hard origin/main
git --git-dir=/root/backend/.git --work-tree=/root/backend pull origin main
#################################################### 配置 ##############################################################
BASE_PATH=/root/backend
modelName=backend
profile=dev
JVM_MEMERY=" -Xms256M -Xmx256M -XX:MaxDirectMemorySize=256M"
# JVM_OPTION="${JVM_MEMERY} -XX:MetaspaceSize=64M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/root/backend/logs/heap_dump_${modelName}.hprof -verbose:gc -XX:+PrintGCDateStamps -XX:+PrintGCDetails -Xloggc:/data0/logs/gc_${modelName}.log -server -Djava.security.egd=file:/dev/./urandom"
DES_PATH=/root/backend
JAR=${DES_PATH}/ruoyi-admin/target/ruoyi-admin.jar
LOG_BACK_LOG=/root/backend/logs/back/${modelName}-info.log
LOG=/root/backend/logs/${modelName}.log
SELF_IP=$(ifconfig | grep "10.0.0" | awk '{print $2}' | cut -d ':' -f 2 |head -n 1)
if [[ "${SELF_IP}" == "" ]] ;then
SELF_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
#################################################### 构建 ############################################################
cd /root/backend && mvn clean && mvn install -T 4
pkill -f /root/backend/ruoyi-admin/target/ruoyi-admin.jar
nohup java ${JVM_OPTION} -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=6011 -jar ${JAR} --spring.profiles.active=${profile} >> ${LOG} 2>&1 &
tail -f /root/backend/logs/backend.log
#################################################### 启动 ##############################################################

266
pom.xml Normal file
View 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>

46
ruoyi-abuwx/pom.xml Normal file
View File

@@ -0,0 +1,46 @@
<?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-abuwx</artifactId>
<description>微信小程序</description>
<dependencies>
<!-- 通用工具 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
</dependency>
<!-- 通用工具 -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-system</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-framework</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.31</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,104 @@
package com.ruoyi.abuwx.controller;
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 com.ruoyi.abuwx.domain.AbucoderWxuser;
import com.ruoyi.abuwx.service.IAbucoderWxuserService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 微信用户Controller
*
* @author 阿卜Coder QQ932696181
* @date 2022-06-26
*/
@RestController
@RequestMapping("/abuwx/wxuser")
public class AbucoderWxuserController extends BaseController
{
@Autowired
private IAbucoderWxuserService abucoderWxuserService;
/**
* 查询微信用户列表
*/
@PreAuthorize("@ss.hasPermi('abuwx:wxuser:list')")
@GetMapping("/list")
public TableDataInfo list(AbucoderWxuser abucoderWxuser)
{
startPage();
List<AbucoderWxuser> list = abucoderWxuserService.selectAbucoderWxuserList(abucoderWxuser);
return getDataTable(list);
}
/**
* 导出微信用户列表
*/
@PreAuthorize("@ss.hasPermi('abuwx:wxuser:export')")
@Log(title = "微信用户", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, AbucoderWxuser abucoderWxuser)
{
List<AbucoderWxuser> list = abucoderWxuserService.selectAbucoderWxuserList(abucoderWxuser);
ExcelUtil<AbucoderWxuser> util = new ExcelUtil<AbucoderWxuser>(AbucoderWxuser.class);
util.exportExcel(response, list, "微信用户数据");
}
/**
* 获取微信用户详细信息
*/
@PreAuthorize("@ss.hasPermi('abuwx:wxuser:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(abucoderWxuserService.selectAbucoderWxuserById(id));
}
/**
* 新增微信用户
*/
@PreAuthorize("@ss.hasPermi('abuwx:wxuser:add')")
@Log(title = "微信用户", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody AbucoderWxuser abucoderWxuser)
{
return toAjax(abucoderWxuserService.insertAbucoderWxuser(abucoderWxuser));
}
/**
* 修改微信用户
*/
@PreAuthorize("@ss.hasPermi('abuwx:wxuser:edit')")
@Log(title = "微信用户", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody AbucoderWxuser abucoderWxuser)
{
return toAjax(abucoderWxuserService.updateAbucoderWxuser(abucoderWxuser));
}
/**
* 删除微信用户
*/
@PreAuthorize("@ss.hasPermi('abuwx:wxuser:remove')")
@Log(title = "微信用户", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(abucoderWxuserService.deleteAbucoderWxuserByIds(ids));
}
}

View File

@@ -0,0 +1,30 @@
package com.ruoyi.abuwx.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
@Data
public class AbucoderWxuser extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** ID */
private Long id;
/** 微信名称 */
@Excel(name = "微信名称")
private String nickname;
/** 头像 */
@Excel(name = "头像")
private String avatar;
/** OpenID */
@Excel(name = "OpenID")
private String openid;
/** 性别 */
@Excel(name = "性别")
private Integer gender;
}

View File

@@ -0,0 +1,68 @@
package com.ruoyi.abuwx.mapper;
import java.util.List;
import com.ruoyi.abuwx.domain.AbucoderWxuser;
/**
* 微信用户Mapper接口
*
* @author 阿卜Coder QQ932696181
* @date 2022-06-26
*/
public interface AbucoderWxuserMapper
{
/**
* 查询微信用户
*
* @param id 微信用户主键
* @return 微信用户
*/
public AbucoderWxuser selectAbucoderWxuserById(Long id);
/**
* 查询微信用户列表
*
* @param abucoderWxuser 微信用户
* @return 微信用户集合
*/
public List<AbucoderWxuser> selectAbucoderWxuserList(AbucoderWxuser abucoderWxuser);
/**
* 新增微信用户
*
* @param abucoderWxuser 微信用户
* @return 结果
*/
public int insertAbucoderWxuser(AbucoderWxuser abucoderWxuser);
/**
* 修改微信用户
*
* @param abucoderWxuser 微信用户
* @return 结果
*/
public int updateAbucoderWxuser(AbucoderWxuser abucoderWxuser);
/**
* 删除微信用户
*
* @param id 微信用户主键
* @return 结果
*/
public int deleteAbucoderWxuserById(Long id);
/**
* 批量删除微信用户
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteAbucoderWxuserByIds(Long[] ids);
/**
* 通过OpenID查询微信用户信息
* @param openid
* @return
*/
public AbucoderWxuser selectAbucoderWxuserOpenID(String openid);
}

View File

@@ -0,0 +1,68 @@
package com.ruoyi.abuwx.service;
import java.util.List;
import com.ruoyi.abuwx.domain.AbucoderWxuser;
/**
* 微信用户Service接口
*
* @author 阿卜Coder QQ932696181
* @date 2022-06-26
*/
public interface IAbucoderWxuserService
{
/**
* 查询微信用户
*
* @param id 微信用户主键
* @return 微信用户
*/
public AbucoderWxuser selectAbucoderWxuserById(Long id);
/**
* 查询微信用户列表
*
* @param abucoderWxuser 微信用户
* @return 微信用户集合
*/
public List<AbucoderWxuser> selectAbucoderWxuserList(AbucoderWxuser abucoderWxuser);
/**
* 新增微信用户
*
* @param abucoderWxuser 微信用户
* @return 结果
*/
public int insertAbucoderWxuser(AbucoderWxuser abucoderWxuser);
/**
* 修改微信用户
*
* @param abucoderWxuser 微信用户
* @return 结果
*/
public int updateAbucoderWxuser(AbucoderWxuser abucoderWxuser);
/**
* 批量删除微信用户
*
* @param ids 需要删除的微信用户主键集合
* @return 结果
*/
public int deleteAbucoderWxuserByIds(Long[] ids);
/**
* 删除微信用户信息
*
* @param id 微信用户主键
* @return 结果
*/
public int deleteAbucoderWxuserById(Long id);
/**
* 通过OpenID查询微信用户信息
* @param openid
* @return
*/
public AbucoderWxuser selectAbucoderWxuserOpenID(String openid);
}

View File

@@ -0,0 +1,106 @@
package com.ruoyi.abuwx.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.abuwx.mapper.AbucoderWxuserMapper;
import com.ruoyi.abuwx.domain.AbucoderWxuser;
import com.ruoyi.abuwx.service.IAbucoderWxuserService;
/**
* 微信用户Service业务层处理
*
* @author 阿卜Coder QQ932696181
* @date 2022-06-26
*/
@Service
public class AbucoderWxuserServiceImpl implements IAbucoderWxuserService
{
@Autowired
private AbucoderWxuserMapper abucoderWxuserMapper;
/**
* 查询微信用户
*
* @param id 微信用户主键
* @return 微信用户
*/
@Override
public AbucoderWxuser selectAbucoderWxuserById(Long id)
{
return abucoderWxuserMapper.selectAbucoderWxuserById(id);
}
/**
* 查询微信用户列表
*
* @param abucoderWxuser 微信用户
* @return 微信用户
*/
@Override
public List<AbucoderWxuser> selectAbucoderWxuserList(AbucoderWxuser abucoderWxuser)
{
return abucoderWxuserMapper.selectAbucoderWxuserList(abucoderWxuser);
}
/**
* 新增微信用户
*
* @param abucoderWxuser 微信用户
* @return 结果
*/
@Override
public int insertAbucoderWxuser(AbucoderWxuser abucoderWxuser)
{
abucoderWxuser.setCreateTime(DateUtils.getNowDate());
return abucoderWxuserMapper.insertAbucoderWxuser(abucoderWxuser);
}
/**
* 修改微信用户
*
* @param abucoderWxuser 微信用户
* @return 结果
*/
@Override
public int updateAbucoderWxuser(AbucoderWxuser abucoderWxuser)
{
abucoderWxuser.setUpdateTime(DateUtils.getNowDate());
return abucoderWxuserMapper.updateAbucoderWxuser(abucoderWxuser);
}
/**
* 批量删除微信用户
*
* @param ids 需要删除的微信用户主键
* @return 结果
*/
@Override
public int deleteAbucoderWxuserByIds(Long[] ids)
{
return abucoderWxuserMapper.deleteAbucoderWxuserByIds(ids);
}
/**
* 删除微信用户信息
*
* @param id 微信用户主键
* @return 结果
*/
@Override
public int deleteAbucoderWxuserById(Long id)
{
return abucoderWxuserMapper.deleteAbucoderWxuserById(id);
}
/**
* 通过OpenID查询微信用户信息
* @param openid
* @return
*/
@Override
public AbucoderWxuser selectAbucoderWxuserOpenID(String openid) {
return abucoderWxuserMapper.selectAbucoderWxuserOpenID(openid);
}
}

View File

@@ -0,0 +1,129 @@
package com.ruoyi.abuwxapi;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.abuwx.domain.AbucoderWxuser;
import com.ruoyi.abuwx.service.IAbucoderWxuserService;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.framework.config.ServerConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@RestController
@RequestMapping("/wxapi/")
public class WxLoginController {
private static final Logger log = LoggerFactory.getLogger(WxLoginController.class);
@Autowired
private IAbucoderWxuserService iAbucoderWxuserService;
@Autowired
private ServerConfig serverConfig;
/**
* 你自己的微信小程序APPID
*/
private final static String AppID = "你自己的微信小程序APPID";
/**
* 你自己的微信APP密钥
*/
private final static String AppSecret = "你自己的微信APP密钥";
/**
* 登录时获取的 code微信官方提供的临时凭证
* @param object
* @return
*/
@PostMapping("/wxlogin")
public AjaxResult wxLogin(@RequestBody JSONObject object){
//微信官方提供的微信小程序登录授权时使用的URL地址
String url = "https://api.weixin.qq.com/sns/jscode2session";
log.info("微信登录,传入参数:"+object);
/**
* 拼接需要的参数
* appid = AppID 你自己的微信小程序APPID
* js_code = AppSecret 你自己的微信APP密钥
* grant_type=authorization_code = code 微信官方提供的临时凭证
*/
String params = StrUtil.format("appid={}&secret={}&js_code={}&grant_type=authorization_code", AppID, AppSecret, object.get("code"));
//开始发起网络请求,若依管理系统自带网络请求工具,直接使用即可
String res = HttpUtils.sendGet(url,params);
JSONObject jsonObject = JSON.parseObject(res);
String openid = (String) jsonObject.get("openid");
if (StrUtil.isEmpty(openid)) {
return AjaxResult.error("未获取到openid");
}
/**先通过openid来查询是否存在*/
AbucoderWxuser abucoderWxuser = iAbucoderWxuserService.selectAbucoderWxuserOpenID(openid);
if (abucoderWxuser == null){
/**如果不存在就插入到我们的数据库里*/
AbucoderWxuser wxuser = new AbucoderWxuser();
wxuser.setOpenid(openid);
wxuser.setCreateTime(DateUtils.getNowDate());
iAbucoderWxuserService.insertAbucoderWxuser(wxuser);
/**返回结果集到前段*/
return AjaxResult.success(wxuser);
}else {
/**返回结果集到前段*/
return AjaxResult.success(abucoderWxuser);
}
}
@PostMapping("/upload")
@ResponseBody
public AjaxResult uploadFile(MultipartFile file) throws Exception
{
System.out.println(file);
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());
}
}
/**
* 保存昵称与头像信息到用户信息里
* @param object
* @return
*/
@PostMapping("/saveUserInfo")
@ResponseBody
public AjaxResult saveUserInfo(@RequestBody JSONObject object){
System.out.println(object);
AbucoderWxuser abucoderWxuser = iAbucoderWxuserService.selectAbucoderWxuserOpenID(String.valueOf(object.get("openid")));
if (StringUtils.hasLength(String.valueOf(object.get("nickName")))){
abucoderWxuser.setNickname(String.valueOf(object.get("nickName")));
abucoderWxuser.setCreateBy(String.valueOf(object.get("nickName")));
}
if (StringUtils.hasLength(String.valueOf(object.get("avatarUrl")))){
abucoderWxuser.setAvatar(String.valueOf(object.get("avatarUrl")));
}
abucoderWxuser.setUpdateTime(DateUtils.getNowDate());
iAbucoderWxuserService.updateAbucoderWxuser(abucoderWxuser);
//返回前段需要的数据
return AjaxResult.success(abucoderWxuser);
}
}

View File

@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.abuwx.mapper.AbucoderBannersMapper">
<resultMap type="AbucoderBanners" id="AbucoderBannersResult">
<result property="id" column="id" />
<result property="bannerTitle" column="banner_title" />
<result property="bannerUrl" column="banner_url" />
<result property="bannerImg" column="banner_img" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectAbucoderBannersVo">
select id, banner_title, banner_url, banner_img, create_by, create_time, update_by, update_time, remark from abucoder_banners
</sql>
<select id="selectAbucoderBannersList" parameterType="AbucoderBanners" resultMap="AbucoderBannersResult">
<include refid="selectAbucoderBannersVo"/>
<where>
</where>
</select>
<select id="selectAbucoderBannersById" parameterType="Long" resultMap="AbucoderBannersResult">
<include refid="selectAbucoderBannersVo"/>
where id = #{id}
</select>
<insert id="insertAbucoderBanners" parameterType="AbucoderBanners" useGeneratedKeys="true" keyProperty="id">
insert into abucoder_banners
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="bannerTitle != null">banner_title,</if>
<if test="bannerUrl != null">banner_url,</if>
<if test="bannerImg != null">banner_img,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="bannerTitle != null">#{bannerTitle},</if>
<if test="bannerUrl != null">#{bannerUrl},</if>
<if test="bannerImg != null">#{bannerImg},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateAbucoderBanners" parameterType="AbucoderBanners">
update abucoder_banners
<trim prefix="SET" suffixOverrides=",">
<if test="bannerTitle != null">banner_title = #{bannerTitle},</if>
<if test="bannerUrl != null">banner_url = #{bannerUrl},</if>
<if test="bannerImg != null">banner_img = #{bannerImg},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAbucoderBannersById" parameterType="Long">
delete from abucoder_banners where id = #{id}
</delete>
<delete id="deleteAbucoderBannersByIds" parameterType="String">
delete from abucoder_banners where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.abuwx.mapper.AbucoderItemsMapper">
<resultMap type="AbucoderItems" id="AbucoderItemsResult">
<result property="id" column="id" />
<result property="itemName" column="item_name" />
<result property="itemDesc" column="item_desc" />
<result property="itemContent" column="item_content" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectAbucoderItemsVo">
select id, item_name, item_desc, item_content, create_by, create_time, update_by, update_time, remark from abucoder_items
</sql>
<select id="selectAbucoderItemsList" parameterType="AbucoderItems" resultMap="AbucoderItemsResult">
<include refid="selectAbucoderItemsVo"/>
<where>
<if test="itemName != null and itemName != ''"> and item_name like concat('%', #{itemName}, '%')</if>
</where>
</select>
<select id="selectAbucoderItemsById" parameterType="Long" resultMap="AbucoderItemsResult">
<include refid="selectAbucoderItemsVo"/>
where id = #{id}
</select>
<insert id="insertAbucoderItems" parameterType="AbucoderItems" useGeneratedKeys="true" keyProperty="id">
insert into abucoder_items
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="itemName != null">item_name,</if>
<if test="itemDesc != null">item_desc,</if>
<if test="itemContent != null">item_content,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="itemName != null">#{itemName},</if>
<if test="itemDesc != null">#{itemDesc},</if>
<if test="itemContent != null">#{itemContent},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateAbucoderItems" parameterType="AbucoderItems">
update abucoder_items
<trim prefix="SET" suffixOverrides=",">
<if test="itemName != null">item_name = #{itemName},</if>
<if test="itemDesc != null">item_desc = #{itemDesc},</if>
<if test="itemContent != null">item_content = #{itemContent},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAbucoderItemsById" parameterType="Long">
delete from abucoder_items where id = #{id}
</delete>
<delete id="deleteAbucoderItemsByIds" parameterType="String">
delete from abucoder_items where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.abuwx.mapper.AbucoderProgramsMapper">
<resultMap type="AbucoderPrograms" id="AbucoderProgramsResult">
<result property="id" column="id" />
<result property="programName" column="program_name" />
<result property="programTag" column="program_tag" />
<result property="programImg" column="program_img" />
<result property="programContent" column="program_content" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectAbucoderProgramsVo">
select id, program_name, program_tag, program_img, program_content, create_by, create_time, update_by, update_time, remark from abucoder_programs
</sql>
<select id="selectAbucoderProgramsList" parameterType="AbucoderPrograms" resultMap="AbucoderProgramsResult">
<include refid="selectAbucoderProgramsVo"/>
<where>
<if test="programName != null and programName != ''"> and program_name like concat('%', #{programName}, '%')</if>
</where>
</select>
<select id="selectAbucoderProgramsById" parameterType="Long" resultMap="AbucoderProgramsResult">
<include refid="selectAbucoderProgramsVo"/>
where id = #{id}
</select>
<insert id="insertAbucoderPrograms" parameterType="AbucoderPrograms" useGeneratedKeys="true" keyProperty="id">
insert into abucoder_programs
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="programName != null">program_name,</if>
<if test="programTag != null">program_tag,</if>
<if test="programImg != null">program_img,</if>
<if test="programContent != null">program_content,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="programName != null">#{programName},</if>
<if test="programTag != null">#{programTag},</if>
<if test="programImg != null">#{programImg},</if>
<if test="programContent != null">#{programContent},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateAbucoderPrograms" parameterType="AbucoderPrograms">
update abucoder_programs
<trim prefix="SET" suffixOverrides=",">
<if test="programName != null">program_name = #{programName},</if>
<if test="programTag != null">program_tag = #{programTag},</if>
<if test="programImg != null">program_img = #{programImg},</if>
<if test="programContent != null">program_content = #{programContent},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAbucoderProgramsById" parameterType="Long">
delete from abucoder_programs where id = #{id}
</delete>
<delete id="deleteAbucoderProgramsByIds" parameterType="String">
delete from abucoder_programs where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.abuwx.mapper.AbucoderWxappConfigMapper">
<resultMap type="AbucoderWxappConfig" id="AbucoderWxappConfigResult">
<result property="id" column="id" />
<result property="appid" column="appid" />
<result property="appSecret" column="app_secret" />
<result property="state" column="state" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectAbucoderWxappConfigVo">
select id, appid, app_secret, state, create_by, create_time, update_by, update_time, remark from abucoder_wxapp_config
</sql>
<select id="selectAbucoderWxappConfigList" parameterType="AbucoderWxappConfig" resultMap="AbucoderWxappConfigResult">
<include refid="selectAbucoderWxappConfigVo"/>
<where>
<if test="appid != null and appid != ''"> and appid = #{appid}</if>
<if test="appSecret != null and appSecret != ''"> and app_secret = #{appSecret}</if>
<if test="state != null "> and state = #{state}</if>
</where>
</select>
<select id="selectAbucoderWxappConfigById" parameterType="Long" resultMap="AbucoderWxappConfigResult">
<include refid="selectAbucoderWxappConfigVo"/>
where id = #{id}
</select>
<select id="selectAbucoderWxappConfig" resultMap="AbucoderWxappConfigResult">
<include refid="selectAbucoderWxappConfigVo"/>
where state = 0
</select>
<insert id="insertAbucoderWxappConfig" parameterType="AbucoderWxappConfig" useGeneratedKeys="true" keyProperty="id">
insert into abucoder_wxapp_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="appid != null">appid,</if>
<if test="appSecret != null">app_secret,</if>
<if test="state != null">state,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="appid != null">#{appid},</if>
<if test="appSecret != null">#{appSecret},</if>
<if test="state != null">#{state},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateAbucoderWxappConfig" parameterType="AbucoderWxappConfig">
update abucoder_wxapp_config
<trim prefix="SET" suffixOverrides=",">
<if test="appid != null">appid = #{appid},</if>
<if test="appSecret != null">app_secret = #{appSecret},</if>
<if test="state != null">state = #{state},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAbucoderWxappConfigById" parameterType="Long">
delete from abucoder_wxapp_config where id = #{id}
</delete>
<delete id="deleteAbucoderWxappConfigByIds" parameterType="String">
delete from abucoder_wxapp_config where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.abuwx.mapper.AbucoderWxuserMapper">
<resultMap type="AbucoderWxuser" id="AbucoderWxuserResult">
<result property="id" column="id" />
<result property="nickname" column="nickname" />
<result property="avatar" column="avatar" />
<result property="openid" column="openid" />
<result property="gender" column="gender" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectAbucoderWxuserVo">
select id, nickname, avatar, openid, gender, create_by, create_time, update_by, update_time, remark from abucoder_wxuser
</sql>
<select id="selectAbucoderWxuserList" parameterType="AbucoderWxuser" resultMap="AbucoderWxuserResult">
<include refid="selectAbucoderWxuserVo"/>
<where>
<if test="openid != null and openid != ''"> and openid = #{openid}</if>
<if test="gender != null "> and gender = #{gender}</if>
</where>
</select>
<select id="selectAbucoderWxuserById" parameterType="Long" resultMap="AbucoderWxuserResult">
<include refid="selectAbucoderWxuserVo"/>
where id = #{id}
</select>
<select id="selectAbucoderWxuserOpenID" resultMap="AbucoderWxuserResult">
<include refid="selectAbucoderWxuserVo"/>
where openid = #{openid}
</select>
<insert id="insertAbucoderWxuser" parameterType="AbucoderWxuser" useGeneratedKeys="true" keyProperty="id">
insert into abucoder_wxuser
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="nickname != null">nickname,</if>
<if test="avatar != null">avatar,</if>
<if test="openid != null">openid,</if>
<if test="gender != null">gender,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="nickname != null">#{nickname},</if>
<if test="avatar != null">#{avatar},</if>
<if test="openid != null">#{openid},</if>
<if test="gender != null">#{gender},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateAbucoderWxuser" parameterType="AbucoderWxuser">
update abucoder_wxuser
<trim prefix="SET" suffixOverrides=",">
<if test="nickname != null">nickname = #{nickname},</if>
<if test="avatar != null">avatar = #{avatar},</if>
<if test="openid != null">openid = #{openid},</if>
<if test="gender != null">gender = #{gender},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAbucoderWxuserById" parameterType="Long">
delete from abucoder_wxuser where id = #{id}
</delete>
<delete id="deleteAbucoderWxuserByIds" parameterType="String">
delete from abucoder_wxuser where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

145
ruoyi-admin/pom.xml Normal file
View 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>

View 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" +
" ''-' `'-' `-..-' ");
}
}

View File

@@ -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);
}
}

View File

@@ -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;
}
}

View File

@@ -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);
}
}
}

View File

@@ -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();
}
}

View File

@@ -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);
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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));
}
}

View File

@@ -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();
}
}

View File

@@ -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);
}
}

View File

@@ -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());
}
}

View File

@@ -0,0 +1,94 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
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;
/**
* 登录方法
*
* @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;
}
/**
* 获取用户信息
*
* @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));
}
}

View File

@@ -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));
}
}

View File

@@ -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));
}
}

View File

@@ -0,0 +1,56 @@
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.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
{
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(new Date());
ossEntity.setService(storage.getService());
return toAjax(sysOssService.save(ossEntity)).put("url", ossEntity.getUrl()).put("fileName",ossEntity.getFileName());
}
}

View File

@@ -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);
}
}

View File

@@ -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("上传图片异常,请联系管理员");
}
}

View File

@@ -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);
}
}

View File

@@ -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;
}
}

View File

@@ -0,0 +1,259 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
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;
/**
* 获取用户列表
*/
@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));
}
}

View File

@@ -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));
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}

View File

@@ -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);
}

View File

@@ -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;
}
}

View File

@@ -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));
}
}

View File

@@ -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));
}
}

View File

@@ -0,0 +1,8 @@
package com.ruoyi.web.controller.system.cloud.valdator;
/**
* 阿里云
*/
public interface AliyunGroup
{
}

View File

@@ -0,0 +1,8 @@
package com.ruoyi.web.controller.system.cloud.valdator;
/**
* 腾讯云
*/
public interface QcloudGroup
{
}

View File

@@ -0,0 +1,8 @@
package com.ruoyi.web.controller.system.cloud.valdator;
/**
* 七牛
*/
public interface QiniuGroup
{
}

View File

@@ -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();
}
}

View File

@@ -0,0 +1 @@
restart.include.json=/com.alibaba.fastjson2.*.jar

View File

@@ -0,0 +1,70 @@
# 数据源配置
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&currentSchema=ks_db4&stringtype=unspecified
username: sysdba
password: ZKR2024@com
# 从库数据源
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
# 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

View File

@@ -0,0 +1,91 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: dm.jdbc.driver.DmDriver
druid:
# 主库数据源
master:
url: jdbc:dm://127.0.0.1:5236?schema=GTDB
username: SYSDBA
password: ZKR123456com
# 从库数据源
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 1 FROM DUAL
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
# 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
redis:
# 地址
host: 127.0.0.1
# 端口默认为6379
port: 6379
# 数据库索引
database: 5
# 密码
password: zkr2024@@
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms

View File

@@ -0,0 +1,163 @@
# 项目相关配置
ruoyi:
# 名称
name: RuoYi
# 版本
version: 3.8.8
# 版权年份
copyrightYear: 2024
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: D:/ruoyi/uploadPath
# 获取ip地址开关
addressEnabled: false
# 验证码类型 math 数字计算 char 字符验证
captchaType: math
# 开发环境配置
server:
# 服务器的HTTP端口默认为8080
port: 9090
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: dev
# 文件上传
servlet:
multipart:
# 单个文件大小
max-file-size: 10MB
# 设置总上传的文件大小
max-request-size: 20MB
# 服务模块
devtools:
restart:
# 热部署开关
enabled: true
# redis 配置
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
# token配置
token:
# 令牌自定义标识
header: Authorization
# 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz
# 令牌有效期默认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

View File

@@ -0,0 +1,24 @@
Application Version: ${ruoyi.version}
Spring Boot Version: ${spring-boot.version}
////////////////////////////////////////////////////////////////////
// _ooOoo_ //
// o8888888o //
// 88" . "88 //
// (| ^_^ |) //
// O\ = /O //
// ____/`---'\____ //
// .' \\| |// `. //
// / \\||| : |||// \ //
// / _||||| -:- |||||- \ //
// | | \\\ - /// | | //
// | \_| ''\---/'' | | //
// \ .-\__ `-` ___/-. / //
// ___`. .' /--.--\ `. . ___ //
// ."" '< `.___\_<|>_/___.' >'"". //
// | | : `- \`.;`\ _ /`;.`/ - ` : | | //
// \ \ `-. \_ __\ /__ _/ .-` / / //
// ========`-.____`-.___\_____/___.-`____.-'======== //
// `=---=' //
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
// 佛祖保佑 永不宕机 永无BUG //
////////////////////////////////////////////////////////////////////

View 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}]

View 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>

View 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>

116
ruoyi-bussiness/pom.xml Normal file
View File

@@ -0,0 +1,116 @@
<?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>
</dependencies>
</project>

View File

@@ -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();
}
}

View File

@@ -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";
}

View File

@@ -0,0 +1,82 @@
package com.ruoyi.cms.controller.app;
import com.ruoyi.cms.domain.AppUser;
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 com.ruoyi.common.core.domain.entity.JobTitle;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.page.TableDataInfo;
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.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static com.ruoyi.common.utils.PageUtils.startPage;
@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);
}
@GetMapping("/standar/filed")
public AjaxResult standarFiled()
{
Map<String,Object> filed = iBussinessDictTypeService.standarFiled();
return success(filed);
}
}

View File

@@ -0,0 +1,139 @@
package com.ruoyi.cms.controller.app;
import com.ruoyi.cms.domain.BussinessDictData;
import com.ruoyi.cms.domain.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.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.core.page.TableSupport;
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.security.access.prepost.PreAuthorize;
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("获取公司详细信息")
@PreAuthorize("@ss.hasPermi('bussiness:company:query')")
@GetMapping(value = "/{companyId}")
public AjaxResult getInfo(@PathVariable("companyId") Long companyId)
{
return success(companyService.selectCompanyByCompanyId(companyId));
}
/**
* 用户收藏公司
*/
@Log(title = "用户收藏公司")
@PostMapping("/collection/{companyId}")
@ApiOperation("用户收藏公司")
public AjaxResult companyCollection(@PathVariable("companyId") Long companyId)
{
return toAjax(companyCollectionService.companyCollection(companyId));
}
/**
* 用户取消收藏公司
*/
@Log(title = "用户取消收藏公司")
@DeleteMapping("/collection/{companyId}")
@ApiOperation("用户取消收藏公司")
public AjaxResult companyCancel(@PathVariable("companyId") Long companyId)
{
return toAjax(companyCollectionService.companyCancel(companyId));
}
/**
* 公司下的岗位
*/
@Log(title = "公司下的岗位")
@GetMapping("/job/{companyId}")
@ApiOperation("公司下的岗位")
public TableDataInfo jobCompany(@ApiParam("公司id") @PathVariable Long companyId)
{
startPage();
return getDataTable(companyCollectionService.jobCompany(companyId));
}
@Log(title = "查看企业卡片")
@GetMapping("/card")
@ApiOperation("查看企业卡片")
public TableDataInfo card()
{
startPage();
return getDataTable(companyCardService.cardApp());
}
@Log(title = "收藏企业卡片")
@PutMapping("/card/collection/{companyCardId}")
@ApiOperation("收藏企业卡片")
public AjaxResult cardCollection(@PathVariable Long companyCardId)
{
companyCardService.cardCollection(companyCardId);
return success();
}
@Log(title = "取消收藏企业卡片")
@DeleteMapping("/card/collection/{companyCardId}")
@ApiOperation("取消收藏公司卡片")
public AjaxResult cardCancel(@PathVariable Long companyCardId)
{
companyCardService.cardCancel(companyCardId);
return success();
}
@Log(title = "公司招聘的岗位数量")
@GetMapping("/count/{companyId}")
@ApiOperation("公司招聘的岗位数量")
public AjaxResult count(@PathVariable Long companyId)
{
Integer count = companyService.count(companyId);
return success(count);
}
@Log(title = "公司标签下的公司")
@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);
}
@GetMapping("/importLabel500")
public void importLabel()
{
companyService.importLabel();
}
@GetMapping("/importLabelBank")
public void importLabelBank()
{
companyService.importLabelBank();
}
}

View File

@@ -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.Log;
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;
/**
* 招聘会列表
*/
@Log(title = "招聘会列表")
@GetMapping
public TableDataInfo list(JobFair jobFair)
{
startPage();
List<JobFair> results = jobFairService.appList(jobFair);
return getDataTable(results);
}
/**
* 招聘会详情
*/
@Log(title = "招聘会详情")
@GetMapping("/{fairId}")
public AjaxResult appDetail(@ApiParam("招聘会id") @PathVariable Long fairId)
{
return success(jobFairService.appDetail(fairId));
}
/**
* 用户收藏招聘会
*/
@Log(title = "用户收藏招聘会")
@PostMapping("/collection/{fairId}")
public AjaxResult companyCollection(@ApiParam("招聘会id") @PathVariable Long fairId)
{
return toAjax(fairCollectionService.fairCollection(fairId));
}
/**
* 用户取消收藏招聘会
*/
@Log(title = "用户取消收藏招聘会")
@DeleteMapping("/collection/{fairId}")
public AjaxResult companyCancel(@ApiParam("招聘会id") @PathVariable Long fairId)
{
return toAjax(fairCollectionService.cancel(fairId));
}
}

View File

@@ -0,0 +1,21 @@
package com.ruoyi.cms.controller.app;
import com.ruoyi.cms.service.IFileService;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
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;
@RestController
@RequestMapping("/app/file")
public class AppFileController {
@Autowired
private IFileService fileService;
@PostMapping("/upload")
public AjaxResult uploadFile(@RequestParam("file") MultipartFile file, @RequestParam(value = "bussinessId",required = false) Long bussinessId) {
return fileService.uploadFile(file,bussinessId);
}
}

View File

@@ -0,0 +1,294 @@
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.domain.vo.CompetitivenessResponse;
import com.ruoyi.cms.domain.vo.RadarChart;
import com.ruoyi.cms.service.IESJobSearchService;
import com.ruoyi.cms.service.IJobCollectionService;
import com.ruoyi.cms.service.IJobService;
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 io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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.*;
/**
* 岗位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;
private Calendar calendar = Calendar.getInstance();
private Date date = new Date();
{
calendar.set(Calendar.YEAR, 2025); // 设置年份
calendar.set(Calendar.MONTH, Calendar.JULY); // 设置月份7月
calendar.set(Calendar.DAY_OF_MONTH, 12); // 设置日期
date = calendar.getTime(); // 转换为Date对象
}
/**
* 查询岗位列表
*/
@ApiOperation("查询岗位列表")
@GetMapping("/list")
public TableDataInfo list(ESJobSearch job, HttpServletRequest request)
{
// 打印请求参数
System.out.println("Request Parameters:");
request.getParameterMap().forEach((key, value) -> {
System.out.println(key + " = " + String.join(", ", value));
});
// 打印请求头
System.out.println("Request Headers:");
Enumeration<String> headerNames = request.getHeaderNames();
Iterator<String> iterator = Collections.list(headerNames).iterator();
iterator.forEachRemaining(headerName -> {
System.out.println(headerName + " = " + request.getHeader(headerName));
});
EsPageInfo<ESJobDocument> list = jobService.appList(job);
return getTableDataInfo(list);
}
/**
* 获取5条推荐岗位
*/
@ApiOperation("获取推荐岗位")
@GetMapping("/recommend")
public AjaxResult recommend(ESJobSearch esJobSearch)
{
List<ESJobDocument> jobList = jobService.recommend(esJobSearch);
for (ESJobDocument esJobDocument:jobList){
esJobDocument.setPostingDate(date);
}
return success(jobList);
}
@ApiOperation("获取littleVideo")
@GetMapping("/littleVideo")
public AjaxResult littleVideo(ESJobSearch esJobSearch)
{
List<ESJobDocument> jobList = jobService.littleVideo(esJobSearch);
for (ESJobDocument esJobDocument:jobList){
esJobDocument.setPostingDate(date);
}
return success(jobList);
}
@ApiOperation("获取littleVideo")
@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);
for (ESJobDocument esJobDocument:jobList){
esJobDocument.setPostingDate(date);
}
return success(jobList);
}
/**
* 获取5条推荐岗位
*/
@GetMapping("/updateLon")
public void updateLon()
{
jobService.updateLon();
}
/**
* 附件工作
*/
@ApiOperation("附近工作")
@PostMapping(value = "/nearJob")
public TableDataInfo nearJob(@RequestBody ESJobSearch jobQuery)
{
EsPageInfo<ESJobDocument> list = esJobSearchService.nearJob(jobQuery);
List<ESJobDocument> jobList = list.getList();
for (ESJobDocument esJobDocument:jobList){
esJobDocument.setPostingDate(date);
}
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();
for (ESJobDocument esJobDocument:jobList){
esJobDocument.setPostingDate(date);
}
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();
for (ESJobDocument esJobDocument:jobList){
esJobDocument.setPostingDate(date);
}
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();
for (ESJobDocument esJobDocument:jobList){
esJobDocument.setPostingDate(date);
}
list.setList(jobList);
return getTableDataInfo(list);
}
/**
* 获取岗位详细信息
*/
@ApiOperation("获取岗位详细信息")
@GetMapping(value = "/{jobId}")
public AjaxResult getInfo(@PathVariable("jobId") Long jobId)
{
Job job = jobService.selectJobByJobIdApp(jobId);
job.setPostingDate(date);
return success(job);
}
/**
* 用户收藏岗位
*/
@Log(title = "用户收藏岗位")
@PostMapping("/collection/{jobId}")
@ApiOperation("用户收藏")
public AjaxResult jobCollection(@ApiParam("岗位id") @PathVariable Long jobId)
{
return toAjax(jobCollectionService.jobCollection(jobId));
}
/**
* 用户取消收藏岗位
*/
@Log(title = "用户取消收藏岗位")
@DeleteMapping("/collection/{jobId}")
@ApiOperation("用户取消收藏岗位")
public AjaxResult cancel(@ApiParam("岗位id") @PathVariable Long jobId)
{
return toAjax(jobCollectionService.cancel(jobId));
}
/**
* 用户申请岗位
*/
@Log(title = "用户申请岗位")
@GetMapping("/apply/{jobId}")
@ApiOperation("用户申请岗位")
public AjaxResult apply(@ApiParam("岗位id") @PathVariable Long jobId)
{
return toAjax(jobCollectionService.apply(jobId));
}
@Log(title = "竞争力分析")
@GetMapping("/competitiveness/{jobId}")
@ApiOperation("竞争力分析")
public AjaxResult competitiveness(@ApiParam("岗位id") @PathVariable Long jobId) {
// Generate random values for the response
Random random = new Random();
// Build radar chart with random values between 60-95
RadarChart radarChart = new RadarChart();
radarChart.setAge(60 + random.nextInt(36)); // 60-95
radarChart.setExperience(60 + random.nextInt(36));
radarChart.setEducation(60 + random.nextInt(36));
radarChart.setSkill(60 + random.nextInt(36));
radarChart.setSalary(60 + random.nextInt(36));
radarChart.setLocation(60 + random.nextInt(36));
// Build response with random values
CompetitivenessResponse response = new CompetitivenessResponse();
response.setTotalApplicants(0); // Always 0 as requested
response.setMatchScore(60 + random.nextInt(41)); // 60-100
response.setRank(1 + random.nextInt(10)); // 1-10
response.setPercentile(random.nextInt(101)); // 0-100
response.setRadarChart(radarChart);
return success(response);
}
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;
}
@GetMapping("/import")
public AjaxResult importData()
{
jobService.importData();
return success();
}
@GetMapping("/importRow")
public AjaxResult importRow()
{
jobService.importRow();
return success();
}
@GetMapping("/update")
public AjaxResult update()
{
jobService.updateEs();
return success();
}
@PostMapping("/getWechatUrl")
public AjaxResult getWechatUrl(@RequestBody HashMap<String,String> url)
{
String s = url.get("imgUrl");
return AjaxResult.success(jobService.getWechatUrl(s));
}
@PostMapping("/insert")
public AjaxResult insertTemp(@RequestBody Job job)
{
return AjaxResult.success(jobService.insertTemp(job));
}
@ApiOperation("生成分享的html")
@GetMapping("/htmlGen/{id}")
public AjaxResult htmlGen(@PathVariable(required = true) Long id)
{
String result = jobService.htmlGen(id);
return AjaxResult.success(result);
}
@GetMapping("/fix")
public void fix()
{
jobService.fix();
}
}

View File

@@ -0,0 +1,66 @@
package com.ruoyi.cms.controller.app;
import com.ruoyi.cms.domain.AppUser;
import com.ruoyi.cms.domain.Job;
import com.ruoyi.cms.domain.Notice;
import com.ruoyi.cms.domain.vo.AppNoticeVO;
import com.ruoyi.cms.service.IAppNoticeService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.SecurityUtils;
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;
import static com.ruoyi.common.utils.PageUtils.startPage;
@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")
public AjaxResult sysNotice(@RequestParam String id)
{
appNoticeService.sysNotice(id);
return AjaxResult.success();
}
@ApiOperation("岗位推荐、招聘会已读")
@PostMapping("/read")
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);
}
}

View File

@@ -0,0 +1,117 @@
package com.ruoyi.cms.controller.app;
import com.ruoyi.cms.domain.AppUser;
import com.ruoyi.cms.domain.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.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.SecurityUtils;
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.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("/resume")
public AjaxResult saveResume(@RequestBody AppUser appUser)
{
appUser.setUserId(SecurityUtils.getUserId());
appUserService.updateAppUser(appUser);
return AjaxResult.success();
}
@ApiOperation("查看简历")
@GetMapping("/resume")
public AjaxResult getResume()
{
AppUser appUser = appUserService.selectAppUserByUserId(SecurityUtils.getUserId());
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);
}
}

View File

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

View File

@@ -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);
}
}

View File

@@ -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();
}
}

View File

@@ -0,0 +1,114 @@
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.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;
/**
* 查询APP用户列表
*/
@ApiOperation("查询APP用户列表")
@PreAuthorize("@ss.hasPermi('bussiness:user:list')")
@GetMapping("/list")
public TableDataInfo list(AppUser appUser)
{
startPage();
List<AppUser> list = appUserService.selectAppUserList(appUser);
return getDataTable(list);
}
/**
* 导出APP用户列表
*/
@ApiOperation("导出APP用户列表")
@PreAuthorize("@ss.hasPermi('bussiness:user: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用户")
@PreAuthorize("@ss.hasPermi('bussiness:user:edit')")
@Log(title = "APP用户", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody AppUser appUser)
{
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));
}
}

View File

@@ -0,0 +1,129 @@
package com.ruoyi.cms.controller.cms;
import com.ruoyi.cms.domain.Job;
import com.ruoyi.cms.domain.vo.CandidateVO;
import com.ruoyi.cms.service.IJobService;
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.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-03
*/
@RestController
@RequestMapping("/cms/job")
@Api(tags = "后台:岗位管理")
@Anonymous
public class CmsJobController extends BaseController
{
@Autowired
private IJobService jobService;
/**
* 查询岗位列表
*/
@ApiOperation("查询岗位列表")
@PreAuthorize("@ss.hasPermi('bussiness:job:list')")
@GetMapping("/list")
public TableDataInfo list(Job job)
{
startPage();
List<Job> list = jobService.selectJobList(job);
return getDataTable(list);
}
/**
* 获取岗位详细信息
*/
@ApiOperation("获取岗位详细信息")
@PreAuthorize("@ss.hasPermi('bussiness:job:query')")
@GetMapping(value = "/{jobId}")
public AjaxResult getInfo(@PathVariable("jobId") Long jobId)
{
return success(jobService.selectJobByJobId(jobId));
}
/**
* 导出岗位列表
*/
@ApiOperation("导出岗位列表")
@PreAuthorize("@ss.hasPermi('app: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('app:job:add')")
@Log(title = "岗位", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Job job)
{
return toAjax(jobService.insertJob(job));
}
/**
* 修改岗位
*/
@ApiOperation("修改岗位")
@PreAuthorize("@ss.hasPermi('app:job:edit')")
@Log(title = "岗位", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Job job)
{
return toAjax(jobService.updateJob(job));
}
/**
* 删除岗位
*/
@ApiOperation("删除岗位")
@PreAuthorize("@ss.hasPermi('app: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")
public TableDataInfo candidates(Long jobId)
{
startPage();
List<CandidateVO> list = jobService.candidates(jobId);
return getDataTable(list);
}
@GetMapping("/import")
public AjaxResult importData()
{
jobService.importData();
return success();
}
@GetMapping("/importRow")
public AjaxResult importRow()
{
jobService.importRow();
return success();
}
}

View File

@@ -0,0 +1,85 @@
package com.ruoyi.cms.controller.cms;
import com.ruoyi.cms.domain.AppNotice;
import com.ruoyi.cms.service.IAppNoticeService;
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 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;
/**
* 获取通知公告列表
*/
@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));
}
}

View File

@@ -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));
}
}

View File

@@ -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));
}
}

View File

@@ -0,0 +1,110 @@
package com.ruoyi.cms.controller.cms;
import com.ruoyi.cms.domain.Company;
import com.ruoyi.cms.service.ICompanyCollectionService;
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 io.swagger.annotations.ApiParam;
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('app:company:list')")
@GetMapping("/list")
public TableDataInfo list(Company company)
{
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));
}
}

View File

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

View File

@@ -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('app:fair: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));
}
}

View File

@@ -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);
}
}

View File

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

View File

@@ -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));
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -0,0 +1,103 @@
package com.ruoyi.cms.domain;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.xss.Xss;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
/**
* 通知公告表 sys_notice
*
* @author ruoyi
*/
public class AppNotice extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 公告ID */
private Long noticeId;
/** 公告标题 */
private String noticeTitle;
/** 公告类型1通知 2公告 */
private String noticeType;
/** 公告内容 */
private String noticeContent;
/** 公告状态0正常 1关闭 */
private String status;
public Long getNoticeId()
{
return noticeId;
}
public void setNoticeId(Long noticeId)
{
this.noticeId = noticeId;
}
public void setNoticeTitle(String noticeTitle)
{
this.noticeTitle = noticeTitle;
}
@Xss(message = "公告标题不能包含脚本字符")
@NotBlank(message = "公告标题不能为空")
@Size(min = 0, max = 50, message = "公告标题不能超过50个字符")
public String getNoticeTitle()
{
return noticeTitle;
}
public void setNoticeType(String noticeType)
{
this.noticeType = noticeType;
}
public String getNoticeType()
{
return noticeType;
}
public void setNoticeContent(String noticeContent)
{
this.noticeContent = noticeContent;
}
public String getNoticeContent()
{
return noticeContent;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("noticeId", getNoticeId())
.append("noticeTitle", getNoticeTitle())
.append("noticeType", getNoticeType())
.append("noticeContent", getNoticeContent())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@@ -0,0 +1,39 @@
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_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;
private Long userId;
private Long jobId;
/** 浏览日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "浏览日期", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty("浏览日期")
private Date reviewDate;
}

View File

@@ -0,0 +1,114 @@
package com.ruoyi.cms.domain;
import java.util.Date;
import java.util.List;
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用户对象 app_user
* @author lishundong
* @date 2024-09-03
*/
@Data
@ApiModel("APP用户")
@TableName(value = "app_user")
public class AppUser extends BaseEntity
{
@TableField(exist = false)
private static final long serialVersionUID = 1L;
/** 用户ID */
@TableId(value = "user_id",type = IdType.AUTO)
@ApiModelProperty("用户ID")
private Long userId;
/** 用户名称 */
@Excel(name = "用户名称")
@ApiModelProperty("用户名称")
private String name;
/** 年龄段 对应字典age */
@Excel(name = "年龄段 对应字典age")
@ApiModelProperty("年龄段 对应字典age")
private String age;
/** 用户性别0男 1女对应字典sex */
@Excel(name = "用户性别", readConverterExp = "0=男,1=女")
@ApiModelProperty("用户性别0男 1女对应字典sex")
private String sex;
/** 生日 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "生日", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty("生日")
private Date birthDate;
/** 学历 对应字典education */
@Excel(name = "学历 对应字典education")
@ApiModelProperty("学历 对应字典education")
private String education;
/** 政治面貌 */
@Excel(name = "政治面貌")
@ApiModelProperty("政治面貌")
private String politicalAffiliation;
/** 手机号码 */
@Excel(name = "手机号码")
@ApiModelProperty("手机号码")
private String phone;
/** 头像地址 */
@Excel(name = "头像地址")
@ApiModelProperty("头像地址")
private String avatar;
/** 最低工资 */
@Excel(name = "最低工资")
@ApiModelProperty("最低工资")
private String salaryMin;
/** 最高工资 */
@Excel(name = "最高工资")
@ApiModelProperty("最高工资")
private String salaryMax;
/** 期望工作地 对应字典area */
@Excel(name = "期望工作地 对应字典area")
@ApiModelProperty("期望工作地 对应字典area")
private String area;
/** 帐号状态0正常 1停用 */
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
@ApiModelProperty("帐号状态0正常 1停用")
private String status;
/** 最后登录IP */
@Excel(name = "最后登录IP")
@ApiModelProperty("最后登录IP")
private String loginIp;
/** 最后登录时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty("最后登录时间")
private Date loginDate;
@ApiModelProperty("期望岗位,逗号分隔")
private String jobTitleId;
@ApiModelProperty("期望薪资")
private String experience;
@ApiModelProperty("是否开启推荐0不推荐 1推荐")
private Integer isRecommend;
@TableField(exist = false)
private List<String> jobTitle;
}

View File

@@ -0,0 +1,177 @@
package com.ruoyi.cms.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
/**
* 字典数据表 sys_dict_data
*
* @author ruoyi
*/
public class BussinessDictData extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 字典编码 */
@Excel(name = "字典编码", cellType = ColumnType.NUMERIC)
private Long dictCode;
/** 字典排序 */
@Excel(name = "字典排序", cellType = ColumnType.NUMERIC)
private Long dictSort;
/** 字典标签 */
@Excel(name = "字典标签")
private String dictLabel;
/** 字典键值 */
@Excel(name = "字典键值")
private String dictValue;
/** 字典类型 */
@Excel(name = "字典类型")
private String dictType;
/** 样式属性(其他样式扩展) */
private String cssClass;
/** 表格字典样式 */
private String listClass;
/** 是否默认Y是 N否 */
@Excel(name = "是否默认", readConverterExp = "Y=是,N=否")
private String isDefault;
/** 状态0正常 1停用 */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status;
public Long getDictCode()
{
return dictCode;
}
public void setDictCode(Long dictCode)
{
this.dictCode = dictCode;
}
public Long getDictSort()
{
return dictSort;
}
public void setDictSort(Long dictSort)
{
this.dictSort = dictSort;
}
@NotBlank(message = "字典标签不能为空")
@Size(min = 0, max = 100, message = "字典标签长度不能超过100个字符")
public String getDictLabel()
{
return dictLabel;
}
public void setDictLabel(String dictLabel)
{
this.dictLabel = dictLabel;
}
@NotBlank(message = "字典键值不能为空")
@Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符")
public String getDictValue()
{
return dictValue;
}
public void setDictValue(String dictValue)
{
this.dictValue = dictValue;
}
@NotBlank(message = "字典类型不能为空")
@Size(min = 0, max = 100, message = "字典类型长度不能超过100个字符")
public String getDictType()
{
return dictType;
}
public void setDictType(String dictType)
{
this.dictType = dictType;
}
@Size(min = 0, max = 100, message = "样式属性长度不能超过100个字符")
public String getCssClass()
{
return cssClass;
}
public void setCssClass(String cssClass)
{
this.cssClass = cssClass;
}
public String getListClass()
{
return listClass;
}
public void setListClass(String listClass)
{
this.listClass = listClass;
}
public boolean getDefault()
{
return UserConstants.YES.equals(this.isDefault);
}
public String getIsDefault()
{
return isDefault;
}
public void setIsDefault(String isDefault)
{
this.isDefault = isDefault;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("dictCode", getDictCode())
.append("dictSort", getDictSort())
.append("dictLabel", getDictLabel())
.append("dictValue", getDictValue())
.append("dictType", getDictType())
.append("cssClass", getCssClass())
.append("listClass", getListClass())
.append("isDefault", getIsDefault())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@@ -0,0 +1,97 @@
package com.ruoyi.cms.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
/**
* 字典类型表 sys_dict_type
*
* @author ruoyi
*/
public class BussinessDictType extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 字典主键 */
@Excel(name = "字典主键", cellType = ColumnType.NUMERIC)
private Long dictId;
/** 字典名称 */
@Excel(name = "字典名称")
private String dictName;
/** 字典类型 */
@Excel(name = "字典类型")
private String dictType;
/** 状态0正常 1停用 */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status;
public Long getDictId()
{
return dictId;
}
public void setDictId(Long dictId)
{
this.dictId = dictId;
}
@NotBlank(message = "字典名称不能为空")
@Size(min = 0, max = 100, message = "字典类型名称长度不能超过100个字符")
public String getDictName()
{
return dictName;
}
public void setDictName(String dictName)
{
this.dictName = dictName;
}
@NotBlank(message = "字典类型不能为空")
@Size(min = 0, max = 100, message = "字典类型类型长度不能超过100个字符")
@Pattern(regexp = "^[a-z][a-z0-9_]*$", message = "字典类型必须以字母开头,且只能为(小写字母,数字,下滑线)")
public String getDictType()
{
return dictType;
}
public void setDictType(String dictType)
{
this.dictType = dictType;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("dictId", getDictId())
.append("dictName", getDictName())
.append("dictType", getDictType())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@@ -0,0 +1,115 @@
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;
/** 业务类型0其它 1新增 2修改 3删除 */
@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;
/** 操作类别0其它 1后台用户 2手机端用户 */
@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;
/** 请求URL */
@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;
/** 操作状态0正常 1异常 */
@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;
/** 业务类型数组 */
private Integer[] businessTypes;
}

View File

@@ -0,0 +1,48 @@
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;
/** id */
@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;
private String address;
}

View File

@@ -0,0 +1,63 @@
package com.ruoyi.cms.domain;
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;
/**
* 公司对象 company
* @author lishundong
* @date 2024-09-04
*/
@Data
@ApiModel("公司")
@TableName(value = "company")
public class Company extends BaseEntity
{
@TableField(exist = false)
private static final long serialVersionUID = 1L;
/** 公司id */
@TableId(value = "company_id",type = IdType.AUTO)
@ApiModelProperty("公司id")
private Long companyId;
/** 单位名称 */
@Excel(name = "单位名称")
@ApiModelProperty("单位名称")
private String name;
/** 单位地点 */
@Excel(name = "单位地点")
@ApiModelProperty("单位地点")
private String location;
/** 主要行业 */
@Excel(name = "主要行业")
@ApiModelProperty("主要行业")
private String industry;
/** 单位规模 对应字典scale */
@Excel(name = "单位规模 对应字典scale")
@ApiModelProperty("单位规模 对应字典scale")
private String scale;
@Excel(name = "信用代码")
@ApiModelProperty("信用代码")
private String code;
@Excel(name = "单位介绍")
@ApiModelProperty("单位介绍")
private String description;
@Excel(name = "性质")
@ApiModelProperty("性质")
private String nature;
@ApiModelProperty("招聘数量")
private Integer totalRecruitment;
@TableField(exist = false)
@ApiModelProperty("是否收藏")
private Integer isCollection;
}

View File

@@ -0,0 +1,50 @@
package com.ruoyi.cms.domain;
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;
/**
* 公司卡片对象 company_card
* @author ${author}
* @date 2025-02-18
*/
@Data
@ApiModel("公司卡片")
@TableName(value = "company_card")
public class CompanyCard extends BaseEntity
{
@TableField(exist = false)
private static final long serialVersionUID = 1L;
/** 公司id */
@TableId(value = "company_card_id",type = IdType.AUTO)
@ApiModelProperty("公司id")
private Long companyCardId;
/** 卡片名称 */
@Excel(name = "卡片名称")
@ApiModelProperty("卡片名称")
private String name;
/** 标签,逗号分开 */
@Excel(name = "标签,逗号分开")
@ApiModelProperty("标签,逗号分开")
private String targ;
@Excel(name = "企业性质")
@ApiModelProperty("企业性质,逗号分开")
private String companyNature;
/** 背景色 */
@Excel(name = "背景色")
@ApiModelProperty("背景色")
private String backgroudColor;
private Integer status;
private Integer cardOrder;
private String description;
private String icon;
}

View File

@@ -0,0 +1,37 @@
package com.ruoyi.cms.domain;
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;
/**
* 公司卡片收藏对象 company_card_collection
* @author ${author}
* @date 2025-02-18
*/
@Data
@ApiModel("公司卡片收藏")
@TableName(value = "company_card_collection")
public class CompanyCardCollection extends BaseEntity
{
@TableField(exist = false)
private static final long serialVersionUID = 1L;
/** 公司id */
@TableId(value = "company_card_collection_id",type = IdType.AUTO)
@ApiModelProperty("公司id")
private Long companyCardCollectionId;
/** 用户id */
@Excel(name = "用户id")
@ApiModelProperty("用户id")
private Long userId;
@Excel(name = "用户id")
@ApiModelProperty("用户id")
private Long companyCardId;
}

View File

@@ -0,0 +1,40 @@
package com.ruoyi.cms.domain;
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;
/**
* 用户公司收藏对象 company_collection
* @author lishundong
* @date 2024-09-04
*/
@Data
@ApiModel("用户公司收藏")
@TableName(value = "company_collection")
public class CompanyCollection extends BaseEntity
{
@TableField(exist = false)
private static final long serialVersionUID = 1L;
/** id */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty("id")
private Long id;
/** 公司id */
@Excel(name = "公司id")
@ApiModelProperty("公司id")
private Long companyId;
/** App用户id */
@Excel(name = "App用户id")
@ApiModelProperty("App用户id")
private Long userId;
}

View File

@@ -0,0 +1,33 @@
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.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 公司标签对象 company_label
* @author ${author}
* @date 2025-02-18
*/
@Data
@ApiModel("公司标签")
@TableName(value = "company_label")
public class CompanyLabel extends BaseEntity
{
@TableField(exist = false)
private static final long serialVersionUID = 1L;
@TableId(value = "id",type = IdType.AUTO)
private Long id;
private String dictValue;
private Long companyId;
}

View File

@@ -0,0 +1,119 @@
package com.ruoyi.cms.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.dromara.easyes.annotation.IndexField;
import org.dromara.easyes.annotation.IndexId;
import org.dromara.easyes.annotation.IndexName;
import org.dromara.easyes.annotation.rely.Analyzer;
import org.dromara.easyes.annotation.rely.FieldType;
import org.dromara.easyes.annotation.rely.IdType;
import java.math.BigDecimal;
import java.util.Date;
/**
* 全文索引 ES数据模型
**/
@IndexName("job_document_gt")
@Data
public class ESJobDocument
{
/**
* es中的唯一id
*/
@IndexId(type = IdType.NONE)
@JsonIgnore
private String id;
/** 公告ID */
private Long jobId;
/** 公告标题 */
@IndexField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_SMART, searchAnalyzer = Analyzer.IK_MAX_WORD)
private String jobTitle;
/** 内容 */
@IndexField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_SMART, searchAnalyzer = Analyzer.IK_MAX_WORD)
private String description;
/** 公告状态 */
@JsonIgnore
private String status;
private Long minSalary;
/** 最大薪资(元) */
private Long maxSalary;
/** 学历要求 对应字典education */
private String education;
/** 工作经验要求 对应字典experience */
private String experience;
/** 用人单位名称 */
private String companyName;
/** 工作地点 */
private String jobLocation;
private Integer jobLocationAreaCode;
/** 发布时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date postingDate;
/** 招聘人数 */
private Long vacancies;
/** 纬度 */
private BigDecimal latitude;
/** 经度 */
private BigDecimal longitude;
/** 浏览量 */
private Long view;
/** 公司id */
private Long companyId;
private Integer isHot;
private Integer applyNum;
@JsonIgnore
private Company company;
private Integer isApply;
private Integer isCollection;
private String dataSource;
private String jobUrl;
@JsonIgnore
@IndexField(fieldType = FieldType.GEO_POINT)
private String latAndLon;
@JsonIgnore
private String scaleDictCode;
private String industry;
private String jobCategory;
@JsonIgnore
private Integer education_int;
@JsonIgnore
private Integer experience_int;
// @JsonIgnore
private Integer scale;
private String appJobUrl;
private String companyNature;
private Integer isExplain;
private String explainUrl;
private String cover;
}

View File

@@ -0,0 +1,41 @@
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.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 用户岗位收藏对象 job_collection
* @author lishundong
* @date 2024-09-03
*/
@Data
@ApiModel("用户和招聘会收藏")
@TableName(value = "fair_collection")
public class FairCollection extends BaseEntity
{
@TableField(exist = false)
private static final long serialVersionUID = 1L;
/** id */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty("id")
private Long id;
/** 岗位id */
@Excel(name = "招聘会id")
@ApiModelProperty("招聘会id")
private Long fairId;
/** App用户id */
@Excel(name = "App用户id")
@ApiModelProperty("App用户id")
private Long userId;
}

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