Compare commits

...

5 Commits

@ -0,0 +1 @@
custom: http://doc.ruoyi.vip/ruoyi-vue/other/donate.html

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

@ -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.

@ -0,0 +1,95 @@
<p align="center">
<img alt="logo" src="https://oscimg.oschina.net/oscnet/up-d3d0a9303e11d522a06cd263f3079027715.png">
</p>
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi v3.9.0</h1>
<h4 align="center">基于SpringBoot+Vue前后端分离的Java快速开发框架</h4>
<p align="center">
<a href="https://gitee.com/y_project/RuoYi-Vue/stargazers"><img src="https://gitee.com/y_project/RuoYi-Vue/badge/star.svg?theme=dark"></a>
<a href="https://gitee.com/y_project/RuoYi-Vue"><img src="https://img.shields.io/badge/RuoYi-v3.9.0-brightgreen.svg"></a>
<a href="https://gitee.com/y_project/RuoYi-Vue/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a>
</p>
## 平台简介
若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
* 前端采用Vue、Element UI。
* 后端采用Spring Boot、Spring Security、Redis & Jwt。
* 权限认证使用Jwt支持多终端认证系统。
* 支持加载动态权限菜单,多方式轻松权限控制。
* 高效率开发,使用代码生成器可以一键生成前后端代码。
* 提供了技术栈([Vue3](https://v3.cn.vuejs.org) [Element Plus](https://element-plus.org/zh-CN) [Vite](https://cn.vitejs.dev))版本[RuoYi-Vue3](https://gitcode.com/yangzongzhuan/RuoYi-Vue3),保持同步更新。
* 提供了单应用版本[RuoYi-Vue-fast](https://gitcode.com/yangzongzhuan/RuoYi-Vue-fast)Oracle版本[RuoYi-Vue-Oracle](https://gitcode.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。
* 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud)
* 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip)&nbsp;&nbsp;
## 内置功能
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。
3. 岗位管理:配置系统用户所属担任职务。
4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。
5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。
6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。
7. 参数管理:对系统动态配置常用参数。
8. 通知公告:系统通知公告信息发布维护。
9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
10. 登录日志:系统登录日志记录查询包含登录异常。
11. 在线用户:当前系统中活跃用户状态监控。
12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
13. 代码生成前后端代码的生成java、html、xml、sql支持CRUD下载 。
14. 系统接口根据业务代码自动生成相关的api接口文档。
15. 服务监控监视当前系统CPU、内存、磁盘、堆栈等相关信息。
16. 缓存监控:对系统的缓存信息查询,命令统计等。
17. 在线构建器拖动表单元素生成相应的HTML代码。
18. 连接池监视监视当前系统数据库连接池状态可进行分析SQL找出系统性能瓶颈。
## 在线体验
- admin/admin123
- 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。
演示地址http://vue.ruoyi.vip
文档地址http://doc.ruoyi.vip
## 演示图
<table>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/cd1f90be5f2684f4560c9519c0f2a232ee8.jpg"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/1cbcf0e6f257c7d3a063c0e3f2ff989e4b3.jpg"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-8074972883b5ba0622e13246738ebba237a.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-9f88719cdfca9af2e58b352a20e23d43b12.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-39bf2584ec3a529b0d5a3b70d15c9b37646.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-936ec82d1f4872e1bc980927654b6007307.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-b2d62ceb95d2dd9b3fbe157bb70d26001e9.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-d67451d308b7a79ad6819723396f7c3d77a.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/5e8c387724954459291aafd5eb52b456f53.jpg"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/644e78da53c2e92a95dfda4f76e6d117c4b.jpg"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-8370a0d02977eebf6dbf854c8450293c937.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-49003ed83f60f633e7153609a53a2b644f7.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-d4fe726319ece268d4746602c39cffc0621.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-c195234bbcd30be6927f037a6755e6ab69c.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/b6115bc8c31de52951982e509930b20684a.jpg"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-5e4daac0bb59612c5038448acbcef235e3a.png"/></td>
</tr>
</table>
## 若依前后端分离交流群
QQ群 [![加入QQ群](https://img.shields.io/badge/已满-937441-blue.svg)](https://jq.qq.com/?_wv=1027&k=5bVB1og) [![加入QQ群](https://img.shields.io/badge/已满-887144332-blue.svg)](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [![加入QQ群](https://img.shields.io/badge/已满-180251782-blue.svg)](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [![加入QQ群](https://img.shields.io/badge/已满-104180207-blue.svg)](https://jq.qq.com/?_wv=1027&k=51G72yr) [![加入QQ群](https://img.shields.io/badge/已满-186866453-blue.svg)](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [![加入QQ群](https://img.shields.io/badge/已满-201396349-blue.svg)](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [![加入QQ群](https://img.shields.io/badge/已满-101456076-blue.svg)](https://jq.qq.com/?_wv=1027&k=kOIINEb5) [![加入QQ群](https://img.shields.io/badge/已满-101539465-blue.svg)](https://jq.qq.com/?_wv=1027&k=UKtX5jhs) [![加入QQ群](https://img.shields.io/badge/已满-264312783-blue.svg)](https://jq.qq.com/?_wv=1027&k=EI9an8lJ) [![加入QQ群](https://img.shields.io/badge/已满-167385320-blue.svg)](https://jq.qq.com/?_wv=1027&k=SWCtLnMz) [![加入QQ群](https://img.shields.io/badge/已满-104748341-blue.svg)](https://jq.qq.com/?_wv=1027&k=96Dkdq0k) [![加入QQ群](https://img.shields.io/badge/已满-160110482-blue.svg)](https://jq.qq.com/?_wv=1027&k=0fsNiYZt) [![加入QQ群](https://img.shields.io/badge/已满-170801498-blue.svg)](https://jq.qq.com/?_wv=1027&k=7xw4xUG1) [![加入QQ群](https://img.shields.io/badge/已满-108482800-blue.svg)](https://jq.qq.com/?_wv=1027&k=eCx8eyoJ) [![加入QQ群](https://img.shields.io/badge/已满-101046199-blue.svg)](https://jq.qq.com/?_wv=1027&k=SpyH2875) [![加入QQ群](https://img.shields.io/badge/已满-136919097-blue.svg)](https://jq.qq.com/?_wv=1027&k=tKEt51dz) [![加入QQ群](https://img.shields.io/badge/已满-143961921-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=0vBbSb0ztbBgVtn3kJS-Q4HUNYwip89G&authKey=8irq5PhutrZmWIvsUsklBxhj57l%2F1nOZqjzigkXZVoZE451GG4JHPOqW7AW6cf0T&noverify=0&group_code=143961921) [![加入QQ群](https://img.shields.io/badge/已满-174951577-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=ZFAPAbp09S2ltvwrJzp7wGlbopsc0rwi&authKey=HB2cxpxP2yspk%2Bo3WKTBfktRCccVkU26cgi5B16u0KcAYrVu7sBaE7XSEqmMdFQp&noverify=0&group_code=174951577) [![加入QQ群](https://img.shields.io/badge/已满-161281055-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=Fn2aF5IHpwsy8j6VlalNJK6qbwFLFHat&authKey=uyIT%2B97x2AXj3odyXpsSpVaPMC%2Bidw0LxG5MAtEqlrcBcWJUA%2FeS43rsF1Tg7IRJ&noverify=0&group_code=161281055) [![加入QQ群](https://img.shields.io/badge/已满-138988063-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=XIzkm_mV2xTsUtFxo63bmicYoDBA6Ifm&authKey=dDW%2F4qsmw3x9govoZY9w%2FoWAoC4wbHqGal%2BbqLzoS6VBarU8EBptIgPKN%2FviyC8j&noverify=0&group_code=138988063) [![加入QQ群](https://img.shields.io/badge/已满-151450850-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=DkugnCg68PevlycJSKSwjhFqfIgrWWwR&authKey=pR1Pa5lPIeGF%2FFtIk6d%2FGB5qFi0EdvyErtpQXULzo03zbhopBHLWcuqdpwY241R%2F&noverify=0&group_code=151450850) [![加入QQ群](https://img.shields.io/badge/已满-224622315-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=F58bgRa-Dp-rsQJThiJqIYv8t4-lWfXh&authKey=UmUs4CVG5OPA1whvsa4uSespOvyd8%2FAr9olEGaWAfdLmfKQk%2FVBp2YU3u2xXXt76&noverify=0&group_code=224622315) [![加入QQ群](https://img.shields.io/badge/已满-287842588-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=Nxb2EQ5qozWa218Wbs7zgBnjLSNk_tVT&authKey=obBKXj6SBKgrFTJZx0AqQnIYbNOvBB2kmgwWvGhzxR67RoRr84%2Bus5OadzMcdJl5&noverify=0&group_code=287842588) [![加入QQ群](https://img.shields.io/badge/已满-187944233-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=numtK1M_I4eVd2Gvg8qtbuL8JgX42qNh&authKey=giV9XWMaFZTY%2FqPlmWbkB9g3fi0Ev5CwEtT9Tgei0oUlFFCQLDp4ozWRiVIzubIm&noverify=0&group_code=187944233) [![加入QQ群](https://img.shields.io/badge/已满-228578329-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=G6r5KGCaa3pqdbUSXNIgYloyb8e0_L0D&authKey=4w8tF1eGW7%2FedWn%2FHAypQksdrML%2BDHolQSx7094Agm7Luakj9EbfPnSTxSi2T1LQ&noverify=0&group_code=228578329) [![加入QQ群](https://img.shields.io/badge/已满-191164766-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=GsOo-OLz53J8y_9TPoO6XXSGNRTgbFxA&authKey=R7Uy%2Feq%2BZsoKNqHvRKhiXpypW7DAogoWapOawUGHokJSBIBIre2%2FoiAZeZBSLuBc&noverify=0&group_code=191164766) [![加入QQ群](https://img.shields.io/badge/174569686-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=PmYavuzsOthVqfdAPbo4uAeIbu7Ttjgc&authKey=p52l8%2FXa4PS1JcEmS3VccKSwOPJUZ1ZfQ69MEKzbrooNUljRtlKjvsXf04bxNp3G&noverify=0&group_code=174569686) 点击按钮入群。

@ -0,0 +1,12 @@
@echo off
echo.
echo [信息] 清理工程target生成路径。
echo.
%~d0
cd %~dp0
cd ..
call mvn clean
pause

@ -0,0 +1,12 @@
@echo off
echo.
echo [信息] 打包Web工程生成war/jar包文件。
echo.
%~d0
cd %~dp0
cd ..
call mvn clean package -Dmaven.test.skip=true
pause

@ -0,0 +1,14 @@
@echo off
echo.
echo [信息] 使用Jar命令运行Web工程。
echo.
cd %~dp0
cd ../ruoyi-admin/target
set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
java -jar %JAVA_OPTS% ruoyi-admin.jar
cd bin
pause

@ -0,0 +1,274 @@
<?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.9.0</version>
<name>ruoyi</name>
<url>http://www.ruoyi.vip</url>
<description>若依管理系统</description>
<properties>
<ruoyi.version>3.9.0</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-boot.version>2.5.15</spring-boot.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.58</fastjson.version>
<oshi.version>6.8.3</oshi.version>
<commons.io.version>2.19.0</commons.io.version>
<poi.version>4.1.2</poi.version>
<velocity.version>2.3</velocity.version>
<jwt.version>0.9.1</jwt.version>
<!-- override dependency version -->
<tomcat.version>9.0.108</tomcat.version>
<logback.version>1.2.13</logback.version>
<spring-security.version>5.7.14</spring-security.version>
<spring-framework.version>5.3.39</spring-framework.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>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- 覆盖logback的依赖配置-->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<!-- 覆盖tomcat的依赖配置-->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>${tomcat.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-el</artifactId>
<version>${tomcat.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-websocket</artifactId>
<version>${tomcat.version}</version>
</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>
<!-- 定时任务-->
<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>
</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>
</modules>
<packaging>pom</packaging>
<build>
<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>

@ -0,0 +1,103 @@
<?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.9.0</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>
<!-- 测试用 BCrypt 加密 -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-crypto</artifactId>
</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>
<artifactId>mysql-connector-java</artifactId>
</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>
</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>

@ -0,0 +1,30 @@
package com.ruoyi;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
/**
*
*
* @author ruoyi
*/
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class RuoYiApplication
{
public static void main(String[] args)
{
// System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(RuoYiApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" +
" |(_ o _) / _( )_ .' \n" +
" | (_,_).' __ ___(_ o _)' \n" +
" | |\\ \\ | || |(_,_)' \n" +
" | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
}
}

@ -0,0 +1,18 @@
package com.ruoyi;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
/**
* web
*
* @author ruoyi
*/
public class RuoYiServletInitializer extends SpringBootServletInitializer
{
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
{
return application.sources(RuoYiApplication.class);
}
}

@ -0,0 +1,11 @@
package com.ruoyi.test;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
public class BCryptTest {
public static void main(String[] args) {
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
String encode = encoder.encode("lcx123456");
System.out.println(encode);
}
}

@ -0,0 +1,104 @@
package com.ruoyi.water.config.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.water.config.domain.WaterConfig;
import com.ruoyi.water.config.service.IWaterConfigService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2025-11-25
*/
@RestController
@RequestMapping("/water/系统配置")
public class WaterConfigController extends BaseController
{
@Autowired
private IWaterConfigService waterConfigService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:系统配置:list')")
@GetMapping("/list")
public TableDataInfo list(WaterConfig waterConfig)
{
startPage();
List<WaterConfig> list = waterConfigService.selectWaterConfigList(waterConfig);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:系统配置:export')")
@Log(title = "系统配置管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WaterConfig waterConfig)
{
List<WaterConfig> list = waterConfigService.selectWaterConfigList(waterConfig);
ExcelUtil<WaterConfig> util = new ExcelUtil<WaterConfig>(WaterConfig.class);
util.exportExcel(response, list, "系统配置管理数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:系统配置:query')")
@GetMapping(value = "/{configId}")
public AjaxResult getInfo(@PathVariable("configId") Long configId)
{
return success(waterConfigService.selectWaterConfigByConfigId(configId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:系统配置:add')")
@Log(title = "系统配置管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WaterConfig waterConfig)
{
return toAjax(waterConfigService.insertWaterConfig(waterConfig));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:系统配置:edit')")
@Log(title = "系统配置管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WaterConfig waterConfig)
{
return toAjax(waterConfigService.updateWaterConfig(waterConfig));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:系统配置:remove')")
@Log(title = "系统配置管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{configIds}")
public AjaxResult remove(@PathVariable Long[] configIds)
{
return toAjax(waterConfigService.deleteWaterConfigByConfigIds(configIds));
}
}

@ -0,0 +1,103 @@
package com.ruoyi.water.config.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* water_config
*
* @author ruoyi
* @date 2025-11-25
*/
public class WaterConfig extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 配置ID */
@Excel(name = "配置ID")
private Long configId;
/** 配置键 */
@Excel(name = "配置键")
private String configKey;
/** 配置值 */
@Excel(name = "配置值")
private String configValue;
/** 配置类型string/number/boolean/json */
@Excel(name = "配置类型", readConverterExp = "s=tring/number/boolean/json")
private String configType;
/** 配置描述 */
@Excel(name = "配置描述")
private String configDesc;
public void setConfigId(Long configId)
{
this.configId = configId;
}
public Long getConfigId()
{
return configId;
}
public void setConfigKey(String configKey)
{
this.configKey = configKey;
}
public String getConfigKey()
{
return configKey;
}
public void setConfigValue(String configValue)
{
this.configValue = configValue;
}
public String getConfigValue()
{
return configValue;
}
public void setConfigType(String configType)
{
this.configType = configType;
}
public String getConfigType()
{
return configType;
}
public void setConfigDesc(String configDesc)
{
this.configDesc = configDesc;
}
public String getConfigDesc()
{
return configDesc;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("configId", getConfigId())
.append("configKey", getConfigKey())
.append("configValue", getConfigValue())
.append("configType", getConfigType())
.append("configDesc", getConfigDesc())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.water.config.mapper;
import java.util.List;
import com.ruoyi.water.config.domain.WaterConfig;
/**
* Mapper
*
* @author ruoyi
* @date 2025-11-25
*/
public interface WaterConfigMapper
{
/**
*
*
* @param configId
* @return
*/
public WaterConfig selectWaterConfigByConfigId(Long configId);
/**
*
*
* @param waterConfig
* @return
*/
public List<WaterConfig> selectWaterConfigList(WaterConfig waterConfig);
/**
*
*
* @param waterConfig
* @return
*/
public int insertWaterConfig(WaterConfig waterConfig);
/**
*
*
* @param waterConfig
* @return
*/
public int updateWaterConfig(WaterConfig waterConfig);
/**
*
*
* @param configId
* @return
*/
public int deleteWaterConfigByConfigId(Long configId);
/**
*
*
* @param configIds
* @return
*/
public int deleteWaterConfigByConfigIds(Long[] configIds);
}

@ -0,0 +1,61 @@
package com.ruoyi.water.config.service;
import java.util.List;
import com.ruoyi.water.config.domain.WaterConfig;
/**
* Service
*
* @author ruoyi
* @date 2025-11-25
*/
public interface IWaterConfigService
{
/**
*
*
* @param configId
* @return
*/
public WaterConfig selectWaterConfigByConfigId(Long configId);
/**
*
*
* @param waterConfig
* @return
*/
public List<WaterConfig> selectWaterConfigList(WaterConfig waterConfig);
/**
*
*
* @param waterConfig
* @return
*/
public int insertWaterConfig(WaterConfig waterConfig);
/**
*
*
* @param waterConfig
* @return
*/
public int updateWaterConfig(WaterConfig waterConfig);
/**
*
*
* @param configIds
* @return
*/
public int deleteWaterConfigByConfigIds(Long[] configIds);
/**
*
*
* @param configId
* @return
*/
public int deleteWaterConfigByConfigId(Long configId);
}

@ -0,0 +1,96 @@
package com.ruoyi.water.config.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.water.config.mapper.WaterConfigMapper;
import com.ruoyi.water.config.domain.WaterConfig;
import com.ruoyi.water.config.service.IWaterConfigService;
/**
* Service
*
* @author ruoyi
* @date 2025-11-25
*/
@Service
public class WaterConfigServiceImpl implements IWaterConfigService
{
@Autowired
private WaterConfigMapper waterConfigMapper;
/**
*
*
* @param configId
* @return
*/
@Override
public WaterConfig selectWaterConfigByConfigId(Long configId)
{
return waterConfigMapper.selectWaterConfigByConfigId(configId);
}
/**
*
*
* @param waterConfig
* @return
*/
@Override
public List<WaterConfig> selectWaterConfigList(WaterConfig waterConfig)
{
return waterConfigMapper.selectWaterConfigList(waterConfig);
}
/**
*
*
* @param waterConfig
* @return
*/
@Override
public int insertWaterConfig(WaterConfig waterConfig)
{
waterConfig.setCreateTime(DateUtils.getNowDate());
return waterConfigMapper.insertWaterConfig(waterConfig);
}
/**
*
*
* @param waterConfig
* @return
*/
@Override
public int updateWaterConfig(WaterConfig waterConfig)
{
waterConfig.setUpdateTime(DateUtils.getNowDate());
return waterConfigMapper.updateWaterConfig(waterConfig);
}
/**
*
*
* @param configIds
* @return
*/
@Override
public int deleteWaterConfigByConfigIds(Long[] configIds)
{
return waterConfigMapper.deleteWaterConfigByConfigIds(configIds);
}
/**
*
*
* @param configId
* @return
*/
@Override
public int deleteWaterConfigByConfigId(Long configId)
{
return waterConfigMapper.deleteWaterConfigByConfigId(configId);
}
}

@ -0,0 +1,104 @@
package com.ruoyi.water.device.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.water.device.domain.WaterDevice;
import com.ruoyi.water.device.service.IWaterDeviceService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2025-11-24
*/
@RestController
@RequestMapping("/water/设备")
public class WaterDeviceController extends BaseController
{
@Autowired
private IWaterDeviceService waterDeviceService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:设备:list')")
@GetMapping("/list")
public TableDataInfo list(WaterDevice waterDevice)
{
startPage();
List<WaterDevice> list = waterDeviceService.selectWaterDeviceList(waterDevice);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:设备:export')")
@Log(title = "设备管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WaterDevice waterDevice)
{
List<WaterDevice> list = waterDeviceService.selectWaterDeviceList(waterDevice);
ExcelUtil<WaterDevice> util = new ExcelUtil<WaterDevice>(WaterDevice.class);
util.exportExcel(response, list, "设备管理数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:设备:query')")
@GetMapping(value = "/{deviceId}")
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId)
{
return success(waterDeviceService.selectWaterDeviceByDeviceId(deviceId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:设备:add')")
@Log(title = "设备管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WaterDevice waterDevice)
{
return toAjax(waterDeviceService.insertWaterDevice(waterDevice));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:设备:edit')")
@Log(title = "设备管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WaterDevice waterDevice)
{
return toAjax(waterDeviceService.updateWaterDevice(waterDevice));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:设备:remove')")
@Log(title = "设备管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{deviceIds}")
public AjaxResult remove(@PathVariable Long[] deviceIds)
{
return toAjax(waterDeviceService.deleteWaterDeviceByDeviceIds(deviceIds));
}
}

@ -0,0 +1,223 @@
package com.ruoyi.water.device.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* water_device
*
* @author ruoyi
* @date 2025-11-24
*/
public class WaterDevice extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 设备ID */
@Excel(name = "设备ID")
private Long deviceId;
/** 用户ID */
@Excel(name = "用户ID")
private Long userId;
/** 设备编号(唯一) */
@Excel(name = "设备编号", readConverterExp = "唯=一")
private String sn;
/** 设备名称 */
@Excel(name = "设备名称")
private String deviceName;
/** 设备类型 */
@Excel(name = "设备类型")
private String deviceType;
/** 设备型号 */
@Excel(name = "设备型号")
private String model;
/** 状态0离线 1在线 2故障 */
@Excel(name = "状态", readConverterExp = "0=离线,1=在线,2=故障")
private String status;
/** 安装地址 */
@Excel(name = "安装地址")
private String installAddress;
/** 纬度 */
private BigDecimal locationLat;
/** 经度 */
private BigDecimal locationLng;
/** 绑定时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "绑定时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date bindTime;
/** 最后在线时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "最后在线时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date lastOnlineTime;
/** 删除标志0存在 2删除 */
private String delFlag;
public void setDeviceId(Long deviceId)
{
this.deviceId = deviceId;
}
public Long getDeviceId()
{
return deviceId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setSn(String sn)
{
this.sn = sn;
}
public String getSn()
{
return sn;
}
public void setDeviceName(String deviceName)
{
this.deviceName = deviceName;
}
public String getDeviceName()
{
return deviceName;
}
public void setDeviceType(String deviceType)
{
this.deviceType = deviceType;
}
public String getDeviceType()
{
return deviceType;
}
public void setModel(String model)
{
this.model = model;
}
public String getModel()
{
return model;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setInstallAddress(String installAddress)
{
this.installAddress = installAddress;
}
public String getInstallAddress()
{
return installAddress;
}
public void setLocationLat(BigDecimal locationLat)
{
this.locationLat = locationLat;
}
public BigDecimal getLocationLat()
{
return locationLat;
}
public void setLocationLng(BigDecimal locationLng)
{
this.locationLng = locationLng;
}
public BigDecimal getLocationLng()
{
return locationLng;
}
public void setBindTime(Date bindTime)
{
this.bindTime = bindTime;
}
public Date getBindTime()
{
return bindTime;
}
public void setLastOnlineTime(Date lastOnlineTime)
{
this.lastOnlineTime = lastOnlineTime;
}
public Date getLastOnlineTime()
{
return lastOnlineTime;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("deviceId", getDeviceId())
.append("userId", getUserId())
.append("sn", getSn())
.append("deviceName", getDeviceName())
.append("deviceType", getDeviceType())
.append("model", getModel())
.append("status", getStatus())
.append("installAddress", getInstallAddress())
.append("locationLat", getLocationLat())
.append("locationLng", getLocationLng())
.append("bindTime", getBindTime())
.append("lastOnlineTime", getLastOnlineTime())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("delFlag", getDelFlag())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.water.device.mapper;
import java.util.List;
import com.ruoyi.water.device.domain.WaterDevice;
/**
* Mapper
*
* @author ruoyi
* @date 2025-11-24
*/
public interface WaterDeviceMapper
{
/**
*
*
* @param deviceId
* @return
*/
public WaterDevice selectWaterDeviceByDeviceId(Long deviceId);
/**
*
*
* @param waterDevice
* @return
*/
public List<WaterDevice> selectWaterDeviceList(WaterDevice waterDevice);
/**
*
*
* @param waterDevice
* @return
*/
public int insertWaterDevice(WaterDevice waterDevice);
/**
*
*
* @param waterDevice
* @return
*/
public int updateWaterDevice(WaterDevice waterDevice);
/**
*
*
* @param deviceId
* @return
*/
public int deleteWaterDeviceByDeviceId(Long deviceId);
/**
*
*
* @param deviceIds
* @return
*/
public int deleteWaterDeviceByDeviceIds(Long[] deviceIds);
}

@ -0,0 +1,61 @@
package com.ruoyi.water.device.service;
import java.util.List;
import com.ruoyi.water.device.domain.WaterDevice;
/**
* Service
*
* @author ruoyi
* @date 2025-11-24
*/
public interface IWaterDeviceService
{
/**
*
*
* @param deviceId
* @return
*/
public WaterDevice selectWaterDeviceByDeviceId(Long deviceId);
/**
*
*
* @param waterDevice
* @return
*/
public List<WaterDevice> selectWaterDeviceList(WaterDevice waterDevice);
/**
*
*
* @param waterDevice
* @return
*/
public int insertWaterDevice(WaterDevice waterDevice);
/**
*
*
* @param waterDevice
* @return
*/
public int updateWaterDevice(WaterDevice waterDevice);
/**
*
*
* @param deviceIds
* @return
*/
public int deleteWaterDeviceByDeviceIds(Long[] deviceIds);
/**
*
*
* @param deviceId
* @return
*/
public int deleteWaterDeviceByDeviceId(Long deviceId);
}

@ -0,0 +1,96 @@
package com.ruoyi.water.device.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.water.device.mapper.WaterDeviceMapper;
import com.ruoyi.water.device.domain.WaterDevice;
import com.ruoyi.water.device.service.IWaterDeviceService;
/**
* Service
*
* @author ruoyi
* @date 2025-11-24
*/
@Service
public class WaterDeviceServiceImpl implements IWaterDeviceService
{
@Autowired
private WaterDeviceMapper waterDeviceMapper;
/**
*
*
* @param deviceId
* @return
*/
@Override
public WaterDevice selectWaterDeviceByDeviceId(Long deviceId)
{
return waterDeviceMapper.selectWaterDeviceByDeviceId(deviceId);
}
/**
*
*
* @param waterDevice
* @return
*/
@Override
public List<WaterDevice> selectWaterDeviceList(WaterDevice waterDevice)
{
return waterDeviceMapper.selectWaterDeviceList(waterDevice);
}
/**
*
*
* @param waterDevice
* @return
*/
@Override
public int insertWaterDevice(WaterDevice waterDevice)
{
waterDevice.setCreateTime(DateUtils.getNowDate());
return waterDeviceMapper.insertWaterDevice(waterDevice);
}
/**
*
*
* @param waterDevice
* @return
*/
@Override
public int updateWaterDevice(WaterDevice waterDevice)
{
waterDevice.setUpdateTime(DateUtils.getNowDate());
return waterDeviceMapper.updateWaterDevice(waterDevice);
}
/**
*
*
* @param deviceIds
* @return
*/
@Override
public int deleteWaterDeviceByDeviceIds(Long[] deviceIds)
{
return waterDeviceMapper.deleteWaterDeviceByDeviceIds(deviceIds);
}
/**
*
*
* @param deviceId
* @return
*/
@Override
public int deleteWaterDeviceByDeviceId(Long deviceId)
{
return waterDeviceMapper.deleteWaterDeviceByDeviceId(deviceId);
}
}

@ -0,0 +1,104 @@
package com.ruoyi.water.evaluation.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.water.evaluation.domain.WaterEvaluation;
import com.ruoyi.water.evaluation.service.IWaterEvaluationService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2025-11-25
*/
@RestController
@RequestMapping("/water/订单评价")
public class WaterEvaluationController extends BaseController
{
@Autowired
private IWaterEvaluationService waterEvaluationService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:订单评价:list')")
@GetMapping("/list")
public TableDataInfo list(WaterEvaluation waterEvaluation)
{
startPage();
List<WaterEvaluation> list = waterEvaluationService.selectWaterEvaluationList(waterEvaluation);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:订单评价:export')")
@Log(title = "订单评价管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WaterEvaluation waterEvaluation)
{
List<WaterEvaluation> list = waterEvaluationService.selectWaterEvaluationList(waterEvaluation);
ExcelUtil<WaterEvaluation> util = new ExcelUtil<WaterEvaluation>(WaterEvaluation.class);
util.exportExcel(response, list, "订单评价管理数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:订单评价:query')")
@GetMapping(value = "/{evaluationId}")
public AjaxResult getInfo(@PathVariable("evaluationId") Long evaluationId)
{
return success(waterEvaluationService.selectWaterEvaluationByEvaluationId(evaluationId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:订单评价:add')")
@Log(title = "订单评价管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WaterEvaluation waterEvaluation)
{
return toAjax(waterEvaluationService.insertWaterEvaluation(waterEvaluation));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:订单评价:edit')")
@Log(title = "订单评价管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WaterEvaluation waterEvaluation)
{
return toAjax(waterEvaluationService.updateWaterEvaluation(waterEvaluation));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:订单评价:remove')")
@Log(title = "订单评价管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{evaluationIds}")
public AjaxResult remove(@PathVariable Long[] evaluationIds)
{
return toAjax(waterEvaluationService.deleteWaterEvaluationByEvaluationIds(evaluationIds));
}
}

@ -0,0 +1,204 @@
package com.ruoyi.water.evaluation.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* water_evaluation
*
* @author ruoyi
* @date 2025-11-25
*/
public class WaterEvaluation extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 评价ID */
@Excel(name = "评价ID")
private Long evaluationId;
/** 订单ID */
@Excel(name = "订单ID")
private Long orderId;
/** 用户ID */
@Excel(name = "用户ID")
private Long userId;
/** 员工ID */
@Excel(name = "员工ID")
private Long staffId;
/** 综合评分1-5星 */
@Excel(name = "综合评分", readConverterExp = "1=-5星")
private BigDecimal rating;
/** 服务态度评分 */
@Excel(name = "服务态度评分")
private BigDecimal serviceRating;
/** 服务质量评分 */
@Excel(name = "服务质量评分")
private BigDecimal qualityRating;
/** 服务速度评分 */
@Excel(name = "服务速度评分")
private BigDecimal speedRating;
/** 评价内容 */
@Excel(name = "评价内容")
private String content;
/** 评价图片JSON数组 */
@Excel(name = "评价图片", readConverterExp = "J=SON数组")
private String images;
/** 是否匿名0否 1是 */
@Excel(name = "是否匿名", readConverterExp = "0=否,1=是")
private String isAnonymous;
/** 删除标志0存在 2删除 */
private String delFlag;
public void setEvaluationId(Long evaluationId)
{
this.evaluationId = evaluationId;
}
public Long getEvaluationId()
{
return evaluationId;
}
public void setOrderId(Long orderId)
{
this.orderId = orderId;
}
public Long getOrderId()
{
return orderId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setStaffId(Long staffId)
{
this.staffId = staffId;
}
public Long getStaffId()
{
return staffId;
}
public void setRating(BigDecimal rating)
{
this.rating = rating;
}
public BigDecimal getRating()
{
return rating;
}
public void setServiceRating(BigDecimal serviceRating)
{
this.serviceRating = serviceRating;
}
public BigDecimal getServiceRating()
{
return serviceRating;
}
public void setQualityRating(BigDecimal qualityRating)
{
this.qualityRating = qualityRating;
}
public BigDecimal getQualityRating()
{
return qualityRating;
}
public void setSpeedRating(BigDecimal speedRating)
{
this.speedRating = speedRating;
}
public BigDecimal getSpeedRating()
{
return speedRating;
}
public void setContent(String content)
{
this.content = content;
}
public String getContent()
{
return content;
}
public void setImages(String images)
{
this.images = images;
}
public String getImages()
{
return images;
}
public void setIsAnonymous(String isAnonymous)
{
this.isAnonymous = isAnonymous;
}
public String getIsAnonymous()
{
return isAnonymous;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("evaluationId", getEvaluationId())
.append("orderId", getOrderId())
.append("userId", getUserId())
.append("staffId", getStaffId())
.append("rating", getRating())
.append("serviceRating", getServiceRating())
.append("qualityRating", getQualityRating())
.append("speedRating", getSpeedRating())
.append("content", getContent())
.append("images", getImages())
.append("isAnonymous", getIsAnonymous())
.append("createTime", getCreateTime())
.append("delFlag", getDelFlag())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.water.evaluation.mapper;
import java.util.List;
import com.ruoyi.water.evaluation.domain.WaterEvaluation;
/**
* Mapper
*
* @author ruoyi
* @date 2025-11-25
*/
public interface WaterEvaluationMapper
{
/**
*
*
* @param evaluationId
* @return
*/
public WaterEvaluation selectWaterEvaluationByEvaluationId(Long evaluationId);
/**
*
*
* @param waterEvaluation
* @return
*/
public List<WaterEvaluation> selectWaterEvaluationList(WaterEvaluation waterEvaluation);
/**
*
*
* @param waterEvaluation
* @return
*/
public int insertWaterEvaluation(WaterEvaluation waterEvaluation);
/**
*
*
* @param waterEvaluation
* @return
*/
public int updateWaterEvaluation(WaterEvaluation waterEvaluation);
/**
*
*
* @param evaluationId
* @return
*/
public int deleteWaterEvaluationByEvaluationId(Long evaluationId);
/**
*
*
* @param evaluationIds
* @return
*/
public int deleteWaterEvaluationByEvaluationIds(Long[] evaluationIds);
}

@ -0,0 +1,61 @@
package com.ruoyi.water.evaluation.service;
import java.util.List;
import com.ruoyi.water.evaluation.domain.WaterEvaluation;
/**
* Service
*
* @author ruoyi
* @date 2025-11-25
*/
public interface IWaterEvaluationService
{
/**
*
*
* @param evaluationId
* @return
*/
public WaterEvaluation selectWaterEvaluationByEvaluationId(Long evaluationId);
/**
*
*
* @param waterEvaluation
* @return
*/
public List<WaterEvaluation> selectWaterEvaluationList(WaterEvaluation waterEvaluation);
/**
*
*
* @param waterEvaluation
* @return
*/
public int insertWaterEvaluation(WaterEvaluation waterEvaluation);
/**
*
*
* @param waterEvaluation
* @return
*/
public int updateWaterEvaluation(WaterEvaluation waterEvaluation);
/**
*
*
* @param evaluationIds
* @return
*/
public int deleteWaterEvaluationByEvaluationIds(Long[] evaluationIds);
/**
*
*
* @param evaluationId
* @return
*/
public int deleteWaterEvaluationByEvaluationId(Long evaluationId);
}

@ -0,0 +1,95 @@
package com.ruoyi.water.evaluation.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.water.evaluation.mapper.WaterEvaluationMapper;
import com.ruoyi.water.evaluation.domain.WaterEvaluation;
import com.ruoyi.water.evaluation.service.IWaterEvaluationService;
/**
* Service
*
* @author ruoyi
* @date 2025-11-25
*/
@Service
public class WaterEvaluationServiceImpl implements IWaterEvaluationService
{
@Autowired
private WaterEvaluationMapper waterEvaluationMapper;
/**
*
*
* @param evaluationId
* @return
*/
@Override
public WaterEvaluation selectWaterEvaluationByEvaluationId(Long evaluationId)
{
return waterEvaluationMapper.selectWaterEvaluationByEvaluationId(evaluationId);
}
/**
*
*
* @param waterEvaluation
* @return
*/
@Override
public List<WaterEvaluation> selectWaterEvaluationList(WaterEvaluation waterEvaluation)
{
return waterEvaluationMapper.selectWaterEvaluationList(waterEvaluation);
}
/**
*
*
* @param waterEvaluation
* @return
*/
@Override
public int insertWaterEvaluation(WaterEvaluation waterEvaluation)
{
waterEvaluation.setCreateTime(DateUtils.getNowDate());
return waterEvaluationMapper.insertWaterEvaluation(waterEvaluation);
}
/**
*
*
* @param waterEvaluation
* @return
*/
@Override
public int updateWaterEvaluation(WaterEvaluation waterEvaluation)
{
return waterEvaluationMapper.updateWaterEvaluation(waterEvaluation);
}
/**
*
*
* @param evaluationIds
* @return
*/
@Override
public int deleteWaterEvaluationByEvaluationIds(Long[] evaluationIds)
{
return waterEvaluationMapper.deleteWaterEvaluationByEvaluationIds(evaluationIds);
}
/**
*
*
* @param evaluationId
* @return
*/
@Override
public int deleteWaterEvaluationByEvaluationId(Long evaluationId)
{
return waterEvaluationMapper.deleteWaterEvaluationByEvaluationId(evaluationId);
}
}

@ -0,0 +1,104 @@
package com.ruoyi.water.filter.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.water.filter.domain.WaterFilter;
import com.ruoyi.water.filter.service.IWaterFilterService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2025-11-24
*/
@RestController
@RequestMapping("/water/滤芯")
public class WaterFilterController extends BaseController
{
@Autowired
private IWaterFilterService waterFilterService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:滤芯:list')")
@GetMapping("/list")
public TableDataInfo list(WaterFilter waterFilter)
{
startPage();
List<WaterFilter> list = waterFilterService.selectWaterFilterList(waterFilter);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:滤芯:export')")
@Log(title = "滤芯管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WaterFilter waterFilter)
{
List<WaterFilter> list = waterFilterService.selectWaterFilterList(waterFilter);
ExcelUtil<WaterFilter> util = new ExcelUtil<WaterFilter>(WaterFilter.class);
util.exportExcel(response, list, "滤芯管理数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:滤芯:query')")
@GetMapping(value = "/{filterId}")
public AjaxResult getInfo(@PathVariable("filterId") Long filterId)
{
return success(waterFilterService.selectWaterFilterByFilterId(filterId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:滤芯:add')")
@Log(title = "滤芯管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WaterFilter waterFilter)
{
return toAjax(waterFilterService.insertWaterFilter(waterFilter));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:滤芯:edit')")
@Log(title = "滤芯管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WaterFilter waterFilter)
{
return toAjax(waterFilterService.updateWaterFilter(waterFilter));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:滤芯:remove')")
@Log(title = "滤芯管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{filterIds}")
public AjaxResult remove(@PathVariable Long[] filterIds)
{
return toAjax(waterFilterService.deleteWaterFilterByFilterIds(filterIds));
}
}

@ -0,0 +1,209 @@
package com.ruoyi.water.filter.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* water_filter
*
* @author ruoyi
* @date 2025-11-24
*/
public class WaterFilter extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 滤芯ID */
@Excel(name = "滤芯ID")
private Long filterId;
/** 设备ID */
@Excel(name = "设备ID")
private Long deviceId;
/** 滤芯名称PP棉滤芯 */
@Excel(name = "滤芯名称", readConverterExp = "如=PP棉滤芯")
private String filterName;
/** 滤芯类型 */
@Excel(name = "滤芯类型")
private String filterType;
/** 滤芯型号 */
@Excel(name = "滤芯型号")
private String model;
/** 安装时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "安装时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date installTime;
/** 总使用天数默认180天 */
@Excel(name = "总使用天数", readConverterExp = "默=认180天")
private Long totalDays;
/** 已使用天数 */
@Excel(name = "已使用天数")
private Long usedDays;
/** 剩余寿命百分比 */
@Excel(name = "剩余寿命百分比")
private Long lifePercentage;
/** 预计更换时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "预计更换时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date nextReplaceTime;
/** 状态0正常 1需更换 */
@Excel(name = "状态", readConverterExp = "0=正常,1=需更换")
private String status;
/** 删除标志0存在 2删除 */
private String delFlag;
public void setFilterId(Long filterId)
{
this.filterId = filterId;
}
public Long getFilterId()
{
return filterId;
}
public void setDeviceId(Long deviceId)
{
this.deviceId = deviceId;
}
public Long getDeviceId()
{
return deviceId;
}
public void setFilterName(String filterName)
{
this.filterName = filterName;
}
public String getFilterName()
{
return filterName;
}
public void setFilterType(String filterType)
{
this.filterType = filterType;
}
public String getFilterType()
{
return filterType;
}
public void setModel(String model)
{
this.model = model;
}
public String getModel()
{
return model;
}
public void setInstallTime(Date installTime)
{
this.installTime = installTime;
}
public Date getInstallTime()
{
return installTime;
}
public void setTotalDays(Long totalDays)
{
this.totalDays = totalDays;
}
public Long getTotalDays()
{
return totalDays;
}
public void setUsedDays(Long usedDays)
{
this.usedDays = usedDays;
}
public Long getUsedDays()
{
return usedDays;
}
public void setLifePercentage(Long lifePercentage)
{
this.lifePercentage = lifePercentage;
}
public Long getLifePercentage()
{
return lifePercentage;
}
public void setNextReplaceTime(Date nextReplaceTime)
{
this.nextReplaceTime = nextReplaceTime;
}
public Date getNextReplaceTime()
{
return nextReplaceTime;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("filterId", getFilterId())
.append("deviceId", getDeviceId())
.append("filterName", getFilterName())
.append("filterType", getFilterType())
.append("model", getModel())
.append("installTime", getInstallTime())
.append("totalDays", getTotalDays())
.append("usedDays", getUsedDays())
.append("lifePercentage", getLifePercentage())
.append("nextReplaceTime", getNextReplaceTime())
.append("status", getStatus())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("delFlag", getDelFlag())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.water.filter.mapper;
import java.util.List;
import com.ruoyi.water.filter.domain.WaterFilter;
/**
* Mapper
*
* @author ruoyi
* @date 2025-11-24
*/
public interface WaterFilterMapper
{
/**
*
*
* @param filterId
* @return
*/
public WaterFilter selectWaterFilterByFilterId(Long filterId);
/**
*
*
* @param waterFilter
* @return
*/
public List<WaterFilter> selectWaterFilterList(WaterFilter waterFilter);
/**
*
*
* @param waterFilter
* @return
*/
public int insertWaterFilter(WaterFilter waterFilter);
/**
*
*
* @param waterFilter
* @return
*/
public int updateWaterFilter(WaterFilter waterFilter);
/**
*
*
* @param filterId
* @return
*/
public int deleteWaterFilterByFilterId(Long filterId);
/**
*
*
* @param filterIds
* @return
*/
public int deleteWaterFilterByFilterIds(Long[] filterIds);
}

@ -0,0 +1,61 @@
package com.ruoyi.water.filter.service;
import java.util.List;
import com.ruoyi.water.filter.domain.WaterFilter;
/**
* Service
*
* @author ruoyi
* @date 2025-11-24
*/
public interface IWaterFilterService
{
/**
*
*
* @param filterId
* @return
*/
public WaterFilter selectWaterFilterByFilterId(Long filterId);
/**
*
*
* @param waterFilter
* @return
*/
public List<WaterFilter> selectWaterFilterList(WaterFilter waterFilter);
/**
*
*
* @param waterFilter
* @return
*/
public int insertWaterFilter(WaterFilter waterFilter);
/**
*
*
* @param waterFilter
* @return
*/
public int updateWaterFilter(WaterFilter waterFilter);
/**
*
*
* @param filterIds
* @return
*/
public int deleteWaterFilterByFilterIds(Long[] filterIds);
/**
*
*
* @param filterId
* @return
*/
public int deleteWaterFilterByFilterId(Long filterId);
}

@ -0,0 +1,96 @@
package com.ruoyi.water.filter.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.water.filter.mapper.WaterFilterMapper;
import com.ruoyi.water.filter.domain.WaterFilter;
import com.ruoyi.water.filter.service.IWaterFilterService;
/**
* Service
*
* @author ruoyi
* @date 2025-11-24
*/
@Service
public class WaterFilterServiceImpl implements IWaterFilterService
{
@Autowired
private WaterFilterMapper waterFilterMapper;
/**
*
*
* @param filterId
* @return
*/
@Override
public WaterFilter selectWaterFilterByFilterId(Long filterId)
{
return waterFilterMapper.selectWaterFilterByFilterId(filterId);
}
/**
*
*
* @param waterFilter
* @return
*/
@Override
public List<WaterFilter> selectWaterFilterList(WaterFilter waterFilter)
{
return waterFilterMapper.selectWaterFilterList(waterFilter);
}
/**
*
*
* @param waterFilter
* @return
*/
@Override
public int insertWaterFilter(WaterFilter waterFilter)
{
waterFilter.setCreateTime(DateUtils.getNowDate());
return waterFilterMapper.insertWaterFilter(waterFilter);
}
/**
*
*
* @param waterFilter
* @return
*/
@Override
public int updateWaterFilter(WaterFilter waterFilter)
{
waterFilter.setUpdateTime(DateUtils.getNowDate());
return waterFilterMapper.updateWaterFilter(waterFilter);
}
/**
*
*
* @param filterIds
* @return
*/
@Override
public int deleteWaterFilterByFilterIds(Long[] filterIds)
{
return waterFilterMapper.deleteWaterFilterByFilterIds(filterIds);
}
/**
*
*
* @param filterId
* @return
*/
@Override
public int deleteWaterFilterByFilterId(Long filterId)
{
return waterFilterMapper.deleteWaterFilterByFilterId(filterId);
}
}

@ -0,0 +1,104 @@
package com.ruoyi.water.message.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.water.message.domain.WaterMessage;
import com.ruoyi.water.message.service.IWaterMessageService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2025-11-25
*/
@RestController
@RequestMapping("/water/系统消息")
public class WaterMessageController extends BaseController
{
@Autowired
private IWaterMessageService waterMessageService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:系统消息:list')")
@GetMapping("/list")
public TableDataInfo list(WaterMessage waterMessage)
{
startPage();
List<WaterMessage> list = waterMessageService.selectWaterMessageList(waterMessage);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:系统消息:export')")
@Log(title = "系统消息管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WaterMessage waterMessage)
{
List<WaterMessage> list = waterMessageService.selectWaterMessageList(waterMessage);
ExcelUtil<WaterMessage> util = new ExcelUtil<WaterMessage>(WaterMessage.class);
util.exportExcel(response, list, "系统消息管理数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:系统消息:query')")
@GetMapping(value = "/{messageId}")
public AjaxResult getInfo(@PathVariable("messageId") Long messageId)
{
return success(waterMessageService.selectWaterMessageByMessageId(messageId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:系统消息:add')")
@Log(title = "系统消息管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WaterMessage waterMessage)
{
return toAjax(waterMessageService.insertWaterMessage(waterMessage));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:系统消息:edit')")
@Log(title = "系统消息管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WaterMessage waterMessage)
{
return toAjax(waterMessageService.updateWaterMessage(waterMessage));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:系统消息:remove')")
@Log(title = "系统消息管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{messageIds}")
public AjaxResult remove(@PathVariable Long[] messageIds)
{
return toAjax(waterMessageService.deleteWaterMessageByMessageIds(messageIds));
}
}

@ -0,0 +1,190 @@
package com.ruoyi.water.message.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* water_message
*
* @author ruoyi
* @date 2025-11-25
*/
public class WaterMessage extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 消息ID */
@Excel(name = "消息ID")
private Long messageId;
/** 用户ID用户消息 */
@Excel(name = "用户ID", readConverterExp = "用=户消息")
private Long userId;
/** 员工ID员工消息 */
@Excel(name = "员工ID", readConverterExp = "员=工消息")
private Long staffId;
/** 消息类型order订单/device设备/system系统/service服务 */
@Excel(name = "消息类型", readConverterExp = "o=rder订单/device设备/system系统/service服务")
private String messageType;
/** 消息标题 */
@Excel(name = "消息标题")
private String title;
/** 消息内容 */
private String content;
/** 关联ID如订单ID、设备ID */
@Excel(name = "关联ID", readConverterExp = "如=订单ID、设备ID")
private Long relatedId;
/** 是否已读0未读 1已读 */
@Excel(name = "是否已读", readConverterExp = "0=未读,1=已读")
private String isRead;
/** 发送时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "发送时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date sendTime;
/** 阅读时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "阅读时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date readTime;
/** 删除标志0存在 2删除 */
private String delFlag;
public void setMessageId(Long messageId)
{
this.messageId = messageId;
}
public Long getMessageId()
{
return messageId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setStaffId(Long staffId)
{
this.staffId = staffId;
}
public Long getStaffId()
{
return staffId;
}
public void setMessageType(String messageType)
{
this.messageType = messageType;
}
public String getMessageType()
{
return messageType;
}
public void setTitle(String title)
{
this.title = title;
}
public String getTitle()
{
return title;
}
public void setContent(String content)
{
this.content = content;
}
public String getContent()
{
return content;
}
public void setRelatedId(Long relatedId)
{
this.relatedId = relatedId;
}
public Long getRelatedId()
{
return relatedId;
}
public void setIsRead(String isRead)
{
this.isRead = isRead;
}
public String getIsRead()
{
return isRead;
}
public void setSendTime(Date sendTime)
{
this.sendTime = sendTime;
}
public Date getSendTime()
{
return sendTime;
}
public void setReadTime(Date readTime)
{
this.readTime = readTime;
}
public Date getReadTime()
{
return readTime;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("messageId", getMessageId())
.append("userId", getUserId())
.append("staffId", getStaffId())
.append("messageType", getMessageType())
.append("title", getTitle())
.append("content", getContent())
.append("relatedId", getRelatedId())
.append("isRead", getIsRead())
.append("sendTime", getSendTime())
.append("readTime", getReadTime())
.append("delFlag", getDelFlag())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.water.message.mapper;
import java.util.List;
import com.ruoyi.water.message.domain.WaterMessage;
/**
* Mapper
*
* @author ruoyi
* @date 2025-11-25
*/
public interface WaterMessageMapper
{
/**
*
*
* @param messageId
* @return
*/
public WaterMessage selectWaterMessageByMessageId(Long messageId);
/**
*
*
* @param waterMessage
* @return
*/
public List<WaterMessage> selectWaterMessageList(WaterMessage waterMessage);
/**
*
*
* @param waterMessage
* @return
*/
public int insertWaterMessage(WaterMessage waterMessage);
/**
*
*
* @param waterMessage
* @return
*/
public int updateWaterMessage(WaterMessage waterMessage);
/**
*
*
* @param messageId
* @return
*/
public int deleteWaterMessageByMessageId(Long messageId);
/**
*
*
* @param messageIds
* @return
*/
public int deleteWaterMessageByMessageIds(Long[] messageIds);
}

@ -0,0 +1,61 @@
package com.ruoyi.water.message.service;
import java.util.List;
import com.ruoyi.water.message.domain.WaterMessage;
/**
* Service
*
* @author ruoyi
* @date 2025-11-25
*/
public interface IWaterMessageService
{
/**
*
*
* @param messageId
* @return
*/
public WaterMessage selectWaterMessageByMessageId(Long messageId);
/**
*
*
* @param waterMessage
* @return
*/
public List<WaterMessage> selectWaterMessageList(WaterMessage waterMessage);
/**
*
*
* @param waterMessage
* @return
*/
public int insertWaterMessage(WaterMessage waterMessage);
/**
*
*
* @param waterMessage
* @return
*/
public int updateWaterMessage(WaterMessage waterMessage);
/**
*
*
* @param messageIds
* @return
*/
public int deleteWaterMessageByMessageIds(Long[] messageIds);
/**
*
*
* @param messageId
* @return
*/
public int deleteWaterMessageByMessageId(Long messageId);
}

@ -0,0 +1,93 @@
package com.ruoyi.water.message.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.water.message.mapper.WaterMessageMapper;
import com.ruoyi.water.message.domain.WaterMessage;
import com.ruoyi.water.message.service.IWaterMessageService;
/**
* Service
*
* @author ruoyi
* @date 2025-11-25
*/
@Service
public class WaterMessageServiceImpl implements IWaterMessageService
{
@Autowired
private WaterMessageMapper waterMessageMapper;
/**
*
*
* @param messageId
* @return
*/
@Override
public WaterMessage selectWaterMessageByMessageId(Long messageId)
{
return waterMessageMapper.selectWaterMessageByMessageId(messageId);
}
/**
*
*
* @param waterMessage
* @return
*/
@Override
public List<WaterMessage> selectWaterMessageList(WaterMessage waterMessage)
{
return waterMessageMapper.selectWaterMessageList(waterMessage);
}
/**
*
*
* @param waterMessage
* @return
*/
@Override
public int insertWaterMessage(WaterMessage waterMessage)
{
return waterMessageMapper.insertWaterMessage(waterMessage);
}
/**
*
*
* @param waterMessage
* @return
*/
@Override
public int updateWaterMessage(WaterMessage waterMessage)
{
return waterMessageMapper.updateWaterMessage(waterMessage);
}
/**
*
*
* @param messageIds
* @return
*/
@Override
public int deleteWaterMessageByMessageIds(Long[] messageIds)
{
return waterMessageMapper.deleteWaterMessageByMessageIds(messageIds);
}
/**
*
*
* @param messageId
* @return
*/
@Override
public int deleteWaterMessageByMessageId(Long messageId)
{
return waterMessageMapper.deleteWaterMessageByMessageId(messageId);
}
}

@ -0,0 +1,104 @@
package com.ruoyi.water.notice.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.water.notice.domain.WaterNotice;
import com.ruoyi.water.notice.service.IWaterNoticeService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2025-11-25
*/
@RestController
@RequestMapping("/water/通知公告")
public class WaterNoticeController extends BaseController
{
@Autowired
private IWaterNoticeService waterNoticeService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:通知公告:list')")
@GetMapping("/list")
public TableDataInfo list(WaterNotice waterNotice)
{
startPage();
List<WaterNotice> list = waterNoticeService.selectWaterNoticeList(waterNotice);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:通知公告:export')")
@Log(title = "通知公告管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WaterNotice waterNotice)
{
List<WaterNotice> list = waterNoticeService.selectWaterNoticeList(waterNotice);
ExcelUtil<WaterNotice> util = new ExcelUtil<WaterNotice>(WaterNotice.class);
util.exportExcel(response, list, "通知公告管理数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:通知公告:query')")
@GetMapping(value = "/{noticeId}")
public AjaxResult getInfo(@PathVariable("noticeId") Long noticeId)
{
return success(waterNoticeService.selectWaterNoticeByNoticeId(noticeId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:通知公告:add')")
@Log(title = "通知公告管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WaterNotice waterNotice)
{
return toAjax(waterNoticeService.insertWaterNotice(waterNotice));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:通知公告:edit')")
@Log(title = "通知公告管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WaterNotice waterNotice)
{
return toAjax(waterNoticeService.updateWaterNotice(waterNotice));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:通知公告:remove')")
@Log(title = "通知公告管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{noticeIds}")
public AjaxResult remove(@PathVariable Long[] noticeIds)
{
return toAjax(waterNoticeService.deleteWaterNoticeByNoticeIds(noticeIds));
}
}

@ -0,0 +1,165 @@
package com.ruoyi.water.notice.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* water_notice
*
* @author ruoyi
* @date 2025-11-25
*/
public class WaterNotice extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 公告ID */
@Excel(name = "公告ID")
private Long noticeId;
/** 公告标题 */
@Excel(name = "公告标题")
private String noticeTitle;
/** 公告内容 */
private String noticeContent;
/** 公告类型info通知/warning警告/urgent紧急 */
@Excel(name = "公告类型", readConverterExp = "i=nfo通知/warning警告/urgent紧急")
private String noticeType;
/** 目标对象all全部/user用户/staff员工 */
@Excel(name = "目标对象", readConverterExp = "a=ll全部/user用户/staff员工")
private String targetType;
/** 状态0发布 1草稿 2下架 */
@Excel(name = "状态", readConverterExp = "0=发布,1=草稿,2=下架")
private String status;
/** 发布时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date publishTime;
/** 过期时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "过期时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date expireTime;
/** 删除标志0存在 2删除 */
private String delFlag;
public void setNoticeId(Long noticeId)
{
this.noticeId = noticeId;
}
public Long getNoticeId()
{
return noticeId;
}
public void setNoticeTitle(String noticeTitle)
{
this.noticeTitle = noticeTitle;
}
public String getNoticeTitle()
{
return noticeTitle;
}
public void setNoticeContent(String noticeContent)
{
this.noticeContent = noticeContent;
}
public String getNoticeContent()
{
return noticeContent;
}
public void setNoticeType(String noticeType)
{
this.noticeType = noticeType;
}
public String getNoticeType()
{
return noticeType;
}
public void setTargetType(String targetType)
{
this.targetType = targetType;
}
public String getTargetType()
{
return targetType;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setPublishTime(Date publishTime)
{
this.publishTime = publishTime;
}
public Date getPublishTime()
{
return publishTime;
}
public void setExpireTime(Date expireTime)
{
this.expireTime = expireTime;
}
public Date getExpireTime()
{
return expireTime;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("noticeId", getNoticeId())
.append("noticeTitle", getNoticeTitle())
.append("noticeContent", getNoticeContent())
.append("noticeType", getNoticeType())
.append("targetType", getTargetType())
.append("status", getStatus())
.append("publishTime", getPublishTime())
.append("expireTime", getExpireTime())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("delFlag", getDelFlag())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.water.notice.mapper;
import java.util.List;
import com.ruoyi.water.notice.domain.WaterNotice;
/**
* Mapper
*
* @author ruoyi
* @date 2025-11-25
*/
public interface WaterNoticeMapper
{
/**
*
*
* @param noticeId
* @return
*/
public WaterNotice selectWaterNoticeByNoticeId(Long noticeId);
/**
*
*
* @param waterNotice
* @return
*/
public List<WaterNotice> selectWaterNoticeList(WaterNotice waterNotice);
/**
*
*
* @param waterNotice
* @return
*/
public int insertWaterNotice(WaterNotice waterNotice);
/**
*
*
* @param waterNotice
* @return
*/
public int updateWaterNotice(WaterNotice waterNotice);
/**
*
*
* @param noticeId
* @return
*/
public int deleteWaterNoticeByNoticeId(Long noticeId);
/**
*
*
* @param noticeIds
* @return
*/
public int deleteWaterNoticeByNoticeIds(Long[] noticeIds);
}

@ -0,0 +1,61 @@
package com.ruoyi.water.notice.service;
import java.util.List;
import com.ruoyi.water.notice.domain.WaterNotice;
/**
* Service
*
* @author ruoyi
* @date 2025-11-25
*/
public interface IWaterNoticeService
{
/**
*
*
* @param noticeId
* @return
*/
public WaterNotice selectWaterNoticeByNoticeId(Long noticeId);
/**
*
*
* @param waterNotice
* @return
*/
public List<WaterNotice> selectWaterNoticeList(WaterNotice waterNotice);
/**
*
*
* @param waterNotice
* @return
*/
public int insertWaterNotice(WaterNotice waterNotice);
/**
*
*
* @param waterNotice
* @return
*/
public int updateWaterNotice(WaterNotice waterNotice);
/**
*
*
* @param noticeIds
* @return
*/
public int deleteWaterNoticeByNoticeIds(Long[] noticeIds);
/**
*
*
* @param noticeId
* @return
*/
public int deleteWaterNoticeByNoticeId(Long noticeId);
}

@ -0,0 +1,96 @@
package com.ruoyi.water.notice.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.water.notice.mapper.WaterNoticeMapper;
import com.ruoyi.water.notice.domain.WaterNotice;
import com.ruoyi.water.notice.service.IWaterNoticeService;
/**
* Service
*
* @author ruoyi
* @date 2025-11-25
*/
@Service
public class WaterNoticeServiceImpl implements IWaterNoticeService
{
@Autowired
private WaterNoticeMapper waterNoticeMapper;
/**
*
*
* @param noticeId
* @return
*/
@Override
public WaterNotice selectWaterNoticeByNoticeId(Long noticeId)
{
return waterNoticeMapper.selectWaterNoticeByNoticeId(noticeId);
}
/**
*
*
* @param waterNotice
* @return
*/
@Override
public List<WaterNotice> selectWaterNoticeList(WaterNotice waterNotice)
{
return waterNoticeMapper.selectWaterNoticeList(waterNotice);
}
/**
*
*
* @param waterNotice
* @return
*/
@Override
public int insertWaterNotice(WaterNotice waterNotice)
{
waterNotice.setCreateTime(DateUtils.getNowDate());
return waterNoticeMapper.insertWaterNotice(waterNotice);
}
/**
*
*
* @param waterNotice
* @return
*/
@Override
public int updateWaterNotice(WaterNotice waterNotice)
{
waterNotice.setUpdateTime(DateUtils.getNowDate());
return waterNoticeMapper.updateWaterNotice(waterNotice);
}
/**
*
*
* @param noticeIds
* @return
*/
@Override
public int deleteWaterNoticeByNoticeIds(Long[] noticeIds)
{
return waterNoticeMapper.deleteWaterNoticeByNoticeIds(noticeIds);
}
/**
*
*
* @param noticeId
* @return
*/
@Override
public int deleteWaterNoticeByNoticeId(Long noticeId)
{
return waterNoticeMapper.deleteWaterNoticeByNoticeId(noticeId);
}
}

@ -0,0 +1,104 @@
package com.ruoyi.water.order.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.water.order.domain.WaterOrderProduct;
import com.ruoyi.water.order.service.IWaterOrderProductService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2025-11-25
*/
@RestController
@RequestMapping("/water/订单商品")
public class WaterOrderProductController extends BaseController
{
@Autowired
private IWaterOrderProductService waterOrderProductService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:订单商品:list')")
@GetMapping("/list")
public TableDataInfo list(WaterOrderProduct waterOrderProduct)
{
startPage();
List<WaterOrderProduct> list = waterOrderProductService.selectWaterOrderProductList(waterOrderProduct);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:订单商品:export')")
@Log(title = "订单商品管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WaterOrderProduct waterOrderProduct)
{
List<WaterOrderProduct> list = waterOrderProductService.selectWaterOrderProductList(waterOrderProduct);
ExcelUtil<WaterOrderProduct> util = new ExcelUtil<WaterOrderProduct>(WaterOrderProduct.class);
util.exportExcel(response, list, "订单商品管理数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:订单商品:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(waterOrderProductService.selectWaterOrderProductById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:订单商品:add')")
@Log(title = "订单商品管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WaterOrderProduct waterOrderProduct)
{
return toAjax(waterOrderProductService.insertWaterOrderProduct(waterOrderProduct));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:订单商品:edit')")
@Log(title = "订单商品管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WaterOrderProduct waterOrderProduct)
{
return toAjax(waterOrderProductService.updateWaterOrderProduct(waterOrderProduct));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:订单商品:remove')")
@Log(title = "订单商品管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(waterOrderProductService.deleteWaterOrderProductByIds(ids));
}
}

@ -0,0 +1,104 @@
package com.ruoyi.water.order.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.water.order.domain.WaterServiceOrder;
import com.ruoyi.water.order.service.IWaterServiceOrderService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2025-11-25
*/
@RestController
@RequestMapping("/water/服务订单")
public class WaterServiceOrderController extends BaseController
{
@Autowired
private IWaterServiceOrderService waterServiceOrderService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:服务订单:list')")
@GetMapping("/list")
public TableDataInfo list(WaterServiceOrder waterServiceOrder)
{
startPage();
List<WaterServiceOrder> list = waterServiceOrderService.selectWaterServiceOrderList(waterServiceOrder);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:服务订单:export')")
@Log(title = "服务订单管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WaterServiceOrder waterServiceOrder)
{
List<WaterServiceOrder> list = waterServiceOrderService.selectWaterServiceOrderList(waterServiceOrder);
ExcelUtil<WaterServiceOrder> util = new ExcelUtil<WaterServiceOrder>(WaterServiceOrder.class);
util.exportExcel(response, list, "服务订单管理数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:服务订单:query')")
@GetMapping(value = "/{orderId}")
public AjaxResult getInfo(@PathVariable("orderId") Long orderId)
{
return success(waterServiceOrderService.selectWaterServiceOrderByOrderId(orderId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:服务订单:add')")
@Log(title = "服务订单管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WaterServiceOrder waterServiceOrder)
{
return toAjax(waterServiceOrderService.insertWaterServiceOrder(waterServiceOrder));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:服务订单:edit')")
@Log(title = "服务订单管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WaterServiceOrder waterServiceOrder)
{
return toAjax(waterServiceOrderService.updateWaterServiceOrder(waterServiceOrder));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:服务订单:remove')")
@Log(title = "服务订单管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{orderIds}")
public AjaxResult remove(@PathVariable Long[] orderIds)
{
return toAjax(waterServiceOrderService.deleteWaterServiceOrderByOrderIds(orderIds));
}
}

@ -0,0 +1,130 @@
package com.ruoyi.water.order.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* water_order_product
*
* @author ruoyi
* @date 2025-11-25
*/
public class WaterOrderProduct extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
@Excel(name = "主键ID")
private Long id;
/** 订单ID */
@Excel(name = "订单ID")
private Long orderId;
/** 商品ID */
@Excel(name = "商品ID")
private Long productId;
/** 商品名称(冗余) */
@Excel(name = "商品名称", readConverterExp = "冗=余")
private String productName;
/** 商品单价(冗余) */
@Excel(name = "商品单价", readConverterExp = "冗=余")
private BigDecimal productPrice;
/** 购买数量 */
@Excel(name = "购买数量")
private Long quantity;
/** 小计金额 */
@Excel(name = "小计金额")
private BigDecimal totalPrice;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setOrderId(Long orderId)
{
this.orderId = orderId;
}
public Long getOrderId()
{
return orderId;
}
public void setProductId(Long productId)
{
this.productId = productId;
}
public Long getProductId()
{
return productId;
}
public void setProductName(String productName)
{
this.productName = productName;
}
public String getProductName()
{
return productName;
}
public void setProductPrice(BigDecimal productPrice)
{
this.productPrice = productPrice;
}
public BigDecimal getProductPrice()
{
return productPrice;
}
public void setQuantity(Long quantity)
{
this.quantity = quantity;
}
public Long getQuantity()
{
return quantity;
}
public void setTotalPrice(BigDecimal totalPrice)
{
this.totalPrice = totalPrice;
}
public BigDecimal getTotalPrice()
{
return totalPrice;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("orderId", getOrderId())
.append("productId", getProductId())
.append("productName", getProductName())
.append("productPrice", getProductPrice())
.append("quantity", getQuantity())
.append("totalPrice", getTotalPrice())
.append("createTime", getCreateTime())
.toString();
}
}

@ -0,0 +1,471 @@
package com.ruoyi.water.order.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* water_service_order
*
* @author ruoyi
* @date 2025-11-25
*/
public class WaterServiceOrder extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 订单ID */
@Excel(name = "订单ID")
private Long orderId;
/** 订单号(唯一) */
@Excel(name = "订单号", readConverterExp = "唯=一")
private String orderNo;
/** 用户ID */
@Excel(name = "用户ID")
private Long userId;
/** 负责员工ID */
@Excel(name = "负责员工ID")
private Long staffId;
/** 服务类型(设备安装/滤芯更换/维修/订购/水质检测) */
@Excel(name = "服务类型", readConverterExp = "设=备安装/滤芯更换/维修/订购/水质检测")
private String serviceType;
/** 订单来源user用户下单/admin后台派单 */
@Excel(name = "订单来源", readConverterExp = "u=ser用户下单/admin后台派单")
private String orderSource;
/** 订单状态pending待支付/paid已支付/accepted已接单/processing处理中/completed已完成/cancelled已取消 */
@Excel(name = "订单状态", readConverterExp = "p=ending待支付/paid已支付/accepted已接单/processing处理中/completed已完成/cancelled已取消")
private String orderStatus;
/** 支付状态unpaid未支付/paid已支付/refunded已退款 */
@Excel(name = "支付状态", readConverterExp = "u=npaid未支付/paid已支付/refunded已退款")
private String paymentStatus;
/** 订单金额 */
@Excel(name = "订单金额")
private BigDecimal amount;
/** 实付金额 */
@Excel(name = "实付金额")
private BigDecimal actualAmount;
/** 优惠金额 */
@Excel(name = "优惠金额")
private BigDecimal discountAmount;
/** 支付方式wechat微信/balance余额/alipay支付宝 */
@Excel(name = "支付方式", readConverterExp = "w=echat微信/balance余额/alipay支付宝")
private String paymentMethod;
/** 联系人 */
@Excel(name = "联系人")
private String contactName;
/** 联系电话 */
@Excel(name = "联系电话")
private String contactPhone;
/** 服务地址 */
@Excel(name = "服务地址")
private String serviceAddress;
/** 纬度 */
@Excel(name = "纬度")
private BigDecimal locationLat;
/** 经度 */
@Excel(name = "经度")
private BigDecimal locationLng;
/** 服务描述/问题描述 */
@Excel(name = "服务描述/问题描述")
private String description;
/** 优先级normal普通/high紧急 */
@Excel(name = "优先级", readConverterExp = "n=ormal普通/high紧急")
private String priority;
/** 配送距离(公里) */
@Excel(name = "配送距离", readConverterExp = "公=里")
private BigDecimal deliveryDistance;
/** 预计时长(分钟) */
@Excel(name = "预计时长", readConverterExp = "分=钟")
private Long estimatedDuration;
/** 实际时长(分钟) */
@Excel(name = "实际时长", readConverterExp = "分=钟")
private Long actualDuration;
/** 提交时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "提交时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date submitTime;
/** 支付时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date paymentTime;
/** 接单时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "接单时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date acceptTime;
/** 开始配送时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始配送时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTime;
/** 完成时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date completeTime;
/** 取消时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "取消时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date cancelTime;
/** 删除标志0存在 2删除 */
private String delFlag;
public void setOrderId(Long orderId)
{
this.orderId = orderId;
}
public Long getOrderId()
{
return orderId;
}
public void setOrderNo(String orderNo)
{
this.orderNo = orderNo;
}
public String getOrderNo()
{
return orderNo;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setStaffId(Long staffId)
{
this.staffId = staffId;
}
public Long getStaffId()
{
return staffId;
}
public void setServiceType(String serviceType)
{
this.serviceType = serviceType;
}
public String getServiceType()
{
return serviceType;
}
public void setOrderSource(String orderSource)
{
this.orderSource = orderSource;
}
public String getOrderSource()
{
return orderSource;
}
public void setOrderStatus(String orderStatus)
{
this.orderStatus = orderStatus;
}
public String getOrderStatus()
{
return orderStatus;
}
public void setPaymentStatus(String paymentStatus)
{
this.paymentStatus = paymentStatus;
}
public String getPaymentStatus()
{
return paymentStatus;
}
public void setAmount(BigDecimal amount)
{
this.amount = amount;
}
public BigDecimal getAmount()
{
return amount;
}
public void setActualAmount(BigDecimal actualAmount)
{
this.actualAmount = actualAmount;
}
public BigDecimal getActualAmount()
{
return actualAmount;
}
public void setDiscountAmount(BigDecimal discountAmount)
{
this.discountAmount = discountAmount;
}
public BigDecimal getDiscountAmount()
{
return discountAmount;
}
public void setPaymentMethod(String paymentMethod)
{
this.paymentMethod = paymentMethod;
}
public String getPaymentMethod()
{
return paymentMethod;
}
public void setContactName(String contactName)
{
this.contactName = contactName;
}
public String getContactName()
{
return contactName;
}
public void setContactPhone(String contactPhone)
{
this.contactPhone = contactPhone;
}
public String getContactPhone()
{
return contactPhone;
}
public void setServiceAddress(String serviceAddress)
{
this.serviceAddress = serviceAddress;
}
public String getServiceAddress()
{
return serviceAddress;
}
public void setLocationLat(BigDecimal locationLat)
{
this.locationLat = locationLat;
}
public BigDecimal getLocationLat()
{
return locationLat;
}
public void setLocationLng(BigDecimal locationLng)
{
this.locationLng = locationLng;
}
public BigDecimal getLocationLng()
{
return locationLng;
}
public void setDescription(String description)
{
this.description = description;
}
public String getDescription()
{
return description;
}
public void setPriority(String priority)
{
this.priority = priority;
}
public String getPriority()
{
return priority;
}
public void setDeliveryDistance(BigDecimal deliveryDistance)
{
this.deliveryDistance = deliveryDistance;
}
public BigDecimal getDeliveryDistance()
{
return deliveryDistance;
}
public void setEstimatedDuration(Long estimatedDuration)
{
this.estimatedDuration = estimatedDuration;
}
public Long getEstimatedDuration()
{
return estimatedDuration;
}
public void setActualDuration(Long actualDuration)
{
this.actualDuration = actualDuration;
}
public Long getActualDuration()
{
return actualDuration;
}
public void setSubmitTime(Date submitTime)
{
this.submitTime = submitTime;
}
public Date getSubmitTime()
{
return submitTime;
}
public void setPaymentTime(Date paymentTime)
{
this.paymentTime = paymentTime;
}
public Date getPaymentTime()
{
return paymentTime;
}
public void setAcceptTime(Date acceptTime)
{
this.acceptTime = acceptTime;
}
public Date getAcceptTime()
{
return acceptTime;
}
public void setStartTime(Date startTime)
{
this.startTime = startTime;
}
public Date getStartTime()
{
return startTime;
}
public void setCompleteTime(Date completeTime)
{
this.completeTime = completeTime;
}
public Date getCompleteTime()
{
return completeTime;
}
public void setCancelTime(Date cancelTime)
{
this.cancelTime = cancelTime;
}
public Date getCancelTime()
{
return cancelTime;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("orderId", getOrderId())
.append("orderNo", getOrderNo())
.append("userId", getUserId())
.append("staffId", getStaffId())
.append("serviceType", getServiceType())
.append("orderSource", getOrderSource())
.append("orderStatus", getOrderStatus())
.append("paymentStatus", getPaymentStatus())
.append("amount", getAmount())
.append("actualAmount", getActualAmount())
.append("discountAmount", getDiscountAmount())
.append("paymentMethod", getPaymentMethod())
.append("contactName", getContactName())
.append("contactPhone", getContactPhone())
.append("serviceAddress", getServiceAddress())
.append("locationLat", getLocationLat())
.append("locationLng", getLocationLng())
.append("description", getDescription())
.append("priority", getPriority())
.append("deliveryDistance", getDeliveryDistance())
.append("estimatedDuration", getEstimatedDuration())
.append("actualDuration", getActualDuration())
.append("submitTime", getSubmitTime())
.append("paymentTime", getPaymentTime())
.append("acceptTime", getAcceptTime())
.append("startTime", getStartTime())
.append("completeTime", getCompleteTime())
.append("cancelTime", getCancelTime())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("delFlag", getDelFlag())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.water.order.mapper;
import java.util.List;
import com.ruoyi.water.order.domain.WaterOrderProduct;
/**
* Mapper
*
* @author ruoyi
* @date 2025-11-25
*/
public interface WaterOrderProductMapper
{
/**
*
*
* @param id
* @return
*/
public WaterOrderProduct selectWaterOrderProductById(Long id);
/**
*
*
* @param waterOrderProduct
* @return
*/
public List<WaterOrderProduct> selectWaterOrderProductList(WaterOrderProduct waterOrderProduct);
/**
*
*
* @param waterOrderProduct
* @return
*/
public int insertWaterOrderProduct(WaterOrderProduct waterOrderProduct);
/**
*
*
* @param waterOrderProduct
* @return
*/
public int updateWaterOrderProduct(WaterOrderProduct waterOrderProduct);
/**
*
*
* @param id
* @return
*/
public int deleteWaterOrderProductById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteWaterOrderProductByIds(Long[] ids);
}

@ -0,0 +1,61 @@
package com.ruoyi.water.order.mapper;
import java.util.List;
import com.ruoyi.water.order.domain.WaterServiceOrder;
/**
* Mapper
*
* @author ruoyi
* @date 2025-11-25
*/
public interface WaterServiceOrderMapper
{
/**
*
*
* @param orderId
* @return
*/
public WaterServiceOrder selectWaterServiceOrderByOrderId(Long orderId);
/**
*
*
* @param waterServiceOrder
* @return
*/
public List<WaterServiceOrder> selectWaterServiceOrderList(WaterServiceOrder waterServiceOrder);
/**
*
*
* @param waterServiceOrder
* @return
*/
public int insertWaterServiceOrder(WaterServiceOrder waterServiceOrder);
/**
*
*
* @param waterServiceOrder
* @return
*/
public int updateWaterServiceOrder(WaterServiceOrder waterServiceOrder);
/**
*
*
* @param orderId
* @return
*/
public int deleteWaterServiceOrderByOrderId(Long orderId);
/**
*
*
* @param orderIds
* @return
*/
public int deleteWaterServiceOrderByOrderIds(Long[] orderIds);
}

@ -0,0 +1,61 @@
package com.ruoyi.water.order.service;
import java.util.List;
import com.ruoyi.water.order.domain.WaterOrderProduct;
/**
* Service
*
* @author ruoyi
* @date 2025-11-25
*/
public interface IWaterOrderProductService
{
/**
*
*
* @param id
* @return
*/
public WaterOrderProduct selectWaterOrderProductById(Long id);
/**
*
*
* @param waterOrderProduct
* @return
*/
public List<WaterOrderProduct> selectWaterOrderProductList(WaterOrderProduct waterOrderProduct);
/**
*
*
* @param waterOrderProduct
* @return
*/
public int insertWaterOrderProduct(WaterOrderProduct waterOrderProduct);
/**
*
*
* @param waterOrderProduct
* @return
*/
public int updateWaterOrderProduct(WaterOrderProduct waterOrderProduct);
/**
*
*
* @param ids
* @return
*/
public int deleteWaterOrderProductByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteWaterOrderProductById(Long id);
}

@ -0,0 +1,61 @@
package com.ruoyi.water.order.service;
import java.util.List;
import com.ruoyi.water.order.domain.WaterServiceOrder;
/**
* Service
*
* @author ruoyi
* @date 2025-11-25
*/
public interface IWaterServiceOrderService
{
/**
*
*
* @param orderId
* @return
*/
public WaterServiceOrder selectWaterServiceOrderByOrderId(Long orderId);
/**
*
*
* @param waterServiceOrder
* @return
*/
public List<WaterServiceOrder> selectWaterServiceOrderList(WaterServiceOrder waterServiceOrder);
/**
*
*
* @param waterServiceOrder
* @return
*/
public int insertWaterServiceOrder(WaterServiceOrder waterServiceOrder);
/**
*
*
* @param waterServiceOrder
* @return
*/
public int updateWaterServiceOrder(WaterServiceOrder waterServiceOrder);
/**
*
*
* @param orderIds
* @return
*/
public int deleteWaterServiceOrderByOrderIds(Long[] orderIds);
/**
*
*
* @param orderId
* @return
*/
public int deleteWaterServiceOrderByOrderId(Long orderId);
}

@ -0,0 +1,95 @@
package com.ruoyi.water.order.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.water.order.mapper.WaterOrderProductMapper;
import com.ruoyi.water.order.domain.WaterOrderProduct;
import com.ruoyi.water.order.service.IWaterOrderProductService;
/**
* Service
*
* @author ruoyi
* @date 2025-11-25
*/
@Service
public class WaterOrderProductServiceImpl implements IWaterOrderProductService
{
@Autowired
private WaterOrderProductMapper waterOrderProductMapper;
/**
*
*
* @param id
* @return
*/
@Override
public WaterOrderProduct selectWaterOrderProductById(Long id)
{
return waterOrderProductMapper.selectWaterOrderProductById(id);
}
/**
*
*
* @param waterOrderProduct
* @return
*/
@Override
public List<WaterOrderProduct> selectWaterOrderProductList(WaterOrderProduct waterOrderProduct)
{
return waterOrderProductMapper.selectWaterOrderProductList(waterOrderProduct);
}
/**
*
*
* @param waterOrderProduct
* @return
*/
@Override
public int insertWaterOrderProduct(WaterOrderProduct waterOrderProduct)
{
waterOrderProduct.setCreateTime(DateUtils.getNowDate());
return waterOrderProductMapper.insertWaterOrderProduct(waterOrderProduct);
}
/**
*
*
* @param waterOrderProduct
* @return
*/
@Override
public int updateWaterOrderProduct(WaterOrderProduct waterOrderProduct)
{
return waterOrderProductMapper.updateWaterOrderProduct(waterOrderProduct);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteWaterOrderProductByIds(Long[] ids)
{
return waterOrderProductMapper.deleteWaterOrderProductByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteWaterOrderProductById(Long id)
{
return waterOrderProductMapper.deleteWaterOrderProductById(id);
}
}

@ -0,0 +1,96 @@
package com.ruoyi.water.order.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.water.order.mapper.WaterServiceOrderMapper;
import com.ruoyi.water.order.domain.WaterServiceOrder;
import com.ruoyi.water.order.service.IWaterServiceOrderService;
/**
* Service
*
* @author ruoyi
* @date 2025-11-25
*/
@Service
public class WaterServiceOrderServiceImpl implements IWaterServiceOrderService
{
@Autowired
private WaterServiceOrderMapper waterServiceOrderMapper;
/**
*
*
* @param orderId
* @return
*/
@Override
public WaterServiceOrder selectWaterServiceOrderByOrderId(Long orderId)
{
return waterServiceOrderMapper.selectWaterServiceOrderByOrderId(orderId);
}
/**
*
*
* @param waterServiceOrder
* @return
*/
@Override
public List<WaterServiceOrder> selectWaterServiceOrderList(WaterServiceOrder waterServiceOrder)
{
return waterServiceOrderMapper.selectWaterServiceOrderList(waterServiceOrder);
}
/**
*
*
* @param waterServiceOrder
* @return
*/
@Override
public int insertWaterServiceOrder(WaterServiceOrder waterServiceOrder)
{
waterServiceOrder.setCreateTime(DateUtils.getNowDate());
return waterServiceOrderMapper.insertWaterServiceOrder(waterServiceOrder);
}
/**
*
*
* @param waterServiceOrder
* @return
*/
@Override
public int updateWaterServiceOrder(WaterServiceOrder waterServiceOrder)
{
waterServiceOrder.setUpdateTime(DateUtils.getNowDate());
return waterServiceOrderMapper.updateWaterServiceOrder(waterServiceOrder);
}
/**
*
*
* @param orderIds
* @return
*/
@Override
public int deleteWaterServiceOrderByOrderIds(Long[] orderIds)
{
return waterServiceOrderMapper.deleteWaterServiceOrderByOrderIds(orderIds);
}
/**
*
*
* @param orderId
* @return
*/
@Override
public int deleteWaterServiceOrderByOrderId(Long orderId)
{
return waterServiceOrderMapper.deleteWaterServiceOrderByOrderId(orderId);
}
}

@ -0,0 +1,104 @@
package com.ruoyi.water.product.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.water.product.domain.WaterProduct;
import com.ruoyi.water.product.service.IWaterProductService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2025-11-25
*/
@RestController
@RequestMapping("/water/商品")
public class WaterProductController extends BaseController
{
@Autowired
private IWaterProductService waterProductService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:商品:list')")
@GetMapping("/list")
public TableDataInfo list(WaterProduct waterProduct)
{
startPage();
List<WaterProduct> list = waterProductService.selectWaterProductList(waterProduct);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:商品:export')")
@Log(title = "商品管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WaterProduct waterProduct)
{
List<WaterProduct> list = waterProductService.selectWaterProductList(waterProduct);
ExcelUtil<WaterProduct> util = new ExcelUtil<WaterProduct>(WaterProduct.class);
util.exportExcel(response, list, "商品管理数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:商品:query')")
@GetMapping(value = "/{productId}")
public AjaxResult getInfo(@PathVariable("productId") Long productId)
{
return success(waterProductService.selectWaterProductByProductId(productId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:商品:add')")
@Log(title = "商品管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WaterProduct waterProduct)
{
return toAjax(waterProductService.insertWaterProduct(waterProduct));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:商品:edit')")
@Log(title = "商品管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WaterProduct waterProduct)
{
return toAjax(waterProductService.updateWaterProduct(waterProduct));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:商品:remove')")
@Log(title = "商品管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{productIds}")
public AjaxResult remove(@PathVariable Long[] productIds)
{
return toAjax(waterProductService.deleteWaterProductByProductIds(productIds));
}
}

@ -0,0 +1,192 @@
package com.ruoyi.water.product.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* water_product
*
* @author ruoyi
* @date 2025-11-25
*/
public class WaterProduct extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 商品ID */
@Excel(name = "商品ID")
private Long productId;
/** 商品名称 */
@Excel(name = "商品名称")
private String productName;
/** 商品描述 */
private String productDesc;
/** 商品分类purifier净水器/meter水表/parts配件/service服务 */
@Excel(name = "商品分类", readConverterExp = "p=urifier净水器/meter水表/parts配件/service服务")
private String category;
/** 商品价格 */
@Excel(name = "商品价格")
private BigDecimal price;
/** 库存数量 */
@Excel(name = "库存数量")
private Long stock;
/** 商品图片URL */
@Excel(name = "商品图片URL")
private String imageUrl;
/** 图标Emoji */
@Excel(name = "图标Emoji")
private String icon;
/** 状态0上架 1下架 */
@Excel(name = "状态", readConverterExp = "0=上架,1=下架")
private String status;
/** 排序 */
@Excel(name = "排序")
private Long sortOrder;
/** 删除标志0存在 2删除 */
private String delFlag;
public void setProductId(Long productId)
{
this.productId = productId;
}
public Long getProductId()
{
return productId;
}
public void setProductName(String productName)
{
this.productName = productName;
}
public String getProductName()
{
return productName;
}
public void setProductDesc(String productDesc)
{
this.productDesc = productDesc;
}
public String getProductDesc()
{
return productDesc;
}
public void setCategory(String category)
{
this.category = category;
}
public String getCategory()
{
return category;
}
public void setPrice(BigDecimal price)
{
this.price = price;
}
public BigDecimal getPrice()
{
return price;
}
public void setStock(Long stock)
{
this.stock = stock;
}
public Long getStock()
{
return stock;
}
public void setImageUrl(String imageUrl)
{
this.imageUrl = imageUrl;
}
public String getImageUrl()
{
return imageUrl;
}
public void setIcon(String icon)
{
this.icon = icon;
}
public String getIcon()
{
return icon;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setSortOrder(Long sortOrder)
{
this.sortOrder = sortOrder;
}
public Long getSortOrder()
{
return sortOrder;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("productId", getProductId())
.append("productName", getProductName())
.append("productDesc", getProductDesc())
.append("category", getCategory())
.append("price", getPrice())
.append("stock", getStock())
.append("imageUrl", getImageUrl())
.append("icon", getIcon())
.append("status", getStatus())
.append("sortOrder", getSortOrder())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("delFlag", getDelFlag())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.water.product.mapper;
import java.util.List;
import com.ruoyi.water.product.domain.WaterProduct;
/**
* Mapper
*
* @author ruoyi
* @date 2025-11-25
*/
public interface WaterProductMapper
{
/**
*
*
* @param productId
* @return
*/
public WaterProduct selectWaterProductByProductId(Long productId);
/**
*
*
* @param waterProduct
* @return
*/
public List<WaterProduct> selectWaterProductList(WaterProduct waterProduct);
/**
*
*
* @param waterProduct
* @return
*/
public int insertWaterProduct(WaterProduct waterProduct);
/**
*
*
* @param waterProduct
* @return
*/
public int updateWaterProduct(WaterProduct waterProduct);
/**
*
*
* @param productId
* @return
*/
public int deleteWaterProductByProductId(Long productId);
/**
*
*
* @param productIds
* @return
*/
public int deleteWaterProductByProductIds(Long[] productIds);
}

@ -0,0 +1,61 @@
package com.ruoyi.water.product.service;
import java.util.List;
import com.ruoyi.water.product.domain.WaterProduct;
/**
* Service
*
* @author ruoyi
* @date 2025-11-25
*/
public interface IWaterProductService
{
/**
*
*
* @param productId
* @return
*/
public WaterProduct selectWaterProductByProductId(Long productId);
/**
*
*
* @param waterProduct
* @return
*/
public List<WaterProduct> selectWaterProductList(WaterProduct waterProduct);
/**
*
*
* @param waterProduct
* @return
*/
public int insertWaterProduct(WaterProduct waterProduct);
/**
*
*
* @param waterProduct
* @return
*/
public int updateWaterProduct(WaterProduct waterProduct);
/**
*
*
* @param productIds
* @return
*/
public int deleteWaterProductByProductIds(Long[] productIds);
/**
*
*
* @param productId
* @return
*/
public int deleteWaterProductByProductId(Long productId);
}

@ -0,0 +1,96 @@
package com.ruoyi.water.product.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.water.product.mapper.WaterProductMapper;
import com.ruoyi.water.product.domain.WaterProduct;
import com.ruoyi.water.product.service.IWaterProductService;
/**
* Service
*
* @author ruoyi
* @date 2025-11-25
*/
@Service
public class WaterProductServiceImpl implements IWaterProductService
{
@Autowired
private WaterProductMapper waterProductMapper;
/**
*
*
* @param productId
* @return
*/
@Override
public WaterProduct selectWaterProductByProductId(Long productId)
{
return waterProductMapper.selectWaterProductByProductId(productId);
}
/**
*
*
* @param waterProduct
* @return
*/
@Override
public List<WaterProduct> selectWaterProductList(WaterProduct waterProduct)
{
return waterProductMapper.selectWaterProductList(waterProduct);
}
/**
*
*
* @param waterProduct
* @return
*/
@Override
public int insertWaterProduct(WaterProduct waterProduct)
{
waterProduct.setCreateTime(DateUtils.getNowDate());
return waterProductMapper.insertWaterProduct(waterProduct);
}
/**
*
*
* @param waterProduct
* @return
*/
@Override
public int updateWaterProduct(WaterProduct waterProduct)
{
waterProduct.setUpdateTime(DateUtils.getNowDate());
return waterProductMapper.updateWaterProduct(waterProduct);
}
/**
*
*
* @param productIds
* @return
*/
@Override
public int deleteWaterProductByProductIds(Long[] productIds)
{
return waterProductMapper.deleteWaterProductByProductIds(productIds);
}
/**
*
*
* @param productId
* @return
*/
@Override
public int deleteWaterProductByProductId(Long productId)
{
return waterProductMapper.deleteWaterProductByProductId(productId);
}
}

@ -0,0 +1,104 @@
package com.ruoyi.water.quality.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.water.quality.domain.WaterQuality;
import com.ruoyi.water.quality.service.IWaterQualityService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2025-11-25
*/
@RestController
@RequestMapping("/water/水质检测")
public class WaterQualityController extends BaseController
{
@Autowired
private IWaterQualityService waterQualityService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:水质检测:list')")
@GetMapping("/list")
public TableDataInfo list(WaterQuality waterQuality)
{
startPage();
List<WaterQuality> list = waterQualityService.selectWaterQualityList(waterQuality);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:水质检测:export')")
@Log(title = "水质检测管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WaterQuality waterQuality)
{
List<WaterQuality> list = waterQualityService.selectWaterQualityList(waterQuality);
ExcelUtil<WaterQuality> util = new ExcelUtil<WaterQuality>(WaterQuality.class);
util.exportExcel(response, list, "水质检测管理数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:水质检测:query')")
@GetMapping(value = "/{qualityId}")
public AjaxResult getInfo(@PathVariable("qualityId") Long qualityId)
{
return success(waterQualityService.selectWaterQualityByQualityId(qualityId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:水质检测:add')")
@Log(title = "水质检测管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WaterQuality waterQuality)
{
return toAjax(waterQualityService.insertWaterQuality(waterQuality));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:水质检测:edit')")
@Log(title = "水质检测管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WaterQuality waterQuality)
{
return toAjax(waterQualityService.updateWaterQuality(waterQuality));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:水质检测:remove')")
@Log(title = "水质检测管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{qualityIds}")
public AjaxResult remove(@PathVariable Long[] qualityIds)
{
return toAjax(waterQualityService.deleteWaterQualityByQualityIds(qualityIds));
}
}

@ -0,0 +1,298 @@
package com.ruoyi.water.quality.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* water_quality
*
* @author ruoyi
* @date 2025-11-25
*/
public class WaterQuality extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 检测ID */
@Excel(name = "检测ID")
private Long qualityId;
/** 设备ID */
@Excel(name = "设备ID")
private Long deviceId;
/** 用户ID */
@Excel(name = "用户ID")
private Long userId;
/** 关联订单ID如果是服务订单 */
@Excel(name = "关联订单ID", readConverterExp = "如=果是服务订单")
private Long orderId;
/** 检测时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "检测时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date testTime;
/** 检测地址 */
@Excel(name = "检测地址")
private String testAddress;
/** 水质等级(优质/良好/一般/较差) */
@Excel(name = "水质等级", readConverterExp = "优=质/良好/一般/较差")
private String qualityLevel;
/** 水质描述 */
private String qualityDesc;
/** pH值6.5-8.5 */
@Excel(name = "pH值", readConverterExp = "6=.5-8.5")
private BigDecimal phValue;
/** 浊度 NTU≤1 */
@Excel(name = "浊度 NTU", readConverterExp = "≤=1")
private BigDecimal turbidity;
/** 余氯 mg/L0.05-4 */
@Excel(name = "余氯 mg/L", readConverterExp = "0=.05-4")
private BigDecimal residualChlorine;
/** 总硬度 mg/L≤450 */
@Excel(name = "总硬度 mg/L", readConverterExp = "≤=450")
private BigDecimal totalHardness;
/** TDS溶解性固体 mg/L≤1000 */
@Excel(name = "TDS溶解性固体 mg/L", readConverterExp = "≤=1000")
private BigDecimal tds;
/** COD化学需氧量 mg/L */
@Excel(name = "COD化学需氧量 mg/L")
private BigDecimal cod;
/** 氨氮 mg/L */
@Excel(name = "氨氮 mg/L")
private BigDecimal ammoniaNitrogen;
/** 检测报告URL */
@Excel(name = "检测报告URL")
private String reportUrl;
/** 状态0检测中 1已完成 */
@Excel(name = "状态", readConverterExp = "0=检测中,1=已完成")
private String status;
/** 删除标志0存在 2删除 */
private String delFlag;
public void setQualityId(Long qualityId)
{
this.qualityId = qualityId;
}
public Long getQualityId()
{
return qualityId;
}
public void setDeviceId(Long deviceId)
{
this.deviceId = deviceId;
}
public Long getDeviceId()
{
return deviceId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setOrderId(Long orderId)
{
this.orderId = orderId;
}
public Long getOrderId()
{
return orderId;
}
public void setTestTime(Date testTime)
{
this.testTime = testTime;
}
public Date getTestTime()
{
return testTime;
}
public void setTestAddress(String testAddress)
{
this.testAddress = testAddress;
}
public String getTestAddress()
{
return testAddress;
}
public void setQualityLevel(String qualityLevel)
{
this.qualityLevel = qualityLevel;
}
public String getQualityLevel()
{
return qualityLevel;
}
public void setQualityDesc(String qualityDesc)
{
this.qualityDesc = qualityDesc;
}
public String getQualityDesc()
{
return qualityDesc;
}
public void setPhValue(BigDecimal phValue)
{
this.phValue = phValue;
}
public BigDecimal getPhValue()
{
return phValue;
}
public void setTurbidity(BigDecimal turbidity)
{
this.turbidity = turbidity;
}
public BigDecimal getTurbidity()
{
return turbidity;
}
public void setResidualChlorine(BigDecimal residualChlorine)
{
this.residualChlorine = residualChlorine;
}
public BigDecimal getResidualChlorine()
{
return residualChlorine;
}
public void setTotalHardness(BigDecimal totalHardness)
{
this.totalHardness = totalHardness;
}
public BigDecimal getTotalHardness()
{
return totalHardness;
}
public void setTds(BigDecimal tds)
{
this.tds = tds;
}
public BigDecimal getTds()
{
return tds;
}
public void setCod(BigDecimal cod)
{
this.cod = cod;
}
public BigDecimal getCod()
{
return cod;
}
public void setAmmoniaNitrogen(BigDecimal ammoniaNitrogen)
{
this.ammoniaNitrogen = ammoniaNitrogen;
}
public BigDecimal getAmmoniaNitrogen()
{
return ammoniaNitrogen;
}
public void setReportUrl(String reportUrl)
{
this.reportUrl = reportUrl;
}
public String getReportUrl()
{
return reportUrl;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("qualityId", getQualityId())
.append("deviceId", getDeviceId())
.append("userId", getUserId())
.append("orderId", getOrderId())
.append("testTime", getTestTime())
.append("testAddress", getTestAddress())
.append("qualityLevel", getQualityLevel())
.append("qualityDesc", getQualityDesc())
.append("phValue", getPhValue())
.append("turbidity", getTurbidity())
.append("residualChlorine", getResidualChlorine())
.append("totalHardness", getTotalHardness())
.append("tds", getTds())
.append("cod", getCod())
.append("ammoniaNitrogen", getAmmoniaNitrogen())
.append("reportUrl", getReportUrl())
.append("status", getStatus())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("delFlag", getDelFlag())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.water.quality.mapper;
import java.util.List;
import com.ruoyi.water.quality.domain.WaterQuality;
/**
* Mapper
*
* @author ruoyi
* @date 2025-11-25
*/
public interface WaterQualityMapper
{
/**
*
*
* @param qualityId
* @return
*/
public WaterQuality selectWaterQualityByQualityId(Long qualityId);
/**
*
*
* @param waterQuality
* @return
*/
public List<WaterQuality> selectWaterQualityList(WaterQuality waterQuality);
/**
*
*
* @param waterQuality
* @return
*/
public int insertWaterQuality(WaterQuality waterQuality);
/**
*
*
* @param waterQuality
* @return
*/
public int updateWaterQuality(WaterQuality waterQuality);
/**
*
*
* @param qualityId
* @return
*/
public int deleteWaterQualityByQualityId(Long qualityId);
/**
*
*
* @param qualityIds
* @return
*/
public int deleteWaterQualityByQualityIds(Long[] qualityIds);
}

@ -0,0 +1,61 @@
package com.ruoyi.water.quality.service;
import java.util.List;
import com.ruoyi.water.quality.domain.WaterQuality;
/**
* Service
*
* @author ruoyi
* @date 2025-11-25
*/
public interface IWaterQualityService
{
/**
*
*
* @param qualityId
* @return
*/
public WaterQuality selectWaterQualityByQualityId(Long qualityId);
/**
*
*
* @param waterQuality
* @return
*/
public List<WaterQuality> selectWaterQualityList(WaterQuality waterQuality);
/**
*
*
* @param waterQuality
* @return
*/
public int insertWaterQuality(WaterQuality waterQuality);
/**
*
*
* @param waterQuality
* @return
*/
public int updateWaterQuality(WaterQuality waterQuality);
/**
*
*
* @param qualityIds
* @return
*/
public int deleteWaterQualityByQualityIds(Long[] qualityIds);
/**
*
*
* @param qualityId
* @return
*/
public int deleteWaterQualityByQualityId(Long qualityId);
}

@ -0,0 +1,96 @@
package com.ruoyi.water.quality.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.water.quality.mapper.WaterQualityMapper;
import com.ruoyi.water.quality.domain.WaterQuality;
import com.ruoyi.water.quality.service.IWaterQualityService;
/**
* Service
*
* @author ruoyi
* @date 2025-11-25
*/
@Service
public class WaterQualityServiceImpl implements IWaterQualityService
{
@Autowired
private WaterQualityMapper waterQualityMapper;
/**
*
*
* @param qualityId
* @return
*/
@Override
public WaterQuality selectWaterQualityByQualityId(Long qualityId)
{
return waterQualityMapper.selectWaterQualityByQualityId(qualityId);
}
/**
*
*
* @param waterQuality
* @return
*/
@Override
public List<WaterQuality> selectWaterQualityList(WaterQuality waterQuality)
{
return waterQualityMapper.selectWaterQualityList(waterQuality);
}
/**
*
*
* @param waterQuality
* @return
*/
@Override
public int insertWaterQuality(WaterQuality waterQuality)
{
waterQuality.setCreateTime(DateUtils.getNowDate());
return waterQualityMapper.insertWaterQuality(waterQuality);
}
/**
*
*
* @param waterQuality
* @return
*/
@Override
public int updateWaterQuality(WaterQuality waterQuality)
{
waterQuality.setUpdateTime(DateUtils.getNowDate());
return waterQualityMapper.updateWaterQuality(waterQuality);
}
/**
*
*
* @param qualityIds
* @return
*/
@Override
public int deleteWaterQualityByQualityIds(Long[] qualityIds)
{
return waterQualityMapper.deleteWaterQualityByQualityIds(qualityIds);
}
/**
*
*
* @param qualityId
* @return
*/
@Override
public int deleteWaterQualityByQualityId(Long qualityId)
{
return waterQualityMapper.deleteWaterQualityByQualityId(qualityId);
}
}

@ -0,0 +1,104 @@
package com.ruoyi.water.staff.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.water.staff.domain.WaterStaff;
import com.ruoyi.water.staff.service.IWaterStaffService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2025-11-24
*/
@RestController
@RequestMapping("/water/员工")
public class WaterStaffController extends BaseController
{
@Autowired
private IWaterStaffService waterStaffService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:员工:list')")
@GetMapping("/list")
public TableDataInfo list(WaterStaff waterStaff)
{
startPage();
List<WaterStaff> list = waterStaffService.selectWaterStaffList(waterStaff);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:员工:export')")
@Log(title = "员工管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WaterStaff waterStaff)
{
List<WaterStaff> list = waterStaffService.selectWaterStaffList(waterStaff);
ExcelUtil<WaterStaff> util = new ExcelUtil<WaterStaff>(WaterStaff.class);
util.exportExcel(response, list, "员工管理数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:员工:query')")
@GetMapping(value = "/{staffId}")
public AjaxResult getInfo(@PathVariable("staffId") Long staffId)
{
return success(waterStaffService.selectWaterStaffByStaffId(staffId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:员工:add')")
@Log(title = "员工管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WaterStaff waterStaff)
{
return toAjax(waterStaffService.insertWaterStaff(waterStaff));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:员工:edit')")
@Log(title = "员工管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WaterStaff waterStaff)
{
return toAjax(waterStaffService.updateWaterStaff(waterStaff));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:员工:remove')")
@Log(title = "员工管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{staffIds}")
public AjaxResult remove(@PathVariable Long[] staffIds)
{
return toAjax(waterStaffService.deleteWaterStaffByStaffIds(staffIds));
}
}

@ -0,0 +1,223 @@
package com.ruoyi.water.staff.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* water_staff
*
* @author ruoyi
* @date 2025-11-24
*/
public class WaterStaff extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 员工ID */
@Excel(name = "员工ID")
private Long staffId;
/** 关联sys_user的user_id */
@Excel(name = "关联sys_user的user_id")
private Long userId;
/** 工号 */
@Excel(name = "工号")
private String employeeNo;
/** 姓名 */
@Excel(name = "姓名")
private String staffName;
/** 手机号 */
@Excel(name = "手机号")
private String phone;
/** 部门ID关联sys_dept */
@Excel(name = "部门ID", readConverterExp = "关=联sys_dept")
private Long deptId;
/** 职位 */
@Excel(name = "职位")
private String position;
/** 状态0正常 1停用 */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 工单总数(冗余) */
@Excel(name = "工单总数", readConverterExp = "冗=余")
private Long totalOrders;
/** 完成工单数(冗余) */
@Excel(name = "完成工单数", readConverterExp = "冗=余")
private Long completedOrders;
/** 平均评分(冗余) */
@Excel(name = "平均评分", readConverterExp = "冗=余")
private BigDecimal avgRating;
/** 平均服务时长-分钟(冗余) */
@Excel(name = "平均服务时长-分钟", readConverterExp = "冗=余")
private Long avgDuration;
/** 删除标志0存在 2删除 */
private String delFlag;
public void setStaffId(Long staffId)
{
this.staffId = staffId;
}
public Long getStaffId()
{
return staffId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setEmployeeNo(String employeeNo)
{
this.employeeNo = employeeNo;
}
public String getEmployeeNo()
{
return employeeNo;
}
public void setStaffName(String staffName)
{
this.staffName = staffName;
}
public String getStaffName()
{
return staffName;
}
public void setPhone(String phone)
{
this.phone = phone;
}
public String getPhone()
{
return phone;
}
public void setDeptId(Long deptId)
{
this.deptId = deptId;
}
public Long getDeptId()
{
return deptId;
}
public void setPosition(String position)
{
this.position = position;
}
public String getPosition()
{
return position;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setTotalOrders(Long totalOrders)
{
this.totalOrders = totalOrders;
}
public Long getTotalOrders()
{
return totalOrders;
}
public void setCompletedOrders(Long completedOrders)
{
this.completedOrders = completedOrders;
}
public Long getCompletedOrders()
{
return completedOrders;
}
public void setAvgRating(BigDecimal avgRating)
{
this.avgRating = avgRating;
}
public BigDecimal getAvgRating()
{
return avgRating;
}
public void setAvgDuration(Long avgDuration)
{
this.avgDuration = avgDuration;
}
public Long getAvgDuration()
{
return avgDuration;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("staffId", getStaffId())
.append("userId", getUserId())
.append("employeeNo", getEmployeeNo())
.append("staffName", getStaffName())
.append("phone", getPhone())
.append("deptId", getDeptId())
.append("position", getPosition())
.append("status", getStatus())
.append("totalOrders", getTotalOrders())
.append("completedOrders", getCompletedOrders())
.append("avgRating", getAvgRating())
.append("avgDuration", getAvgDuration())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("delFlag", getDelFlag())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.water.staff.mapper;
import java.util.List;
import com.ruoyi.water.staff.domain.WaterStaff;
/**
* Mapper
*
* @author ruoyi
* @date 2025-11-24
*/
public interface WaterStaffMapper
{
/**
*
*
* @param staffId
* @return
*/
public WaterStaff selectWaterStaffByStaffId(Long staffId);
/**
*
*
* @param waterStaff
* @return
*/
public List<WaterStaff> selectWaterStaffList(WaterStaff waterStaff);
/**
*
*
* @param waterStaff
* @return
*/
public int insertWaterStaff(WaterStaff waterStaff);
/**
*
*
* @param waterStaff
* @return
*/
public int updateWaterStaff(WaterStaff waterStaff);
/**
*
*
* @param staffId
* @return
*/
public int deleteWaterStaffByStaffId(Long staffId);
/**
*
*
* @param staffIds
* @return
*/
public int deleteWaterStaffByStaffIds(Long[] staffIds);
}

@ -0,0 +1,61 @@
package com.ruoyi.water.staff.service;
import java.util.List;
import com.ruoyi.water.staff.domain.WaterStaff;
/**
* Service
*
* @author ruoyi
* @date 2025-11-24
*/
public interface IWaterStaffService
{
/**
*
*
* @param staffId
* @return
*/
public WaterStaff selectWaterStaffByStaffId(Long staffId);
/**
*
*
* @param waterStaff
* @return
*/
public List<WaterStaff> selectWaterStaffList(WaterStaff waterStaff);
/**
*
*
* @param waterStaff
* @return
*/
public int insertWaterStaff(WaterStaff waterStaff);
/**
*
*
* @param waterStaff
* @return
*/
public int updateWaterStaff(WaterStaff waterStaff);
/**
*
*
* @param staffIds
* @return
*/
public int deleteWaterStaffByStaffIds(Long[] staffIds);
/**
*
*
* @param staffId
* @return
*/
public int deleteWaterStaffByStaffId(Long staffId);
}

@ -0,0 +1,96 @@
package com.ruoyi.water.staff.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.water.staff.mapper.WaterStaffMapper;
import com.ruoyi.water.staff.domain.WaterStaff;
import com.ruoyi.water.staff.service.IWaterStaffService;
/**
* Service
*
* @author ruoyi
* @date 2025-11-24
*/
@Service
public class WaterStaffServiceImpl implements IWaterStaffService
{
@Autowired
private WaterStaffMapper waterStaffMapper;
/**
*
*
* @param staffId
* @return
*/
@Override
public WaterStaff selectWaterStaffByStaffId(Long staffId)
{
return waterStaffMapper.selectWaterStaffByStaffId(staffId);
}
/**
*
*
* @param waterStaff
* @return
*/
@Override
public List<WaterStaff> selectWaterStaffList(WaterStaff waterStaff)
{
return waterStaffMapper.selectWaterStaffList(waterStaff);
}
/**
*
*
* @param waterStaff
* @return
*/
@Override
public int insertWaterStaff(WaterStaff waterStaff)
{
waterStaff.setCreateTime(DateUtils.getNowDate());
return waterStaffMapper.insertWaterStaff(waterStaff);
}
/**
*
*
* @param waterStaff
* @return
*/
@Override
public int updateWaterStaff(WaterStaff waterStaff)
{
waterStaff.setUpdateTime(DateUtils.getNowDate());
return waterStaffMapper.updateWaterStaff(waterStaff);
}
/**
*
*
* @param staffIds
* @return
*/
@Override
public int deleteWaterStaffByStaffIds(Long[] staffIds)
{
return waterStaffMapper.deleteWaterStaffByStaffIds(staffIds);
}
/**
*
*
* @param staffId
* @return
*/
@Override
public int deleteWaterStaffByStaffId(Long staffId)
{
return waterStaffMapper.deleteWaterStaffByStaffId(staffId);
}
}

@ -0,0 +1,104 @@
package com.ruoyi.water.user.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.water.user.domain.WaterUser;
import com.ruoyi.water.user.service.IWaterUserService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2025-11-24
*/
@RestController
@RequestMapping("/water/用户")
public class WaterUserController extends BaseController
{
@Autowired
private IWaterUserService waterUserService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:用户:list')")
@GetMapping("/list")
public TableDataInfo list(WaterUser waterUser)
{
startPage();
List<WaterUser> list = waterUserService.selectWaterUserList(waterUser);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:用户:export')")
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WaterUser waterUser)
{
List<WaterUser> list = waterUserService.selectWaterUserList(waterUser);
ExcelUtil<WaterUser> util = new ExcelUtil<WaterUser>(WaterUser.class);
util.exportExcel(response, list, "用户管理数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:用户:query')")
@GetMapping(value = "/{userId}")
public AjaxResult getInfo(@PathVariable("userId") Long userId)
{
return success(waterUserService.selectWaterUserByUserId(userId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:用户:add')")
@Log(title = "用户管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WaterUser waterUser)
{
return toAjax(waterUserService.insertWaterUser(waterUser));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:用户:edit')")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WaterUser waterUser)
{
return toAjax(waterUserService.updateWaterUser(waterUser));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('water:用户:remove')")
@Log(title = "用户管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{userIds}")
public AjaxResult remove(@PathVariable Long[] userIds)
{
return toAjax(waterUserService.deleteWaterUserByUserIds(userIds));
}
}

@ -0,0 +1,204 @@
package com.ruoyi.water.user.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* water_user
*
* @author ruoyi
* @date 2025-11-24
*/
public class WaterUser extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 用户ID */
@Excel(name = "用户ID")
private Long userId;
/** 手机号 */
@Excel(name = "手机号")
private String phone;
/** 密码BCrypt加密 */
private String password;
/** 昵称 */
@Excel(name = "昵称")
private String nickName;
/** 头像URL */
@Excel(name = "头像URL")
private String avatar;
/** 性别0未知 1男 2女 */
@Excel(name = "性别", readConverterExp = "0=未知,1=男,2=女")
private String gender;
/** 微信openid */
@Excel(name = "微信openid")
private String openid;
/** 微信unionid */
private String unionid;
/** 账户余额 */
@Excel(name = "账户余额")
private BigDecimal balance;
/** 订单总数(冗余) */
@Excel(name = "订单总数", readConverterExp = "冗=余")
private Long totalOrders;
/** 状态0正常 1停用 */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 删除标志0存在 2删除 */
private String delFlag;
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setPhone(String phone)
{
this.phone = phone;
}
public String getPhone()
{
return phone;
}
public void setPassword(String password)
{
this.password = password;
}
public String getPassword()
{
return password;
}
public void setNickName(String nickName)
{
this.nickName = nickName;
}
public String getNickName()
{
return nickName;
}
public void setAvatar(String avatar)
{
this.avatar = avatar;
}
public String getAvatar()
{
return avatar;
}
public void setGender(String gender)
{
this.gender = gender;
}
public String getGender()
{
return gender;
}
public void setOpenid(String openid)
{
this.openid = openid;
}
public String getOpenid()
{
return openid;
}
public void setUnionid(String unionid)
{
this.unionid = unionid;
}
public String getUnionid()
{
return unionid;
}
public void setBalance(BigDecimal balance)
{
this.balance = balance;
}
public BigDecimal getBalance()
{
return balance;
}
public void setTotalOrders(Long totalOrders)
{
this.totalOrders = totalOrders;
}
public Long getTotalOrders()
{
return totalOrders;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId())
.append("phone", getPhone())
.append("password", getPassword())
.append("nickName", getNickName())
.append("avatar", getAvatar())
.append("gender", getGender())
.append("openid", getOpenid())
.append("unionid", getUnionid())
.append("balance", getBalance())
.append("totalOrders", getTotalOrders())
.append("status", getStatus())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("delFlag", getDelFlag())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.water.user.mapper;
import java.util.List;
import com.ruoyi.water.user.domain.WaterUser;
/**
* Mapper
*
* @author ruoyi
* @date 2025-11-24
*/
public interface WaterUserMapper
{
/**
*
*
* @param userId
* @return
*/
public WaterUser selectWaterUserByUserId(Long userId);
/**
*
*
* @param waterUser
* @return
*/
public List<WaterUser> selectWaterUserList(WaterUser waterUser);
/**
*
*
* @param waterUser
* @return
*/
public int insertWaterUser(WaterUser waterUser);
/**
*
*
* @param waterUser
* @return
*/
public int updateWaterUser(WaterUser waterUser);
/**
*
*
* @param userId
* @return
*/
public int deleteWaterUserByUserId(Long userId);
/**
*
*
* @param userIds
* @return
*/
public int deleteWaterUserByUserIds(Long[] userIds);
}

@ -0,0 +1,61 @@
package com.ruoyi.water.user.service;
import java.util.List;
import com.ruoyi.water.user.domain.WaterUser;
/**
* Service
*
* @author ruoyi
* @date 2025-11-24
*/
public interface IWaterUserService
{
/**
*
*
* @param userId
* @return
*/
public WaterUser selectWaterUserByUserId(Long userId);
/**
*
*
* @param waterUser
* @return
*/
public List<WaterUser> selectWaterUserList(WaterUser waterUser);
/**
*
*
* @param waterUser
* @return
*/
public int insertWaterUser(WaterUser waterUser);
/**
*
*
* @param waterUser
* @return
*/
public int updateWaterUser(WaterUser waterUser);
/**
*
*
* @param userIds
* @return
*/
public int deleteWaterUserByUserIds(Long[] userIds);
/**
*
*
* @param userId
* @return
*/
public int deleteWaterUserByUserId(Long userId);
}

@ -0,0 +1,96 @@
package com.ruoyi.water.user.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.water.user.mapper.WaterUserMapper;
import com.ruoyi.water.user.domain.WaterUser;
import com.ruoyi.water.user.service.IWaterUserService;
/**
* Service
*
* @author ruoyi
* @date 2025-11-24
*/
@Service
public class WaterUserServiceImpl implements IWaterUserService
{
@Autowired
private WaterUserMapper waterUserMapper;
/**
*
*
* @param userId
* @return
*/
@Override
public WaterUser selectWaterUserByUserId(Long userId)
{
return waterUserMapper.selectWaterUserByUserId(userId);
}
/**
*
*
* @param waterUser
* @return
*/
@Override
public List<WaterUser> selectWaterUserList(WaterUser waterUser)
{
return waterUserMapper.selectWaterUserList(waterUser);
}
/**
*
*
* @param waterUser
* @return
*/
@Override
public int insertWaterUser(WaterUser waterUser)
{
waterUser.setCreateTime(DateUtils.getNowDate());
return waterUserMapper.insertWaterUser(waterUser);
}
/**
*
*
* @param waterUser
* @return
*/
@Override
public int updateWaterUser(WaterUser waterUser)
{
waterUser.setUpdateTime(DateUtils.getNowDate());
return waterUserMapper.updateWaterUser(waterUser);
}
/**
*
*
* @param userIds
* @return
*/
@Override
public int deleteWaterUserByUserIds(Long[] userIds)
{
return waterUserMapper.deleteWaterUserByUserIds(userIds);
}
/**
*
*
* @param userId
* @return
*/
@Override
public int deleteWaterUserByUserId(Long userId)
{
return waterUserMapper.deleteWaterUserByUserId(userId);
}
}

@ -0,0 +1,94 @@
package com.ruoyi.web.controller.common;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.FastByteArrayOutputStream;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.google.code.kaptcha.Producer;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.sign.Base64;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.system.service.ISysConfigService;
/**
*
*
* @author ruoyi
*/
@RestController
public class CaptchaController
{
@Resource(name = "captchaProducer")
private Producer captchaProducer;
@Resource(name = "captchaProducerMath")
private Producer captchaProducerMath;
@Autowired
private RedisCache redisCache;
@Autowired
private ISysConfigService configService;
/**
*
*/
@GetMapping("/captchaImage")
public AjaxResult getCode(HttpServletResponse response) throws IOException
{
AjaxResult ajax = AjaxResult.success();
boolean captchaEnabled = configService.selectCaptchaEnabled();
ajax.put("captchaEnabled", captchaEnabled);
if (!captchaEnabled)
{
return ajax;
}
// 保存验证码信息
String uuid = IdUtils.simpleUUID();
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
String capStr = null, code = null;
BufferedImage image = null;
// 生成验证码
String captchaType = RuoYiConfig.getCaptchaType();
if ("math".equals(captchaType))
{
String capText = captchaProducerMath.createText();
capStr = capText.substring(0, capText.lastIndexOf("@"));
code = capText.substring(capText.lastIndexOf("@") + 1);
image = captchaProducerMath.createImage(capStr);
}
else if ("char".equals(captchaType))
{
capStr = code = captchaProducer.createText();
image = captchaProducer.createImage(capStr);
}
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
// 转换流信息写出
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
try
{
ImageIO.write(image, "jpg", os);
}
catch (IOException e)
{
return AjaxResult.error(e.getMessage());
}
ajax.put("uuid", uuid);
ajax.put("img", Base64.encode(os.toByteArray()));
return ajax;
}
}

@ -0,0 +1,162 @@
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.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 + FileUtils.stripPrefix(resource);
// 下载名称
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, downloadName);
FileUtils.writeBytes(downloadPath, response.getOutputStream());
}
catch (Exception e)
{
log.error("下载文件失败", e);
}
}
}

@ -0,0 +1,121 @@
package com.ruoyi.web.controller.monitor;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.TreeSet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.SysCache;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/monitor/cache")
public class CacheController
{
@Autowired
private RedisTemplate<String, String> redisTemplate;
private final static List<SysCache> caches = new ArrayList<SysCache>();
{
caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息"));
caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息"));
caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "数据字典"));
caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码"));
caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交"));
caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理"));
caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数"));
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping()
public AjaxResult getInfo() throws Exception
{
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
Map<String, Object> result = new HashMap<>(3);
result.put("info", info);
result.put("dbSize", dbSize);
List<Map<String, String>> pieList = new ArrayList<>();
commandStats.stringPropertyNames().forEach(key -> {
Map<String, String> data = new HashMap<>(2);
String property = commandStats.getProperty(key);
data.put("name", StringUtils.removeStart(key, "cmdstat_"));
data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
pieList.add(data);
});
result.put("commandStats", pieList);
return AjaxResult.success(result);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getNames")
public AjaxResult cache()
{
return AjaxResult.success(caches);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getKeys/{cacheName}")
public AjaxResult getCacheKeys(@PathVariable String cacheName)
{
Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
return AjaxResult.success(new TreeSet<>(cacheKeys));
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping("/getValue/{cacheName}/{cacheKey}")
public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
{
String cacheValue = redisTemplate.opsForValue().get(cacheKey);
SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
return AjaxResult.success(sysCache);
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheName/{cacheName}")
public AjaxResult clearCacheName(@PathVariable String cacheName)
{
Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
redisTemplate.delete(cacheKeys);
return AjaxResult.success();
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheKey/{cacheKey}")
public AjaxResult clearCacheKey(@PathVariable String cacheKey)
{
redisTemplate.delete(cacheKey);
return AjaxResult.success();
}
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@DeleteMapping("/clearCacheAll")
public AjaxResult clearCacheAll()
{
Collection<String> cacheKeys = redisTemplate.keys("*");
redisTemplate.delete(cacheKeys);
return AjaxResult.success();
}
}

@ -0,0 +1,27 @@
package com.ruoyi.web.controller.monitor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.framework.web.domain.Server;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/monitor/server")
public class ServerController
{
@PreAuthorize("@ss.hasPermi('monitor:server:list')")
@GetMapping()
public AjaxResult getInfo() throws Exception
{
Server server = new Server();
server.copyTo();
return AjaxResult.success(server);
}
}

@ -0,0 +1,82 @@
package com.ruoyi.web.controller.monitor;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.service.SysPasswordService;
import com.ruoyi.system.domain.SysLogininfor;
import com.ruoyi.system.service.ISysLogininforService;
/**
* 访
*
* @author ruoyi
*/
@RestController
@RequestMapping("/monitor/logininfor")
public class SysLogininforController extends BaseController
{
@Autowired
private ISysLogininforService logininforService;
@Autowired
private SysPasswordService passwordService;
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
@GetMapping("/list")
public TableDataInfo list(SysLogininfor logininfor)
{
startPage();
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
return getDataTable(list);
}
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysLogininfor logininfor)
{
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
util.exportExcel(response, list, "登录日志");
}
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
@Log(title = "登录日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{infoIds}")
public AjaxResult remove(@PathVariable Long[] infoIds)
{
return toAjax(logininforService.deleteLogininforByIds(infoIds));
}
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
@DeleteMapping("/clean")
public AjaxResult clean()
{
logininforService.cleanLogininfor();
return success();
}
@PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')")
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
@GetMapping("/unlock/{userName}")
public AjaxResult unlock(@PathVariable("userName") String userName)
{
passwordService.clearLoginRecordCache(userName);
return success();
}
}

@ -0,0 +1,69 @@
package com.ruoyi.web.controller.monitor;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysOperLog;
import com.ruoyi.system.service.ISysOperLogService;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/monitor/operlog")
public class SysOperlogController extends BaseController
{
@Autowired
private ISysOperLogService operLogService;
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
@GetMapping("/list")
public TableDataInfo list(SysOperLog operLog)
{
startPage();
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
return getDataTable(list);
}
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysOperLog operLog)
{
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
util.exportExcel(response, list, "操作日志");
}
@Log(title = "操作日志", businessType = BusinessType.DELETE)
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/{operIds}")
public AjaxResult remove(@PathVariable Long[] operIds)
{
return toAjax(operLogService.deleteOperLogByIds(operIds));
}
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/clean")
public AjaxResult clean()
{
operLogService.cleanOperLog();
return success();
}
}

@ -0,0 +1,83 @@
package com.ruoyi.web.controller.monitor;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.SysUserOnline;
import com.ruoyi.system.service.ISysUserOnlineService;
/**
* 线
*
* @author ruoyi
*/
@RestController
@RequestMapping("/monitor/online")
public class SysUserOnlineController extends BaseController
{
@Autowired
private ISysUserOnlineService userOnlineService;
@Autowired
private RedisCache redisCache;
@PreAuthorize("@ss.hasPermi('monitor:online:list')")
@GetMapping("/list")
public TableDataInfo list(String ipaddr, String userName)
{
Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
for (String key : keys)
{
LoginUser user = redisCache.getCacheObject(key);
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
{
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
}
else if (StringUtils.isNotEmpty(ipaddr))
{
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
}
else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
{
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
}
else
{
userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
}
}
Collections.reverse(userOnlineList);
userOnlineList.removeAll(Collections.singleton(null));
return getDataTable(userOnlineList);
}
/**
* 退
*/
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
@Log(title = "在线用户", businessType = BusinessType.FORCE)
@DeleteMapping("/{tokenId}")
public AjaxResult forceLogout(@PathVariable String tokenId)
{
redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
return success();
}
}

@ -0,0 +1,133 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.service.ISysConfigService;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/config")
public class SysConfigController extends BaseController
{
@Autowired
private ISysConfigService configService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:config:list')")
@GetMapping("/list")
public TableDataInfo list(SysConfig config)
{
startPage();
List<SysConfig> list = configService.selectConfigList(config);
return getDataTable(list);
}
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:config:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysConfig config)
{
List<SysConfig> list = configService.selectConfigList(config);
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
util.exportExcel(response, list, "参数数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:config:query')")
@GetMapping(value = "/{configId}")
public AjaxResult getInfo(@PathVariable Long configId)
{
return success(configService.selectConfigById(configId));
}
/**
*
*/
@GetMapping(value = "/configKey/{configKey}")
public AjaxResult getConfigKey(@PathVariable String configKey)
{
return success(configService.selectConfigByKey(configKey));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:config:add')")
@Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysConfig config)
{
if (!configService.checkConfigKeyUnique(config))
{
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setCreateBy(getUsername());
return toAjax(configService.insertConfig(config));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:config:edit')")
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysConfig config)
{
if (!configService.checkConfigKeyUnique(config))
{
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setUpdateBy(getUsername());
return toAjax(configService.updateConfig(config));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "参数管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{configIds}")
public AjaxResult remove(@PathVariable Long[] configIds)
{
configService.deleteConfigByIds(configIds);
return success();
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache")
public AjaxResult refreshCache()
{
configService.resetConfigCache();
return success();
}
}

@ -0,0 +1,132 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysDeptService;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/dept")
public class SysDeptController extends BaseController
{
@Autowired
private ISysDeptService deptService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list")
public AjaxResult list(SysDept dept)
{
List<SysDept> depts = deptService.selectDeptList(dept);
return success(depts);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list/exclude/{deptId}")
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
{
List<SysDept> depts = deptService.selectDeptList(new SysDept());
depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
return success(depts);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dept:query')")
@GetMapping(value = "/{deptId}")
public AjaxResult getInfo(@PathVariable Long deptId)
{
deptService.checkDeptDataScope(deptId);
return success(deptService.selectDeptById(deptId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dept:add')")
@Log(title = "部门管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDept dept)
{
if (!deptService.checkDeptNameUnique(dept))
{
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
dept.setCreateBy(getUsername());
return toAjax(deptService.insertDept(dept));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDept dept)
{
Long deptId = dept.getDeptId();
deptService.checkDeptDataScope(deptId);
if (!deptService.checkDeptNameUnique(dept))
{
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
else if (dept.getParentId().equals(deptId))
{
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
}
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
{
return error("该部门包含未停用的子部门!");
}
dept.setUpdateBy(getUsername());
return toAjax(deptService.updateDept(dept));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
@Log(title = "部门管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{deptId}")
public AjaxResult remove(@PathVariable Long deptId)
{
if (deptService.hasChildByDeptId(deptId))
{
return warn("存在下级部门,不允许删除");
}
if (deptService.checkDeptExistUser(deptId))
{
return warn("部门存在用户,不允许删除");
}
deptService.checkDeptDataScope(deptId);
return toAjax(deptService.deleteDeptById(deptId));
}
}

@ -0,0 +1,121 @@
package com.ruoyi.web.controller.system;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDictDataService;
import com.ruoyi.system.service.ISysDictTypeService;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/dict/data")
public class SysDictDataController extends BaseController
{
@Autowired
private ISysDictDataService dictDataService;
@Autowired
private ISysDictTypeService dictTypeService;
@PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list")
public TableDataInfo list(SysDictData dictData)
{
startPage();
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
return getDataTable(list);
}
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysDictData dictData)
{
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
util.exportExcel(response, list, "字典数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictCode}")
public AjaxResult getInfo(@PathVariable Long dictCode)
{
return success(dictDataService.selectDictDataById(dictCode));
}
/**
*
*/
@GetMapping(value = "/type/{dictType}")
public AjaxResult dictType(@PathVariable String dictType)
{
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
if (StringUtils.isNull(data))
{
data = new ArrayList<SysDictData>();
}
return success(data);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dict:add')")
@Log(title = "字典数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDictData dict)
{
dict.setCreateBy(getUsername());
return toAjax(dictDataService.insertDictData(dict));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictData dict)
{
dict.setUpdateBy(getUsername());
return toAjax(dictDataService.updateDictData(dict));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictCodes}")
public AjaxResult remove(@PathVariable Long[] dictCodes)
{
dictDataService.deleteDictDataByIds(dictCodes);
return success();
}
}

@ -0,0 +1,131 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictType;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDictTypeService;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/dict/type")
public class SysDictTypeController extends BaseController
{
@Autowired
private ISysDictTypeService dictTypeService;
@PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list")
public TableDataInfo list(SysDictType dictType)
{
startPage();
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
return getDataTable(list);
}
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysDictType dictType)
{
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
util.exportExcel(response, list, "字典类型");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictId}")
public AjaxResult getInfo(@PathVariable Long dictId)
{
return success(dictTypeService.selectDictTypeById(dictId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dict:add')")
@Log(title = "字典类型", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDictType dict)
{
if (!dictTypeService.checkDictTypeUnique(dict))
{
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setCreateBy(getUsername());
return toAjax(dictTypeService.insertDictType(dict));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictType dict)
{
if (!dictTypeService.checkDictTypeUnique(dict))
{
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setUpdateBy(getUsername());
return toAjax(dictTypeService.updateDictType(dict));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictIds}")
public AjaxResult remove(@PathVariable Long[] dictIds)
{
dictTypeService.deleteDictTypeByIds(dictIds);
return success();
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache")
public AjaxResult refreshCache()
{
dictTypeService.resetDictCache();
return success();
}
/**
*
*/
@GetMapping("/optionselect")
public AjaxResult optionselect()
{
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
return success(dictTypes);
}
}

@ -0,0 +1,29 @@
package com.ruoyi.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.utils.StringUtils;
/**
*
*
* @author ruoyi
*/
@RestController
public class SysIndexController
{
/** 系统基础配置 */
@Autowired
private RuoYiConfig ruoyiConfig;
/**
* 访
*/
@RequestMapping("/")
public String index()
{
return StringUtils.format("欢迎使用{}后台管理框架当前版本v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
}
}

@ -0,0 +1,131 @@
package com.ruoyi.web.controller.system;
import java.util.Date;
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.core.domain.model.LoginUser;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.web.service.SysLoginService;
import com.ruoyi.framework.web.service.SysPermissionService;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysMenuService;
/**
*
*
* @author ruoyi
*/
@RestController
public class SysLoginController
{
@Autowired
private SysLoginService loginService;
@Autowired
private ISysMenuService menuService;
@Autowired
private SysPermissionService permissionService;
@Autowired
private TokenService tokenService;
@Autowired
private ISysConfigService configService;
/**
*
*
* @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;
}
/**
*
*
* @return
*/
@GetMapping("getInfo")
public AjaxResult getInfo()
{
LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser user = loginUser.getUser();
// 角色集合
Set<String> roles = permissionService.getRolePermission(user);
// 权限集合
Set<String> permissions = permissionService.getMenuPermission(user);
if (!loginUser.getPermissions().equals(permissions))
{
loginUser.setPermissions(permissions);
tokenService.refreshToken(loginUser);
}
AjaxResult ajax = AjaxResult.success();
ajax.put("user", user);
ajax.put("roles", roles);
ajax.put("permissions", permissions);
ajax.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate()));
ajax.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate()));
return ajax;
}
/**
*
*
* @return
*/
@GetMapping("getRouters")
public AjaxResult getRouters()
{
Long userId = SecurityUtils.getUserId();
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
return AjaxResult.success(menuService.buildMenus(menus));
}
// 检查初始密码是否提醒修改
public boolean initPasswordIsModify(Date pwdUpdateDate)
{
Integer initPasswordModify = Convert.toInt(configService.selectConfigByKey("sys.account.initPasswordModify"));
return initPasswordModify != null && initPasswordModify == 1 && pwdUpdateDate == null;
}
// 检查密码是否过期
public boolean passwordIsExpiration(Date pwdUpdateDate)
{
Integer passwordValidateDays = Convert.toInt(configService.selectConfigByKey("sys.account.passwordValidateDays"));
if (passwordValidateDays != null && passwordValidateDays > 0)
{
if (StringUtils.isNull(pwdUpdateDate))
{
// 如果从未修改过初始密码,直接提醒过期
return true;
}
Date nowDate = DateUtils.getNowDate();
return DateUtils.differentDaysByMillisecond(nowDate, pwdUpdateDate) > passwordValidateDays;
}
return false;
}
}

@ -0,0 +1,142 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysMenuService;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/menu")
public class SysMenuController extends BaseController
{
@Autowired
private ISysMenuService menuService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:menu:list')")
@GetMapping("/list")
public AjaxResult list(SysMenu menu)
{
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
return success(menus);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:menu:query')")
@GetMapping(value = "/{menuId}")
public AjaxResult getInfo(@PathVariable Long menuId)
{
return success(menuService.selectMenuById(menuId));
}
/**
*
*/
@GetMapping("/treeselect")
public AjaxResult treeselect(SysMenu menu)
{
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
return success(menuService.buildMenuTreeSelect(menus));
}
/**
*
*/
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
{
List<SysMenu> menus = menuService.selectMenuList(getUserId());
AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
return ajax;
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:menu:add')")
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysMenu menu)
{
if (!menuService.checkMenuNameUnique(menu))
{
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
}
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
{
return error("新增菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头");
}
menu.setCreateBy(getUsername());
return toAjax(menuService.insertMenu(menu));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:menu:edit')")
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysMenu menu)
{
if (!menuService.checkMenuNameUnique(menu))
{
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
}
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
{
return error("修改菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头");
}
else if (menu.getMenuId().equals(menu.getParentId()))
{
return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
}
menu.setUpdateBy(getUsername());
return toAjax(menuService.updateMenu(menu));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:menu:remove')")
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{menuId}")
public AjaxResult remove(@PathVariable("menuId") Long menuId)
{
if (menuService.hasChildByMenuId(menuId))
{
return warn("存在子菜单,不允许删除");
}
if (menuService.checkMenuExistRole(menuId))
{
return warn("菜单已分配,不允许删除");
}
return toAjax(menuService.deleteMenuById(menuId));
}
}

@ -0,0 +1,91 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.service.ISysNoticeService;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/notice")
public class SysNoticeController extends BaseController
{
@Autowired
private ISysNoticeService noticeService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:notice:list')")
@GetMapping("/list")
public TableDataInfo list(SysNotice notice)
{
startPage();
List<SysNotice> list = noticeService.selectNoticeList(notice);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:notice:query')")
@GetMapping(value = "/{noticeId}")
public AjaxResult getInfo(@PathVariable Long noticeId)
{
return success(noticeService.selectNoticeById(noticeId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:notice:add')")
@Log(title = "通知公告", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysNotice notice)
{
notice.setCreateBy(getUsername());
return toAjax(noticeService.insertNotice(notice));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:notice:edit')")
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysNotice notice)
{
notice.setUpdateBy(getUsername());
return toAjax(noticeService.updateNotice(notice));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:notice:remove')")
@Log(title = "通知公告", businessType = BusinessType.DELETE)
@DeleteMapping("/{noticeIds}")
public AjaxResult remove(@PathVariable Long[] noticeIds)
{
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
}
}

@ -0,0 +1,129 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.service.ISysPostService;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/post")
public class SysPostController extends BaseController
{
@Autowired
private ISysPostService postService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:post:list')")
@GetMapping("/list")
public TableDataInfo list(SysPost post)
{
startPage();
List<SysPost> list = postService.selectPostList(post);
return getDataTable(list);
}
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:post:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysPost post)
{
List<SysPost> list = postService.selectPostList(post);
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
util.exportExcel(response, list, "岗位数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:post:query')")
@GetMapping(value = "/{postId}")
public AjaxResult getInfo(@PathVariable Long postId)
{
return success(postService.selectPostById(postId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:post:add')")
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysPost post)
{
if (!postService.checkPostNameUnique(post))
{
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
}
else if (!postService.checkPostCodeUnique(post))
{
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
}
post.setCreateBy(getUsername());
return toAjax(postService.insertPost(post));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:post:edit')")
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysPost post)
{
if (!postService.checkPostNameUnique(post))
{
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
}
else if (!postService.checkPostCodeUnique(post))
{
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
}
post.setUpdateBy(getUsername());
return toAjax(postService.updatePost(post));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:post:remove')")
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{postIds}")
public AjaxResult remove(@PathVariable Long[] postIds)
{
return toAjax(postService.deletePostByIds(postIds));
}
/**
*
*/
@GetMapping("/optionselect")
public AjaxResult optionselect()
{
List<SysPost> posts = postService.selectPostAll();
return success(posts);
}
}

@ -0,0 +1,148 @@
package com.ruoyi.web.controller.system;
import java.util.Map;
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.DateUtils;
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.FileUtils;
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(@RequestBody Map<String, String> params)
{
String oldPassword = params.get("oldPassword");
String newPassword = params.get("newPassword");
LoginUser loginUser = getLoginUser();
Long userId = loginUser.getUserId();
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(userId, newPassword) > 0)
{
// 更新缓存用户密码&密码最后更新时间
loginUser.getUser().setPwdUpdateDate(DateUtils.getNowDate());
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, true);
if (userService.updateUserAvatar(loginUser.getUserId(), avatar))
{
String oldAvatar = loginUser.getUser().getAvatar();
if (StringUtils.isNotEmpty(oldAvatar))
{
FileUtils.deleteFile(RuoYiConfig.getProfile() + FileUtils.stripPrefix(oldAvatar));
}
AjaxResult ajax = AjaxResult.success();
ajax.put("imgUrl", avatar);
// 更新缓存用户头像
loginUser.getUser().setAvatar(avatar);
tokenService.setLoginUser(loginUser);
return ajax;
}
}
return error("上传图片异常,请联系管理员");
}
}

@ -0,0 +1,38 @@
package com.ruoyi.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.RegisterBody;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.web.service.SysRegisterService;
import com.ruoyi.system.service.ISysConfigService;
/**
*
*
* @author ruoyi
*/
@RestController
public class SysRegisterController extends BaseController
{
@Autowired
private SysRegisterService registerService;
@Autowired
private ISysConfigService configService;
@PostMapping("/register")
public AjaxResult register(@RequestBody RegisterBody user)
{
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
{
return error("当前系统没有开启注册功能!");
}
String msg = registerService.register(user);
return StringUtils.isEmpty(msg) ? success() : error(msg);
}
}

@ -0,0 +1,262 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.service.SysPermissionService;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.domain.SysUserRole;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService;
/**
*
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/role")
public class SysRoleController extends BaseController
{
@Autowired
private ISysRoleService roleService;
@Autowired
private TokenService tokenService;
@Autowired
private SysPermissionService permissionService;
@Autowired
private ISysUserService userService;
@Autowired
private ISysDeptService deptService;
@PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/list")
public TableDataInfo list(SysRole role)
{
startPage();
List<SysRole> list = roleService.selectRoleList(role);
return getDataTable(list);
}
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:role:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysRole role)
{
List<SysRole> list = roleService.selectRoleList(role);
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
util.exportExcel(response, list, "角色数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping(value = "/{roleId}")
public AjaxResult getInfo(@PathVariable Long roleId)
{
roleService.checkRoleDataScope(roleId);
return success(roleService.selectRoleById(roleId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:role:add')")
@Log(title = "角色管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysRole role)
{
if (!roleService.checkRoleNameUnique(role))
{
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
}
else if (!roleService.checkRoleKeyUnique(role))
{
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
}
role.setCreateBy(getUsername());
return toAjax(roleService.insertRole(role));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysRole role)
{
roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
if (!roleService.checkRoleNameUnique(role))
{
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
}
else if (!roleService.checkRoleKeyUnique(role))
{
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
}
role.setUpdateBy(getUsername());
if (roleService.updateRole(role) > 0)
{
// 更新缓存用户权限
LoginUser loginUser = getLoginUser();
if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
{
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
tokenService.setLoginUser(loginUser);
}
return success();
}
return error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping("/dataScope")
public AjaxResult dataScope(@RequestBody SysRole role)
{
roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
return toAjax(roleService.authDataScope(role));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody SysRole role)
{
roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
role.setUpdateBy(getUsername());
return toAjax(roleService.updateRoleStatus(role));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:role:remove')")
@Log(title = "角色管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{roleIds}")
public AjaxResult remove(@PathVariable Long[] roleIds)
{
return toAjax(roleService.deleteRoleByIds(roleIds));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping("/optionselect")
public AjaxResult optionselect()
{
return success(roleService.selectRoleAll());
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/authUser/allocatedList")
public TableDataInfo allocatedList(SysUser user)
{
startPage();
List<SysUser> list = userService.selectAllocatedList(user);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/authUser/unallocatedList")
public TableDataInfo unallocatedList(SysUser user)
{
startPage();
List<SysUser> list = userService.selectUnallocatedList(user);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/cancel")
public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
{
return toAjax(roleService.deleteAuthUser(userRole));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/cancelAll")
public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
{
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/selectAll")
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
{
roleService.checkRoleDataScope(roleId);
return toAjax(roleService.insertAuthUsers(roleId, userIds));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping(value = "/deptTree/{roleId}")
public AjaxResult deptTree(@PathVariable("roleId") Long roleId)
{
AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));
return ajax;
}
}

@ -0,0 +1,256 @@
package com.ruoyi.web.controller.system;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
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)
{
AjaxResult ajax = AjaxResult.success();
if (StringUtils.isNotNull(userId))
{
userService.checkUserDataScope(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()));
}
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());
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));
}
}

@ -0,0 +1,183 @@
package com.ruoyi.web.controller.tool;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
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.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.utils.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
/**
* swagger
*
* @author ruoyi
*/
@Api("用户信息管理")
@RestController
@RequestMapping("/test/user")
public class TestController extends BaseController
{
private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
{
users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
}
@ApiOperation("获取用户列表")
@GetMapping("/list")
public R<List<UserEntity>> userList()
{
List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
return R.ok(userList);
}
@ApiOperation("获取用户详细")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
@GetMapping("/{userId}")
public R<UserEntity> getUser(@PathVariable Integer userId)
{
if (!users.isEmpty() && users.containsKey(userId))
{
return R.ok(users.get(userId));
}
else
{
return R.fail("用户不存在");
}
}
@ApiOperation("新增用户")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class)
})
@PostMapping("/save")
public R<String> save(UserEntity user)
{
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{
return R.fail("用户ID不能为空");
}
users.put(user.getUserId(), user);
return R.ok();
}
@ApiOperation("更新用户")
@PutMapping("/update")
public R<String> update(@RequestBody UserEntity user)
{
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{
return R.fail("用户ID不能为空");
}
if (users.isEmpty() || !users.containsKey(user.getUserId()))
{
return R.fail("用户不存在");
}
users.remove(user.getUserId());
users.put(user.getUserId(), user);
return R.ok();
}
@ApiOperation("删除用户信息")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
@DeleteMapping("/{userId}")
public R<String> delete(@PathVariable Integer userId)
{
if (!users.isEmpty() && users.containsKey(userId))
{
users.remove(userId);
return R.ok();
}
else
{
return R.fail("用户不存在");
}
}
}
@ApiModel(value = "UserEntity", description = "用户实体")
class UserEntity
{
@ApiModelProperty("用户ID")
private Integer userId;
@ApiModelProperty("用户名称")
private String username;
@ApiModelProperty("用户密码")
private String password;
@ApiModelProperty("用户手机")
private String mobile;
public UserEntity()
{
}
public UserEntity(Integer userId, String username, String password, String mobile)
{
this.userId = userId;
this.username = username;
this.password = password;
this.mobile = mobile;
}
public Integer getUserId()
{
return userId;
}
public void setUserId(Integer userId)
{
this.userId = userId;
}
public String getUsername()
{
return username;
}
public void setUsername(String username)
{
this.username = username;
}
public String getPassword()
{
return password;
}
public void setPassword(String password)
{
this.password = password;
}
public String getMobile()
{
return mobile;
}
public void setMobile(String mobile)
{
this.mobile = mobile;
}
}

@ -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);
}
/**
* tokenAuthorization
*/
private List<SecurityScheme> securitySchemes()
{
List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue()));
return apiKeyList;
}
/**
*
*/
private List<SecurityContext> securityContexts()
{
List<SecurityContext> securityContexts = new ArrayList<>();
securityContexts.add(
SecurityContext.builder()
.securityReferences(defaultAuth())
.operationSelector(o -> o.requestMappingPattern().matches("/.*"))
.build());
return securityContexts;
}
/**
*
*/
private List<SecurityReference> defaultAuth()
{
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope;
List<SecurityReference> securityReferences = new ArrayList<>();
securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
return securityReferences;
}
/**
*
*/
private ApiInfo apiInfo()
{
// 用ApiInfoBuilder进行定制
return new ApiInfoBuilder()
// 设置标题
.title("标题若依管理系统_接口文档")
// 描述
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
// 作者信息
.contact(new Contact(ruoyiConfig.getName(), null, null))
// 版本
.version("版本号:" + ruoyiConfig.getVersion())
.build();
}
}

@ -0,0 +1,61 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源(本地 RuoYi 连接阿里云 MySQL 8.0
master:
url: jdbc:mysql://47.122.2.5:3306/water_manager?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
username: water_app
password: WaterApp@2024
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
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

@ -0,0 +1,136 @@
# 项目相关配置
ruoyi:
# 名称
name: RuoYi
# 版本
version: 3.9.0
# 版权年份
copyrightYear: 2025
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: D:/ruoyi/uploadPath
# 获取ip地址开关
addressEnabled: false
# 验证码类型 math 数字计算 char 字符验证
captchaType: math
# 开发环境配置
server:
# 服务器的HTTP端口默认为8080
port: 8080
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: 100
# 密码锁定时间默认10分钟
lockTime: 1
# Spring配置
spring:
# 资源信息
messages:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: druid
# 文件上传
servlet:
multipart:
# 单个文件大小
max-file-size: 10MB
# 设置总上传的文件大小
max-request-size: 20MB
# 服务模块
devtools:
restart:
# 热部署开关
enabled: true
# redis 配置
redis:
# 地址
host: localhost
# 端口默认为6379
port: 6379
# 数据库索引
database: 0
# 密码
password:
# 连接超时时间
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: mysql
supportMethodsArguments: true
params: count=countSql
# Swagger配置
swagger:
# 是否开启swagger
enabled: true
# 请求前缀
pathMapping: /dev-api
# 防盗链配置
referer:
# 防盗链开关
enabled: false
# 允许的域名列表
allowed-domains: localhost,127.0.0.1,ruoyi.vip,www.ruoyi.vip
# 防止XSS攻击
xss:
# 过滤开关
enabled: true
# 排除链接(多个用逗号分隔)
excludes: /system/notice
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*

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

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

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

Loading…
Cancel
Save