master
commit
c1edc86324
|
|
@ -0,0 +1,43 @@
|
|||
######################################################################
|
||||
# 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
|
||||
|
||||
### NetBeans ###
|
||||
nbproject/private/
|
||||
build/*
|
||||
nbbuild/
|
||||
dist/
|
||||
nbdist/
|
||||
.nb-gradle/
|
||||
|
||||
######################################################################
|
||||
# Others
|
||||
*.log
|
||||
*.xml.versionsBackup
|
||||
|
||||
!*/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,91 @@
|
|||
## 平台简介
|
||||
|
||||
一直想做一款后台管理系统,看了很多优秀的开源项目但是发现没有合适的。于是利用空闲休息时间开始自己写了一套后台系统。如此有了若依。她可以用于所有的Web应用程序,如网站管理后台,网站会员中心,CMS,CRM,OA。所有前端后台代码封装过后十分精简易上手,出错概率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。
|
||||
|
||||
性别男,若依是给女儿取的名字(寓意:你若不离不弃,我必生死相依)
|
||||
|
||||
若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
|
||||
|
||||
* 前后端分离版本,请移步[RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud)
|
||||
* 感谢 [hplus](https://gitee.com/hplus_admin/hplus) 后台主题 UI 框架。
|
||||
* 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip)
|
||||
* 阿里云优惠券:[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)
|
||||
|
||||
## 内置功能
|
||||
|
||||
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://ruoyi.vip
|
||||
文档地址:http://doc.ruoyi.vip
|
||||
|
||||
## 演示图
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-42e518aa72a24d228427a1261cb3679f395.png"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-7f20dd0edba25e5187c5c4dd3ec7d3d9797.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-2dae3d87f6a8ca05057db059cd9a411d51d.png"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-ea4d98423471e55fba784694e45d12bd4bb.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-7f6c6e9f5873efca09bd2870ee8468b8fce.png"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-c708b65f2c382a03f69fe1efa8d341e6cff.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-9ab586c47dd5c7b92bca0d727962c90e3b8.png"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-ef954122a2080e02013112db21754b955c6.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-088edb4d531e122415a1e2342bccb1a9691.png"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-f886fe19bd820c0efae82f680223cac196c.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-c7a2eb71fa65d6e660294b4bccca613d638.png"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-e60137fb0787defe613bd83331dc4755a70.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-7c51c1b5758f0a0f92ed3c60469b7526f9f.png"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-15181aed45bb2461aa97b594cbf2f86ea5f.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-83326ad52ea63f67233d126226738054d98.png"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-3bd6d31e913b70df00107db51d64ef81df7.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-70a2225836bc82042a6785edf6299e2586a.png"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-0184d6ab01fdc6667a14327fcaf8b46345d.png"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-64d8086dc2c02c8f71170290482f7640098.png"/></td>
|
||||
<td><img src="https://oscimg.oschina.net/oscnet/up-5e4daac0bb59612c5038448acbcef235e3a.png"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
## 若依交流群
|
||||
|
||||
QQ群: [](https://jq.qq.com/?_wv=1027&k=5HBAaYN) [](https://jq.qq.com/?_wv=1027&k=5cHeRVW) [](https://jq.qq.com/?_wv=1027&k=53R0L5Z) [](https://jq.qq.com/?_wv=1027&k=5g75dCU) [](https://jq.qq.com/?_wv=1027&k=58cPoHA) [](https://jq.qq.com/?_wv=1027&k=5Ofd4Pb) [](https://jq.qq.com/?_wv=1027&k=5yugASz) [](https://jq.qq.com/?_wv=1027&k=5Rf3d2P) [](https://jq.qq.com/?_wv=1027&k=5ZIjaeP) [](https://jq.qq.com/?_wv=1027&k=5CJw1jY) [](https://jq.qq.com/?_wv=1027&k=5omzbKc) [](https://jq.qq.com/?_wv=1027&k=qPIKBb7s) [](https://jq.qq.com/?_wv=1027&k=4NsjKbtU)
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
@echo off
|
||||
echo.
|
||||
echo [信息] 清理生成路径。
|
||||
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 [信息] 运行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
|
||||
Binary file not shown.
|
|
@ -0,0 +1,277 @@
|
|||
<?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>4.6.0</version>
|
||||
|
||||
<name>ruoyi</name>
|
||||
<url>http://www.ruoyi.vip</url>
|
||||
<description>若依管理系统</description>
|
||||
|
||||
<properties>
|
||||
<ruoyi.version>4.6.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>
|
||||
<shiro.version>1.7.0</shiro.version>
|
||||
<thymeleaf.extras.shiro.version>2.0.0</thymeleaf.extras.shiro.version>
|
||||
<druid.version>1.2.4</druid.version>
|
||||
<bitwalker.version>1.21</bitwalker.version>
|
||||
<kaptcha.version>2.3.2</kaptcha.version>
|
||||
<swagger.version>2.9.2</swagger.version>
|
||||
<pagehelper.boot.version>1.3.0</pagehelper.boot.version>
|
||||
<fastjson.version>1.2.75</fastjson.version>
|
||||
<oshi.version>5.3.6</oshi.version>
|
||||
<jna.version>5.6.0</jna.version>
|
||||
<commons.io.version>2.5</commons.io.version>
|
||||
<commons.fileupload.version>1.3.3</commons.fileupload.version>
|
||||
<poi.version>4.1.2</poi.version>
|
||||
<velocity.version>1.7</velocity.version>
|
||||
</properties>
|
||||
|
||||
<!-- 依赖声明 -->
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringBoot的依赖配置-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>2.2.12.RELEASE</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<!--阿里数据库连接池 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--验证码 -->
|
||||
<dependency>
|
||||
<groupId>com.github.penggle</groupId>
|
||||
<artifactId>kaptcha</artifactId>
|
||||
<version>${kaptcha.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--Shiro核心框架 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-core</artifactId>
|
||||
<version>${shiro.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Shiro使用Spring框架 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-spring</artifactId>
|
||||
<version>${shiro.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Shiro使用EhCache缓存框架 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-ehcache</artifactId>
|
||||
<version>${shiro.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- thymeleaf模板引擎和shiro框架的整合 -->
|
||||
<dependency>
|
||||
<groupId>com.github.theborakompanioni</groupId>
|
||||
<artifactId>thymeleaf-extras-shiro</artifactId>
|
||||
<version>${thymeleaf.extras.shiro.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>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.java.dev.jna</groupId>
|
||||
<artifactId>jna</artifactId>
|
||||
<version>${jna.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.java.dev.jna</groupId>
|
||||
<artifactId>jna-platform</artifactId>
|
||||
<version>${jna.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- swagger2-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>${swagger.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- swagger2-UI-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--io常用工具类 -->
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>${commons.io.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--文件上传工具类 -->
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>${commons.fileupload.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</artifactId>
|
||||
<version>${velocity.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里JSON解析器 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${fastjson.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>
|
||||
<module>zcunsoft</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
||||
<dependencies>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<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>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>public</id>
|
||||
<name>aliyun nexus</name>
|
||||
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
<?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>4.6.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>ruoyi-admin</artifactId>
|
||||
|
||||
<description>
|
||||
web服务入口
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringBoot集成thymeleaf模板 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- spring-boot-devtools -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||
</dependency>
|
||||
|
||||
<!-- swagger2-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--防止进入swagger页面报类型转换错误,排除2.9.2中的引用,手动增加1.5.21版本-->
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.5.21</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
<version>1.5.21</version>
|
||||
</dependency>
|
||||
|
||||
<!-- swagger2-UI-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
</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>
|
||||
|
||||
<!-- 中文转拼音-->
|
||||
<dependency>
|
||||
<groupId>com.belerweb</groupId>
|
||||
<artifactId>pinyin4j</artifactId>
|
||||
<version>2.5.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.flywaydb</groupId>-->
|
||||
<!-- <artifactId>flyway-core</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.zcunsoft</groupId>
|
||||
<artifactId>zcun-task</artifactId>
|
||||
<version>0.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zcunsoft</groupId>
|
||||
<artifactId>zcun-note-push</artifactId>
|
||||
<version>0.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.1.1.RELEASE</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.0.0</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<warName>${project.artifactId}</warName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.ruoyi;
|
||||
|
||||
import com.zcunsoft.pm.note.push.ZCNotePushConfig;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
//@Import({ZCNotePushConfig.class})
|
||||
//@ComponentScan("com.zcunsoft.pm.note.push")
|
||||
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,67 @@
|
|||
package com.ruoyi.system;
|
||||
|
||||
import net.sourceforge.pinyin4j.PinyinHelper;
|
||||
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
|
||||
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
|
||||
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
|
||||
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
|
||||
|
||||
public class PinYinUtil {
|
||||
/**
|
||||
* 获取汉字串拼音首字母,英文字符不变
|
||||
*
|
||||
* @param chinese 汉字串
|
||||
* @return 汉语拼音首字母
|
||||
*/
|
||||
public static String cn2FirstSpell(String chinese) {
|
||||
StringBuffer pybf = new StringBuffer();
|
||||
char[] arr = chinese.toCharArray();
|
||||
HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
|
||||
defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
|
||||
defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
if (arr[i] > 128) {
|
||||
try {
|
||||
String[] _t = PinyinHelper.toHanyuPinyinStringArray(arr[i], defaultFormat);
|
||||
if (_t != null) {
|
||||
pybf.append(_t[0].charAt(0));
|
||||
}
|
||||
} catch (BadHanyuPinyinOutputFormatCombination e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
pybf.append(arr[i]);
|
||||
}
|
||||
}
|
||||
return pybf.toString().replaceAll("\\W", "").trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取汉字串拼音,英文字符不变
|
||||
*
|
||||
* @param chinese 汉字串
|
||||
* @return 汉语拼音
|
||||
*/
|
||||
public static String cn2Spell(String chinese) {
|
||||
StringBuffer pybf = new StringBuffer();
|
||||
char[] arr = chinese.toCharArray();
|
||||
HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
|
||||
defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
|
||||
defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
if (arr[i] > 128) {
|
||||
try {
|
||||
String[] py = PinyinHelper.toHanyuPinyinStringArray(arr[i], defaultFormat);
|
||||
if (py != null) {
|
||||
pybf.append(py[0]);
|
||||
}
|
||||
} catch (BadHanyuPinyinOutputFormatCombination e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
pybf.append(arr[i]);
|
||||
}
|
||||
}
|
||||
return pybf.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
package com.ruoyi.system.controller;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.system.domain.ProjectSumModel;
|
||||
import com.ruoyi.system.mapper.SystemReportMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/system/report")
|
||||
public class ReportController {
|
||||
private String prefix = "system/report";
|
||||
private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
private Calendar scb = Calendar.getInstance();
|
||||
@Autowired
|
||||
private SystemReportMapper systemReportMapper;
|
||||
|
||||
@GetMapping("/projectLastWeekSummary")
|
||||
public String projectLastWeekSummary(ModelMap mmap) {
|
||||
int dow = scb.get(Calendar.DAY_OF_WEEK);
|
||||
boolean showThisWeek = false;
|
||||
if (dow == Calendar.FRIDAY || dow == Calendar.SATURDAY) { //周五、周六显示当周统计
|
||||
showThisWeek = true;
|
||||
}
|
||||
Calendar sc = Calendar.getInstance();
|
||||
sc.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
|
||||
sc.add(Calendar.DAY_OF_MONTH, showThisWeek ? -7 : -14);
|
||||
Date sd = sc.getTime();
|
||||
Calendar ec = Calendar.getInstance();
|
||||
ec.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
|
||||
ec.add(Calendar.DAY_OF_MONTH, showThisWeek ? 0 : -7);
|
||||
Date ed = ec.getTime();
|
||||
ec.add(Calendar.DATE, -1);
|
||||
Date showED = ec.getTime();
|
||||
String sdStr = format.format(sd);
|
||||
String edStr = format.format(ed);
|
||||
List<ProjectSumModel> projectLastWeekSummary = systemReportMapper.selectProjectLastWeekSummary(sdStr, edStr, false);
|
||||
mmap.put("startDate", sdStr);
|
||||
mmap.put("endDate", edStr);
|
||||
mmap.put("report", projectLastWeekSummary);
|
||||
return prefix + "/projectLastWeekSummary";
|
||||
}
|
||||
|
||||
@GetMapping("/projectSummary")
|
||||
public String projectSummary(ModelMap mmap) {
|
||||
List<ProjectSumModel> projectCostSummary = systemReportMapper.selectProjectCostSummary(false);
|
||||
mmap.put("report", projectCostSummary);
|
||||
return prefix + "/projectSummary";
|
||||
}
|
||||
|
||||
@GetMapping("/notReportUserList")
|
||||
public String notReportUserList(ModelMap mmap){
|
||||
|
||||
scb.setTime(new Date());
|
||||
int dow = scb.get(Calendar.DAY_OF_WEEK);
|
||||
boolean showThisWeek = false;
|
||||
if (dow == Calendar.FRIDAY || dow == Calendar.SATURDAY) { //周五、周六显示当周统计
|
||||
showThisWeek = true;
|
||||
}
|
||||
Calendar sc = Calendar.getInstance();
|
||||
sc.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
|
||||
sc.add(Calendar.DAY_OF_MONTH, showThisWeek ? -7 : -14);
|
||||
Date sd = sc.getTime();
|
||||
Calendar ec = Calendar.getInstance();
|
||||
ec.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
|
||||
ec.add(Calendar.DAY_OF_MONTH, showThisWeek ? 0 : -7);
|
||||
Date ed = ec.getTime();
|
||||
ec.add(Calendar.DATE, -1);
|
||||
Date showED = ec.getTime();
|
||||
String sdStr = format.format(sd);
|
||||
String edStr = format.format(ed);
|
||||
List<SysUser> ls = systemReportMapper.selectNotReportedUserList(sdStr, edStr);
|
||||
mmap.put("report", ls);
|
||||
return prefix + "/notReportUserList";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,170 @@
|
|||
package com.ruoyi.system.controller;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.utils.ShiroUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.system.domain.TblContractSettlement;
|
||||
import com.ruoyi.system.domain.TblProject;
|
||||
import com.ruoyi.system.domain.TblUploadFile;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import com.ruoyi.system.service.ITblUploadFileService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.tomcat.jni.FileInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.system.domain.TblContract;
|
||||
import com.ruoyi.system.service.ITblContractService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 合同Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-02-24
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/contract")
|
||||
public class TblContractController extends BaseController {
|
||||
private String prefix = "system/contract";
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private ITblContractService tblContractService;
|
||||
|
||||
@Autowired
|
||||
private ITblUploadFileService tblUploadFileService;
|
||||
|
||||
@RequiresPermissions("system:contract:view")
|
||||
@GetMapping()
|
||||
public String contract(ModelMap mmap) {
|
||||
mmap.put("users", userService.selectAvailableUserList(new SysUser()));
|
||||
return prefix + "/contract";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询合同列表
|
||||
*/
|
||||
@RequiresPermissions("system:contract:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(TblContract tblContract) {
|
||||
startPage();
|
||||
List<TblContract> list = tblContractService.selectTblContractList(tblContract);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出合同列表
|
||||
*/
|
||||
@RequiresPermissions("system:contract:export")
|
||||
@Log(title = "合同", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(TblContract tblContract) {
|
||||
List<TblContract> list = tblContractService.selectTblContractList(tblContract);
|
||||
ExcelUtil<TblContract> util = new ExcelUtil<TblContract>(TblContract.class);
|
||||
return util.exportExcel(list, "contract");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增合同
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add(ModelMap mmap) {
|
||||
mmap.put("leaders", userService.selectAllAvailableUserList(new SysUser()));
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存合同
|
||||
*/
|
||||
@RequiresPermissions("system:contract:add")
|
||||
@Log(title = "合同", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(TblContract tblContract) {
|
||||
tblContract.setCreateBy(ShiroUtils.getLoginName());
|
||||
if (tblContract.getAmount() == null) {
|
||||
tblContract.setAmount(BigDecimal.ZERO);
|
||||
}
|
||||
if (tblContract.getStartDate().after(tblContract.getEndDate())) {
|
||||
return error("添加合同失败,起始时间大于结束时间");
|
||||
}
|
||||
return toAjax(tblContractService.insertTblContract(tblContract));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改合同
|
||||
*/
|
||||
@GetMapping("/edit/{id}")
|
||||
public String edit(@PathVariable("id") String id, ModelMap mmap) {
|
||||
TblContract tblContract = tblContractService.selectTblContractById(id);
|
||||
mmap.put("tblContract", tblContract);
|
||||
mmap.put("leaders", userService.selectAllAvailableUserList(new SysUser()));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存合同
|
||||
*/
|
||||
@RequiresPermissions("system:contract:edit")
|
||||
@Log(title = "合同", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(TblContract tblContract) {
|
||||
tblContract.setUpdateBy(ShiroUtils.getLoginName());
|
||||
if (tblContract.getStartDate() != null && tblContract.getEndDate() != null && tblContract.getStartDate().after(tblContract.getEndDate())) {
|
||||
return error("修改合同失败,起始时间大于结束时间");
|
||||
}
|
||||
if (tblContract.getAmount() == null) {
|
||||
tblContract.setAmount(BigDecimal.ZERO);
|
||||
}
|
||||
return toAjax(tblContractService.updateTblContract(tblContract));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项目
|
||||
*/
|
||||
@GetMapping("/detail/{id}")
|
||||
public String detail(@PathVariable("id") String id, ModelMap mmap) {
|
||||
TblContract tblContract = tblContractService.selectTblContractById(id);
|
||||
mmap.put("tblContract", tblContract);
|
||||
mmap.put("leaders", userService.selectAvailableUserList(new SysUser()));
|
||||
return prefix + "/detail";
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除合同
|
||||
*/
|
||||
@RequiresPermissions("system:contract:remove")
|
||||
@Log(title = "合同", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids) {
|
||||
return toAjax(tblContractService.deleteTblContractByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/contractfiles/{id}")
|
||||
public String contractFiles(@PathVariable("id") String id, ModelMap mmap) {
|
||||
TblContract tblContract = tblContractService.selectTblContractById(id);
|
||||
mmap.put("tblContract", tblContract);
|
||||
return prefix + "/contractfiles";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,251 @@
|
|||
package com.ruoyi.system.controller;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.utils.ShiroUtils;
|
||||
import com.ruoyi.common.utils.uuid.UUID;
|
||||
import com.ruoyi.system.domain.*;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import com.ruoyi.system.service.ITblContractService;
|
||||
import com.sun.jna.platform.win32.Guid;
|
||||
import org.apache.poi.hpsf.GUID;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpRequest;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.system.service.ITblContractSettlementService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.swing.text.html.Option;
|
||||
|
||||
/**
|
||||
* 合同收款Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-03-01
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/settlement")
|
||||
public class TblContractSettlementController extends BaseController
|
||||
{
|
||||
private String prefix = "system/settlement";
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private ITblContractSettlementService tblContractSettlementService;
|
||||
|
||||
@Autowired
|
||||
private ITblContractService tblContractService;
|
||||
|
||||
@RequiresPermissions("system:settlement:view")
|
||||
@GetMapping()
|
||||
public String settlement(ModelMap mmap) {
|
||||
mmap.put("users", userService.selectAvailableUserList(new SysUser()));
|
||||
return prefix + "/settlement";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询合同收款列表
|
||||
*/
|
||||
@RequiresPermissions("system:settlement:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(TblContract tblContract) {
|
||||
startPage();
|
||||
List<ContractSettleIndexModel> list = tblContractService.selectTblContractSettleList(tblContract);
|
||||
// if(list.size() > 0) {
|
||||
// List<String> ids = new ArrayList<String>();
|
||||
// for (ContractSettleIndexModel c : list) {
|
||||
// ids.add(c.getId());
|
||||
// }
|
||||
// //List<CntSettleSummaryModel> sumList = tblContractSettlementService.selectContractSettleSummary(ids.toArray(new String[ids.size()]));
|
||||
// List<CntSettleSummaryModel> payedList = tblContractSettlementService.selectContractPayedSummary(ids.toArray(new String[ids.size()]));
|
||||
// List<CntSettleSummaryModel> planList = tblContractSettlementService.selectContractPlanSettleSummary(ids.toArray(new String[ids.size()]));
|
||||
// list = list.stream().map(c->{
|
||||
// Optional<CntSettleSummaryModel> payedOpt = payedList.stream().filter(x->x.getContractId().equals(c.getId())).findFirst();
|
||||
// Optional<CntSettleSummaryModel> planOpt = planList.stream().filter(x->x.getContractId().equals(c.getId())).findFirst();
|
||||
// if(payedOpt.isPresent())
|
||||
// {
|
||||
// CntSettleSummaryModel payed = payedOpt.get();
|
||||
// c.setPayedAmount(payed.getPayedAmount());
|
||||
// }
|
||||
// if(planOpt.isPresent())
|
||||
// {
|
||||
// CntSettleSummaryModel plan = planOpt.get();
|
||||
// c.setMatureAmount(plan.getMatureAmount());
|
||||
// c.setMatureDate(plan.getMatureDate());
|
||||
// }
|
||||
// return c;
|
||||
// }).collect(Collectors.toList());
|
||||
//// if (sumList.size() > 0)
|
||||
//// {
|
||||
//// list = list.stream().map( c->
|
||||
//// {
|
||||
//// Optional<CntSettleSummaryModel> sumOpt = sumList.stream().filter(x->x.getContractId().equals(c.getId())).findFirst();
|
||||
//// if(sumOpt.isPresent()) {
|
||||
//// CntSettleSummaryModel sum = sumOpt.get();
|
||||
//// c.setPayedAmount(sum.getPayedAmount());
|
||||
//// c.setMatureAmount(sum.getMatureAmount());
|
||||
//// c.setMatureDate(sum.getMatureDate());
|
||||
//// }
|
||||
//// return c;
|
||||
//// }).collect(Collectors.toList());
|
||||
//// }
|
||||
// }
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出合同收款列表
|
||||
*/
|
||||
@RequiresPermissions("system:settlement:export")
|
||||
@Log(title = "合同收款", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(TblContractSettlement tblContractSettlement)
|
||||
{
|
||||
List<TblContractSettlement> list = tblContractSettlementService.selectTblContractSettlementList(tblContractSettlement);
|
||||
ExcelUtil<TblContractSettlement> util = new ExcelUtil<TblContractSettlement>(TblContractSettlement.class);
|
||||
return util.exportExcel(list, "settlement");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增合同收款
|
||||
*/
|
||||
@GetMapping("/add/{id}")
|
||||
public String add(@PathVariable("id") String id,@RequestParam(value = "settleType",defaultValue = "0",required = false) String settleType, ModelMap mmap)
|
||||
{
|
||||
List<TblContract> contracts = tblContractService.selectTblContractList(new TblContract());
|
||||
mmap.put("contracts",contracts);
|
||||
mmap.put("contractId",id);
|
||||
mmap.put("settleType",settleType);
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存合同收款
|
||||
*/
|
||||
@RequiresPermissions("system:settlement:add")
|
||||
@Log(title = "合同收款", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(CntSettlementModel cntSettlementModel)
|
||||
{
|
||||
String contractId = cntSettlementModel.getContractId();
|
||||
|
||||
TblContract cnt = tblContractService.selectTblContractById(contractId);
|
||||
if(cnt == null){
|
||||
return error("合同不存在");
|
||||
}
|
||||
TblContractSettlement settlement = new TblContractSettlement();
|
||||
String settleType = cntSettlementModel.getSettleType();
|
||||
String createBy = ShiroUtils.getLoginName();
|
||||
Date createDate = new Date();
|
||||
List<TblContractSettlement> list = new ArrayList<TblContractSettlement>();
|
||||
for (int i = 0; i< cntSettlementModel.getSettleDate().length; i++)
|
||||
{
|
||||
if(cntSettlementModel.getAmount()[i].compareTo(new BigDecimal(0)) > 0){
|
||||
settlement = new TblContractSettlement();
|
||||
settlement.setContractId(contractId);
|
||||
settlement.setSettleType(settleType);
|
||||
settlement.setPayMode("0"); //尚未明确付款方式需求,默认先填0
|
||||
settlement.setSettleDate(cntSettlementModel.getSettleDate()[i]);
|
||||
settlement.setAmount(cntSettlementModel.getAmount()[i]);
|
||||
if(cntSettlementModel.getRemark().length > i) {
|
||||
settlement.setRemark(cntSettlementModel.getRemark()[i]);
|
||||
}
|
||||
settlement.setCreateBy(createBy);
|
||||
settlement.setCreateTime(createDate);
|
||||
list.add(settlement);
|
||||
}
|
||||
}
|
||||
return toAjax(tblContractSettlementService.insertTblContractSettlementList(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改合同收款
|
||||
*/
|
||||
@GetMapping("/edit/{id}")
|
||||
public String edit(@PathVariable("id") String id,@RequestParam(value = "settleType",defaultValue = "0",required = false) String settleType, ModelMap mmap)
|
||||
{
|
||||
TblContract contract = tblContractService.selectTblContractById(id);
|
||||
TblContractSettlement settle = new TblContractSettlement();
|
||||
settle.setContractId(id);
|
||||
settle.setSettleType(settleType);
|
||||
List<TblContractSettlement> ls = tblContractSettlementService.selectTblContractSettlementList(settle);
|
||||
mmap.put("contract",contract);
|
||||
mmap.put("settlements",ls);
|
||||
mmap.put("settleType",settleType);
|
||||
if(settleType.equals("1")){
|
||||
settle.setSettleType("0");
|
||||
mmap.put("planList",tblContractSettlementService.selectTblContractSettlementList(settle));
|
||||
}
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存合同收款
|
||||
*/
|
||||
@RequiresPermissions("system:settlement:edit")
|
||||
@Log(title = "合同收款", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(TblContractSettlement tblContractSettlement)
|
||||
{
|
||||
return toAjax(tblContractSettlementService.updateTblContractSettlement(tblContractSettlement));
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:contract:edit")
|
||||
@GetMapping("/editPayStatus/{id}")
|
||||
public String editPayStatus(@PathVariable("id") String id,ModelMap mmap){
|
||||
TblContract tblContract = tblContractService.selectTblContractById(id);
|
||||
mmap.put("tblContract", tblContract);
|
||||
return prefix + "/editPayStatus";
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除合同收款
|
||||
*/
|
||||
@RequiresPermissions("system:settlement:remove")
|
||||
@Log(title = "合同收款", businessType = BusinessType.DELETE)
|
||||
@PostMapping( "/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(@RequestBody String ids)
|
||||
{
|
||||
return toAjax(tblContractSettlementService.deleteTblContractSettlementByIds(ids));
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:settlement:list")
|
||||
@PostMapping("/querysettlelist")
|
||||
@ResponseBody
|
||||
public AjaxResult querysettlelist(@RequestBody TblContractSettlement settle){
|
||||
return AjaxResult.success(tblContractSettlementService.selectTblContractSettlementList(settle));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改收款提示状态
|
||||
*/
|
||||
@RequiresPermissions("system:settlement:edit")
|
||||
@Log(title = "合同收款提示状态修改", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/editWarnFlag")
|
||||
@ResponseBody
|
||||
public AjaxResult editWarnFlag(@RequestBody TblContractSettlement tblContractSettlement)
|
||||
{
|
||||
return toAjax(tblContractSettlementService.updateTblContractSettlement(tblContractSettlement));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,185 @@
|
|||
package com.ruoyi.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.system.domain.TblContract;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import com.ruoyi.system.service.ITblContractService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
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.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.system.domain.TblProject;
|
||||
import com.ruoyi.system.service.ITblProjectService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.ShiroUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 项目Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-02-09
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/project")
|
||||
public class TblProjectController extends BaseController {
|
||||
private String prefix = "system/project";
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private ITblProjectService tblProjectService;
|
||||
|
||||
@Autowired
|
||||
private ITblContractService tblContractService;
|
||||
|
||||
@RequiresPermissions("system:project:view")
|
||||
@GetMapping()
|
||||
public String project(ModelMap mmap) {
|
||||
mmap.put("users", userService.selectAvailableUserList(new SysUser()));
|
||||
return prefix + "/project";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询项目列表
|
||||
*/
|
||||
@RequiresPermissions("system:project:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(TblProject tblProject) {
|
||||
startPage();
|
||||
List<TblProject> list = tblProjectService.selectTblProjectList(tblProject);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出项目列表
|
||||
*/
|
||||
@RequiresPermissions("system:project:export")
|
||||
@Log(title = "项目", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(TblProject tblProject) {
|
||||
List<TblProject> list = tblProjectService.selectTblProjectList(tblProject);
|
||||
ExcelUtil<TblProject> util = new ExcelUtil<TblProject>(TblProject.class);
|
||||
return util.exportExcel(list, "project");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增项目
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add(ModelMap mmap) {
|
||||
mmap.put("leaders", userService.selectAllAvailableUserList(new SysUser()));
|
||||
mmap.put("contracts", tblContractService.selectTblContractList(new TblContract()));
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存项目
|
||||
*/
|
||||
@RequiresPermissions("system:project:add")
|
||||
@Log(title = "项目", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(TblProject tblProject) {
|
||||
tblProject.setCreateBy(ShiroUtils.getLoginName());
|
||||
if (tblProject.getStartDate() != null && tblProject.getEndDate() != null &&
|
||||
tblProject.getStartDate().after(tblProject.getEndDate())) {
|
||||
return error("添加项目失败,起始时间大于结束时间");
|
||||
}
|
||||
return toAjax(tblProjectService.insertTblProject(tblProject));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项目
|
||||
*/
|
||||
@GetMapping("/edit/{id}")
|
||||
public String edit(@PathVariable("id") String id, ModelMap mmap) {
|
||||
TblProject tblProject = tblProjectService.selectTblProjectById(id);
|
||||
mmap.put("tblProject", tblProject);
|
||||
mmap.put("leaders", userService.selectAllAvailableUserList(new SysUser()));
|
||||
mmap.put("contracts", tblContractService.selectTblContractList(new TblContract()));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存项目
|
||||
*/
|
||||
@RequiresPermissions("system:project:edit")
|
||||
@Log(title = "项目", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(TblProject tblProject) {
|
||||
tblProject.setUpdateBy(ShiroUtils.getLoginName());
|
||||
if (tblProject.getStartDate() != null && tblProject.getEndDate() != null &&
|
||||
tblProject.getStartDate().after(tblProject.getEndDate())) {
|
||||
return error("修改项目失败,起始时间大于结束时间");
|
||||
}
|
||||
return toAjax(tblProjectService.updateTblProject(tblProject));
|
||||
}
|
||||
|
||||
@GetMapping("/detail/{id}")
|
||||
public String detail(@PathVariable("id") String id, ModelMap mmap) {
|
||||
TblProject tblProject = tblProjectService.selectTblProjectById(id);
|
||||
SysUser leader = null;//new SysUser();
|
||||
TblContract contract = null;
|
||||
new TblContract();
|
||||
if (tblProject != null) {
|
||||
leader = userService.selectUserById(tblProject.getLeaderId());
|
||||
contract = tblContractService.selectTblContractById(tblProject.getContractId());
|
||||
}
|
||||
|
||||
mmap.put("tblProject", tblProject);
|
||||
mmap.put("leader", leader != null ? leader : new SysUser());
|
||||
mmap.put("contract", contract != null ? contract : new TblContract());
|
||||
return prefix + "/detail";
|
||||
}
|
||||
|
||||
@GetMapping("/authUser/{id}")
|
||||
public String authUser(@PathVariable("id") String id, ModelMap mmap) {
|
||||
TblProject tblProject = tblProjectService.selectTblProjectById(id);
|
||||
mmap.put("project", tblProject);
|
||||
mmap.put("users", tblProjectService.selectTblProjectUserList(id));
|
||||
return prefix + "/authUser";
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:user:add")
|
||||
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
||||
@PostMapping("/authUser/insert")
|
||||
@ResponseBody
|
||||
public AjaxResult insertAuthProject(String projectId, String[] mine) {
|
||||
tblProjectService.insertAuthUser(projectId, mine);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除项目
|
||||
*/
|
||||
@RequiresPermissions("system:project:remove")
|
||||
@Log(title = "项目", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids) {
|
||||
return toAjax(tblProjectService.deleteTblProjectByIds(ids));
|
||||
}
|
||||
|
||||
@GetMapping("/projectfiles/{id}")
|
||||
public String contractfiles(@PathVariable("id") String id, ModelMap mmap) {
|
||||
TblProject tblProject = tblProjectService.selectTblProjectById(id);
|
||||
mmap.put("tblProject", tblProject);
|
||||
return prefix + "/projectfiles";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,619 @@
|
|||
package com.ruoyi.system.controller;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.ruoyi.system.PinYinUtil;
|
||||
import com.ruoyi.system.domain.ProjectUserCost;
|
||||
import com.ruoyi.system.domain.excel.*;
|
||||
import com.ruoyi.system.domain.query.ProjectCostExportQuery;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
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.SysUser;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.ShiroUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.utils.uuid.UUID;
|
||||
import com.ruoyi.system.domain.ProjectCostModel;
|
||||
import com.ruoyi.system.domain.TblProject;
|
||||
import com.ruoyi.system.domain.TblProjectCost;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import com.ruoyi.system.service.ITblProjectCostService;
|
||||
import com.ruoyi.system.service.ITblProjectService;
|
||||
|
||||
/**
|
||||
* 工时Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-02-18
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/cost")
|
||||
public class TblProjectCostController extends BaseController {
|
||||
private String prefix = "system/cost";
|
||||
|
||||
@Autowired
|
||||
private ITblProjectCostService tblProjectCostService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private ITblProjectService tblProjectService;
|
||||
|
||||
private static final String STR_DATE_FORMAT = "yyyy-MM-dd";
|
||||
|
||||
@RequiresPermissions("system:cost:view")
|
||||
@GetMapping()
|
||||
public String cost(ModelMap mmap) {
|
||||
List<SysUser> users = userService.selectAvailableUserFilterByLeader(new SysUser());
|
||||
sortUser(users);
|
||||
mmap.put("users", users);
|
||||
List<TblProject> projects = tblProjectService.selectTblProjectList(new TblProject().setOrder());
|
||||
mmap.put("projects", projects);
|
||||
return prefix + "/cost";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询工时列表
|
||||
*/
|
||||
@RequiresPermissions("system:cost:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(TblProjectCost tblProjectCost) {
|
||||
startPage();
|
||||
List<TblProjectCost> list = tblProjectCostService.selectTblProjectCostList(tblProjectCost);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:cost:summember")
|
||||
@GetMapping("/summember")
|
||||
public String summember(ModelMap mmap) throws ParseException {
|
||||
List<SysUser> users = userService.selectUserList(new SysUser());
|
||||
sortUser(users);
|
||||
mmap.put("users", users);
|
||||
String[] d = getWeek(0, null);
|
||||
mmap.put("endDate", d[1]);
|
||||
mmap.put("startDate", d[0]);
|
||||
mmap.put("type", "summember");
|
||||
return prefix + "/sum";
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:cost:sumproject")
|
||||
@GetMapping("/sumproject")
|
||||
public String sumproject(ModelMap mmap) throws ParseException {
|
||||
List<TblProject> projects = tblProjectService.selectMyTblProjectList(ShiroUtils.getUserId());
|
||||
mmap.put("projects", projects);
|
||||
|
||||
String[] d = getWeek(0, null);
|
||||
mmap.put("endDate", d[1]);
|
||||
mmap.put("startDate", d[0]);
|
||||
mmap.put("type", "sumproject");
|
||||
return prefix + "/sum";
|
||||
}
|
||||
|
||||
@PostMapping("/changeweek")
|
||||
@ResponseBody
|
||||
public String[] getWeek(int week, String date) throws ParseException {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(STR_DATE_FORMAT);
|
||||
|
||||
String[] d = new String[2];
|
||||
Calendar cal = Calendar.getInstance();
|
||||
if (week != 0 && StringUtils.isNotEmpty(date)) {
|
||||
cal.setTime(sdf.parse(date));
|
||||
}
|
||||
cal.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
|
||||
if (week == 0) {
|
||||
if (cal.after(Calendar.getInstance())) {
|
||||
cal.add(Calendar.DATE, -7);
|
||||
}
|
||||
} else {
|
||||
cal.add(Calendar.DATE, 7 * week);
|
||||
}
|
||||
d[1] = sdf.format(cal.getTime());
|
||||
cal.add(Calendar.DATE, -6);
|
||||
d[0] = sdf.format(cal.getTime());
|
||||
return d;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计工时列表
|
||||
*/
|
||||
@RequiresPermissions("system:cost:sumproject")
|
||||
@PostMapping("/sumproject")
|
||||
@ResponseBody
|
||||
public TableDataInfo sumproject(TblProjectCost tblProjectCost) {
|
||||
return sum(tblProjectCost, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计工时列表
|
||||
*/
|
||||
@RequiresPermissions("system:cost:summember")
|
||||
@PostMapping("/summember")
|
||||
@ResponseBody
|
||||
public TableDataInfo summember(TblProjectCost tblProjectCost) {
|
||||
return sum(tblProjectCost, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计工时列表
|
||||
*/
|
||||
private TableDataInfo sum(TblProjectCost tblProjectCost, int searchType) {
|
||||
tblProjectCost.getParams().put("pmo", ShiroUtils.getSubject().hasRole("pmo") || ShiroUtils.getSysUser().isAdmin());
|
||||
tblProjectCost.getParams().put("userId", ShiroUtils.getUserId());
|
||||
tblProjectCost.getParams().put("order", searchType == 0 ? "project_id,user" : "user,project_id");
|
||||
List<TblProjectCost> list = null;
|
||||
if (searchType == 0) {
|
||||
list = tblProjectCostService.selectTblProjectCostSumProject(tblProjectCost);
|
||||
} else {
|
||||
list = tblProjectCostService.selectTblProjectCostSumMember(tblProjectCost);
|
||||
}
|
||||
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(STR_DATE_FORMAT);
|
||||
String key = null;
|
||||
Map<String, Object> row = null;
|
||||
List<TblProjectCost> rowList = null;
|
||||
List<Map<String, Object>> sumList = null;
|
||||
for (TblProjectCost c : list) {
|
||||
if ((searchType == 0 && (!c.getProjectId().equals(key)))
|
||||
|| (searchType != 0 && (!c.getUser().toString().equals(key)))) {
|
||||
key = searchType == 0 ? c.getProjectId() : c.getUser().toString();
|
||||
row = new HashMap<String, Object>();
|
||||
rowList = new ArrayList<TblProjectCost>();
|
||||
sumList = new ArrayList<Map<String, Object>>();
|
||||
row.put("list", rowList);
|
||||
row.put("sumList", sumList);
|
||||
row.put("name", searchType == 0 ? c.getProjectName() : c.getUserName());
|
||||
row.put("costDay", new BigDecimal(0));
|
||||
row.put("startDate", sdf.format(tblProjectCost.getEndDate()));
|
||||
row.put("endDate", sdf.format(tblProjectCost.getStartDate()));
|
||||
row.put("leader", c.getLeader());
|
||||
result.add(row);
|
||||
}
|
||||
// int i = 0;
|
||||
// while (i < rowList.size() && rowList.get(i).getCostDay().compareTo(c.getCostDay()) > 0) {
|
||||
// i++;
|
||||
// }
|
||||
// rowList.add(i, c);
|
||||
rowList.add(c);
|
||||
if ((searchType == 0 && !sumList.stream().anyMatch(x -> x.get("sumId") == c.getUser()))
|
||||
|| (searchType != 0 && !sumList.stream().anyMatch(x -> x.get("sumId") == c.getProjectId()))) {
|
||||
Map<String, Object> sumRow = new HashMap<String, Object>();
|
||||
sumRow.put("sumId", searchType == 0 ? c.getUser() : c.getProjectId());
|
||||
sumRow.put("sumName", searchType == 0 ? c.getUserName() : c.getProjectName());
|
||||
sumRow.put("sumDay", c.getCostDay());
|
||||
//sumList.put(c.getProjectId(),sumRow);
|
||||
sumList.add(sumRow);
|
||||
} else {
|
||||
Map<String, Object> sumRow = sumList.stream().filter(x -> x.get("sumId").equals(c.getProjectId())).findFirst().get();
|
||||
sumRow.put("sumDay", ((BigDecimal) sumRow.get("sumDay")).add(c.getCostDay()));
|
||||
}
|
||||
|
||||
row.put("costDay", ((BigDecimal) row.get("costDay")).add(c.getCostDay()));
|
||||
String date = sdf.format(c.getStartDate());
|
||||
if (date.compareTo((String) row.get("startDate")) < 0) {
|
||||
row.put("startDate", date);
|
||||
}
|
||||
date = sdf.format(c.getEndDate());
|
||||
if (date.compareTo((String) row.get("endDate")) > 0) {
|
||||
row.put("endDate", date);
|
||||
}
|
||||
}
|
||||
for (Map<String, Object> r : result) {
|
||||
((List<Map<String, Object>>) r.get("sumList")).sort(new Comparator<Map<String, Object>>() {
|
||||
public int compare(Map<String, Object> arg0, Map<String, Object> arg1) {
|
||||
return ((BigDecimal) arg1.get("sumDay")).compareTo((BigDecimal) arg0.get("sumDay"));
|
||||
}
|
||||
|
||||
}.thenComparing(new Comparator<Map<String, Object>>() {
|
||||
public int compare(Map<String, Object> arg0, Map<String, Object> arg1) {
|
||||
return ((String) arg1.get("sumName")).compareTo((String) arg0.get("sumName"));
|
||||
}
|
||||
}));
|
||||
((List<TblProjectCost>) r.get("list")).sort(new Comparator<TblProjectCost>() {
|
||||
public int compare(TblProjectCost arg0, TblProjectCost arg1) {
|
||||
if (searchType == 0) {
|
||||
return arg1.getUser().compareTo(arg0.getUser());
|
||||
} else {
|
||||
return arg1.getProjectId().compareTo(arg0.getProjectId());
|
||||
}
|
||||
}
|
||||
}.thenComparing(new Comparator<TblProjectCost>() {
|
||||
public int compare(TblProjectCost arg0, TblProjectCost arg1) {
|
||||
return arg1.getCostDay().compareTo(arg0.getCostDay());
|
||||
}
|
||||
}));
|
||||
}
|
||||
Collections.sort(result, new Comparator<Map<String, Object>>() {
|
||||
public int compare(Map<String, Object> arg0, Map<String, Object> arg1) {
|
||||
return ((BigDecimal) arg1.get("costDay")).compareTo((BigDecimal) arg0.get("costDay"));
|
||||
}
|
||||
}.thenComparing(new Comparator<Map<String, Object>>() {
|
||||
public int compare(Map<String, Object> arg0, Map<String, Object> arg1) {
|
||||
return ((String) arg1.get("name")).compareTo((String) arg0.get("name"));
|
||||
}
|
||||
}));
|
||||
|
||||
return getDataTable(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出工时列表
|
||||
*/
|
||||
@RequiresPermissions("system:cost:export")
|
||||
@Log(title = "工时", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(TblProjectCost tblProjectCost) {
|
||||
List<TblProjectCost> list = tblProjectCostService.selectTblProjectCostList(tblProjectCost);
|
||||
ExcelUtil<TblProjectCost> util = new ExcelUtil<TblProjectCost>(TblProjectCost.class);
|
||||
return util.exportExcel(list, "cost");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工时
|
||||
*
|
||||
* @throws ParseException
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add(ModelMap mmap) throws ParseException {
|
||||
|
||||
List<SysUser> users = tblProjectCostService.selectUserByProjectLeader(ShiroUtils.getSysUser().isAdmin() || ShiroUtils.getSubject().hasRole("pmo") ? -1L : ShiroUtils.getUserId());//userService.selectAvailableUserFilterByLeader(new SysUser());
|
||||
|
||||
if (users.size() > 0) {
|
||||
Long userId = users.get(0).getUserId();
|
||||
// TblProjectCost tblProjectCost = tblProjectCostService.selectTblProjectCostLastData(userId);
|
||||
// // Date lastDate = null;
|
||||
// if (tblProjectCost != null) {
|
||||
// mmap.put("projectList", tblProjectCost.getProjectId().split(","));
|
||||
// // lastDate = tblProjectCost.getEndDate();
|
||||
// } else {
|
||||
// mmap.put("projectList", "".split(","));
|
||||
// }
|
||||
mmap.put("projectList", "".split(","));
|
||||
// Date beginDate = null;
|
||||
// Calendar calendar = new GregorianCalendar();
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat(STR_DATE_FORMAT);
|
||||
// if (lastDate != null) {
|
||||
// calendar.setTime(lastDate);
|
||||
// calendar.add(Calendar.DATE, 1);
|
||||
// beginDate = calendar.getTime();
|
||||
// mmap.put("beginDate", sdf.format(beginDate));
|
||||
// calendar.add(Calendar.DATE, 6);
|
||||
// Date endDate = calendar.getTime();
|
||||
// mmap.put("endDate", sdf.format(endDate));
|
||||
// }
|
||||
String[] d = getWeek(0, null);
|
||||
mmap.put("endDate", d[1]);
|
||||
mmap.put("beginDate", d[0]);
|
||||
|
||||
mmap.put("userId", userId);
|
||||
}
|
||||
// TblProject tp = new TblProject().setOrder(userId, ShiroUtils.getLoginName());
|
||||
// TblProject tp = new TblProject().setOrder();
|
||||
// tp.setStatus("1");
|
||||
// List<TblProject> projects = tblProjectService.selectTblProjectList(tp);
|
||||
//
|
||||
// mmap.put("projects", projects);
|
||||
|
||||
sortUser(users);
|
||||
mmap.put("users", users);
|
||||
// 取身份信息
|
||||
SysUser user = ShiroUtils.getSysUser();
|
||||
mmap.put("loginUser", user);
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
@PostMapping("/getuserproject")
|
||||
@ResponseBody
|
||||
public AjaxResult getUserProject(@RequestBody Long userId) {
|
||||
List<TblProject> list = tblProjectService.selectTblProjectListByUserProject(userId, ShiroUtils.getSysUser().isAdmin() || ShiroUtils.getSubject().hasRole("pmo") ? -1L : ShiroUtils.getUserId());
|
||||
sortProject(list);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
private void sortProject(List<TblProject> projects) {
|
||||
if (projects == null) {
|
||||
return;
|
||||
}
|
||||
Collections.sort(projects, new Comparator<TblProject>() {
|
||||
public int compare(TblProject arg0, TblProject arg1) {
|
||||
if (StringUtils.isEmpty(arg0.getName()) || StringUtils.isEmpty(arg1.getName())) {
|
||||
return -1;
|
||||
}
|
||||
try {
|
||||
return PinYinUtil.cn2Spell(arg0.getName()).compareTo(PinYinUtil.cn2Spell(arg1.getName()));
|
||||
} catch (Exception ex) {
|
||||
PinYinUtil.cn2Spell(arg0.getName());
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void sortUser(List<SysUser> users) {
|
||||
if (users == null) {
|
||||
return;
|
||||
}
|
||||
Collections.sort(users, new Comparator<SysUser>() {
|
||||
public int compare(SysUser arg0, SysUser arg1) {
|
||||
if (StringUtils.isEmpty(arg0.getUserName()) || StringUtils.isEmpty(arg1.getUserName())) {
|
||||
return -1;
|
||||
}
|
||||
// System.out.println(PinYinUtil.cn2Spell(arg0.getUserName()));
|
||||
return PinYinUtil.cn2Spell(arg0.getUserName()).compareTo(PinYinUtil.cn2Spell(arg1.getUserName()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增保存工时
|
||||
*/
|
||||
@RequiresPermissions("system:cost:add")
|
||||
@Log(title = "工时", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(ProjectCostModel projectCostModel) {
|
||||
// SysUser user = new SysUser();
|
||||
// user.setUserId(projectCostModel.getUser());
|
||||
//// userService.selectUserById()
|
||||
// List<SysUser> users = userService.selectAvailableUserList(user);
|
||||
SysUser user = userService.selectAvailableUserById(projectCostModel.getUser());
|
||||
if (user == null || user.getUserId() == null) {
|
||||
return error("添加工时失败,用户不存在");
|
||||
}
|
||||
if (projectCostModel.getStartDate().after(projectCostModel.getEndDate())) {
|
||||
return error("添加工时失败,起始时间大于结束时间");
|
||||
}
|
||||
TblProjectCost tblProjectCost = new TblProjectCost();
|
||||
tblProjectCost.setStartDate(projectCostModel.getStartDate());
|
||||
tblProjectCost.setEndDate(projectCostModel.getEndDate());
|
||||
tblProjectCost.setUser(projectCostModel.getUser());
|
||||
// List<TblProjectCost> list = tblProjectCostService.selectTblProjectCostList(tblProjectCost);
|
||||
// if (list.size() > 0) {
|
||||
// return error("添加工时失败,该时间段内已有工时记录");
|
||||
// }
|
||||
String userName = user.getUserName();
|
||||
String createBy = ShiroUtils.getLoginName();
|
||||
String groupId = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
Date createTime = new Date();
|
||||
List<TblProjectCost> list = new ArrayList<TblProjectCost>();
|
||||
for (int i = 0; i < projectCostModel.getProjectId().length; i++) {
|
||||
if (projectCostModel.getCostDay()[i].compareTo(new BigDecimal(0)) > 0) {
|
||||
tblProjectCost = new TblProjectCost(groupId + "-" + String.valueOf(100 + i).substring(1));
|
||||
tblProjectCost.setGroupId(groupId);
|
||||
tblProjectCost.setUser(projectCostModel.getUser());
|
||||
// SysUser u = userService.selectUserById(projectCostModel.getUser());
|
||||
// if(u != null)
|
||||
// {
|
||||
// tblProjectCost.setDeptId(u.getDeptId());
|
||||
// }
|
||||
tblProjectCost.setUserName(userName);
|
||||
tblProjectCost.setStartDate(projectCostModel.getStartDate());
|
||||
tblProjectCost.setEndDate(projectCostModel.getEndDate());
|
||||
tblProjectCost.setProjectId(projectCostModel.getProjectId()[i]);
|
||||
tblProjectCost.setCostDay(projectCostModel.getCostDay()[i]);
|
||||
if (projectCostModel.getRemark().length > i) {
|
||||
tblProjectCost.setRemark(projectCostModel.getRemark()[i]);
|
||||
} else {
|
||||
tblProjectCost.setRemark("");
|
||||
}
|
||||
tblProjectCost.setCreateBy(createBy);
|
||||
tblProjectCost.setCreateTime(createTime);
|
||||
list.add(tblProjectCost);
|
||||
}
|
||||
}
|
||||
return toAjax(tblProjectCostService.insertTblProjectCostList(list));
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:cost:add")
|
||||
@Log(title = "工时", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/changePerson")
|
||||
@ResponseBody
|
||||
public AjaxResult changePerson(ProjectCostModel projectCostModel) {
|
||||
SysUser user = new SysUser();
|
||||
user.setUserId(projectCostModel.getUser());
|
||||
List<SysUser> users = userService.selectAvailableUserList(user);
|
||||
if (users.size() != 1) {
|
||||
return error("失败,用户不存在");
|
||||
}
|
||||
return toAjax(tblProjectCostService.updateUserUpdatetime(projectCostModel.getUser()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工时
|
||||
*/
|
||||
@GetMapping("/edit/{id}")
|
||||
public String edit(@PathVariable("id") String id, ModelMap mmap) {
|
||||
TblProjectCost tblProjectCost = tblProjectCostService.selectTblProjectCostById(new TblProjectCost(id));
|
||||
List<TblProject> list = new ArrayList<>();
|
||||
if (tblProjectCost != null) {
|
||||
list = tblProjectService.selectTblProjectListByUserProject(tblProjectCost.getUser(), ShiroUtils.getSysUser().isAdmin() || ShiroUtils.getSubject().hasRole("pmo") ? -1L : ShiroUtils.getUserId());
|
||||
}
|
||||
mmap.put("tblProjectCost", tblProjectCost);
|
||||
mmap.put("projectList", list);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存工时
|
||||
*/
|
||||
@RequiresPermissions("system:cost:edit")
|
||||
@Log(title = "工时", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(TblProjectCost tblProjectCost) {
|
||||
tblProjectCost.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(tblProjectCostService.updateTblProjectCost(tblProjectCost));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工时
|
||||
*/
|
||||
@RequiresPermissions("system:cost:remove")
|
||||
@Log(title = "工时", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids) {
|
||||
return toAjax(tblProjectCostService.deleteTblProjectCostByIds(ids));
|
||||
}
|
||||
|
||||
@GetMapping("/exportExcel")
|
||||
public String exportExcel(ModelMap mmap) throws ParseException {
|
||||
List<SysUser> users = userService.selectAvailableUserFilterByLeader(new SysUser());
|
||||
List<TblProject> projects = tblProjectService.selectPMOTblProjectList(ShiroUtils.getUserId());
|
||||
mmap.put("users", users);
|
||||
mmap.put("projects", projects);
|
||||
String[] d = getWeek(0, null);
|
||||
mmap.put("endDate", d[1]);
|
||||
mmap.put("startDate", d[0]);
|
||||
return prefix + "/exportExcel";
|
||||
}
|
||||
|
||||
@PostMapping("/downLoadExcel")
|
||||
@ResponseBody
|
||||
public AjaxResult downLoadExcel(ProjectCostExportQuery query) {
|
||||
TblProjectCost tblProjectCost = new TblProjectCost();
|
||||
tblProjectCost.setStartDate(query.getStartDate());
|
||||
tblProjectCost.setEndDate(query.getEndDate());
|
||||
tblProjectCost.getParams().put("pmo", ShiroUtils.getSubject().hasRole("pmo") || ShiroUtils.getSysUser().isAdmin());
|
||||
tblProjectCost.getParams().put("userId", ShiroUtils.getUserId());
|
||||
// tblProjectCost.getParams().put("order", "start_date desc");
|
||||
List<TblProjectCost> list = null;
|
||||
String preStr = "";
|
||||
if ("user-sum".equalsIgnoreCase(query.getSumType())) {
|
||||
SysUser u = userService.selectUserById(Long.valueOf(query.getQueryId()));
|
||||
preStr = u != null ? u.getUserName() : "";
|
||||
tblProjectCost.setUser(Long.valueOf(query.getQueryId()));
|
||||
list = tblProjectCostService.selectTblProjectCostSumProject(tblProjectCost);
|
||||
} else {
|
||||
TblProject p = tblProjectService.selectTblProjectById(query.getQueryId());
|
||||
preStr = p != null ? p.getName() : "";
|
||||
tblProjectCost.setProjectId(query.getQueryId());
|
||||
list = tblProjectCostService.selectTblProjectCostSumMember(tblProjectCost);
|
||||
}
|
||||
if (query.getWithCost() != true) {
|
||||
List<CostDetailForExcel> excels = new ArrayList<CostDetailForExcel>();
|
||||
if (list != null) {
|
||||
excels = list.stream().map(x -> {
|
||||
CostDetailForExcel info = new CostDetailForExcel();
|
||||
info.setName("user-sum".equalsIgnoreCase(query.getSumType()) ? x.getProjectName() : x.getUserName());
|
||||
info.setRemark(x.getRemark());
|
||||
info.setTimeSpan(x.getStartDate(), x.getEndDate());
|
||||
info.setCost(x.getCostDay());
|
||||
|
||||
return info;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
ExcelUtil<CostDetailForExcel> util = new ExcelUtil<CostDetailForExcel>(CostDetailForExcel.class);
|
||||
return util.exportExcel(excels, String.format("%s工时明细", preStr));
|
||||
} else if ("user-sum".equalsIgnoreCase(query.getSumType())) {
|
||||
List<CostDetailWithPostCostForExcel> excels = new ArrayList<CostDetailWithPostCostForExcel>();
|
||||
if (list != null) {
|
||||
excels = list.stream().map(x -> {
|
||||
CostDetailWithPostCostForExcel info = new CostDetailWithPostCostForExcel();
|
||||
info.setName(x.getProjectName());
|
||||
info.setRemark(x.getRemark());
|
||||
info.setTimeSpan(x.getStartDate(), x.getEndDate());
|
||||
info.setCost(x.getCostDay());
|
||||
info.setPostCost(x.getPostCost());
|
||||
return info;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
ExcelUtil<CostDetailWithPostCostForExcel> util = new ExcelUtil<CostDetailWithPostCostForExcel>(CostDetailWithPostCostForExcel.class);
|
||||
return util.exportExcel(excels, String.format("%s工时明细", preStr));
|
||||
|
||||
} else {
|
||||
List<UserCostDetailForExcel> excels = new ArrayList<UserCostDetailForExcel>();
|
||||
if (list != null) {
|
||||
excels = list.stream().map(x -> {
|
||||
UserCostDetailForExcel info = new UserCostDetailForExcel();
|
||||
info.setName(x.getUserName());
|
||||
info.setPostName(x.getPostName());
|
||||
info.setRemark(x.getRemark());
|
||||
info.setTimeSpan(x.getStartDate(), x.getEndDate());
|
||||
info.setCost(x.getCostDay());
|
||||
info.setPostCost(x.getUnitPrice());
|
||||
info.setPostCostTotal(x.getPostCost());
|
||||
return info;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
ExcelUtil<UserCostDetailForExcel> util = new ExcelUtil<UserCostDetailForExcel>(UserCostDetailForExcel.class);
|
||||
return util.exportExcel(excels, String.format("%s工时明细", preStr));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/exportSummary")
|
||||
public String exportSummary(ModelMap mmap) throws ParseException {
|
||||
String[] d = getWeek(0, null);
|
||||
mmap.put("endDate", d[1]);
|
||||
mmap.put("startDate", d[0]);
|
||||
return prefix + "/exportSummary";
|
||||
}
|
||||
|
||||
@PostMapping("/downLoadSummaryExcel")
|
||||
@ResponseBody
|
||||
public AjaxResult downLoadSummaryExcel(ProjectCostExportQuery query) {
|
||||
TblProjectCost tblProjectCost = new TblProjectCost();
|
||||
tblProjectCost.setStartDate(query.getStartDate());
|
||||
tblProjectCost.setEndDate(query.getEndDate());
|
||||
List<ProjectUserCost> list = tblProjectCostService.selectProjectUserCostByDate(tblProjectCost);
|
||||
List<TblProject> projects = tblProjectCostService.selectAllProjectName();
|
||||
List<SysUser> users = tblProjectCostService.selectAllSysUser();
|
||||
List<UserCostSummaryForExcel> userExcels = new ArrayList<>();
|
||||
List<ProjectCostSummaryForExcel> projectExcels = new ArrayList<>();
|
||||
|
||||
for (ProjectUserCost item : list) {
|
||||
Optional<SysUser> user = users.stream().filter(x -> x.getUserId() != null && x.getUserId().compareTo(item.getUserId()) == 0).findFirst();
|
||||
Optional<TblProject> project = projects.stream().filter(x -> x.getId().equalsIgnoreCase(item.getProjectId())).findFirst();
|
||||
String userName = user.isPresent() ? user.get().getUserName() : "-";
|
||||
String projectName = project.isPresent() ? project.get().getName() : "-";
|
||||
Boolean needInit = false;
|
||||
if ("user-sum".equalsIgnoreCase(query.getSumType())) {
|
||||
Optional<UserCostSummaryForExcel> cell = userExcels.stream().filter(x -> x.getUserId() != null && x.getUserId().compareTo(item.getUserId()) == 0).findFirst();
|
||||
if (cell.isPresent()) {
|
||||
cell.get().add(item, userName, projectName);
|
||||
} else {
|
||||
needInit = true;
|
||||
}
|
||||
} else {
|
||||
Optional<ProjectCostSummaryForExcel> cell = projectExcels.stream().filter(x -> x.getProjectId() != null && x.getProjectId().equalsIgnoreCase(item.getProjectId())).findFirst();
|
||||
if (cell.isPresent()) {
|
||||
cell.get().add(item, userName, projectName);
|
||||
} else {
|
||||
needInit = true;
|
||||
}
|
||||
}
|
||||
if (needInit) {
|
||||
if ("user-sum".equalsIgnoreCase(query.getSumType())) {
|
||||
userExcels.add(UserCostSummaryForExcel.init(item, userName, projectName));
|
||||
} else {
|
||||
projectExcels.add(ProjectCostSummaryForExcel.init(item, userName, projectName));
|
||||
}
|
||||
}
|
||||
}
|
||||
if ("user-sum".equalsIgnoreCase(query.getSumType())) {
|
||||
ExcelUtil<UserCostSummaryForExcel> util = new ExcelUtil<UserCostSummaryForExcel>(UserCostSummaryForExcel.class);
|
||||
return util.exportExcel(userExcels, String.format("%s明细", "人员"));
|
||||
} else {
|
||||
ExcelUtil<ProjectCostSummaryForExcel> util = new ExcelUtil<ProjectCostSummaryForExcel>(ProjectCostSummaryForExcel.class);
|
||||
return util.exportExcel(projectExcels, String.format("%s明细", "项目"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
package com.ruoyi.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.utils.ShiroUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.system.domain.TblUploadFile;
|
||||
import com.ruoyi.system.service.ITblUploadFileService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* 文件关联Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-03-08
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/file")
|
||||
public class TblUploadFileController extends BaseController
|
||||
{
|
||||
private String prefix = "system/file";
|
||||
|
||||
@Autowired
|
||||
private ITblUploadFileService tblUploadFileService;
|
||||
|
||||
/**
|
||||
* 删除文件关联
|
||||
*/
|
||||
@RequiresPermissions("system:file:remove")
|
||||
@Log(title = "文件关联", businessType = BusinessType.DELETE)
|
||||
@PostMapping( "/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(@RequestBody String ids)
|
||||
{
|
||||
return toAjax(tblUploadFileService.deleteTblUploadFileByIds(ids));
|
||||
}
|
||||
|
||||
@PostMapping("/uploadfile")
|
||||
@ResponseBody
|
||||
public AjaxResult uploadfile(@RequestParam("file") MultipartFile file, TblUploadFile fileInfo) {
|
||||
String relType = fileInfo.getRelType();;
|
||||
String fileBasePath = RuoYiConfig.getUploadPath() + "/" + relType;
|
||||
String filePath = null;
|
||||
try {
|
||||
filePath = FileUploadUtils.upload(fileBasePath, file);
|
||||
} catch (Exception e) {
|
||||
return error("文件上传失败");
|
||||
}
|
||||
fileInfo.setFilePath(filePath);
|
||||
fileInfo.setCreateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(tblUploadFileService.insertTblUploadFile(fileInfo));
|
||||
}
|
||||
|
||||
@PostMapping("/queryfilelist")
|
||||
@ResponseBody
|
||||
public AjaxResult queryfilelist(@RequestBody TblUploadFile fileInfo){
|
||||
return AjaxResult.success(tblUploadFileService.selectTblUploadFileList(fileInfo));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
public class CntSettleSummaryModel extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/** 合同id */
|
||||
@Excel(name = "合同id")
|
||||
private String contractId;
|
||||
/**
|
||||
* 已付款金额
|
||||
*/
|
||||
@Excel(name = "已付款金额")
|
||||
private BigDecimal payedAmount;
|
||||
|
||||
/**
|
||||
* 近期到期金额
|
||||
*/
|
||||
@Excel(name = "近期到期金额")
|
||||
private BigDecimal matureAmount;
|
||||
|
||||
/**
|
||||
* 近期到期时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "近期到期时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date matureDate;
|
||||
|
||||
public void setContractId(String contractId)
|
||||
{
|
||||
this.contractId = contractId;
|
||||
}
|
||||
public String getContractId()
|
||||
{
|
||||
return contractId;
|
||||
}
|
||||
|
||||
public BigDecimal getPayedAmount() {
|
||||
return this.payedAmount;
|
||||
}
|
||||
|
||||
public void setPayedAmount(BigDecimal payedAmount) {
|
||||
this.payedAmount = payedAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getMatureAmount() {
|
||||
return this.matureAmount;
|
||||
}
|
||||
|
||||
public void setMatureAmount(BigDecimal matureAmount) {
|
||||
this.matureAmount = matureAmount;
|
||||
}
|
||||
|
||||
public Date getMatureDate() {
|
||||
return this.matureDate;
|
||||
}
|
||||
|
||||
public void setMatureDate(Date matureDate) {
|
||||
this.matureDate = matureDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("contractId", getContractId())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("payedAmount", getPayedAmount())
|
||||
.append("matureAmount", getMatureAmount())
|
||||
.append("matureDate", getMatureDate())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
public class CntSettlementModel {
|
||||
private String contractId;
|
||||
private String settleType;
|
||||
private Date[] settleDate;
|
||||
private BigDecimal[] amount;
|
||||
private String[] remark;
|
||||
|
||||
public String getContractId() {
|
||||
return this.contractId;
|
||||
}
|
||||
|
||||
public void setContractId(String contractId) {
|
||||
this.contractId = contractId;
|
||||
}
|
||||
|
||||
public String getSettleType() {
|
||||
return this.settleType;
|
||||
}
|
||||
|
||||
public void setSettleType(String settleType) {
|
||||
this.settleType = settleType;
|
||||
}
|
||||
|
||||
public Date[] getSettleDate() {
|
||||
return this.settleDate;
|
||||
}
|
||||
|
||||
public void setSettleDate(Date[] settleDate) {
|
||||
this.settleDate = settleDate;
|
||||
}
|
||||
|
||||
public BigDecimal[] getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public void setAmount(BigDecimal[] amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public String[] getRemark() {
|
||||
return this.remark;
|
||||
}
|
||||
|
||||
public void setRemark(String[] remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
public class ContractSettleIndexModel extends TblContract {
|
||||
|
||||
/**
|
||||
* 已付款金额
|
||||
*/
|
||||
@Excel(name = "已付款金额")
|
||||
private BigDecimal payedAmount;
|
||||
|
||||
/**
|
||||
* 近期到期金额
|
||||
*/
|
||||
@Excel(name = "近期到期金额")
|
||||
private BigDecimal matureAmount;
|
||||
|
||||
/**
|
||||
* 近期到期时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "近期到期时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date matureDate;
|
||||
|
||||
public BigDecimal getPayedAmount() {
|
||||
return this.payedAmount;
|
||||
}
|
||||
|
||||
public void setPayedAmount(BigDecimal payedAmount) {
|
||||
this.payedAmount = payedAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getMatureAmount() {
|
||||
return this.matureAmount;
|
||||
}
|
||||
|
||||
public void setMatureAmount(BigDecimal matureAmount) {
|
||||
this.matureAmount = matureAmount;
|
||||
}
|
||||
|
||||
public Date getMatureDate() {
|
||||
return this.matureDate;
|
||||
}
|
||||
|
||||
public void setMatureDate(Date matureDate) {
|
||||
this.matureDate = matureDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("leaderId", getLeaderId())
|
||||
.append("leader", getLeader())
|
||||
.append("buyers", getBuyers())
|
||||
.append("sellers", getSellers())
|
||||
.append("signDate", getSignDate())
|
||||
.append("startDate", getStartDate())
|
||||
.append("endDate", getEndDate())
|
||||
.append("amount", getAmount())
|
||||
.append("payMode", getPayMode())
|
||||
.append("remark", getRemark())
|
||||
.append("payStatus", getPayStatus())
|
||||
.append("status", getStatus())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("payedAmount", getPayedAmount())
|
||||
.append("matureAmount", getMatureAmount())
|
||||
.append("matureDate", getMatureDate())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
public class IndexProjectStatusSumModel {
|
||||
private String statusCode;
|
||||
private Long count;
|
||||
|
||||
public String getStatusCode() {
|
||||
return this.statusCode;
|
||||
}
|
||||
|
||||
public Long getCount() {
|
||||
return this.count;
|
||||
}
|
||||
|
||||
public void setStatusCode(String statusCode) {
|
||||
this.statusCode = statusCode;
|
||||
}
|
||||
|
||||
public void setCount(Long count) {
|
||||
this.count = count;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
public class IndexProjectSummaryModel {
|
||||
private String name;
|
||||
private Long count;
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public Long getCount() {
|
||||
return this.count;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setCount(Long count) {
|
||||
this.count = count;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 工时信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class ProjectCostModel {
|
||||
|
||||
/** 项目ID */
|
||||
private String[] projectId;
|
||||
|
||||
/** 组ID */
|
||||
private String groupId;
|
||||
|
||||
/** 用户ID */
|
||||
private Long user;
|
||||
|
||||
/** 起始日期 */
|
||||
private Date startDate;
|
||||
|
||||
/** 结束日期 */
|
||||
private Date endDate;
|
||||
|
||||
/** 人时 */
|
||||
private BigDecimal[] costDay;
|
||||
|
||||
/** 备注 */
|
||||
private String[] remark;
|
||||
|
||||
public String[] getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String[] remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public String[] getProjectId() {
|
||||
return projectId;
|
||||
}
|
||||
|
||||
public void setProjectId(String[] projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public String getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(String groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public Long getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(Long user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public Date getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Date startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public BigDecimal[] getCostDay() {
|
||||
return costDay;
|
||||
}
|
||||
|
||||
public void setCostDay(BigDecimal[] costDay) {
|
||||
this.costDay = costDay;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import org.apache.poi.hpsf.Decimal;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class ProjectSumModel implements Serializable {
|
||||
private String projectId;
|
||||
private String projectName;
|
||||
private BigDecimal costAmount;
|
||||
private BigDecimal twoWeeksAgoAmount;
|
||||
|
||||
public String getProjectId() {
|
||||
return this.projectId;
|
||||
}
|
||||
|
||||
public String getProjectName() {
|
||||
return this.projectName;
|
||||
}
|
||||
|
||||
public BigDecimal getCostAmount() {
|
||||
return this.costAmount != null ? this.costAmount : BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
public BigDecimal getTwoWeeksAgoAmount() {
|
||||
return this.twoWeeksAgoAmount != null ? this.twoWeeksAgoAmount : BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
public void setProjectId(String projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public void setCostAmount(BigDecimal costAmount) {
|
||||
this.costAmount = costAmount;
|
||||
}
|
||||
|
||||
public void setTwoWeeksAgoAmount(BigDecimal twoWeeksAgoAmount) {
|
||||
this.twoWeeksAgoAmount = twoWeeksAgoAmount;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author denis
|
||||
* @date 2023/7/11 13:44
|
||||
*/
|
||||
@Data
|
||||
public class ProjectUserCost {
|
||||
private String projectId;
|
||||
private Long userId;
|
||||
private BigDecimal costDay;
|
||||
private BigDecimal postCost;
|
||||
}
|
||||
|
|
@ -0,0 +1,252 @@
|
|||
package com.ruoyi.system.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;
|
||||
|
||||
/**
|
||||
* 合同对象 tbl_contract
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-02-24
|
||||
*/
|
||||
public class TblContract extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 合同名称
|
||||
*/
|
||||
@Excel(name = "合同名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 负责人id
|
||||
*/
|
||||
@Excel(name = "负责人id")
|
||||
private Long leaderId;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
@Excel(name = "负责人")
|
||||
private String leader;
|
||||
|
||||
/**
|
||||
* 甲方
|
||||
*/
|
||||
@Excel(name = "甲方")
|
||||
private String buyers;
|
||||
|
||||
/**
|
||||
* 乙方
|
||||
*/
|
||||
@Excel(name = "乙方")
|
||||
private String sellers;
|
||||
|
||||
/**
|
||||
* 签约日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "签约日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date signDate;
|
||||
|
||||
/**
|
||||
* 起始日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "起始日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date startDate;
|
||||
|
||||
/**
|
||||
* 结束日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "结束日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date endDate;
|
||||
|
||||
/**
|
||||
* 金额
|
||||
*/
|
||||
@Excel(name = "金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 付款方式
|
||||
*/
|
||||
@Excel(name = "付款方式")
|
||||
private String payMode;
|
||||
|
||||
/**
|
||||
* 收款状态
|
||||
*/
|
||||
@Excel(name = "收款状态")
|
||||
private Long payStatus;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Excel(name = "状态")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
private String signYear;
|
||||
|
||||
public String getSignYear() {
|
||||
return signYear;
|
||||
}
|
||||
|
||||
public void setSignYear(String signYear) {
|
||||
this.signYear = signYear;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setLeaderId(Long leaderId) {
|
||||
this.leaderId = leaderId;
|
||||
}
|
||||
|
||||
public Long getLeaderId() {
|
||||
return leaderId;
|
||||
}
|
||||
|
||||
public void setLeader(String leader) {
|
||||
this.leader = leader != "--请选择--" ? leader : "";
|
||||
}
|
||||
|
||||
public String getLeader() {
|
||||
return leader;
|
||||
}
|
||||
|
||||
public void setBuyers(String buyers) {
|
||||
this.buyers = buyers;
|
||||
}
|
||||
|
||||
public String getBuyers() {
|
||||
return buyers;
|
||||
}
|
||||
|
||||
public void setSellers(String sellers) {
|
||||
this.sellers = sellers;
|
||||
}
|
||||
|
||||
public String getSellers() {
|
||||
return sellers;
|
||||
}
|
||||
|
||||
public void setSignDate(Date signDate) {
|
||||
this.signDate = signDate;
|
||||
}
|
||||
|
||||
public Date getSignDate() {
|
||||
return signDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Date startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public Date getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setAmount(BigDecimal amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setPayMode(String payMode) {
|
||||
this.payMode = payMode;
|
||||
}
|
||||
|
||||
public String getPayMode() {
|
||||
return payMode;
|
||||
}
|
||||
|
||||
public void setPayStatus(Long payStatus) {
|
||||
this.payStatus = payStatus;
|
||||
}
|
||||
|
||||
public Long getPayStatus() {
|
||||
return payStatus;
|
||||
}
|
||||
|
||||
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("id", getId())
|
||||
.append("name", getName())
|
||||
.append("leaderId", getLeaderId())
|
||||
.append("leader", getLeader())
|
||||
.append("buyers", getBuyers())
|
||||
.append("sellers", getSellers())
|
||||
.append("signDate", getSignDate())
|
||||
.append("startDate", getStartDate())
|
||||
.append("endDate", getEndDate())
|
||||
.append("amount", getAmount())
|
||||
.append("payMode", getPayMode())
|
||||
.append("remark", getRemark())
|
||||
.append("payStatus", getPayStatus())
|
||||
.append("status", getStatus())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,150 @@
|
|||
package com.ruoyi.system.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;
|
||||
|
||||
/**
|
||||
* 合同收款对象 tbl_contract_settlement
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-03-01
|
||||
*/
|
||||
public class TblContractSettlement extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 合同id
|
||||
*/
|
||||
@Excel(name = "合同id")
|
||||
private String contractId;
|
||||
|
||||
/**
|
||||
* 计划收款or确认收款
|
||||
*/
|
||||
@Excel(name = "计划收款or确认收款")
|
||||
private String settleType;
|
||||
|
||||
/**
|
||||
* 收款日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "收款日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date settleDate;
|
||||
|
||||
/**
|
||||
* 金额
|
||||
*/
|
||||
@Excel(name = "金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 付款方式
|
||||
*/
|
||||
@Excel(name = "付款方式")
|
||||
private String payMode;
|
||||
|
||||
/**
|
||||
* 提示标识
|
||||
*/
|
||||
@Excel(name = "提示标识")
|
||||
private String warnFlag;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setContractId(String contractId) {
|
||||
this.contractId = contractId;
|
||||
}
|
||||
|
||||
public String getContractId() {
|
||||
return contractId;
|
||||
}
|
||||
|
||||
public void setSettleType(String settleType) {
|
||||
this.settleType = settleType;
|
||||
}
|
||||
|
||||
public String getSettleType() {
|
||||
return settleType;
|
||||
}
|
||||
|
||||
public void setSettleDate(Date settleDate) {
|
||||
this.settleDate = settleDate;
|
||||
}
|
||||
|
||||
public Date getSettleDate() {
|
||||
return settleDate;
|
||||
}
|
||||
|
||||
public void setAmount(BigDecimal amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setPayMode(String payMode) {
|
||||
this.payMode = payMode;
|
||||
}
|
||||
|
||||
public String getPayMode() {
|
||||
return payMode;
|
||||
}
|
||||
|
||||
public void setWarnFlag(String warnFlag) {
|
||||
this.warnFlag = warnFlag;
|
||||
}
|
||||
|
||||
public String getWarnFlag() {
|
||||
return warnFlag;
|
||||
}
|
||||
|
||||
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("id", getId())
|
||||
.append("contractId", getContractId())
|
||||
.append("settleType", getSettleType())
|
||||
.append("settleDate", getSettleDate())
|
||||
.append("amount", getAmount())
|
||||
.append("payMode", getPayMode())
|
||||
.append("remark", getRemark())
|
||||
.append("warnFlag", getWarnFlag())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,269 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.framework.web.domain.server.Sys;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 项目对象 tbl_project
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-02-28
|
||||
*/
|
||||
public class TblProject extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 自增编号
|
||||
*/
|
||||
private Long autoId;
|
||||
|
||||
/**
|
||||
* 项目编号,根据自增编号转换
|
||||
*/
|
||||
private String projectNo;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Excel(name = "名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 负责人id
|
||||
*/
|
||||
private Long leaderId;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
@Excel(name = "负责人")
|
||||
private String leader;
|
||||
|
||||
/**
|
||||
* 状态(0正常 1停用)
|
||||
*/
|
||||
@Excel(name = "状态", readConverterExp = "1=正常,2=已完成,3=已停止")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 合同id
|
||||
*/
|
||||
private String contractId;
|
||||
|
||||
/**
|
||||
* 合同名称
|
||||
*/
|
||||
@Excel(name = "合同名称")
|
||||
private String contractName;
|
||||
|
||||
/**
|
||||
* 甲方
|
||||
*/
|
||||
@Excel(name = "甲方")
|
||||
private String buyers;
|
||||
|
||||
/**
|
||||
* 乙方
|
||||
*/
|
||||
@Excel(name = "乙方")
|
||||
private String sellers;
|
||||
|
||||
/**
|
||||
* 起始日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "起始日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date startDate;
|
||||
|
||||
/**
|
||||
* 结束日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "结束日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date endDate;
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setAutoId(Long autoId) {
|
||||
this.autoId = autoId;
|
||||
this.projectNo = this.autoId != null ? String.format("%08d", this.autoId.longValue()) : "-";
|
||||
}
|
||||
|
||||
public Long getAutoId() {
|
||||
return this.autoId;
|
||||
}
|
||||
|
||||
public String getProjectNo() {
|
||||
return projectNo;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setLeaderId(Long leaderId) {
|
||||
this.leaderId = leaderId;
|
||||
}
|
||||
|
||||
public Long getLeaderId() {
|
||||
return leaderId;
|
||||
}
|
||||
|
||||
public void setLeader(String leader) {
|
||||
this.leader = leader != "--请选择--" ? leader : "";
|
||||
}
|
||||
|
||||
public String getLeader() {
|
||||
return leader;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public void setContractId(String contractId) {
|
||||
this.contractId = contractId;
|
||||
}
|
||||
|
||||
public String getContractId() {
|
||||
return contractId;
|
||||
}
|
||||
|
||||
public void setContractName(String contractName) {
|
||||
this.contractName = contractName != "--请选择--" ? contractName : "";
|
||||
}
|
||||
|
||||
public String getContractName() {
|
||||
return contractName;
|
||||
}
|
||||
|
||||
public void setBuyers(String buyers) {
|
||||
this.buyers = buyers;
|
||||
}
|
||||
|
||||
public String getBuyers() {
|
||||
return buyers;
|
||||
}
|
||||
|
||||
public void setSellers(String sellers) {
|
||||
this.sellers = sellers;
|
||||
}
|
||||
|
||||
public String getSellers() {
|
||||
return sellers;
|
||||
}
|
||||
|
||||
public void setStartDate(Date startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public Date getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public TblProject setOrder(Long userId, String createBy) {
|
||||
StringBuffer order = new StringBuffer("order by ");
|
||||
if (userId != null) {
|
||||
this.getParams().put("user", userId);
|
||||
order.append(
|
||||
"(select max(create_time) from tbl_project_cost tpc where tpc.project_id=tbl_project.id and tpc.user=#{params.user}) desc,");
|
||||
}
|
||||
this.setCreateBy(createBy);
|
||||
order.append(
|
||||
"(select max(create_time) from tbl_project_cost tpc1 where tpc1.project_id=tbl_project.id and tpc1.create_by=#{createBy}) desc,")
|
||||
.append("if(create_by =#{createBy},create_time,null) desc,create_time desc");
|
||||
this.getParams().put("order", order.toString());
|
||||
return this;
|
||||
}
|
||||
|
||||
public TblProject setOrder() {
|
||||
this.getParams().put("order", "order by CONVERT(name using gbk)");
|
||||
return this;
|
||||
}
|
||||
|
||||
public TblProject setOrderByCreatTime(Boolean desc) {
|
||||
this.getParams().put("order", "order by create_time" + (desc ? " desc" : ""));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
private String projectNoQuery;
|
||||
|
||||
public String getProjectNoQuery() {
|
||||
return projectNoQuery;
|
||||
}
|
||||
|
||||
public void setProjectNoQuery(String projectNoQuery) {
|
||||
this.projectNoQuery = projectNoQuery;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("remark", getRemark())
|
||||
.append("leaderId", getLeaderId())
|
||||
.append("leader", getLeader())
|
||||
.append("status", getStatus())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("contractId", getContractId())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("contractName", getContractName())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("buyers", getBuyers())
|
||||
.append("sellers", getSellers())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("startDate", getStartDate())
|
||||
.append("endDate", getEndDate())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,209 @@
|
|||
package com.ruoyi.system.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;
|
||||
|
||||
/**
|
||||
* 工时对象 tbl_project_cost
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-02-18
|
||||
*/
|
||||
public class TblProjectCost extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 项目ID
|
||||
*/
|
||||
private String projectId;
|
||||
|
||||
/**
|
||||
* 组ID
|
||||
*/
|
||||
private String groupId;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
@Excel(name = "项目名称")
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long user;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@Excel(name = "用户名")
|
||||
private String userName;
|
||||
|
||||
private String leader;
|
||||
|
||||
/**
|
||||
* 起始日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "起始日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date startDate;
|
||||
|
||||
/**
|
||||
* 结束日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "结束日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date endDate;
|
||||
|
||||
/**
|
||||
* 人时
|
||||
*/
|
||||
@Excel(name = "人时")
|
||||
private BigDecimal costDay;
|
||||
|
||||
private String postName;
|
||||
private BigDecimal postCost;
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
public TblProjectCost(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public TblProjectCost() {
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setProjectId(String projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public String getProjectId() {
|
||||
return projectId;
|
||||
}
|
||||
|
||||
public void setGroupId(String groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public String getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName != "--请选择--" ? projectName : "";
|
||||
}
|
||||
|
||||
public String getProjectName() {
|
||||
return projectName;
|
||||
}
|
||||
|
||||
public void setUser(Long user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public Long getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName != "--请选择--" ? userName : "";
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setStartDate(Date startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public Date getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setCostDay(BigDecimal costDay) {
|
||||
this.costDay = costDay;
|
||||
}
|
||||
|
||||
public BigDecimal getCostDay() {
|
||||
return costDay;
|
||||
}
|
||||
|
||||
public BigDecimal getPostCost() {
|
||||
return postCost;
|
||||
}
|
||||
|
||||
public void setPostCost(BigDecimal postCost) {
|
||||
this.postCost = postCost;
|
||||
}
|
||||
|
||||
public String getPostName() {
|
||||
return postName;
|
||||
}
|
||||
|
||||
public void setPostName(String postName) {
|
||||
this.postName = postName;
|
||||
}
|
||||
|
||||
public BigDecimal getUnitPrice() {
|
||||
return unitPrice;
|
||||
}
|
||||
|
||||
public void setUnitPrice(BigDecimal unitPrice) {
|
||||
this.unitPrice = unitPrice;
|
||||
}
|
||||
|
||||
public String getLeader() {
|
||||
return leader;
|
||||
}
|
||||
|
||||
public void setLeader(String leader) {
|
||||
this.leader = leader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("projectId", getProjectId())
|
||||
.append("groupId", getGroupId())
|
||||
.append("projectName", getProjectName())
|
||||
.append("user", getUser())
|
||||
.append("userName", getUserName())
|
||||
.append("startDate", getStartDate())
|
||||
.append("endDate", getEndDate())
|
||||
.append("costDay", getCostDay())
|
||||
.append("remark", getRemark())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
package com.ruoyi.system.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;
|
||||
|
||||
/**
|
||||
* 文件关联对象 tbl_upload_file
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-03-08
|
||||
*/
|
||||
public class TblUploadFile extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** ID */
|
||||
private String id;
|
||||
|
||||
/** 关联类型 */
|
||||
@Excel(name = "关联类型")
|
||||
private String relType;
|
||||
|
||||
/** 关联表ID */
|
||||
@Excel(name = "关联表ID")
|
||||
private String relId;
|
||||
|
||||
/** 文件名 */
|
||||
@Excel(name = "文件名")
|
||||
private String fileName;
|
||||
|
||||
/** 文件路径(包含保存文件名) */
|
||||
@Excel(name = "文件路径", readConverterExp = "包=含保存文件名")
|
||||
private String filePath;
|
||||
|
||||
/** 后缀名 */
|
||||
@Excel(name = "后缀名")
|
||||
private String fileExt;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setRelType(String relType)
|
||||
{
|
||||
this.relType = relType;
|
||||
}
|
||||
|
||||
public String getRelType()
|
||||
{
|
||||
return relType;
|
||||
}
|
||||
public void setRelId(String relId)
|
||||
{
|
||||
this.relId = relId;
|
||||
}
|
||||
|
||||
public String getRelId()
|
||||
{
|
||||
return relId;
|
||||
}
|
||||
public void setFileName(String fileName)
|
||||
{
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public String getFileName()
|
||||
{
|
||||
return fileName;
|
||||
}
|
||||
public void setFilePath(String filePath)
|
||||
{
|
||||
this.filePath = filePath;
|
||||
}
|
||||
|
||||
public String getFilePath()
|
||||
{
|
||||
return filePath;
|
||||
}
|
||||
public void setFileExt(String fileExt)
|
||||
{
|
||||
this.fileExt = fileExt;
|
||||
}
|
||||
|
||||
public String getFileExt()
|
||||
{
|
||||
return fileExt;
|
||||
}
|
||||
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("id", getId())
|
||||
.append("relType", getRelType())
|
||||
.append("relId", getRelId())
|
||||
.append("fileName", getFileName())
|
||||
.append("filePath", getFilePath())
|
||||
.append("fileExt", getFileExt())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 项目对象 tbl_user_project
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-02-09
|
||||
*/
|
||||
public class TblUserProject extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long userId;
|
||||
|
||||
private String projectId;
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getProjectId() {
|
||||
return projectId;
|
||||
}
|
||||
|
||||
public void setProjectId(String projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("userId", getUserId())
|
||||
.append("projectId", getProjectId()).toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import org.apache.poi.hpsf.Decimal;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class UserLastWeekSumModel implements Serializable {
|
||||
private Long userCount;
|
||||
private Long reportedCount;
|
||||
private BigDecimal costAmount;
|
||||
private BigDecimal twoWeeksAgoAmount;
|
||||
|
||||
public Long getUserCount() {
|
||||
return this.userCount;
|
||||
}
|
||||
|
||||
public Long getReportedCount() {
|
||||
return this.reportedCount;
|
||||
}
|
||||
|
||||
public BigDecimal getCostAmount() {
|
||||
return this.costAmount != null ? this.costAmount : BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
public BigDecimal getTwoWeeksAgoAmount(){
|
||||
return this.twoWeeksAgoAmount != null ? this.twoWeeksAgoAmount : BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
public void setUserCount(Long userCount) {
|
||||
this.userCount = userCount;
|
||||
}
|
||||
|
||||
public void setReportedCount(Long reportedCount) {
|
||||
this.reportedCount = reportedCount;
|
||||
}
|
||||
|
||||
public void setCostAmount(BigDecimal costAmount) {
|
||||
this.costAmount = costAmount;
|
||||
}
|
||||
|
||||
public void setTwoWeeksAgoAmount(BigDecimal twoWeeksAgoAmount){
|
||||
this.twoWeeksAgoAmount = twoWeeksAgoAmount;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
package com.ruoyi.system.domain.excel;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class CostDetailForExcel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Excel(name = "名称")
|
||||
private String name;
|
||||
@Excel(name = "内容", autoSize = true)
|
||||
private String remark;
|
||||
@Excel(name = "时间")
|
||||
private String timeSpan;
|
||||
@Excel(name = "工时", isStatistics = true)
|
||||
private String cost;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public String getTimeSpan() {
|
||||
return timeSpan;
|
||||
}
|
||||
|
||||
public String getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
if (remark == null) {
|
||||
return;
|
||||
}
|
||||
this.remark = remark.replaceAll("<BR>", String.valueOf((char) 10));
|
||||
}
|
||||
|
||||
public void setTimeSpan(Date sd, Date ed) {
|
||||
if (sd == null || ed == null) {
|
||||
this.timeSpan = "-";
|
||||
} else {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
this.timeSpan = format.format(sd) + "~" + format.format(ed);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setCost(BigDecimal cost) {
|
||||
if (cost == null || "".equals(cost)) {
|
||||
this.cost = "-";
|
||||
return;
|
||||
}
|
||||
if (new BigDecimal(cost.intValue()).compareTo(cost) == 0) {
|
||||
this.cost = String.valueOf(cost.intValue());
|
||||
} else {
|
||||
this.cost = String.format("%.2f", cost);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
package com.ruoyi.system.domain.excel;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author denis
|
||||
* @date 2022/10/21 14:39
|
||||
*/
|
||||
public class CostDetailWithPostCostForExcel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Excel(name = "名称")
|
||||
private String name;
|
||||
@Excel(name = "内容", autoSize = true)
|
||||
private String remark;
|
||||
@Excel(name = "时间")
|
||||
private String timeSpan;
|
||||
@Excel(name = "工时", isStatistics = true)
|
||||
private String cost;
|
||||
|
||||
@Excel(name = "成本", isStatistics = true)
|
||||
private String postCost;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public String getTimeSpan() {
|
||||
return timeSpan;
|
||||
}
|
||||
|
||||
public String getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
public String getPostCost() {
|
||||
return postCost;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
if (remark == null) {
|
||||
return;
|
||||
}
|
||||
this.remark = remark.replaceAll("<BR>", String.valueOf((char) 10));
|
||||
}
|
||||
|
||||
public void setTimeSpan(Date sd, Date ed) {
|
||||
if (sd == null || ed == null) {
|
||||
this.timeSpan = "-";
|
||||
} else {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
this.timeSpan = format.format(sd) + "~" + format.format(ed);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setCost(BigDecimal cost) {
|
||||
if (cost == null || "".equals(cost)) {
|
||||
this.cost = "-";
|
||||
return;
|
||||
}
|
||||
if (new BigDecimal(cost.intValue()).compareTo(cost) == 0) {
|
||||
this.cost = String.valueOf(cost.intValue());
|
||||
} else {
|
||||
this.cost = String.format("%.2f", cost);
|
||||
}
|
||||
}
|
||||
public void setPostCost(BigDecimal postCost){
|
||||
if (postCost == null || "".equals(postCost)) {
|
||||
this.postCost = "-";
|
||||
return;
|
||||
}
|
||||
if(new BigDecimal(postCost.intValue()).compareTo(postCost) == 0){
|
||||
this.postCost = String.valueOf(postCost.intValue());
|
||||
}else {
|
||||
this.postCost = String.format("%.2f", postCost);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
package com.ruoyi.system.domain.excel;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.system.domain.ProjectUserCost;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author denis
|
||||
* @date 2023/7/11 14:18
|
||||
*/
|
||||
@Data
|
||||
public class ProjectCostSummaryForExcel {
|
||||
|
||||
@Excel(name = "项目名称")
|
||||
private String projectName;
|
||||
@Excel(name = "人员")
|
||||
private String content;
|
||||
private Long userId;
|
||||
private String projectId;
|
||||
@Excel(name = "工时", isStatistics = true)
|
||||
private String timesStr;
|
||||
private BigDecimal times;
|
||||
@Excel(name = "成本", isStatistics = true)
|
||||
private String costStr;
|
||||
private BigDecimal cost;
|
||||
|
||||
public static ProjectCostSummaryForExcel init(ProjectUserCost cost, String userName, String projectName) {
|
||||
ProjectCostSummaryForExcel excel = new ProjectCostSummaryForExcel();
|
||||
excel.setProjectId(cost.getProjectId());
|
||||
excel.setProjectName(projectName);
|
||||
excel.setContent(userName + "(" + cost.getCostDay() + ")");
|
||||
excel.setTimes(cost.getCostDay());
|
||||
excel.setCost(cost.getPostCost());
|
||||
return excel;
|
||||
}
|
||||
|
||||
public void setTimes(BigDecimal times) {
|
||||
this.times = times;
|
||||
this.timesStr = this.times == null ? "-" : String.format("%.2f", this.times);
|
||||
}
|
||||
|
||||
public void setCost(BigDecimal cost) {
|
||||
this.cost = cost;
|
||||
this.costStr = this.cost == null ? "-" : String.format("%.2f", this.cost);
|
||||
}
|
||||
|
||||
public void add(ProjectUserCost cost, String userName, String projectName) {
|
||||
addTime(cost.getCostDay());
|
||||
addCost(cost.getPostCost());
|
||||
this.content = this.content + " " + userName + "(" + cost.getCostDay() + ")";
|
||||
}
|
||||
|
||||
public void addTime(BigDecimal t) {
|
||||
if (this.times != null && t != null) {
|
||||
setTimes(this.times.add(t));
|
||||
} else if (this.times == null) {
|
||||
setTimes(t);
|
||||
}
|
||||
}
|
||||
|
||||
public void addCost(BigDecimal c) {
|
||||
if (this.cost != null && c != null) {
|
||||
setCost(this.cost.add(c));
|
||||
} else if (this.cost == null) {
|
||||
setCost(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
package com.ruoyi.system.domain.excel;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author denis
|
||||
* @date 2022/10/19 15:31
|
||||
*/
|
||||
public class UserCostDetailForExcel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Excel(name = "名称")
|
||||
private String name;
|
||||
@Excel(name = "岗位")
|
||||
private String postName;
|
||||
@Excel(name = "内容", autoSize = true)
|
||||
private String remark;
|
||||
@Excel(name = "时间")
|
||||
private String timeSpan;
|
||||
@Excel(name = "工时", isStatistics = true)
|
||||
private String cost;
|
||||
@Excel(name = "单价(元/月)")
|
||||
private String postCost;
|
||||
@Excel(name = "成本", isStatistics = true)
|
||||
private String postCostTotal;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getPostName() {
|
||||
return postName;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public String getTimeSpan() {
|
||||
return timeSpan;
|
||||
}
|
||||
|
||||
public String getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
public String getPostCostTotal() {
|
||||
return postCostTotal;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setPostName(String postName) {
|
||||
this.postName = postName;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
if (remark == null) {
|
||||
return;
|
||||
}
|
||||
this.remark = remark.replaceAll("<BR>", String.valueOf((char) 10));
|
||||
}
|
||||
|
||||
public void setTimeSpan(Date sd, Date ed) {
|
||||
if (sd == null || ed == null) {
|
||||
this.timeSpan = "-";
|
||||
} else {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
this.timeSpan = format.format(sd) + "~" + format.format(ed);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setCost(BigDecimal cost) {
|
||||
if (cost == null || "".equals(cost)) {
|
||||
this.cost = "-";
|
||||
return;
|
||||
}
|
||||
if (new BigDecimal(cost.intValue()).compareTo(cost) == 0) {
|
||||
this.cost = String.valueOf(cost.intValue());
|
||||
} else {
|
||||
this.cost = String.format("%.2f", cost);
|
||||
}
|
||||
}
|
||||
public void setPostCostTotal(BigDecimal postCostTotal){
|
||||
if (postCostTotal == null || "".equals(postCostTotal)) {
|
||||
this.postCostTotal = "-";
|
||||
return;
|
||||
}
|
||||
if(new BigDecimal(postCostTotal.intValue()).compareTo(postCostTotal) == 0){
|
||||
this.postCostTotal = String.valueOf(postCostTotal.intValue());
|
||||
}else {
|
||||
this.postCostTotal = String.format("%.2f", postCostTotal);
|
||||
}
|
||||
}
|
||||
|
||||
public void setPostCost(BigDecimal postCost) {
|
||||
if (postCost == null || "".equals(postCost)) {
|
||||
this.postCost = "-";
|
||||
return;
|
||||
}
|
||||
if(new BigDecimal(postCost.intValue()).compareTo(postCost) == 0){
|
||||
this.postCost = String.valueOf(postCost.intValue());
|
||||
}else {
|
||||
this.postCost = String.format("%.2f", postCost);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
package com.ruoyi.system.domain.excel;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.system.domain.ProjectUserCost;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author denis
|
||||
* @date 2023/7/11 14:17
|
||||
*/
|
||||
@Data
|
||||
public class UserCostSummaryForExcel {
|
||||
|
||||
@Excel(name = "名称")
|
||||
private String userName;
|
||||
@Excel(name = "项目")
|
||||
private String content;
|
||||
private Long userId;
|
||||
private String projectId;
|
||||
@Excel(name = "工时", isStatistics = true)
|
||||
private String timesStr;
|
||||
private BigDecimal times;
|
||||
@Excel(name = "成本", isStatistics = true)
|
||||
private String costStr;
|
||||
private BigDecimal cost;
|
||||
|
||||
|
||||
public static UserCostSummaryForExcel init(ProjectUserCost cost, String userName, String projectName) {
|
||||
UserCostSummaryForExcel excel = new UserCostSummaryForExcel();
|
||||
excel.setUserId(cost.getUserId());
|
||||
excel.setUserName(userName);
|
||||
excel.setContent(projectName + "(" + cost.getCostDay() + ")");
|
||||
excel.setTimes(cost.getCostDay());
|
||||
excel.setCost(cost.getPostCost());
|
||||
return excel;
|
||||
}
|
||||
|
||||
public void setTimes(BigDecimal times) {
|
||||
this.times = times;
|
||||
this.timesStr = this.times == null ? "-" : String.format("%.2f", this.times);
|
||||
}
|
||||
|
||||
public void setCost(BigDecimal cost) {
|
||||
this.cost = cost;
|
||||
this.costStr = this.cost == null ? "-" : String.format("%.2f", this.cost);
|
||||
}
|
||||
|
||||
public void add(ProjectUserCost cost, String userName, String projectName) {
|
||||
addTime(cost.getCostDay());
|
||||
addCost(cost.getPostCost());
|
||||
this.content = this.content + " " + projectName + "(" + cost.getCostDay() + ")";
|
||||
}
|
||||
|
||||
public void addTime(BigDecimal t) {
|
||||
if (this.times != null && t != null) {
|
||||
setTimes(this.times.add(t));
|
||||
} else if (this.times == null) {
|
||||
setTimes(t);
|
||||
}
|
||||
}
|
||||
|
||||
public void addCost(BigDecimal c) {
|
||||
if (this.cost != null && c != null) {
|
||||
setCost(this.cost.add(c));
|
||||
} else if (this.cost == null) {
|
||||
setCost(c);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package com.ruoyi.system.domain.query;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class ProjectCostExportQuery implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String sumType;
|
||||
private String queryId;
|
||||
private Date startDate;
|
||||
private Date endDate;
|
||||
private Boolean withCost;
|
||||
|
||||
public String getSumType() {
|
||||
return sumType;
|
||||
}
|
||||
|
||||
public String getQueryId() {
|
||||
return queryId;
|
||||
}
|
||||
|
||||
public Date getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public Boolean getWithCost(){return withCost;}
|
||||
|
||||
public void setSumType(String sumType) {
|
||||
this.sumType = sumType;
|
||||
}
|
||||
|
||||
public void setQueryId(String queryId) {
|
||||
this.queryId = queryId;
|
||||
}
|
||||
|
||||
public void setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Date startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public void setWithCost(Boolean withCost) {
|
||||
this.withCost = withCost;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.ruoyi.system.domain.query;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
public class UserIDQuery extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Long userId;
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.system.domain.IndexProjectStatusSumModel;
|
||||
import com.ruoyi.system.domain.ProjectSumModel;
|
||||
import com.ruoyi.system.domain.UserLastWeekSumModel;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SystemReportMapper {
|
||||
public List<ProjectSumModel> selectProjectLastWeekSummary(@Param("startDate") String startDate , @Param("endDate") String endDate,@Param("queryTop") Boolean queryTop);
|
||||
|
||||
public List<ProjectSumModel> selectProjectCostSummary(@Param("queryTop") Boolean queryTop);
|
||||
|
||||
public UserLastWeekSumModel selectUserLastWeekSummary(@Param("startDate") String startDate , @Param("endDate") String endDate);
|
||||
|
||||
public List<IndexProjectStatusSumModel> selectProjectSummaryByStatus();
|
||||
|
||||
public List<SysUser> selectNotReportedUserList(@Param("startDate") String startDate , @Param("endDate") String endDate);
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.system.domain.ContractSettleIndexModel;
|
||||
import com.ruoyi.system.domain.TblContract;
|
||||
|
||||
/**
|
||||
* 合同Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-02-24
|
||||
*/
|
||||
public interface TblContractMapper
|
||||
{
|
||||
/**
|
||||
* 查询合同
|
||||
*
|
||||
* @param id 合同ID
|
||||
* @return 合同
|
||||
*/
|
||||
public TblContract selectTblContractById(String id);
|
||||
|
||||
/**
|
||||
* 查询合同列表
|
||||
*
|
||||
* @param tblContract 合同
|
||||
* @return 合同集合
|
||||
*/
|
||||
public List<TblContract> selectTblContractList(TblContract tblContract);
|
||||
|
||||
/**
|
||||
* 查询合同收款列表
|
||||
*
|
||||
* @param tblContract 合同
|
||||
* @return 合同集合
|
||||
*/
|
||||
public List<ContractSettleIndexModel> selectTblContractSettleList(TblContract tblContract);
|
||||
|
||||
/**
|
||||
* 新增合同
|
||||
*
|
||||
* @param tblContract 合同
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTblContract(TblContract tblContract);
|
||||
|
||||
/**
|
||||
* 修改合同
|
||||
*
|
||||
* @param tblContract 合同
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTblContract(TblContract tblContract);
|
||||
|
||||
/**
|
||||
* 删除合同
|
||||
*
|
||||
* @param id 合同ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTblContractById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除合同
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTblContractByIds(String[] ids);
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.system.domain.CntSettleSummaryModel;
|
||||
import com.ruoyi.system.domain.TblContractSettlement;
|
||||
|
||||
/**
|
||||
* 合同收款Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-03-01
|
||||
*/
|
||||
public interface TblContractSettlementMapper
|
||||
{
|
||||
/**
|
||||
* 查询合同收款
|
||||
*
|
||||
* @param id 合同收款ID
|
||||
* @return 合同收款
|
||||
*/
|
||||
public TblContractSettlement selectTblContractSettlementById(String id);
|
||||
|
||||
/**
|
||||
* 查询合同收款列表
|
||||
*
|
||||
* @param tblContractSettlement 合同收款
|
||||
* @return 合同收款集合
|
||||
*/
|
||||
public List<TblContractSettlement> selectTblContractSettlementList(TblContractSettlement tblContractSettlement);
|
||||
|
||||
/**
|
||||
* 新增合同收款
|
||||
*
|
||||
* @param tblContractSettlement 合同收款
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTblContractSettlement(TblContractSettlement tblContractSettlement);
|
||||
|
||||
|
||||
/**
|
||||
* 新增合同收款
|
||||
*
|
||||
* @param tblContractSettlement 合同收款
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTblContractSettlementList(List<TblContractSettlement> tblContractSettlements);
|
||||
|
||||
/**
|
||||
* 修改合同收款
|
||||
*
|
||||
* @param tblContractSettlement 合同收款
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTblContractSettlement(TblContractSettlement tblContractSettlement);
|
||||
|
||||
/**
|
||||
* 删除合同收款
|
||||
*
|
||||
* @param id 合同收款ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTblContractSettlementById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除合同收款
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTblContractSettlementByIds(String[] ids);
|
||||
|
||||
public List<CntSettleSummaryModel> selectContractSettleSummary(String[] ids);
|
||||
|
||||
public List<CntSettleSummaryModel> selectContractPayedSummary(String[] ids);
|
||||
public List<CntSettleSummaryModel> selectContractPlanSettleSummary(String[] ids);
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.framework.web.domain.server.Sys;
|
||||
import com.ruoyi.system.domain.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 工时Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-02-18
|
||||
*/
|
||||
public interface TblProjectCostMapper {
|
||||
/**
|
||||
* 查询工时
|
||||
*
|
||||
* @param id 工时ID
|
||||
* @return 工时
|
||||
*/
|
||||
public TblProjectCost selectTblProjectCostById(TblProjectCost tblProjectCost);
|
||||
|
||||
/**
|
||||
* 查询工时列表
|
||||
*
|
||||
* @param tblProjectCost 工时
|
||||
* @return 工时集合
|
||||
*/
|
||||
public List<TblProjectCost> selectTblProjectCostList(TblProjectCost tblProjectCost);
|
||||
|
||||
/**
|
||||
* 统计工时
|
||||
*
|
||||
* @param tblProjectCost 工时
|
||||
* @return 工时集合
|
||||
*/
|
||||
public List<TblProjectCost> selectTblProjectCostSumMember(TblProjectCost tblProjectCost);
|
||||
|
||||
public List<TblProjectCost> selectTblProjectCostSumProject(TblProjectCost tblProjectCost);
|
||||
|
||||
/**
|
||||
* 新增工时
|
||||
*
|
||||
* @param tblProjectCost 工时
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTblProjectCost(TblProjectCost tblProjectCost);
|
||||
|
||||
/**
|
||||
* 新增工时
|
||||
*
|
||||
* @param tblProjectCost 工时
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTblProjectCostList(List<TblProjectCost> list);
|
||||
|
||||
/**
|
||||
* 修改工时
|
||||
*
|
||||
* @param tblProjectCost 工时
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTblProjectCost(TblProjectCost tblProjectCost);
|
||||
|
||||
public int updateTblProjectCostName(TblProject tblProject);
|
||||
|
||||
/**
|
||||
* 删除工时
|
||||
*
|
||||
* @param id 工时ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTblProjectCostById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除工时
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTblProjectCostByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 查询最近统计时间
|
||||
*
|
||||
* @param userId userId
|
||||
* @return 最近统计时间
|
||||
*/
|
||||
public TblProjectCost selectTblProjectCostLastData(Long userId);
|
||||
|
||||
public int updateUserUpdatetime(Long user);
|
||||
|
||||
public int insertUserUpdatetime(Long user);
|
||||
|
||||
public List<SysUser> selectUserByProjectLeader(@Param("userId") Long userId);
|
||||
|
||||
public List<ProjectUserCost> selectProjectUserCostByDate(TblProjectCost tblProjectCost);
|
||||
|
||||
public List<TblProject> selectAllProjectName();
|
||||
|
||||
public List<SysUser> selectAllSysUser();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ruoyi.common.annotation.DataScope;
|
||||
import com.ruoyi.system.domain.IndexProjectStatusSumModel;
|
||||
import com.ruoyi.system.domain.TblProject;
|
||||
import com.ruoyi.system.domain.query.UserIDQuery;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 项目Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-02-09
|
||||
*/
|
||||
public interface TblProjectMapper {
|
||||
/**
|
||||
* 查询项目
|
||||
*
|
||||
* @param id 项目ID
|
||||
* @return 项目
|
||||
*/
|
||||
public TblProject selectTblProjectById(String id);
|
||||
|
||||
/**
|
||||
* 查询项目列表
|
||||
*
|
||||
* @param tblProject 项目
|
||||
* @return 项目集合
|
||||
*/
|
||||
public List<TblProject> selectTblProjectList(TblProject tblProject);
|
||||
|
||||
/**
|
||||
* 新增项目
|
||||
*
|
||||
* @param tblProject 项目
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTblProject(TblProject tblProject);
|
||||
|
||||
/**
|
||||
* 修改项目
|
||||
*
|
||||
* @param tblProject 项目
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTblProject(TblProject tblProject);
|
||||
|
||||
/**
|
||||
* 删除项目
|
||||
*
|
||||
* @param id 项目ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTblProjectById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除项目
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTblProjectByIds(String[] ids);
|
||||
|
||||
public List<TblProject> selectMyTblProjectList(Long userId);
|
||||
|
||||
@DataScope(userAlias = "u", deptAlias = "d")
|
||||
public List<TblProject> selectPMOTblProjectList(UserIDQuery userId);
|
||||
|
||||
public List<TblProject> selectTblProjectListByUserProject(@Param("userId") Long userId, @Param("leaderId") Long leaderId);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.TblUploadFile;
|
||||
|
||||
/**
|
||||
* 文件关联Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-03-08
|
||||
*/
|
||||
public interface TblUploadFileMapper
|
||||
{
|
||||
/**
|
||||
* 查询文件关联
|
||||
*
|
||||
* @param id 文件关联ID
|
||||
* @return 文件关联
|
||||
*/
|
||||
public TblUploadFile selectTblUploadFileById(String id);
|
||||
|
||||
/**
|
||||
* 查询文件关联列表
|
||||
*
|
||||
* @param tblUploadFile 文件关联
|
||||
* @return 文件关联集合
|
||||
*/
|
||||
public List<TblUploadFile> selectTblUploadFileList(TblUploadFile tblUploadFile);
|
||||
|
||||
/**
|
||||
* 新增文件关联
|
||||
*
|
||||
* @param tblUploadFile 文件关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTblUploadFile(TblUploadFile tblUploadFile);
|
||||
|
||||
/**
|
||||
* 修改文件关联
|
||||
*
|
||||
* @param tblUploadFile 文件关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTblUploadFile(TblUploadFile tblUploadFile);
|
||||
|
||||
/**
|
||||
* 删除文件关联
|
||||
*
|
||||
* @param id 文件关联ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTblUploadFileById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除文件关联
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTblUploadFileByIds(String[] ids);
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.TblProject;
|
||||
import com.ruoyi.system.domain.TblUserProject;
|
||||
|
||||
/**
|
||||
* 项目Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-02-09
|
||||
*/
|
||||
public interface TblUserProjectMapper {
|
||||
public static String Insert_ALL = "all";
|
||||
public static String Clear_All = "clearAll";
|
||||
/**
|
||||
* 查询项目
|
||||
*
|
||||
* @param id 项目ID
|
||||
* @return 项目
|
||||
*/
|
||||
public String[] selectTblUserProjectByUser(Long userId);
|
||||
|
||||
public Long[] selectTblUserProjectByProject(String projectId);
|
||||
|
||||
/**
|
||||
* 新增项目
|
||||
*
|
||||
* @param tblProject 项目
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTblUserProject(List<TblUserProject> list);
|
||||
|
||||
public int insertTblUserProjectAllProject(Long userId);
|
||||
public int insertTblUserProjectAllUser(String projectId);
|
||||
|
||||
/**
|
||||
* 删除项目
|
||||
*
|
||||
* @param id 项目ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTblUserProjectByUser(Long userId);
|
||||
public int deleteTblUserProjectByProject(String projectId);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.system.domain.IndexProjectStatusSumModel;
|
||||
import com.ruoyi.system.domain.ProjectSumModel;
|
||||
import com.ruoyi.system.domain.UserLastWeekSumModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ISystemReportService {
|
||||
public List<ProjectSumModel> selectProjectLastWeekSummary(String startDate, String endDate, Boolean queryTop);
|
||||
|
||||
public List<ProjectSumModel> selectProjectCostSummary(Boolean queryTop);
|
||||
|
||||
public UserLastWeekSumModel selectUserLastWeekSummary(String startDate , String endDate);
|
||||
|
||||
public List<IndexProjectStatusSumModel> selectProjectSummaryByStatus();
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.system.domain.ContractSettleIndexModel;
|
||||
import com.ruoyi.system.domain.TblContract;
|
||||
|
||||
/**
|
||||
* 合同Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-02-24
|
||||
*/
|
||||
public interface ITblContractService
|
||||
{
|
||||
/**
|
||||
* 查询合同
|
||||
*
|
||||
* @param id 合同ID
|
||||
* @return 合同
|
||||
*/
|
||||
public TblContract selectTblContractById(String id);
|
||||
|
||||
/**
|
||||
* 查询合同列表
|
||||
*
|
||||
* @param tblContract 合同
|
||||
* @return 合同集合
|
||||
*/
|
||||
public List<TblContract> selectTblContractList(TblContract tblContract);
|
||||
|
||||
/**
|
||||
* 查询合同列表
|
||||
*
|
||||
* @param tblContract 合同
|
||||
* @return 合同集合
|
||||
*/
|
||||
public List<ContractSettleIndexModel> selectTblContractSettleList(TblContract tblContract);
|
||||
|
||||
/**
|
||||
* 新增合同
|
||||
*
|
||||
* @param tblContract 合同
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTblContract(TblContract tblContract);
|
||||
|
||||
/**
|
||||
* 修改合同
|
||||
*
|
||||
* @param tblContract 合同
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTblContract(TblContract tblContract);
|
||||
|
||||
/**
|
||||
* 批量删除合同
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTblContractByIds(String ids);
|
||||
|
||||
/**
|
||||
* 删除合同信息
|
||||
*
|
||||
* @param id 合同ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTblContractById(String id);
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.system.domain.CntSettleSummaryModel;
|
||||
import com.ruoyi.system.domain.TblContractSettlement;
|
||||
|
||||
/**
|
||||
* 合同收款Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-03-01
|
||||
*/
|
||||
public interface ITblContractSettlementService
|
||||
{
|
||||
/**
|
||||
* 查询合同收款
|
||||
*
|
||||
* @param id 合同收款ID
|
||||
* @return 合同收款
|
||||
*/
|
||||
public TblContractSettlement selectTblContractSettlementById(String id);
|
||||
|
||||
/**
|
||||
* 查询合同收款列表
|
||||
*
|
||||
* @param tblContractSettlement 合同收款
|
||||
* @return 合同收款集合
|
||||
*/
|
||||
public List<TblContractSettlement> selectTblContractSettlementList(TblContractSettlement tblContractSettlement);
|
||||
|
||||
/**
|
||||
* 新增合同收款
|
||||
*
|
||||
* @param tblContractSettlement 合同收款
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTblContractSettlement(TblContractSettlement tblContractSettlement);
|
||||
|
||||
/**
|
||||
* 新增合同收款
|
||||
*
|
||||
* @param tblContractSettlement 合同收款
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTblContractSettlementList(List<TblContractSettlement> tblContractSettlements);
|
||||
|
||||
/**
|
||||
* 修改合同收款
|
||||
*
|
||||
* @param tblContractSettlement 合同收款
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTblContractSettlement(TblContractSettlement tblContractSettlement);
|
||||
|
||||
/**
|
||||
* 批量删除合同收款
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTblContractSettlementByIds(String ids);
|
||||
|
||||
/**
|
||||
* 删除合同收款信息
|
||||
*
|
||||
* @param id 合同收款ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTblContractSettlementById(String id);
|
||||
|
||||
public List<CntSettleSummaryModel> selectContractSettleSummary(String[] ids);
|
||||
public List<CntSettleSummaryModel> selectContractPayedSummary(String[] ids);
|
||||
public List<CntSettleSummaryModel> selectContractPlanSettleSummary(String[] ids);
|
||||
}
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.system.domain.*;
|
||||
|
||||
/**
|
||||
* 工时Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-02-18
|
||||
*/
|
||||
public interface ITblProjectCostService {
|
||||
/**
|
||||
* 查询工时
|
||||
*
|
||||
* @param id 工时ID
|
||||
* @return 工时
|
||||
*/
|
||||
public TblProjectCost selectTblProjectCostById(TblProjectCost tblProjectCost);
|
||||
|
||||
/**
|
||||
* 查询工时列表
|
||||
*
|
||||
* @param tblProjectCost 工时
|
||||
* @return 工时集合
|
||||
*/
|
||||
public List<TblProjectCost> selectTblProjectCostList(TblProjectCost tblProjectCost);
|
||||
|
||||
/**
|
||||
* 统计工时列表
|
||||
*
|
||||
* @param tblProjectCost 工时
|
||||
* @return 工时集合
|
||||
*/
|
||||
public List<TblProjectCost> selectTblProjectCostSumMember(TblProjectCost tblProjectCost);
|
||||
|
||||
/**
|
||||
* 统计工时列表
|
||||
*
|
||||
* @param tblProjectCost 工时
|
||||
* @return 工时集合
|
||||
*/
|
||||
public List<TblProjectCost> selectTblProjectCostSumProject(TblProjectCost tblProjectCost);
|
||||
|
||||
/**
|
||||
* 查询最近统计时间
|
||||
*
|
||||
* @param userId userId
|
||||
* @return 最近统计时间
|
||||
*/
|
||||
public TblProjectCost selectTblProjectCostLastData(Long userId);
|
||||
|
||||
/**
|
||||
* 新增工时
|
||||
*
|
||||
* @param tblProjectCost 工时
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTblProjectCost(TblProjectCost tblProjectCost);
|
||||
|
||||
/**
|
||||
* 新增工时
|
||||
*
|
||||
* @param tblProjectCost 工时
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTblProjectCostList(List<TblProjectCost> tblProjectCost);
|
||||
|
||||
/**
|
||||
* 修改工时
|
||||
*
|
||||
* @param tblProjectCost 工时
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTblProjectCost(TblProjectCost tblProjectCost);
|
||||
|
||||
/**
|
||||
* 批量删除工时
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTblProjectCostByIds(String ids);
|
||||
|
||||
/**
|
||||
* 删除工时信息
|
||||
*
|
||||
* @param id 工时ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTblProjectCostById(String id);
|
||||
|
||||
public int updateUserUpdatetime(Long userId);
|
||||
|
||||
public List<SysUser> selectUserByProjectLeader(Long userId);
|
||||
|
||||
|
||||
public List<ProjectUserCost> selectProjectUserCostByDate(TblProjectCost tblProjectCost);
|
||||
|
||||
public List<TblProject> selectAllProjectName();
|
||||
|
||||
public List<SysUser> selectAllSysUser();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ruoyi.system.domain.IndexProjectStatusSumModel;
|
||||
import com.ruoyi.system.domain.TblProject;
|
||||
|
||||
/**
|
||||
* 项目Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-02-09
|
||||
*/
|
||||
public interface ITblProjectService {
|
||||
/**
|
||||
* 查询项目
|
||||
*
|
||||
* @param id 项目ID
|
||||
* @return 项目
|
||||
*/
|
||||
public TblProject selectTblProjectById(String id);
|
||||
|
||||
/**
|
||||
* 查询项目列表
|
||||
*
|
||||
* @param tblProject 项目
|
||||
* @return 项目集合
|
||||
*/
|
||||
public List<TblProject> selectTblProjectList(TblProject tblProject);
|
||||
|
||||
/**
|
||||
* 新增项目
|
||||
*
|
||||
* @param tblProject 项目
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTblProject(TblProject tblProject);
|
||||
|
||||
/**
|
||||
* 修改项目
|
||||
*
|
||||
* @param tblProject 项目
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTblProject(TblProject tblProject);
|
||||
|
||||
/**
|
||||
* 批量删除项目
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTblProjectByIds(String ids);
|
||||
|
||||
/**
|
||||
* 删除项目信息
|
||||
*
|
||||
* @param id 项目ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTblProjectById(String id);
|
||||
|
||||
public Map<String, Object> selectTblUserProjectList(Long userId);
|
||||
|
||||
public Map<String, Object> selectTblProjectUserList(String id);
|
||||
|
||||
public void insertAuthProject(Long userId, String[] mine);
|
||||
public void insertAuthUser(String projectId,String[] mine);
|
||||
|
||||
public List<TblProject> selectMyTblProjectList(Long userId);
|
||||
public List<TblProject> selectPMOTblProjectList(Long userId);
|
||||
|
||||
public List<TblProject> selectTblProjectListByUserProject(Long userId,Long leaderId);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.TblUploadFile;
|
||||
|
||||
/**
|
||||
* 文件关联Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-03-08
|
||||
*/
|
||||
public interface ITblUploadFileService
|
||||
{
|
||||
/**
|
||||
* 查询文件关联
|
||||
*
|
||||
* @param id 文件关联ID
|
||||
* @return 文件关联
|
||||
*/
|
||||
public TblUploadFile selectTblUploadFileById(String id);
|
||||
|
||||
/**
|
||||
* 查询文件关联列表
|
||||
*
|
||||
* @param tblUploadFile 文件关联
|
||||
* @return 文件关联集合
|
||||
*/
|
||||
public List<TblUploadFile> selectTblUploadFileList(TblUploadFile tblUploadFile);
|
||||
|
||||
/**
|
||||
* 新增文件关联
|
||||
*
|
||||
* @param tblUploadFile 文件关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTblUploadFile(TblUploadFile tblUploadFile);
|
||||
|
||||
/**
|
||||
* 修改文件关联
|
||||
*
|
||||
* @param tblUploadFile 文件关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTblUploadFile(TblUploadFile tblUploadFile);
|
||||
|
||||
/**
|
||||
* 批量删除文件关联
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTblUploadFileByIds(String ids);
|
||||
|
||||
/**
|
||||
* 删除文件关联信息
|
||||
*
|
||||
* @param id 文件关联ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTblUploadFileById(String id);
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import com.ruoyi.system.domain.IndexProjectStatusSumModel;
|
||||
import com.ruoyi.system.domain.ProjectSumModel;
|
||||
import com.ruoyi.system.domain.UserLastWeekSumModel;
|
||||
import com.ruoyi.system.mapper.SystemReportMapper;
|
||||
import com.ruoyi.system.mapper.TblProjectCostMapper;
|
||||
import com.ruoyi.system.service.ISystemReportService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SystemReportMapperImpl implements ISystemReportService {
|
||||
@Autowired
|
||||
private SystemReportMapper systemReportMapper;
|
||||
|
||||
@Override
|
||||
public List<ProjectSumModel> selectProjectLastWeekSummary(String startDate, String endDate, Boolean queryTop) {
|
||||
return systemReportMapper.selectProjectLastWeekSummary(startDate, endDate, queryTop);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProjectSumModel> selectProjectCostSummary(Boolean queryTop) {
|
||||
return systemReportMapper.selectProjectCostSummary(queryTop);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserLastWeekSumModel selectUserLastWeekSummary(String startDate, String endDate) {
|
||||
return systemReportMapper.selectUserLastWeekSummary(startDate, endDate);
|
||||
}
|
||||
@Override
|
||||
public List<IndexProjectStatusSumModel> selectProjectSummaryByStatus(){return systemReportMapper.selectProjectSummaryByStatus();}
|
||||
}
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.system.domain.ContractSettleIndexModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.TblContractMapper;
|
||||
import com.ruoyi.system.domain.TblContract;
|
||||
import com.ruoyi.system.service.ITblContractService;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
|
||||
/**
|
||||
* 合同Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-02-24
|
||||
*/
|
||||
@Service
|
||||
public class TblContractServiceImpl implements ITblContractService
|
||||
{
|
||||
@Autowired
|
||||
private TblContractMapper tblContractMapper;
|
||||
|
||||
/**
|
||||
* 查询合同
|
||||
*
|
||||
* @param id 合同ID
|
||||
* @return 合同
|
||||
*/
|
||||
@Override
|
||||
public TblContract selectTblContractById(String id)
|
||||
{
|
||||
return tblContractMapper.selectTblContractById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询合同列表
|
||||
*
|
||||
* @param tblContract 合同
|
||||
* @return 合同
|
||||
*/
|
||||
@Override
|
||||
public List<TblContract> selectTblContractList(TblContract tblContract)
|
||||
{
|
||||
return tblContractMapper.selectTblContractList(tblContract);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询合同收款列表
|
||||
*
|
||||
* @param tblContract 合同
|
||||
* @return 合同
|
||||
*/
|
||||
@Override
|
||||
public List<ContractSettleIndexModel> selectTblContractSettleList(TblContract tblContract)
|
||||
{
|
||||
return tblContractMapper.selectTblContractSettleList(tblContract);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增合同
|
||||
*
|
||||
* @param tblContract 合同
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertTblContract(TblContract tblContract)
|
||||
{
|
||||
tblContract.setCreateTime(DateUtils.getNowDate());
|
||||
return tblContractMapper.insertTblContract(tblContract);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改合同
|
||||
*
|
||||
* @param tblContract 合同
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateTblContract(TblContract tblContract)
|
||||
{
|
||||
tblContract.setUpdateTime(DateUtils.getNowDate());
|
||||
return tblContractMapper.updateTblContract(tblContract);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除合同对象
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTblContractByIds(String ids)
|
||||
{
|
||||
return tblContractMapper.deleteTblContractByIds(Convert.toStrArray(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除合同信息
|
||||
*
|
||||
* @param id 合同ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTblContractById(String id)
|
||||
{
|
||||
return tblContractMapper.deleteTblContractById(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.system.domain.CntSettleSummaryModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.TblContractSettlementMapper;
|
||||
import com.ruoyi.system.domain.TblContractSettlement;
|
||||
import com.ruoyi.system.service.ITblContractSettlementService;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
|
||||
/**
|
||||
* 合同收款Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-03-01
|
||||
*/
|
||||
@Service
|
||||
public class TblContractSettlementServiceImpl implements ITblContractSettlementService
|
||||
{
|
||||
@Autowired
|
||||
private TblContractSettlementMapper tblContractSettlementMapper;
|
||||
|
||||
/**
|
||||
* 查询合同收款
|
||||
*
|
||||
* @param id 合同收款ID
|
||||
* @return 合同收款
|
||||
*/
|
||||
@Override
|
||||
public TblContractSettlement selectTblContractSettlementById(String id)
|
||||
{
|
||||
return tblContractSettlementMapper.selectTblContractSettlementById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询合同收款列表
|
||||
*
|
||||
* @param tblContractSettlement 合同收款
|
||||
* @return 合同收款
|
||||
*/
|
||||
@Override
|
||||
public List<TblContractSettlement> selectTblContractSettlementList(TblContractSettlement tblContractSettlement)
|
||||
{
|
||||
return tblContractSettlementMapper.selectTblContractSettlementList(tblContractSettlement);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增合同收款
|
||||
*
|
||||
* @param tblContractSettlement 合同收款
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertTblContractSettlement(TblContractSettlement tblContractSettlement)
|
||||
{
|
||||
tblContractSettlement.setCreateTime(DateUtils.getNowDate());
|
||||
return tblContractSettlementMapper.insertTblContractSettlement(tblContractSettlement);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增合同收款
|
||||
*
|
||||
* @param tblContractSettlement 合同收款
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertTblContractSettlementList(List<TblContractSettlement> tblContractSettlements)
|
||||
{
|
||||
return tblContractSettlementMapper.insertTblContractSettlementList(tblContractSettlements);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改合同收款
|
||||
*
|
||||
* @param tblContractSettlement 合同收款
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateTblContractSettlement(TblContractSettlement tblContractSettlement)
|
||||
{
|
||||
tblContractSettlement.setUpdateTime(DateUtils.getNowDate());
|
||||
return tblContractSettlementMapper.updateTblContractSettlement(tblContractSettlement);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除合同收款对象
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTblContractSettlementByIds(String ids)
|
||||
{
|
||||
return tblContractSettlementMapper.deleteTblContractSettlementByIds(Convert.toStrArray(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除合同收款信息
|
||||
*
|
||||
* @param id 合同收款ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTblContractSettlementById(String id)
|
||||
{
|
||||
return tblContractSettlementMapper.deleteTblContractSettlementById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CntSettleSummaryModel> selectContractSettleSummary(String[] ids)
|
||||
{
|
||||
return tblContractSettlementMapper.selectContractSettleSummary(ids);
|
||||
}
|
||||
@Override
|
||||
public List<CntSettleSummaryModel> selectContractPayedSummary(String[] ids)
|
||||
{
|
||||
return tblContractSettlementMapper.selectContractPayedSummary(ids);
|
||||
}
|
||||
@Override
|
||||
public List<CntSettleSummaryModel> selectContractPlanSettleSummary(String[] ids)
|
||||
{
|
||||
return tblContractSettlementMapper.selectContractPlanSettleSummary(ids);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,170 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.system.domain.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ruoyi.common.annotation.DataScope;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.system.mapper.TblProjectCostMapper;
|
||||
import com.ruoyi.system.service.ITblProjectCostService;
|
||||
|
||||
/**
|
||||
* 工时Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-02-18
|
||||
*/
|
||||
@Service
|
||||
public class TblProjectCostServiceImpl implements ITblProjectCostService {
|
||||
@Autowired
|
||||
private TblProjectCostMapper tblProjectCostMapper;
|
||||
|
||||
/**
|
||||
* 查询工时
|
||||
*
|
||||
* @param id 工时ID
|
||||
* @return 工时
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "d", userAlias = "u")
|
||||
public TblProjectCost selectTblProjectCostById(TblProjectCost tblProjectCost) {
|
||||
return tblProjectCostMapper.selectTblProjectCostById(tblProjectCost);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询工时列表
|
||||
*
|
||||
* @param tblProjectCost 工时
|
||||
* @return 工时
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "d", userAlias = "u")
|
||||
public List<TblProjectCost> selectTblProjectCostList(TblProjectCost tblProjectCost) {
|
||||
return tblProjectCostMapper.selectTblProjectCostList(tblProjectCost);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工时
|
||||
*
|
||||
* @param tblProjectCost 工时
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertTblProjectCost(TblProjectCost tblProjectCost) {
|
||||
tblProjectCost.setCreateTime(DateUtils.getNowDate());
|
||||
return tblProjectCostMapper.insertTblProjectCost(tblProjectCost);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工时
|
||||
*
|
||||
* @param tblProjectCost 工时
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertTblProjectCostList(List<TblProjectCost> list) {
|
||||
if (tblProjectCostMapper.insertTblProjectCostList(list) > 0) {
|
||||
return updateUserUpdatetime(list.get(0).getUser());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateUserUpdatetime(Long userId) {
|
||||
if (tblProjectCostMapper.updateUserUpdatetime(userId) == 0) {
|
||||
tblProjectCostMapper.insertUserUpdatetime(userId);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工时
|
||||
*
|
||||
* @param tblProjectCost 工时
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateTblProjectCost(TblProjectCost tblProjectCost) {
|
||||
tblProjectCost.setUpdateTime(DateUtils.getNowDate());
|
||||
return tblProjectCostMapper.updateTblProjectCost(tblProjectCost);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工时对象
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTblProjectCostByIds(String ids) {
|
||||
return tblProjectCostMapper.deleteTblProjectCostByIds(Convert.toStrArray(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工时信息
|
||||
*
|
||||
* @param id 工时ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTblProjectCostById(String id) {
|
||||
return tblProjectCostMapper.deleteTblProjectCostById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询最近统计时间
|
||||
*
|
||||
* @param userId userId
|
||||
* @return 最近统计时间
|
||||
*/
|
||||
@Override
|
||||
public TblProjectCost selectTblProjectCostLastData(Long userId) {
|
||||
return tblProjectCostMapper.selectTblProjectCostLastData(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计工时列表
|
||||
*
|
||||
* @param tblProjectCost 工时
|
||||
* @return 工时
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "d", userAlias = "u")
|
||||
public List<TblProjectCost> selectTblProjectCostSumMember(TblProjectCost tblProjectCost) {
|
||||
return tblProjectCostMapper.selectTblProjectCostSumMember(tblProjectCost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TblProjectCost> selectTblProjectCostSumProject(TblProjectCost tblProjectCost) {
|
||||
return tblProjectCostMapper.selectTblProjectCostSumProject(tblProjectCost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUser> selectUserByProjectLeader(Long userId) {
|
||||
return tblProjectCostMapper.selectUserByProjectLeader(userId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ProjectUserCost> selectProjectUserCostByDate(TblProjectCost tblProjectCost) {
|
||||
return tblProjectCostMapper.selectProjectUserCostByDate(tblProjectCost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TblProject> selectAllProjectName() {
|
||||
return tblProjectCostMapper.selectAllProjectName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUser> selectAllSysUser() {
|
||||
return tblProjectCostMapper.selectAllSysUser();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,195 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ruoyi.common.annotation.DataScope;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.system.domain.IndexProjectStatusSumModel;
|
||||
import com.ruoyi.system.domain.query.UserIDQuery;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import net.sf.jsqlparser.expression.operators.relational.OldOracleJoinBinaryExpression;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.system.domain.TblProject;
|
||||
import com.ruoyi.system.domain.TblProjectCost;
|
||||
import com.ruoyi.system.domain.TblUserProject;
|
||||
import com.ruoyi.system.mapper.TblProjectCostMapper;
|
||||
import com.ruoyi.system.mapper.TblProjectMapper;
|
||||
import com.ruoyi.system.mapper.TblUserProjectMapper;
|
||||
import com.ruoyi.system.service.ITblProjectService;
|
||||
|
||||
/**
|
||||
* 项目Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-02-09
|
||||
*/
|
||||
@Service
|
||||
public class TblProjectServiceImpl implements ITblProjectService {
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private TblProjectMapper tblProjectMapper;
|
||||
|
||||
@Autowired
|
||||
private TblProjectCostMapper tblProjectCostMapper;
|
||||
|
||||
@Autowired
|
||||
private TblUserProjectMapper tblUserProjectMapper;
|
||||
|
||||
/**
|
||||
* 查询项目
|
||||
*
|
||||
* @param id 项目ID
|
||||
* @return 项目
|
||||
*/
|
||||
@Override
|
||||
public TblProject selectTblProjectById(String id) {
|
||||
return tblProjectMapper.selectTblProjectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询项目列表
|
||||
*
|
||||
* @param tblProject 项目
|
||||
* @return 项目
|
||||
*/
|
||||
@Override
|
||||
public List<TblProject> selectTblProjectList(TblProject tblProject) {
|
||||
return tblProjectMapper.selectTblProjectList(tblProject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增项目
|
||||
*
|
||||
* @param tblProject 项目
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertTblProject(TblProject tblProject) {
|
||||
tblProject.setCreateTime(DateUtils.getNowDate());
|
||||
return tblProjectMapper.insertTblProject(tblProject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项目
|
||||
*
|
||||
* @param tblProject 项目
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateTblProject(TblProject tblProject) {
|
||||
tblProject.setUpdateTime(DateUtils.getNowDate());
|
||||
tblProjectCostMapper.updateTblProjectCostName(tblProject);
|
||||
return tblProjectMapper.updateTblProject(tblProject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除项目对象
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTblProjectByIds(String ids) {
|
||||
return tblProjectMapper.deleteTblProjectByIds(Convert.toStrArray(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除项目信息
|
||||
*
|
||||
* @param id 项目ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTblProjectById(String id) {
|
||||
return tblProjectMapper.deleteTblProjectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> selectTblUserProjectList(Long userId) {
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("list", tblProjectMapper.selectTblProjectList(new TblProject()));
|
||||
Map<String, Boolean> mine = new HashMap<String, Boolean>();
|
||||
for (String project : tblUserProjectMapper.selectTblUserProjectByUser(userId)) {
|
||||
mine.put(project, true);
|
||||
}
|
||||
result.put("mine", mine);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> selectTblProjectUserList(String id) {
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result.put("list", userService.selectAvailableUserList(new SysUser()));
|
||||
Map<Long, Boolean> mine = new HashMap<Long, Boolean>();
|
||||
for (Long user : tblUserProjectMapper.selectTblUserProjectByProject(id)) {
|
||||
mine.put(user, true);
|
||||
}
|
||||
result.put("mine", mine);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertAuthProject(Long userId, String[] mine) {
|
||||
tblUserProjectMapper.deleteTblUserProjectByUser(userId);
|
||||
if (mine.length == 1 && mine[0].equalsIgnoreCase(TblUserProjectMapper.Clear_All)) {
|
||||
return;
|
||||
} else if (mine.length == 1 && mine[0].equalsIgnoreCase(TblUserProjectMapper.Insert_ALL)) {
|
||||
tblUserProjectMapper.insertTblUserProjectAllProject(userId);
|
||||
} else if (mine.length > 0) {
|
||||
List<TblUserProject> list = new ArrayList<TblUserProject>();
|
||||
for (String projectId : mine) {
|
||||
TblUserProject project = new TblUserProject();
|
||||
project.setUserId(userId);
|
||||
project.setProjectId(projectId);
|
||||
list.add(project);
|
||||
}
|
||||
tblUserProjectMapper.insertTblUserProject(list);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertAuthUser(String projectId, String[] mine) {
|
||||
tblUserProjectMapper.deleteTblUserProjectByProject(projectId);
|
||||
if (mine.length == 1 && mine[0].equalsIgnoreCase(TblUserProjectMapper.Clear_All)) {
|
||||
return;
|
||||
} else if (mine.length == 1 && mine[0].equalsIgnoreCase(TblUserProjectMapper.Insert_ALL)) {
|
||||
tblUserProjectMapper.insertTblUserProjectAllUser(projectId);
|
||||
} else if (mine.length > 0) {
|
||||
List<TblUserProject> list = new ArrayList<TblUserProject>();
|
||||
for (String userId : mine) {
|
||||
TblUserProject project = new TblUserProject();
|
||||
project.setUserId(Long.valueOf(userId));
|
||||
project.setProjectId(projectId);
|
||||
list.add(project);
|
||||
}
|
||||
tblUserProjectMapper.insertTblUserProject(list);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TblProject> selectMyTblProjectList(Long userId) {
|
||||
return tblProjectMapper.selectMyTblProjectList(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TblProject> selectPMOTblProjectList(Long userId) {
|
||||
UserIDQuery query = new UserIDQuery();
|
||||
query.setUserId(userId);
|
||||
return tblProjectMapper.selectPMOTblProjectList(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TblProject> selectTblProjectListByUserProject(Long userId, Long leaderId) {
|
||||
return tblProjectMapper.selectTblProjectListByUserProject(userId, userId != leaderId ? leaderId : null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
package com.ruoyi.system.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.system.mapper.TblUploadFileMapper;
|
||||
import com.ruoyi.system.domain.TblUploadFile;
|
||||
import com.ruoyi.system.service.ITblUploadFileService;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
|
||||
/**
|
||||
* 文件关联Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-03-08
|
||||
*/
|
||||
@Service
|
||||
public class TblUploadFileServiceImpl implements ITblUploadFileService
|
||||
{
|
||||
@Autowired
|
||||
private TblUploadFileMapper tblUploadFileMapper;
|
||||
|
||||
/**
|
||||
* 查询文件关联
|
||||
*
|
||||
* @param id 文件关联ID
|
||||
* @return 文件关联
|
||||
*/
|
||||
@Override
|
||||
public TblUploadFile selectTblUploadFileById(String id)
|
||||
{
|
||||
return tblUploadFileMapper.selectTblUploadFileById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文件关联列表
|
||||
*
|
||||
* @param tblUploadFile 文件关联
|
||||
* @return 文件关联
|
||||
*/
|
||||
@Override
|
||||
public List<TblUploadFile> selectTblUploadFileList(TblUploadFile tblUploadFile)
|
||||
{
|
||||
return tblUploadFileMapper.selectTblUploadFileList(tblUploadFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增文件关联
|
||||
*
|
||||
* @param tblUploadFile 文件关联
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertTblUploadFile(TblUploadFile tblUploadFile)
|
||||
{
|
||||
tblUploadFile.setCreateTime(DateUtils.getNowDate());
|
||||
return tblUploadFileMapper.insertTblUploadFile(tblUploadFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文件关联
|
||||
*
|
||||
* @param tblUploadFile 文件关联
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateTblUploadFile(TblUploadFile tblUploadFile)
|
||||
{
|
||||
return tblUploadFileMapper.updateTblUploadFile(tblUploadFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件关联对象
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTblUploadFileByIds(String ids)
|
||||
{
|
||||
return tblUploadFileMapper.deleteTblUploadFileByIds(Convert.toStrArray(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件关联信息
|
||||
*
|
||||
* @param id 文件关联ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTblUploadFileById(String id)
|
||||
{
|
||||
return tblUploadFileMapper.deleteTblUploadFileById(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.ruoyi.system.tasks;
|
||||
|
||||
import com.zcunsoft.pm.task.base.ZCunTaskBase;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author denis
|
||||
* @date 2022/6/21 15:45
|
||||
*/
|
||||
@Component("leaderNoteTask")
|
||||
public class LeaderNoteTask implements ZCunTaskBase {
|
||||
@Override
|
||||
public void run(String settingId) {
|
||||
System.out.println("配置ID");
|
||||
sendNote();
|
||||
}
|
||||
|
||||
private void sendNote() {
|
||||
System.out.println("执行LeaderTask");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.ruoyi.system.tasks;
|
||||
|
||||
import com.zcunsoft.pm.task.base.ZCunTaskBase;
|
||||
import com.zcunsoft.pm.note.push.email.ZCMailUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
/**
|
||||
* @author denis
|
||||
* @date 2022/6/21 15:46
|
||||
*/
|
||||
@Component("pmoNoteTask")
|
||||
public class PMONoteTask implements ZCunTaskBase {
|
||||
@Override
|
||||
public void run(String settingId) {
|
||||
System.out.println("配置ID:" + settingId);
|
||||
sendNote();
|
||||
}
|
||||
|
||||
private void sendNote() {
|
||||
System.out.println("执行PMONoteTask");
|
||||
ZCMailUtils.sendMail("chenxiangluan@zcunsoft.com","若依测试发送","若依测试发送内容");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
package com.ruoyi.web.controller.common;
|
||||
|
||||
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.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.config.ServerConfig;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.common.utils.file.FileUtils;
|
||||
|
||||
/**
|
||||
* 通用请求处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
public class CommonController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
||||
|
||||
@Autowired
|
||||
private ServerConfig serverConfig;
|
||||
|
||||
/**
|
||||
* 通用下载请求
|
||||
*
|
||||
* @param fileName 文件名称
|
||||
* @param delete 是否删除
|
||||
*/
|
||||
@GetMapping("common/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("/common/upload")
|
||||
@ResponseBody
|
||||
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("fileName", fileName);
|
||||
ajax.put("url", url);
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 本地资源通用下载
|
||||
*/
|
||||
@GetMapping("/common/download/resource")
|
||||
public void resourceDownload(String resource,String filename, HttpServletRequest request, HttpServletResponse response)
|
||||
throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!FileUtils.checkAllowDownload(resource))
|
||||
{
|
||||
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
|
||||
}
|
||||
// 本地资源路径
|
||||
String localPath = RuoYiConfig.getProfile();
|
||||
// 数据库资源地址
|
||||
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
|
||||
// 下载名称
|
||||
String downloadName = filename;
|
||||
if(downloadName== null ||downloadName.equals("")){
|
||||
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,80 @@
|
|||
package com.ruoyi.web.controller.demo.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
/**
|
||||
* 模态窗口
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/demo/modal")
|
||||
public class DemoDialogController
|
||||
{
|
||||
private String prefix = "demo/modal";
|
||||
|
||||
/**
|
||||
* 模态窗口
|
||||
*/
|
||||
@GetMapping("/dialog")
|
||||
public String dialog()
|
||||
{
|
||||
return prefix + "/dialog";
|
||||
}
|
||||
|
||||
/**
|
||||
* 弹层组件
|
||||
*/
|
||||
@GetMapping("/layer")
|
||||
public String layer()
|
||||
{
|
||||
return prefix + "/layer";
|
||||
}
|
||||
|
||||
/**
|
||||
* 表单
|
||||
*/
|
||||
@GetMapping("/form")
|
||||
public String form()
|
||||
{
|
||||
return prefix + "/form";
|
||||
}
|
||||
|
||||
/**
|
||||
* 表格
|
||||
*/
|
||||
@GetMapping("/table")
|
||||
public String table()
|
||||
{
|
||||
return prefix + "/table";
|
||||
}
|
||||
|
||||
/**
|
||||
* 表格check
|
||||
*/
|
||||
@GetMapping("/check")
|
||||
public String check()
|
||||
{
|
||||
return prefix + "/table/check";
|
||||
}
|
||||
|
||||
/**
|
||||
* 表格radio
|
||||
*/
|
||||
@GetMapping("/radio")
|
||||
public String radio()
|
||||
{
|
||||
return prefix + "/table/radio";
|
||||
}
|
||||
|
||||
/**
|
||||
* 表格回传父窗体
|
||||
*/
|
||||
@GetMapping("/parent")
|
||||
public String parent()
|
||||
{
|
||||
return prefix + "/table/parent";
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,35 @@
|
|||
package com.ruoyi.web.controller.demo.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
/**
|
||||
* 图标相关
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/demo/icon")
|
||||
public class DemoIconController
|
||||
{
|
||||
private String prefix = "demo/icon";
|
||||
|
||||
/**
|
||||
* FontAwesome图标
|
||||
*/
|
||||
@GetMapping("/fontawesome")
|
||||
public String fontAwesome()
|
||||
{
|
||||
return prefix + "/fontawesome";
|
||||
}
|
||||
|
||||
/**
|
||||
* Glyphicons图标
|
||||
*/
|
||||
@GetMapping("/glyphicons")
|
||||
public String glyphicons()
|
||||
{
|
||||
return prefix + "/glyphicons";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,326 @@
|
|||
package com.ruoyi.web.controller.demo.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
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.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.PageDomain;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.page.TableSupport;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.exception.BusinessException;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.web.controller.demo.domain.CustomerModel;
|
||||
import com.ruoyi.web.controller.demo.domain.UserOperateModel;
|
||||
|
||||
/**
|
||||
* 操作控制
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/demo/operate")
|
||||
public class DemoOperateController extends BaseController
|
||||
{
|
||||
private String prefix = "demo/operate";
|
||||
|
||||
private final static Map<Integer, UserOperateModel> users = new LinkedHashMap<Integer, UserOperateModel>();
|
||||
{
|
||||
users.put(1, new UserOperateModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0"));
|
||||
users.put(2, new UserOperateModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1"));
|
||||
users.put(3, new UserOperateModel(3, "1000003", "测试3", "0", "15666666666", "ry@qq.com", 110.0, "1"));
|
||||
users.put(4, new UserOperateModel(4, "1000004", "测试4", "1", "15666666666", "ry@qq.com", 220.0, "1"));
|
||||
users.put(5, new UserOperateModel(5, "1000005", "测试5", "0", "15666666666", "ry@qq.com", 140.0, "1"));
|
||||
users.put(6, new UserOperateModel(6, "1000006", "测试6", "1", "15666666666", "ry@qq.com", 330.0, "1"));
|
||||
users.put(7, new UserOperateModel(7, "1000007", "测试7", "0", "15666666666", "ry@qq.com", 160.0, "1"));
|
||||
users.put(8, new UserOperateModel(8, "1000008", "测试8", "1", "15666666666", "ry@qq.com", 170.0, "1"));
|
||||
users.put(9, new UserOperateModel(9, "1000009", "测试9", "0", "15666666666", "ry@qq.com", 180.0, "1"));
|
||||
users.put(10, new UserOperateModel(10, "1000010", "测试10", "0", "15666666666", "ry@qq.com", 210.0, "1"));
|
||||
users.put(11, new UserOperateModel(11, "1000011", "测试11", "1", "15666666666", "ry@qq.com", 110.0, "1"));
|
||||
users.put(12, new UserOperateModel(12, "1000012", "测试12", "0", "15666666666", "ry@qq.com", 120.0, "1"));
|
||||
users.put(13, new UserOperateModel(13, "1000013", "测试13", "1", "15666666666", "ry@qq.com", 380.0, "1"));
|
||||
users.put(14, new UserOperateModel(14, "1000014", "测试14", "0", "15666666666", "ry@qq.com", 280.0, "1"));
|
||||
users.put(15, new UserOperateModel(15, "1000015", "测试15", "0", "15666666666", "ry@qq.com", 570.0, "1"));
|
||||
users.put(16, new UserOperateModel(16, "1000016", "测试16", "1", "15666666666", "ry@qq.com", 260.0, "1"));
|
||||
users.put(17, new UserOperateModel(17, "1000017", "测试17", "1", "15666666666", "ry@qq.com", 210.0, "1"));
|
||||
users.put(18, new UserOperateModel(18, "1000018", "测试18", "1", "15666666666", "ry@qq.com", 340.0, "1"));
|
||||
users.put(19, new UserOperateModel(19, "1000019", "测试19", "1", "15666666666", "ry@qq.com", 160.0, "1"));
|
||||
users.put(20, new UserOperateModel(20, "1000020", "测试20", "1", "15666666666", "ry@qq.com", 220.0, "1"));
|
||||
users.put(21, new UserOperateModel(21, "1000021", "测试21", "1", "15666666666", "ry@qq.com", 120.0, "1"));
|
||||
users.put(22, new UserOperateModel(22, "1000022", "测试22", "1", "15666666666", "ry@qq.com", 130.0, "1"));
|
||||
users.put(23, new UserOperateModel(23, "1000023", "测试23", "1", "15666666666", "ry@qq.com", 490.0, "1"));
|
||||
users.put(24, new UserOperateModel(24, "1000024", "测试24", "1", "15666666666", "ry@qq.com", 570.0, "1"));
|
||||
users.put(25, new UserOperateModel(25, "1000025", "测试25", "1", "15666666666", "ry@qq.com", 250.0, "1"));
|
||||
users.put(26, new UserOperateModel(26, "1000026", "测试26", "1", "15666666666", "ry@qq.com", 250.0, "1"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 表格
|
||||
*/
|
||||
@GetMapping("/table")
|
||||
public String table()
|
||||
{
|
||||
return prefix + "/table";
|
||||
}
|
||||
|
||||
/**
|
||||
* 其他
|
||||
*/
|
||||
@GetMapping("/other")
|
||||
public String other()
|
||||
{
|
||||
return prefix + "/other";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询数据
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(UserOperateModel userModel)
|
||||
{
|
||||
TableDataInfo rspData = new TableDataInfo();
|
||||
List<UserOperateModel> userList = new ArrayList<UserOperateModel>(users.values());
|
||||
// 查询条件过滤
|
||||
if (StringUtils.isNotEmpty(userModel.getSearchValue()))
|
||||
{
|
||||
userList.clear();
|
||||
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet())
|
||||
{
|
||||
if (entry.getValue().getUserName().equals(userModel.getSearchValue()))
|
||||
{
|
||||
userList.add(entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(userModel.getUserName()))
|
||||
{
|
||||
userList.clear();
|
||||
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet())
|
||||
{
|
||||
if (entry.getValue().getUserName().equals(userModel.getUserName()))
|
||||
{
|
||||
userList.add(entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize())
|
||||
{
|
||||
rspData.setRows(userList);
|
||||
rspData.setTotal(userList.size());
|
||||
return rspData;
|
||||
}
|
||||
Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
|
||||
Integer pageSize = pageDomain.getPageNum() * 10;
|
||||
if (pageSize > userList.size())
|
||||
{
|
||||
pageSize = userList.size();
|
||||
}
|
||||
rspData.setRows(userList.subList(pageNum, pageSize));
|
||||
rspData.setTotal(userList.size());
|
||||
return rspData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add(ModelMap mmap)
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存用户
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(UserOperateModel user)
|
||||
{
|
||||
Integer userId = users.size() + 1;
|
||||
user.setUserId(userId);
|
||||
return AjaxResult.success(users.put(userId, user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存主子表信息
|
||||
*/
|
||||
@PostMapping("/customer/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(CustomerModel customerModel)
|
||||
{
|
||||
System.out.println(customerModel.toString());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@GetMapping("/edit/{userId}")
|
||||
public String edit(@PathVariable("userId") Integer userId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("user", users.get(userId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存用户
|
||||
*/
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(UserOperateModel user)
|
||||
{
|
||||
return AjaxResult.success(users.put(user.getUserId(), user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(UserOperateModel user)
|
||||
{
|
||||
List<UserOperateModel> list = new ArrayList<UserOperateModel>(users.values());
|
||||
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
|
||||
return util.exportExcel(list, "用户数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@GetMapping("/importTemplate")
|
||||
@ResponseBody
|
||||
public AjaxResult importTemplate()
|
||||
{
|
||||
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
|
||||
return util.importTemplateExcel("用户数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@PostMapping("/importData")
|
||||
@ResponseBody
|
||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
||||
{
|
||||
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
|
||||
List<UserOperateModel> userList = util.importExcel(file.getInputStream());
|
||||
String message = importUser(userList, updateSupport);
|
||||
return AjaxResult.success(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
Integer[] userIds = Convert.toIntArray(ids);
|
||||
for (Integer userId : userIds)
|
||||
{
|
||||
users.remove(userId);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看详细
|
||||
*/
|
||||
@GetMapping("/detail/{userId}")
|
||||
public String detail(@PathVariable("userId") Integer userId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("user", users.get(userId));
|
||||
return prefix + "/detail";
|
||||
}
|
||||
|
||||
@PostMapping("/clean")
|
||||
@ResponseBody
|
||||
public AjaxResult clean()
|
||||
{
|
||||
users.clear();
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入用户数据
|
||||
*
|
||||
* @param userList 用户数据列表
|
||||
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
|
||||
* @return 结果
|
||||
*/
|
||||
public String importUser(List<UserOperateModel> userList, Boolean isUpdateSupport)
|
||||
{
|
||||
if (StringUtils.isNull(userList) || userList.size() == 0)
|
||||
{
|
||||
throw new BusinessException("导入用户数据不能为空!");
|
||||
}
|
||||
int successNum = 0;
|
||||
int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
for (UserOperateModel user : userList)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 验证是否存在这个用户
|
||||
boolean userFlag = false;
|
||||
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet())
|
||||
{
|
||||
if (entry.getValue().getUserName().equals(user.getUserName()))
|
||||
{
|
||||
userFlag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!userFlag)
|
||||
{
|
||||
Integer userId = users.size() + 1;
|
||||
user.setUserId(userId);
|
||||
users.put(userId, user);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、用户 " + user.getUserName() + " 导入成功");
|
||||
}
|
||||
else if (isUpdateSupport)
|
||||
{
|
||||
users.put(user.getUserId(), user);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、用户 " + user.getUserName() + " 更新成功");
|
||||
}
|
||||
else
|
||||
{
|
||||
failureNum++;
|
||||
failureMsg.append("<br/>" + failureNum + "、用户 " + user.getUserName() + " 已存在");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:";
|
||||
failureMsg.append(msg + e.getMessage());
|
||||
}
|
||||
}
|
||||
if (failureNum > 0)
|
||||
{
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new BusinessException(failureMsg.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
package com.ruoyi.web.controller.demo.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
/**
|
||||
* 报表
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/demo/report")
|
||||
public class DemoReportController
|
||||
{
|
||||
private String prefix = "demo/report";
|
||||
|
||||
/**
|
||||
* 百度ECharts
|
||||
*/
|
||||
@GetMapping("/echarts")
|
||||
public String echarts()
|
||||
{
|
||||
return prefix + "/echarts";
|
||||
}
|
||||
|
||||
/**
|
||||
* 图表插件
|
||||
*/
|
||||
@GetMapping("/peity")
|
||||
public String peity()
|
||||
{
|
||||
return prefix + "/peity";
|
||||
}
|
||||
|
||||
/**
|
||||
* 线状图插件
|
||||
*/
|
||||
@GetMapping("/sparkline")
|
||||
public String sparkline()
|
||||
{
|
||||
return prefix + "/sparkline";
|
||||
}
|
||||
|
||||
/**
|
||||
* 图表组合
|
||||
*/
|
||||
@GetMapping("/metrics")
|
||||
public String metrics()
|
||||
{
|
||||
return prefix + "/metrics";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,534 @@
|
|||
package com.ruoyi.web.controller.demo.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
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.ResponseBody;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.PageDomain;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.page.TableSupport;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* 表格相关
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/demo/table")
|
||||
public class DemoTableController extends BaseController
|
||||
{
|
||||
private String prefix = "demo/table";
|
||||
|
||||
private final static List<UserTableModel> users = new ArrayList<UserTableModel>();
|
||||
{
|
||||
users.add(new UserTableModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0"));
|
||||
users.add(new UserTableModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1"));
|
||||
users.add(new UserTableModel(3, "1000003", "测试3", "0", "15666666666", "ry@qq.com", 110.0, "1"));
|
||||
users.add(new UserTableModel(4, "1000004", "测试4", "1", "15666666666", "ry@qq.com", 220.0, "1"));
|
||||
users.add(new UserTableModel(5, "1000005", "测试5", "0", "15666666666", "ry@qq.com", 140.0, "1"));
|
||||
users.add(new UserTableModel(6, "1000006", "测试6", "1", "15666666666", "ry@qq.com", 330.0, "1"));
|
||||
users.add(new UserTableModel(7, "1000007", "测试7", "0", "15666666666", "ry@qq.com", 160.0, "1"));
|
||||
users.add(new UserTableModel(8, "1000008", "测试8", "1", "15666666666", "ry@qq.com", 170.0, "1"));
|
||||
users.add(new UserTableModel(9, "1000009", "测试9", "0", "15666666666", "ry@qq.com", 180.0, "1"));
|
||||
users.add(new UserTableModel(10, "1000010", "测试10", "0", "15666666666", "ry@qq.com", 210.0, "1"));
|
||||
users.add(new UserTableModel(11, "1000011", "测试11", "1", "15666666666", "ry@qq.com", 110.0, "1"));
|
||||
users.add(new UserTableModel(12, "1000012", "测试12", "0", "15666666666", "ry@qq.com", 120.0, "1"));
|
||||
users.add(new UserTableModel(13, "1000013", "测试13", "1", "15666666666", "ry@qq.com", 380.0, "1"));
|
||||
users.add(new UserTableModel(14, "1000014", "测试14", "0", "15666666666", "ry@qq.com", 280.0, "1"));
|
||||
users.add(new UserTableModel(15, "1000015", "测试15", "0", "15666666666", "ry@qq.com", 570.0, "1"));
|
||||
users.add(new UserTableModel(16, "1000016", "测试16", "1", "15666666666", "ry@qq.com", 260.0, "1"));
|
||||
users.add(new UserTableModel(17, "1000017", "测试17", "1", "15666666666", "ry@qq.com", 210.0, "1"));
|
||||
users.add(new UserTableModel(18, "1000018", "测试18", "1", "15666666666", "ry@qq.com", 340.0, "1"));
|
||||
users.add(new UserTableModel(19, "1000019", "测试19", "1", "15666666666", "ry@qq.com", 160.0, "1"));
|
||||
users.add(new UserTableModel(20, "1000020", "测试20", "1", "15666666666", "ry@qq.com", 220.0, "1"));
|
||||
users.add(new UserTableModel(21, "1000021", "测试21", "1", "15666666666", "ry@qq.com", 120.0, "1"));
|
||||
users.add(new UserTableModel(22, "1000022", "测试22", "1", "15666666666", "ry@qq.com", 130.0, "1"));
|
||||
users.add(new UserTableModel(23, "1000023", "测试23", "1", "15666666666", "ry@qq.com", 490.0, "1"));
|
||||
users.add(new UserTableModel(24, "1000024", "测试24", "1", "15666666666", "ry@qq.com", 570.0, "1"));
|
||||
users.add(new UserTableModel(25, "1000025", "测试25", "1", "15666666666", "ry@qq.com", 250.0, "1"));
|
||||
users.add(new UserTableModel(26, "1000026", "测试26", "1", "15666666666", "ry@qq.com", 250.0, "1"));
|
||||
}
|
||||
|
||||
private final static List<UserTableColumn> columns = new ArrayList<UserTableColumn>();
|
||||
{
|
||||
columns.add(new UserTableColumn("用户ID", "userId"));
|
||||
columns.add(new UserTableColumn("用户编号", "userCode"));
|
||||
columns.add(new UserTableColumn("用户姓名", "userName"));
|
||||
columns.add(new UserTableColumn("用户手机", "userPhone"));
|
||||
columns.add(new UserTableColumn("用户邮箱", "userEmail"));
|
||||
columns.add(new UserTableColumn("用户状态", "status"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索相关
|
||||
*/
|
||||
@GetMapping("/search")
|
||||
public String search()
|
||||
{
|
||||
return prefix + "/search";
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据汇总
|
||||
*/
|
||||
@GetMapping("/footer")
|
||||
public String footer()
|
||||
{
|
||||
return prefix + "/footer";
|
||||
}
|
||||
|
||||
/**
|
||||
* 组合表头
|
||||
*/
|
||||
@GetMapping("/groupHeader")
|
||||
public String groupHeader()
|
||||
{
|
||||
return prefix + "/groupHeader";
|
||||
}
|
||||
|
||||
/**
|
||||
* 表格导出
|
||||
*/
|
||||
@GetMapping("/export")
|
||||
public String export()
|
||||
{
|
||||
return prefix + "/export";
|
||||
}
|
||||
|
||||
/**
|
||||
* 翻页记住选择
|
||||
*/
|
||||
@GetMapping("/remember")
|
||||
public String remember()
|
||||
{
|
||||
return prefix + "/remember";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转至指定页
|
||||
*/
|
||||
@GetMapping("/pageGo")
|
||||
public String pageGo()
|
||||
{
|
||||
return prefix + "/pageGo";
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义查询参数
|
||||
*/
|
||||
@GetMapping("/params")
|
||||
public String params()
|
||||
{
|
||||
return prefix + "/params";
|
||||
}
|
||||
|
||||
/**
|
||||
* 多表格
|
||||
*/
|
||||
@GetMapping("/multi")
|
||||
public String multi()
|
||||
{
|
||||
return prefix + "/multi";
|
||||
}
|
||||
|
||||
/**
|
||||
* 点击按钮加载表格
|
||||
*/
|
||||
@GetMapping("/button")
|
||||
public String button()
|
||||
{
|
||||
return prefix + "/button";
|
||||
}
|
||||
|
||||
/**
|
||||
* 直接加载表格数据
|
||||
*/
|
||||
@GetMapping("/data")
|
||||
public String data(ModelMap mmap)
|
||||
{
|
||||
mmap.put("users", users);
|
||||
return prefix + "/data";
|
||||
}
|
||||
|
||||
/**
|
||||
* 表格冻结列
|
||||
*/
|
||||
@GetMapping("/fixedColumns")
|
||||
public String fixedColumns()
|
||||
{
|
||||
return prefix + "/fixedColumns";
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义触发事件
|
||||
*/
|
||||
@GetMapping("/event")
|
||||
public String event()
|
||||
{
|
||||
return prefix + "/event";
|
||||
}
|
||||
|
||||
/**
|
||||
* 表格细节视图
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
public String detail()
|
||||
{
|
||||
return prefix + "/detail";
|
||||
}
|
||||
|
||||
/**
|
||||
* 表格父子视图
|
||||
*/
|
||||
@GetMapping("/child")
|
||||
public String child()
|
||||
{
|
||||
return prefix + "/child";
|
||||
}
|
||||
|
||||
/**
|
||||
* 表格图片预览
|
||||
*/
|
||||
@GetMapping("/image")
|
||||
public String image()
|
||||
{
|
||||
return prefix + "/image";
|
||||
}
|
||||
|
||||
/**
|
||||
* 动态增删改查
|
||||
*/
|
||||
@GetMapping("/curd")
|
||||
public String curd()
|
||||
{
|
||||
return prefix + "/curd";
|
||||
}
|
||||
|
||||
/**
|
||||
* 表格拖拽操作
|
||||
*/
|
||||
@GetMapping("/reorder")
|
||||
public String reorder()
|
||||
{
|
||||
return prefix + "/reorder";
|
||||
}
|
||||
|
||||
/**
|
||||
* 表格列宽拖动
|
||||
*/
|
||||
@GetMapping("/resizable")
|
||||
public String resizable()
|
||||
{
|
||||
return prefix + "/resizable";
|
||||
}
|
||||
|
||||
/**
|
||||
* 表格行内编辑操作
|
||||
*/
|
||||
@GetMapping("/editable")
|
||||
public String editable()
|
||||
{
|
||||
return prefix + "/editable";
|
||||
}
|
||||
|
||||
/**
|
||||
* 主子表提交
|
||||
*/
|
||||
@GetMapping("/subdata")
|
||||
public String subdata()
|
||||
{
|
||||
return prefix + "/subdata";
|
||||
}
|
||||
|
||||
/**
|
||||
* 表格自动刷新
|
||||
*/
|
||||
@GetMapping("/refresh")
|
||||
public String refresh()
|
||||
{
|
||||
return prefix + "/refresh";
|
||||
}
|
||||
|
||||
/**
|
||||
* 表格打印配置
|
||||
*/
|
||||
@GetMapping("/print")
|
||||
public String print()
|
||||
{
|
||||
return prefix + "/print";
|
||||
}
|
||||
|
||||
/**
|
||||
* 表格标题格式化
|
||||
*/
|
||||
@GetMapping("/headerStyle")
|
||||
public String headerStyle()
|
||||
{
|
||||
return prefix + "/headerStyle";
|
||||
}
|
||||
|
||||
/**
|
||||
* 表格动态列
|
||||
*/
|
||||
@GetMapping("/dynamicColumns")
|
||||
public String dynamicColumns()
|
||||
{
|
||||
return prefix + "/dynamicColumns";
|
||||
}
|
||||
|
||||
/**
|
||||
* 表格其他操作
|
||||
*/
|
||||
@GetMapping("/other")
|
||||
public String other()
|
||||
{
|
||||
return prefix + "/other";
|
||||
}
|
||||
|
||||
/**
|
||||
* 动态获取列
|
||||
*/
|
||||
@PostMapping("/ajaxColumns")
|
||||
@ResponseBody
|
||||
public AjaxResult ajaxColumns(UserTableColumn userColumn)
|
||||
{
|
||||
List<UserTableColumn> columnList = new ArrayList<UserTableColumn>(Arrays.asList(new UserTableColumn[columns.size()]));
|
||||
Collections.copy(columnList, columns);
|
||||
if (userColumn != null && "userBalance".equals(userColumn.getField()))
|
||||
{
|
||||
columnList.add(new UserTableColumn("用户余额", "userBalance"));
|
||||
}
|
||||
return AjaxResult.success(columnList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询数据
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(UserTableModel userModel)
|
||||
{
|
||||
TableDataInfo rspData = new TableDataInfo();
|
||||
List<UserTableModel> userList = new ArrayList<UserTableModel>(Arrays.asList(new UserTableModel[users.size()]));
|
||||
Collections.copy(userList, users);
|
||||
// 查询条件过滤
|
||||
if (StringUtils.isNotEmpty(userModel.getUserName()))
|
||||
{
|
||||
userList.clear();
|
||||
for (UserTableModel user : users)
|
||||
{
|
||||
if (user.getUserName().equals(userModel.getUserName()))
|
||||
{
|
||||
userList.add(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize())
|
||||
{
|
||||
rspData.setRows(userList);
|
||||
rspData.setTotal(userList.size());
|
||||
return rspData;
|
||||
}
|
||||
Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
|
||||
Integer pageSize = pageDomain.getPageNum() * 10;
|
||||
if (pageSize > userList.size())
|
||||
{
|
||||
pageSize = userList.size();
|
||||
}
|
||||
rspData.setRows(userList.subList(pageNum, pageSize));
|
||||
rspData.setTotal(userList.size());
|
||||
return rspData;
|
||||
}
|
||||
}
|
||||
|
||||
class UserTableColumn
|
||||
{
|
||||
/** 表头 */
|
||||
private String title;
|
||||
/** 字段 */
|
||||
private String field;
|
||||
|
||||
public UserTableColumn()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public UserTableColumn(String title, String field)
|
||||
{
|
||||
this.title = title;
|
||||
this.field = field;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getField()
|
||||
{
|
||||
return field;
|
||||
}
|
||||
|
||||
public void setField(String field)
|
||||
{
|
||||
this.field = field;
|
||||
}
|
||||
}
|
||||
|
||||
class UserTableModel
|
||||
{
|
||||
/** 用户ID */
|
||||
private int userId;
|
||||
|
||||
/** 用户编号 */
|
||||
private String userCode;
|
||||
|
||||
/** 用户姓名 */
|
||||
private String userName;
|
||||
|
||||
/** 用户性别 */
|
||||
private String userSex;
|
||||
|
||||
/** 用户手机 */
|
||||
private String userPhone;
|
||||
|
||||
/** 用户邮箱 */
|
||||
private String userEmail;
|
||||
|
||||
/** 用户余额 */
|
||||
private double userBalance;
|
||||
|
||||
/** 用户状态(0正常 1停用) */
|
||||
private String status;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
public UserTableModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public UserTableModel(int userId, String userCode, String userName, String userSex, String userPhone,
|
||||
String userEmail, double userBalance, String status)
|
||||
{
|
||||
this.userId = userId;
|
||||
this.userCode = userCode;
|
||||
this.userName = userName;
|
||||
this.userSex = userSex;
|
||||
this.userPhone = userPhone;
|
||||
this.userEmail = userEmail;
|
||||
this.userBalance = userBalance;
|
||||
this.status = status;
|
||||
this.createTime = DateUtils.getNowDate();
|
||||
}
|
||||
|
||||
public int getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(int userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserCode()
|
||||
{
|
||||
return userCode;
|
||||
}
|
||||
|
||||
public void setUserCode(String userCode)
|
||||
{
|
||||
this.userCode = userCode;
|
||||
}
|
||||
|
||||
public String getUserName()
|
||||
{
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName)
|
||||
{
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getUserSex()
|
||||
{
|
||||
return userSex;
|
||||
}
|
||||
|
||||
public void setUserSex(String userSex)
|
||||
{
|
||||
this.userSex = userSex;
|
||||
}
|
||||
|
||||
public String getUserPhone()
|
||||
{
|
||||
return userPhone;
|
||||
}
|
||||
|
||||
public void setUserPhone(String userPhone)
|
||||
{
|
||||
this.userPhone = userPhone;
|
||||
}
|
||||
|
||||
public String getUserEmail()
|
||||
{
|
||||
return userEmail;
|
||||
}
|
||||
|
||||
public void setUserEmail(String userEmail)
|
||||
{
|
||||
this.userEmail = userEmail;
|
||||
}
|
||||
|
||||
public double getUserBalance()
|
||||
{
|
||||
return userBalance;
|
||||
}
|
||||
|
||||
public void setUserBalance(double userBalance)
|
||||
{
|
||||
this.userBalance = userBalance;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Date getCreateTime()
|
||||
{
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime)
|
||||
{
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
package com.ruoyi.web.controller.demo.domain;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 客户测试信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class CustomerModel
|
||||
{
|
||||
/**
|
||||
* 客户姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 客户手机
|
||||
*/
|
||||
private String phonenumber;
|
||||
|
||||
/**
|
||||
* 客户性别
|
||||
*/
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 客户生日
|
||||
*/
|
||||
private String birthday;
|
||||
|
||||
/**
|
||||
* 客户描述
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 商品信息
|
||||
*/
|
||||
private List<GoodsModel> goods;
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPhonenumber()
|
||||
{
|
||||
return phonenumber;
|
||||
}
|
||||
|
||||
public void setPhonenumber(String phonenumber)
|
||||
{
|
||||
this.phonenumber = phonenumber;
|
||||
}
|
||||
|
||||
|
||||
public String getSex()
|
||||
{
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(String sex)
|
||||
{
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public String getBirthday()
|
||||
{
|
||||
return birthday;
|
||||
}
|
||||
|
||||
public void setBirthday(String birthday)
|
||||
{
|
||||
this.birthday = birthday;
|
||||
}
|
||||
|
||||
public String getRemark()
|
||||
{
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark)
|
||||
{
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public List<GoodsModel> getGoods()
|
||||
{
|
||||
return goods;
|
||||
}
|
||||
|
||||
public void setGoods(List<GoodsModel> goods)
|
||||
{
|
||||
this.goods = goods;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("name", getName())
|
||||
.append("phonenumber", getPhonenumber())
|
||||
.append("sex", getSex())
|
||||
.append("birthday", getBirthday())
|
||||
.append("goods", getGoods())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
package com.ruoyi.web.controller.demo.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 商品测试信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class GoodsModel
|
||||
{
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 商品重量
|
||||
*/
|
||||
private Integer weight;
|
||||
|
||||
/**
|
||||
* 商品价格
|
||||
*/
|
||||
private Double price;
|
||||
|
||||
/**
|
||||
* 商品日期
|
||||
*/
|
||||
private Date date;
|
||||
|
||||
/**
|
||||
* 商品种类
|
||||
*/
|
||||
private String type;
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getWeight()
|
||||
{
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void setWeight(Integer weight)
|
||||
{
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public Double getPrice()
|
||||
{
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(Double price)
|
||||
{
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public Date getDate()
|
||||
{
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(Date date)
|
||||
{
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("name", getName())
|
||||
.append("weight", getWeight())
|
||||
.append("price", getPrice())
|
||||
.append("date", getDate())
|
||||
.append("type", getType())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
package com.ruoyi.web.controller.demo.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.annotation.Excel.Type;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
|
||||
public class UserOperateModel extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private int userId;
|
||||
|
||||
@Excel(name = "用户编号")
|
||||
private String userCode;
|
||||
|
||||
@Excel(name = "用户姓名")
|
||||
private String userName;
|
||||
|
||||
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
|
||||
private String userSex;
|
||||
|
||||
@Excel(name = "用户手机")
|
||||
private String userPhone;
|
||||
|
||||
@Excel(name = "用户邮箱")
|
||||
private String userEmail;
|
||||
|
||||
@Excel(name = "用户余额")
|
||||
private double userBalance;
|
||||
|
||||
@Excel(name = "用户状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
|
||||
private Date createTime;
|
||||
|
||||
public UserOperateModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public UserOperateModel(int userId, String userCode, String userName, String userSex, String userPhone,
|
||||
String userEmail, double userBalance, String status)
|
||||
{
|
||||
this.userId = userId;
|
||||
this.userCode = userCode;
|
||||
this.userName = userName;
|
||||
this.userSex = userSex;
|
||||
this.userPhone = userPhone;
|
||||
this.userEmail = userEmail;
|
||||
this.userBalance = userBalance;
|
||||
this.status = status;
|
||||
this.createTime = DateUtils.getNowDate();
|
||||
}
|
||||
|
||||
public int getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(int userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserCode()
|
||||
{
|
||||
return userCode;
|
||||
}
|
||||
|
||||
public void setUserCode(String userCode)
|
||||
{
|
||||
this.userCode = userCode;
|
||||
}
|
||||
|
||||
public String getUserName()
|
||||
{
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName)
|
||||
{
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getUserSex()
|
||||
{
|
||||
return userSex;
|
||||
}
|
||||
|
||||
public void setUserSex(String userSex)
|
||||
{
|
||||
this.userSex = userSex;
|
||||
}
|
||||
|
||||
public String getUserPhone()
|
||||
{
|
||||
return userPhone;
|
||||
}
|
||||
|
||||
public void setUserPhone(String userPhone)
|
||||
{
|
||||
this.userPhone = userPhone;
|
||||
}
|
||||
|
||||
public String getUserEmail()
|
||||
{
|
||||
return userEmail;
|
||||
}
|
||||
|
||||
public void setUserEmail(String userEmail)
|
||||
{
|
||||
this.userEmail = userEmail;
|
||||
}
|
||||
|
||||
public double getUserBalance()
|
||||
{
|
||||
return userBalance;
|
||||
}
|
||||
|
||||
public void setUserBalance(double userBalance)
|
||||
{
|
||||
this.userBalance = userBalance;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getCreateTime()
|
||||
{
|
||||
return createTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCreateTime(Date createTime)
|
||||
{
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
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.ResponseBody;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.framework.web.service.CacheService;
|
||||
|
||||
/**
|
||||
* 缓存监控
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/monitor/cache")
|
||||
public class CacheController extends BaseController
|
||||
{
|
||||
private String prefix = "monitor/cache";
|
||||
|
||||
@Autowired
|
||||
private CacheService cacheService;
|
||||
|
||||
@GetMapping()
|
||||
public String cache(ModelMap mmap)
|
||||
{
|
||||
mmap.put("cacheNames", cacheService.getCacheNames());
|
||||
return prefix + "/cache";
|
||||
}
|
||||
|
||||
@PostMapping("/getNames")
|
||||
public String getCacheNames(String fragment, ModelMap mmap)
|
||||
{
|
||||
mmap.put("cacheNames", cacheService.getCacheNames());
|
||||
return prefix + "/cache::" + fragment;
|
||||
}
|
||||
|
||||
@PostMapping("/getKeys")
|
||||
public String getCacheKeys(String fragment, String cacheName, ModelMap mmap)
|
||||
{
|
||||
mmap.put("cacheName", cacheName);
|
||||
mmap.put("cacheKyes", cacheService.getCacheKeys(cacheName));
|
||||
return prefix + "/cache::" + fragment;
|
||||
}
|
||||
|
||||
@PostMapping("/getValue")
|
||||
public String getCacheValue(String fragment, String cacheName, String cacheKey, ModelMap mmap)
|
||||
{
|
||||
mmap.put("cacheName", cacheName);
|
||||
mmap.put("cacheKey", cacheKey);
|
||||
mmap.put("cacheValue", cacheService.getCacheValue(cacheName, cacheKey));
|
||||
return prefix + "/cache::" + fragment;
|
||||
}
|
||||
|
||||
@PostMapping("/clearCacheName")
|
||||
@ResponseBody
|
||||
public AjaxResult clearCacheName(String cacheName, ModelMap mmap)
|
||||
{
|
||||
cacheService.clearCacheName(cacheName);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/clearCacheKey")
|
||||
@ResponseBody
|
||||
public AjaxResult clearCacheKey(String cacheName, String cacheKey, ModelMap mmap)
|
||||
{
|
||||
cacheService.clearCacheKey(cacheName, cacheKey);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("/clearAll")
|
||||
@ResponseBody
|
||||
public AjaxResult clearAll(ModelMap mmap)
|
||||
{
|
||||
cacheService.clearAll();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
|
||||
/**
|
||||
* druid 监控
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/monitor/data")
|
||||
public class DruidController extends BaseController
|
||||
{
|
||||
private String prefix = "/druid";
|
||||
|
||||
@RequiresPermissions("monitor:data:view")
|
||||
@GetMapping()
|
||||
public String index()
|
||||
{
|
||||
return redirect(prefix + "/index");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.Server;
|
||||
|
||||
/**
|
||||
* 服务器监控
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/monitor/server")
|
||||
public class ServerController extends BaseController
|
||||
{
|
||||
private String prefix = "monitor/server";
|
||||
|
||||
@RequiresPermissions("monitor:server:view")
|
||||
@GetMapping()
|
||||
public String server(ModelMap mmap) throws Exception
|
||||
{
|
||||
Server server = new Server();
|
||||
server.copyTo();
|
||||
mmap.put("server", server);
|
||||
return prefix + "/server";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
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.ResponseBody;
|
||||
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.SysLogininfor;
|
||||
import com.ruoyi.system.service.ISysLogininforService;
|
||||
|
||||
/**
|
||||
* 系统访问记录
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/monitor/logininfor")
|
||||
public class SysLogininforController extends BaseController
|
||||
{
|
||||
private String prefix = "monitor/logininfor";
|
||||
|
||||
@Autowired
|
||||
private ISysLogininforService logininforService;
|
||||
|
||||
@Autowired
|
||||
private SysPasswordService passwordService;
|
||||
|
||||
@RequiresPermissions("monitor:logininfor:view")
|
||||
@GetMapping()
|
||||
public String logininfor()
|
||||
{
|
||||
return prefix + "/logininfor";
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:logininfor:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysLogininfor logininfor)
|
||||
{
|
||||
startPage();
|
||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("monitor:logininfor:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(SysLogininfor logininfor)
|
||||
{
|
||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
||||
return util.exportExcel(list, "登录日志");
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:logininfor:remove")
|
||||
@Log(title = "登录日志", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(logininforService.deleteLogininforByIds(ids));
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:logininfor:remove")
|
||||
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
|
||||
@PostMapping("/clean")
|
||||
@ResponseBody
|
||||
public AjaxResult clean()
|
||||
{
|
||||
logininforService.cleanLogininfor();
|
||||
return success();
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:logininfor:unlock")
|
||||
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/unlock")
|
||||
@ResponseBody
|
||||
public AjaxResult unlock(String loginName)
|
||||
{
|
||||
passwordService.clearLoginRecordCache(loginName);
|
||||
return success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
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.ResponseBody;
|
||||
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
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/monitor/operlog")
|
||||
public class SysOperlogController extends BaseController
|
||||
{
|
||||
private String prefix = "monitor/operlog";
|
||||
|
||||
@Autowired
|
||||
private ISysOperLogService operLogService;
|
||||
|
||||
@RequiresPermissions("monitor:operlog:view")
|
||||
@GetMapping()
|
||||
public String operlog()
|
||||
{
|
||||
return prefix + "/operlog";
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:operlog:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysOperLog operLog)
|
||||
{
|
||||
startPage();
|
||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("monitor:operlog:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(SysOperLog operLog)
|
||||
{
|
||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
|
||||
return util.exportExcel(list, "操作日志");
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:operlog:remove")
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(operLogService.deleteOperLogByIds(ids));
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:operlog:detail")
|
||||
@GetMapping("/detail/{operId}")
|
||||
public String detail(@PathVariable("operId") Long operId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("operLog", operLogService.selectOperLogById(operId));
|
||||
return prefix + "/detail";
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
||||
@RequiresPermissions("monitor:operlog:remove")
|
||||
@PostMapping("/clean")
|
||||
@ResponseBody
|
||||
public AjaxResult clean()
|
||||
{
|
||||
operLogService.cleanOperLog();
|
||||
return success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
package com.ruoyi.web.controller.monitor;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
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.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.enums.OnlineStatus;
|
||||
import com.ruoyi.common.utils.ShiroUtils;
|
||||
import com.ruoyi.framework.shiro.session.OnlineSession;
|
||||
import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
|
||||
import com.ruoyi.system.domain.SysUserOnline;
|
||||
import com.ruoyi.system.service.ISysUserOnlineService;
|
||||
|
||||
/**
|
||||
* 在线用户监控
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/monitor/online")
|
||||
public class SysUserOnlineController extends BaseController
|
||||
{
|
||||
private String prefix = "monitor/online";
|
||||
|
||||
@Autowired
|
||||
private ISysUserOnlineService userOnlineService;
|
||||
|
||||
@Autowired
|
||||
private OnlineSessionDAO onlineSessionDAO;
|
||||
|
||||
@RequiresPermissions("monitor:online:view")
|
||||
@GetMapping()
|
||||
public String online()
|
||||
{
|
||||
return prefix + "/online";
|
||||
}
|
||||
|
||||
@RequiresPermissions("monitor:online:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysUserOnline userOnline)
|
||||
{
|
||||
startPage();
|
||||
List<SysUserOnline> list = userOnlineService.selectUserOnlineList(userOnline);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@RequiresPermissions(value = { "monitor:online:batchForceLogout", "monitor:online:forceLogout" }, logical = Logical.OR)
|
||||
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||
@PostMapping("/batchForceLogout")
|
||||
@ResponseBody
|
||||
public AjaxResult batchForceLogout(String ids)
|
||||
{
|
||||
for (String sessionId : Convert.toStrArray(ids))
|
||||
{
|
||||
SysUserOnline online = userOnlineService.selectOnlineById(sessionId);
|
||||
if (online == null)
|
||||
{
|
||||
return error("用户已下线");
|
||||
}
|
||||
OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId());
|
||||
if (onlineSession == null)
|
||||
{
|
||||
return error("用户已下线");
|
||||
}
|
||||
if (sessionId.equals(ShiroUtils.getSessionId()))
|
||||
{
|
||||
return error("当前登录用户无法强退");
|
||||
}
|
||||
onlineSessionDAO.delete(onlineSession);
|
||||
online.setStatus(OnlineStatus.off_line);
|
||||
userOnlineService.saveOnline(online);
|
||||
userOnlineService.removeUserCache(online.getLoginName(), sessionId);
|
||||
}
|
||||
return success();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,179 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.config.ThirdAuthConfig;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
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.utils.AuthUtils;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import com.ruoyi.common.utils.ShiroUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.framework.shiro.auth.LoginType;
|
||||
import com.ruoyi.framework.shiro.auth.UserToken;
|
||||
import com.ruoyi.system.domain.SysAuthUser;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import me.zhyd.oauth.cache.AuthDefaultStateCache;
|
||||
import me.zhyd.oauth.cache.AuthStateCache;
|
||||
import me.zhyd.oauth.model.AuthCallback;
|
||||
import me.zhyd.oauth.model.AuthResponse;
|
||||
import me.zhyd.oauth.model.AuthUser;
|
||||
import me.zhyd.oauth.request.AuthRequest;
|
||||
import me.zhyd.oauth.utils.AuthStateUtils;
|
||||
|
||||
/**
|
||||
* 第三方认证授权处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
public class SysAuthController extends BaseController {
|
||||
public static final String THIRD_WECHAT = "wechat";
|
||||
|
||||
private AuthStateCache authStateCache;
|
||||
|
||||
@Autowired
|
||||
private SysUserMapper userMapper;
|
||||
|
||||
|
||||
private final static Map<String, String> auths = new HashMap<String, String>();
|
||||
|
||||
{
|
||||
// auths.put("gitee", "{\"clientId\":\"e5cf90f79b02128d8f140d6898c480ea9dc5278e15a23617e38b58de8ebdc8be\",\"clientSecret\":\"c02d1df684909ba465cf521d94209e2a50e45f2199244f2af697b514efb38d60\",\"redirectUri\":\"http://127.0.0.1:80/auth/callback/gitee\"}");
|
||||
// auths.put("github", "{\"clientId\":\"Iv1.1be0cdcd71aca63b\",\"clientSecret\":\"0d59d28b43152bc8906011624db37b0fed88d154\",\"redirectUri\":\"http://127.0.0.1:80/auth/callback/github\"}");
|
||||
// Serializable weChatConfig = new Serializable(){
|
||||
// public String clientId = ThirdAuthConfig.getWeChatAppId();
|
||||
// public String clientSecret = ThirdAuthConfig.getWeChatAppSecret();
|
||||
// public String redirectUri = ThirdAuthConfig.getWeChatCallBack();
|
||||
// public String scope = ThirdAuthConfig.getWeChatScope();
|
||||
// };
|
||||
// auths.put("wechat",JSONObject.toJSONString(weChatConfig));
|
||||
authStateCache = AuthDefaultStateCache.INSTANCE;
|
||||
}
|
||||
|
||||
@PostMapping("/auth/qrcodeauth")
|
||||
@ResponseBody
|
||||
public AjaxResult qrCodeAuth(@RequestBody String source) {
|
||||
ThirdAuthConfig.ThirdConfig _config = ThirdAuthConfig.getSourceConfig(source);
|
||||
if (_config == null) {
|
||||
return AjaxResult.error("第三方登录方式暂不支持!");
|
||||
}
|
||||
AuthRequest authRequest = AuthUtils.getAuthRequest(source, _config.getAppId(), _config.getAgentId(), _config.getSecret(), _config.getCallBack(), authStateCache);
|
||||
|
||||
String authorizeUrl = authRequest.authorize(AuthStateUtils.createState());
|
||||
return AjaxResult.success("", authorizeUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* 认证授权
|
||||
*
|
||||
* @param source
|
||||
* @throws IOException
|
||||
*/
|
||||
@GetMapping("/auth/{source}")
|
||||
@ResponseBody
|
||||
public void renderAuth(@PathVariable("source") String source) throws IOException {
|
||||
// System.out.println(ThirdAuthConfig.getWeChatAppId());
|
||||
System.out.println(RuoYiConfig.getName());
|
||||
// System.out.println(RuoYiConfig.getWeChatAppId());
|
||||
|
||||
|
||||
String obj = auths.get(source);
|
||||
if (StringUtils.isEmpty(obj)) {
|
||||
return;
|
||||
}
|
||||
JSONObject json = JSONObject.parseObject(obj);
|
||||
AuthRequest authRequest = AuthUtils.getAuthRequest(source, json.getString("clientId"), json.getString("agentId"), json.getString("clientSecret"), json.getString("redirectUri"), authStateCache);
|
||||
String authorizeUrl = authRequest.authorize(AuthStateUtils.createState());
|
||||
ServletUtils.getResponse().sendRedirect(authorizeUrl);
|
||||
}
|
||||
|
||||
@GetMapping("/auth/callback/{source}")
|
||||
public String callBack(@PathVariable("source") String source, AuthCallback callback, HttpServletRequest request, ModelMap mmap) {
|
||||
mmap.put("source", source);
|
||||
mmap.put("callback", callback);
|
||||
return "success/callback";
|
||||
}
|
||||
|
||||
/**
|
||||
* 回调结果
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@PostMapping("/auth/callback/{source}")
|
||||
public Object callbackAuth(@PathVariable("source") String source, AuthCallback callback, HttpServletRequest request) {
|
||||
ThirdAuthConfig.ThirdConfig _config = ThirdAuthConfig.getSourceConfig(source);
|
||||
if (_config == null) {
|
||||
return new ModelAndView("error/auth/support");
|
||||
}
|
||||
|
||||
// JSONObject json = JSONObject.parseObject(obj);
|
||||
AuthRequest authRequest = AuthUtils.getAuthRequest(source, _config.getAppId(), _config.getAgentId(), _config.getSecret(), _config.getCallBack(), authStateCache);
|
||||
AuthResponse<AuthUser> response = authRequest.login(callback);
|
||||
if (response.ok()) {
|
||||
if (SecurityUtils.getSubject() != null && SecurityUtils.getSubject().getPrincipal() != null) {
|
||||
SysUser user = userMapper.selectAuthUserByUuid(source + response.getData().getUuid());
|
||||
if (StringUtils.isNotNull(user)) {
|
||||
return new ModelAndView("error/auth/error");
|
||||
}
|
||||
// 若已经登录则直接绑定系统账号
|
||||
SysAuthUser authUser = new SysAuthUser();
|
||||
authUser.setAvatar(response.getData().getAvatar());
|
||||
authUser.setUuid(source + response.getData().getUuid());
|
||||
authUser.setUserId(ShiroUtils.getUserId());
|
||||
authUser.setUserName(response.getData().getNickname());
|
||||
authUser.setLoginName(response.getData().getUsername());
|
||||
authUser.setEmail(response.getData().getEmail());
|
||||
authUser.setSource(source);
|
||||
userMapper.insertAuthUser(authUser);
|
||||
return new ModelAndView("success/auth");
|
||||
}
|
||||
SysUser user = userMapper.selectAuthUserByUuid(source + response.getData().getUuid());
|
||||
if (StringUtils.isNotNull(user)) {
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
UserToken token = new UserToken(user.getLoginName(), LoginType.NOPASSWD);
|
||||
subject.login(token);
|
||||
return new ModelAndView("success/auth");
|
||||
} else {
|
||||
return new ModelAndView("error/auth/bind");
|
||||
}
|
||||
}
|
||||
return new ModelAndView("error/auth/unkown");
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否授权
|
||||
*/
|
||||
@PostMapping("/auth/checkAuthUser")
|
||||
@ResponseBody
|
||||
public AjaxResult checkAuthUser(SysAuthUser authUser) {
|
||||
Long userId = ShiroUtils.getUserId();
|
||||
String source = authUser.getSource();
|
||||
if (userMapper.checkAuthUser(userId, source) > 0) {
|
||||
return error(source + "平台账号已经绑定");
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消授权
|
||||
*/
|
||||
@PostMapping("/auth/unlock")
|
||||
@ResponseBody
|
||||
public AjaxResult unlockAuth(SysAuthUser authUser) {
|
||||
return toAjax(userMapper.deleteAuthUser(authUser.getAuthId()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import javax.annotation.Resource;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.google.code.kaptcha.Constants;
|
||||
import com.google.code.kaptcha.Producer;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
|
||||
/**
|
||||
* 图片验证码(支持算术形式)
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/captcha")
|
||||
public class SysCaptchaController extends BaseController
|
||||
{
|
||||
@Resource(name = "captchaProducer")
|
||||
private Producer captchaProducer;
|
||||
|
||||
@Resource(name = "captchaProducerMath")
|
||||
private Producer captchaProducerMath;
|
||||
|
||||
/**
|
||||
* 验证码生成
|
||||
*/
|
||||
@GetMapping(value = "/captchaImage")
|
||||
public ModelAndView getKaptchaImage(HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
ServletOutputStream out = null;
|
||||
try
|
||||
{
|
||||
HttpSession session = request.getSession();
|
||||
response.setDateHeader("Expires", 0);
|
||||
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
|
||||
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
|
||||
response.setHeader("Pragma", "no-cache");
|
||||
response.setContentType("image/jpeg");
|
||||
|
||||
String type = request.getParameter("type");
|
||||
String capStr = null;
|
||||
String code = null;
|
||||
BufferedImage bi = null;
|
||||
if ("math".equals(type))
|
||||
{
|
||||
String capText = captchaProducerMath.createText();
|
||||
capStr = capText.substring(0, capText.lastIndexOf("@"));
|
||||
code = capText.substring(capText.lastIndexOf("@") + 1);
|
||||
bi = captchaProducerMath.createImage(capStr);
|
||||
}
|
||||
else if ("char".equals(type))
|
||||
{
|
||||
capStr = code = captchaProducer.createText();
|
||||
bi = captchaProducer.createImage(capStr);
|
||||
}
|
||||
session.setAttribute(Constants.KAPTCHA_SESSION_KEY, code);
|
||||
out = response.getOutputStream();
|
||||
ImageIO.write(bi, "jpg", out);
|
||||
out.flush();
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (out != null)
|
||||
{
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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.ResponseBody;
|
||||
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.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.ShiroUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.SysConfig;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
|
||||
/**
|
||||
* 参数配置 信息操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/config")
|
||||
public class SysConfigController extends BaseController
|
||||
{
|
||||
private String prefix = "system/config";
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
@RequiresPermissions("system:config:view")
|
||||
@GetMapping()
|
||||
public String config()
|
||||
{
|
||||
return prefix + "/config";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询参数配置列表
|
||||
*/
|
||||
@RequiresPermissions("system:config:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysConfig config)
|
||||
{
|
||||
startPage();
|
||||
List<SysConfig> list = configService.selectConfigList(config);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("system:config:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(SysConfig config)
|
||||
{
|
||||
List<SysConfig> list = configService.selectConfigList(config);
|
||||
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
||||
return util.exportExcel(list, "参数数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增参数配置
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存参数配置
|
||||
*/
|
||||
@RequiresPermissions("system:config:add")
|
||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(@Validated SysConfig config)
|
||||
{
|
||||
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
||||
{
|
||||
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setCreateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(configService.insertConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改参数配置
|
||||
*/
|
||||
@GetMapping("/edit/{configId}")
|
||||
public String edit(@PathVariable("configId") Long configId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("config", configService.selectConfigById(configId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存参数配置
|
||||
*/
|
||||
@RequiresPermissions("system:config:edit")
|
||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(@Validated SysConfig config)
|
||||
{
|
||||
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
||||
{
|
||||
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(configService.updateConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除参数配置
|
||||
*/
|
||||
@RequiresPermissions("system:config:remove")
|
||||
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(configService.deleteConfigByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空缓存
|
||||
*/
|
||||
@RequiresPermissions("system:config:remove")
|
||||
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
||||
@GetMapping("/clearCache")
|
||||
@ResponseBody
|
||||
public AjaxResult clearCache()
|
||||
{
|
||||
configService.clearCache();
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验参数键名
|
||||
*/
|
||||
@PostMapping("/checkConfigKeyUnique")
|
||||
@ResponseBody
|
||||
public String checkConfigKeyUnique(SysConfig config)
|
||||
{
|
||||
return configService.checkConfigKeyUnique(config);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,211 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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.ResponseBody;
|
||||
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.Ztree;
|
||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.ShiroUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.service.ISysDeptService;
|
||||
|
||||
/**
|
||||
* 部门信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/dept")
|
||||
public class SysDeptController extends BaseController
|
||||
{
|
||||
private String prefix = "system/dept";
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@RequiresPermissions("system:dept:view")
|
||||
@GetMapping()
|
||||
public String dept()
|
||||
{
|
||||
return prefix + "/dept";
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:dept:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public List<SysDept> list(SysDept dept)
|
||||
{
|
||||
List<SysDept> deptList = deptService.selectDeptList(dept);
|
||||
return deptList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增部门
|
||||
*/
|
||||
@GetMapping("/add/{parentId}")
|
||||
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("dept", deptService.selectDeptById(parentId));
|
||||
mmap.put("leaders",userService.selectAllAvailableUserList(new SysUser()));
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存部门
|
||||
*/
|
||||
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||
@RequiresPermissions("system:dept:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(@Validated SysDept dept)
|
||||
{
|
||||
if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
||||
{
|
||||
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
}
|
||||
dept.setCreateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(deptService.insertDept(dept));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@GetMapping("/edit/{deptId}")
|
||||
public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap)
|
||||
{
|
||||
SysDept dept = deptService.selectDeptById(deptId);
|
||||
if (StringUtils.isNotNull(dept) && 100L == deptId)
|
||||
{
|
||||
dept.setParentName("无");
|
||||
}
|
||||
mmap.put("dept", dept);
|
||||
mmap.put("leaders",userService.selectAllAvailableUserList(new SysUser()));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:dept:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(@Validated SysDept dept)
|
||||
{
|
||||
if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
||||
{
|
||||
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
}
|
||||
else if (dept.getParentId().equals(dept.getDeptId()))
|
||||
{
|
||||
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||
}
|
||||
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
|
||||
&& deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0)
|
||||
{
|
||||
return AjaxResult.error("该部门包含未停用的子部门!");
|
||||
}
|
||||
dept.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(deptService.updateDept(dept));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
||||
@RequiresPermissions("system:dept:remove")
|
||||
@GetMapping("/remove/{deptId}")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(@PathVariable("deptId") Long deptId)
|
||||
{
|
||||
if (deptService.selectDeptCount(deptId) > 0)
|
||||
{
|
||||
return AjaxResult.warn("存在下级部门,不允许删除");
|
||||
}
|
||||
if (deptService.checkDeptExistUser(deptId))
|
||||
{
|
||||
return AjaxResult.warn("部门存在用户,不允许删除");
|
||||
}
|
||||
return toAjax(deptService.deleteDeptById(deptId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验部门名称
|
||||
*/
|
||||
@PostMapping("/checkDeptNameUnique")
|
||||
@ResponseBody
|
||||
public String checkDeptNameUnique(SysDept dept)
|
||||
{
|
||||
return deptService.checkDeptNameUnique(dept);
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择部门树
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @param excludeId 排除ID
|
||||
*/
|
||||
@GetMapping(value = { "/selectDeptTree/{deptId}", "/selectDeptTree/{deptId}/{excludeId}" })
|
||||
public String selectDeptTree(@PathVariable("deptId") Long deptId,
|
||||
@PathVariable(value = "excludeId", required = false) String excludeId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("dept", deptService.selectDeptById(deptId));
|
||||
mmap.put("excludeId", excludeId);
|
||||
return prefix + "/tree";
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载部门列表树
|
||||
*/
|
||||
@GetMapping("/treeData")
|
||||
@ResponseBody
|
||||
public List<Ztree> treeData()
|
||||
{
|
||||
List<Ztree> ztrees = deptService.selectDeptTree(new SysDept());
|
||||
return ztrees;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载部门列表树(排除下级)
|
||||
*/
|
||||
@GetMapping("/treeData/{excludeId}")
|
||||
@ResponseBody
|
||||
public List<Ztree> treeDataExcludeChild(@PathVariable(value = "excludeId", required = false) Long excludeId)
|
||||
{
|
||||
SysDept dept = new SysDept();
|
||||
dept.setDeptId(excludeId);
|
||||
List<Ztree> ztrees = deptService.selectDeptTreeExcludeChild(dept);
|
||||
return ztrees;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载角色部门(数据权限)列表树
|
||||
*/
|
||||
@GetMapping("/roleDeptTreeData")
|
||||
@ResponseBody
|
||||
public List<Ztree> deptTreeData(SysRole role)
|
||||
{
|
||||
List<Ztree> ztrees = deptService.roleDeptTreeData(role);
|
||||
return ztrees;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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.ResponseBody;
|
||||
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.ShiroUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.service.ISysDictDataService;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/dict/data")
|
||||
public class SysDictDataController extends BaseController
|
||||
{
|
||||
private String prefix = "system/dict/data";
|
||||
|
||||
@Autowired
|
||||
private ISysDictDataService dictDataService;
|
||||
|
||||
@RequiresPermissions("system:dict:view")
|
||||
@GetMapping()
|
||||
public String dictData()
|
||||
{
|
||||
return prefix + "/data";
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
@RequiresPermissions("system:dict:list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysDictData dictData)
|
||||
{
|
||||
startPage();
|
||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("system:dict:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(SysDictData dictData)
|
||||
{
|
||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
|
||||
return util.exportExcel(list, "字典数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@GetMapping("/add/{dictType}")
|
||||
public String add(@PathVariable("dictType") String dictType, ModelMap mmap)
|
||||
{
|
||||
mmap.put("dictType", dictType);
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存字典类型
|
||||
*/
|
||||
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
||||
@RequiresPermissions("system:dict:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(@Validated SysDictData dict)
|
||||
{
|
||||
dict.setCreateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(dictDataService.insertDictData(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典类型
|
||||
*/
|
||||
@GetMapping("/edit/{dictCode}")
|
||||
public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap)
|
||||
{
|
||||
mmap.put("dict", dictDataService.selectDictDataById(dictCode));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存字典类型
|
||||
*/
|
||||
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:dict:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(@Validated SysDictData dict)
|
||||
{
|
||||
dict.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(dictDataService.updateDictData(dict));
|
||||
}
|
||||
|
||||
@Log(title = "字典数据", businessType = BusinessType.DELETE)
|
||||
@RequiresPermissions("system:dict:remove")
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(dictDataService.deleteDictDataByIds(ids));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,188 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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.ResponseBody;
|
||||
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.Ztree;
|
||||
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.ShiroUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.service.ISysDictTypeService;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/dict")
|
||||
public class SysDictTypeController extends BaseController
|
||||
{
|
||||
private String prefix = "system/dict/type";
|
||||
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
|
||||
@RequiresPermissions("system:dict:view")
|
||||
@GetMapping()
|
||||
public String dictType()
|
||||
{
|
||||
return prefix + "/type";
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
@RequiresPermissions("system:dict:list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysDictType dictType)
|
||||
{
|
||||
startPage();
|
||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("system:dict:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(SysDictType dictType)
|
||||
{
|
||||
|
||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
||||
return util.exportExcel(list, "字典类型");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存字典类型
|
||||
*/
|
||||
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||
@RequiresPermissions("system:dict:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(@Validated SysDictType dict)
|
||||
{
|
||||
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
||||
{
|
||||
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setCreateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(dictTypeService.insertDictType(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典类型
|
||||
*/
|
||||
@GetMapping("/edit/{dictId}")
|
||||
public String edit(@PathVariable("dictId") Long dictId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存字典类型
|
||||
*/
|
||||
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:dict:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(@Validated SysDictType dict)
|
||||
{
|
||||
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
||||
{
|
||||
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(dictTypeService.updateDictType(dict));
|
||||
}
|
||||
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@RequiresPermissions("system:dict:remove")
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(dictTypeService.deleteDictTypeByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空缓存
|
||||
*/
|
||||
@RequiresPermissions("system:dict:remove")
|
||||
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
||||
@GetMapping("/clearCache")
|
||||
@ResponseBody
|
||||
public AjaxResult clearCache()
|
||||
{
|
||||
dictTypeService.clearCache();
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典详细
|
||||
*/
|
||||
@RequiresPermissions("system:dict:list")
|
||||
@GetMapping("/detail/{dictId}")
|
||||
public String detail(@PathVariable("dictId") Long dictId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
|
||||
mmap.put("dictList", dictTypeService.selectDictTypeAll());
|
||||
return "system/dict/data/data";
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验字典类型
|
||||
*/
|
||||
@PostMapping("/checkDictTypeUnique")
|
||||
@ResponseBody
|
||||
public String checkDictTypeUnique(SysDictType dictType)
|
||||
{
|
||||
return dictTypeService.checkDictTypeUnique(dictType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择字典树
|
||||
*/
|
||||
@GetMapping("/selectDictTree/{columnId}/{dictType}")
|
||||
public String selectDeptTree(@PathVariable("columnId") Long columnId, @PathVariable("dictType") String dictType,
|
||||
ModelMap mmap)
|
||||
{
|
||||
mmap.put("columnId", columnId);
|
||||
mmap.put("dict", dictTypeService.selectDictTypeByType(dictType));
|
||||
return prefix + "/tree";
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载字典列表树
|
||||
*/
|
||||
@GetMapping("/treeData")
|
||||
@ResponseBody
|
||||
public List<Ztree> treeData()
|
||||
{
|
||||
List<Ztree> ztrees = dictTypeService.selectDictTree(new SysDictType());
|
||||
return ztrees;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,212 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||
import com.ruoyi.common.utils.*;
|
||||
import com.ruoyi.framework.web.domain.server.Sys;
|
||||
import com.ruoyi.system.domain.IndexProjectStatusSumModel;
|
||||
import com.ruoyi.system.domain.IndexProjectSummaryModel;
|
||||
import com.ruoyi.system.domain.ProjectSumModel;
|
||||
import com.ruoyi.system.domain.UserLastWeekSumModel;
|
||||
import com.ruoyi.system.mapper.SystemReportMapper;
|
||||
import com.ruoyi.system.service.impl.TblProjectCostServiceImpl;
|
||||
import com.ruoyi.system.service.impl.TblProjectServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
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.ResponseBody;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.constant.ShiroConstants;
|
||||
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.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import com.ruoyi.system.service.ISysMenuService;
|
||||
import springfox.documentation.spring.web.json.Json;
|
||||
|
||||
/**
|
||||
* 首页 业务处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
public class SysIndexController extends BaseController {
|
||||
@Autowired
|
||||
private ISysMenuService menuService;
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
@Autowired
|
||||
private SysPasswordService passwordService;
|
||||
|
||||
@Autowired
|
||||
private SystemReportMapper systemReportMapper;
|
||||
|
||||
// 系统首页
|
||||
@GetMapping("/index")
|
||||
public String index(ModelMap mmap) {
|
||||
// 取身份信息
|
||||
SysUser user = ShiroUtils.getSysUser();
|
||||
// 根据用户id取出菜单
|
||||
List<SysMenu> menus = menuService.selectMenusByUser(user);
|
||||
mmap.put("menus", menus);
|
||||
mmap.put("user", user);
|
||||
mmap.put("sideTheme", configService.selectConfigByKey("sys.index.sideTheme"));
|
||||
mmap.put("skinName", configService.selectConfigByKey("sys.index.skinName"));
|
||||
mmap.put("ignoreFooter", configService.selectConfigByKey("sys.index.ignoreFooter"));
|
||||
mmap.put("copyrightYear", RuoYiConfig.getCopyrightYear());
|
||||
mmap.put("demoEnabled", RuoYiConfig.isDemoEnabled());
|
||||
mmap.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate()));
|
||||
mmap.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate()));
|
||||
|
||||
// 菜单导航显示风格
|
||||
String menuStyle = configService.selectConfigByKey("sys.index.menuStyle");
|
||||
// 移动端,默认使左侧导航菜单,否则取默认配置
|
||||
String indexStyle = ServletUtils.checkAgentIsMobile(ServletUtils.getRequest().getHeader("User-Agent")) ? "index" : menuStyle;
|
||||
|
||||
// 优先Cookie配置导航菜单
|
||||
Cookie[] cookies = ServletUtils.getRequest().getCookies();
|
||||
for (Cookie cookie : cookies) {
|
||||
if (StringUtils.isNotEmpty(cookie.getName()) && "nav-style".equalsIgnoreCase(cookie.getName())) {
|
||||
indexStyle = cookie.getValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
String webIndex = "topnav".equalsIgnoreCase(indexStyle) ? "index-topnav" : "index";
|
||||
return webIndex;
|
||||
}
|
||||
|
||||
// 锁定屏幕
|
||||
@GetMapping("/lockscreen")
|
||||
public String lockscreen(ModelMap mmap) {
|
||||
mmap.put("user", ShiroUtils.getSysUser());
|
||||
ServletUtils.getSession().setAttribute(ShiroConstants.LOCK_SCREEN, true);
|
||||
return "lock";
|
||||
}
|
||||
|
||||
// 解锁屏幕
|
||||
@PostMapping("/unlockscreen")
|
||||
@ResponseBody
|
||||
public AjaxResult unlockscreen(String password) {
|
||||
SysUser user = ShiroUtils.getSysUser();
|
||||
if (StringUtils.isNull(user)) {
|
||||
return AjaxResult.error("服务器超时,请重新登陆");
|
||||
}
|
||||
if (passwordService.matches(user, password)) {
|
||||
ServletUtils.getSession().removeAttribute(ShiroConstants.LOCK_SCREEN);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error("密码不正确,请重新输入。");
|
||||
}
|
||||
|
||||
// 切换主题
|
||||
@GetMapping("/system/switchSkin")
|
||||
public String switchSkin() {
|
||||
return "skin";
|
||||
}
|
||||
|
||||
// 切换菜单
|
||||
@GetMapping("/system/menuStyle/{style}")
|
||||
public void menuStyle(@PathVariable String style, HttpServletResponse response) {
|
||||
CookieUtils.setCookie(response, "nav-style", style);
|
||||
}
|
||||
|
||||
// 系统介绍
|
||||
@GetMapping("/system/main")
|
||||
public String main(ModelMap mmap) {
|
||||
//依据权限显示不同的首页
|
||||
if(!ShiroUtils.isPermitted("system:index:summary")){
|
||||
return "main/blank";
|
||||
}
|
||||
|
||||
|
||||
mmap.put("version", RuoYiConfig.getVersion());
|
||||
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Calendar scb = Calendar.getInstance();
|
||||
scb.setTime(new Date());
|
||||
int dow = scb.get(Calendar.DAY_OF_WEEK);
|
||||
boolean showThisWeek = false;
|
||||
if (dow == Calendar.FRIDAY || dow == Calendar.SATURDAY) { //周五、周六显示当周统计
|
||||
showThisWeek = true;
|
||||
}
|
||||
Calendar sc = Calendar.getInstance();
|
||||
sc.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
|
||||
sc.add(Calendar.DAY_OF_MONTH, showThisWeek ? -7 : -14);
|
||||
Date sd = sc.getTime();
|
||||
Calendar ec = Calendar.getInstance();
|
||||
ec.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
|
||||
ec.add(Calendar.DAY_OF_MONTH, showThisWeek ? 0 : -7);
|
||||
Date ed = ec.getTime();
|
||||
ec.add(Calendar.DATE, -1);
|
||||
Date showED = ec.getTime();
|
||||
String sdStr = format.format(sd);
|
||||
String edStr = format.format(ed);
|
||||
String showEDStr = format.format(showED);
|
||||
UserLastWeekSumModel lastWeekSum = systemReportMapper.selectUserLastWeekSummary(sdStr, edStr);
|
||||
List<ProjectSumModel> lastWeekProjectSum = systemReportMapper.selectProjectLastWeekSummary(sdStr, edStr, true);
|
||||
List<ProjectSumModel> projectSummary = systemReportMapper.selectProjectCostSummary(true);
|
||||
List<IndexProjectStatusSumModel> projectSum = systemReportMapper.selectProjectSummaryByStatus();
|
||||
List<SysDictData> projectStatus = DictUtils.getDictCache("project_status");
|
||||
List<IndexProjectSummaryModel> indexProjectSum = new ArrayList<IndexProjectSummaryModel>();
|
||||
Long projectCount = (long) 0;
|
||||
if (projectStatus != null) {
|
||||
for (SysDictData dic : projectStatus) {
|
||||
IndexProjectSummaryModel sum = new IndexProjectSummaryModel();
|
||||
sum.setName(dic.getDictLabel());
|
||||
Optional<IndexProjectStatusSumModel> res = projectSum.stream().filter(x ->
|
||||
x.getStatusCode().equals(dic.getDictValue())
|
||||
).findFirst();
|
||||
if (res.isPresent()) {
|
||||
sum.setCount(res.get().getCount());
|
||||
} else {
|
||||
sum.setCount((long) 0);
|
||||
}
|
||||
projectCount += sum.getCount();
|
||||
indexProjectSum.add(sum);
|
||||
}
|
||||
}
|
||||
mmap.put("startDate", sdStr);
|
||||
mmap.put("endDate", showEDStr);
|
||||
mmap.put("lastWeekSum", lastWeekSum);
|
||||
mmap.put("projectCount", projectCount);
|
||||
mmap.put("indexProjectSum", indexProjectSum);
|
||||
mmap.put("lastWeekProjectSum", lastWeekProjectSum);
|
||||
mmap.put("projectSummary", projectSummary);
|
||||
// mmap.put("lastWeekProjectSum", JSON.toJSONString(lastWeekProjectSum));
|
||||
return "main";
|
||||
}
|
||||
|
||||
// 检查初始密码是否提醒修改
|
||||
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,83 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.framework.shiro.auth.LoginType;
|
||||
import com.ruoyi.framework.shiro.auth.UserToken;
|
||||
import com.ruoyi.framework.web.service.ConfigService;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
public class SysLoginController extends BaseController
|
||||
{
|
||||
/**
|
||||
* 是否开启记住我功能
|
||||
*/
|
||||
@Value("${shiro.rememberMe.enabled: false}")
|
||||
private boolean rememberMe;
|
||||
|
||||
@Autowired
|
||||
private ConfigService configService;
|
||||
@GetMapping("/login")
|
||||
public String login(HttpServletRequest request, HttpServletResponse response, ModelMap mmap)
|
||||
{
|
||||
// 如果是Ajax请求,返回Json字符串。
|
||||
if (ServletUtils.isAjaxRequest(request))
|
||||
{
|
||||
return ServletUtils.renderString(response, "{\"code\":\"600\",\"msg\":\"未登录或登录超时。请重新登录\"}");
|
||||
}
|
||||
// // 是否开启记住我
|
||||
// mmap.put("isRemembered", rememberMe);
|
||||
// // 是否开启用户注册
|
||||
// mmap.put("isAllowRegister", configService.getKey("sys.account.registerUser"));
|
||||
return "login";
|
||||
}
|
||||
|
||||
@PostMapping("/login")
|
||||
@ResponseBody
|
||||
public AjaxResult ajaxLogin(String username, String password, Boolean rememberMe)
|
||||
{
|
||||
UserToken token = new UserToken(username, password, LoginType.PASSWORD, rememberMe);
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
try
|
||||
{
|
||||
subject.login(token);
|
||||
return success();
|
||||
}
|
||||
catch (AuthenticationException e)
|
||||
{
|
||||
String msg = "用户或密码错误";
|
||||
if (StringUtils.isNotEmpty(e.getMessage()))
|
||||
{
|
||||
msg = e.getMessage();
|
||||
}
|
||||
return error(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/unauth")
|
||||
public String unauth()
|
||||
{
|
||||
return "error/unauth";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,197 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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.ResponseBody;
|
||||
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.Ztree;
|
||||
import com.ruoyi.common.core.domain.entity.SysMenu;
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.ShiroUtils;
|
||||
import com.ruoyi.framework.shiro.util.AuthorizationUtils;
|
||||
import com.ruoyi.system.service.ISysMenuService;
|
||||
|
||||
/**
|
||||
* 菜单信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/menu")
|
||||
public class SysMenuController extends BaseController
|
||||
{
|
||||
private String prefix = "system/menu";
|
||||
|
||||
@Autowired
|
||||
private ISysMenuService menuService;
|
||||
|
||||
@RequiresPermissions("system:menu:view")
|
||||
@GetMapping()
|
||||
public String menu()
|
||||
{
|
||||
return prefix + "/menu";
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:menu:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public List<SysMenu> list(SysMenu menu)
|
||||
{
|
||||
Long userId = ShiroUtils.getUserId();
|
||||
List<SysMenu> menuList = menuService.selectMenuList(menu, userId);
|
||||
return menuList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
*/
|
||||
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
|
||||
@RequiresPermissions("system:menu:remove")
|
||||
@GetMapping("/remove/{menuId}")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(@PathVariable("menuId") Long menuId)
|
||||
{
|
||||
if (menuService.selectCountMenuByParentId(menuId) > 0)
|
||||
{
|
||||
return AjaxResult.warn("存在子菜单,不允许删除");
|
||||
}
|
||||
if (menuService.selectCountRoleMenuByMenuId(menuId) > 0)
|
||||
{
|
||||
return AjaxResult.warn("菜单已分配,不允许删除");
|
||||
}
|
||||
AuthorizationUtils.clearAllCachedAuthorizationInfo();
|
||||
return toAjax(menuService.deleteMenuById(menuId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@GetMapping("/add/{parentId}")
|
||||
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
|
||||
{
|
||||
SysMenu menu = null;
|
||||
if (0L != parentId)
|
||||
{
|
||||
menu = menuService.selectMenuById(parentId);
|
||||
}
|
||||
else
|
||||
{
|
||||
menu = new SysMenu();
|
||||
menu.setMenuId(0L);
|
||||
menu.setMenuName("主目录");
|
||||
}
|
||||
mmap.put("menu", menu);
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存菜单
|
||||
*/
|
||||
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
||||
@RequiresPermissions("system:menu:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(@Validated SysMenu menu)
|
||||
{
|
||||
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
||||
{
|
||||
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
}
|
||||
menu.setCreateBy(ShiroUtils.getLoginName());
|
||||
AuthorizationUtils.clearAllCachedAuthorizationInfo();
|
||||
return toAjax(menuService.insertMenu(menu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜单
|
||||
*/
|
||||
@GetMapping("/edit/{menuId}")
|
||||
public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("menu", menuService.selectMenuById(menuId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存菜单
|
||||
*/
|
||||
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:menu:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(@Validated SysMenu menu)
|
||||
{
|
||||
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
||||
{
|
||||
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
}
|
||||
menu.setUpdateBy(ShiroUtils.getLoginName());
|
||||
AuthorizationUtils.clearAllCachedAuthorizationInfo();
|
||||
return toAjax(menuService.updateMenu(menu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择菜单图标
|
||||
*/
|
||||
@GetMapping("/icon")
|
||||
public String icon()
|
||||
{
|
||||
return prefix + "/icon";
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验菜单名称
|
||||
*/
|
||||
@PostMapping("/checkMenuNameUnique")
|
||||
@ResponseBody
|
||||
public String checkMenuNameUnique(SysMenu menu)
|
||||
{
|
||||
return menuService.checkMenuNameUnique(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载角色菜单列表树
|
||||
*/
|
||||
@GetMapping("/roleMenuTreeData")
|
||||
@ResponseBody
|
||||
public List<Ztree> roleMenuTreeData(SysRole role)
|
||||
{
|
||||
Long userId = ShiroUtils.getUserId();
|
||||
List<Ztree> ztrees = menuService.roleMenuTreeData(role, userId);
|
||||
return ztrees;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载所有菜单列表树
|
||||
*/
|
||||
@GetMapping("/menuTreeData")
|
||||
@ResponseBody
|
||||
public List<Ztree> menuTreeData()
|
||||
{
|
||||
Long userId = ShiroUtils.getUserId();
|
||||
List<Ztree> ztrees = menuService.menuTreeData(userId);
|
||||
return ztrees;
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择菜单树
|
||||
*/
|
||||
@GetMapping("/selectMenuTree/{menuId}")
|
||||
public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("menu", menuService.selectMenuById(menuId));
|
||||
return prefix + "/tree";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
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.ResponseBody;
|
||||
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.ShiroUtils;
|
||||
import com.ruoyi.system.domain.SysNotice;
|
||||
import com.ruoyi.system.service.ISysNoticeService;
|
||||
|
||||
/**
|
||||
* 公告 信息操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/notice")
|
||||
public class SysNoticeController extends BaseController
|
||||
{
|
||||
private String prefix = "system/notice";
|
||||
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
|
||||
@RequiresPermissions("system:notice:view")
|
||||
@GetMapping()
|
||||
public String notice()
|
||||
{
|
||||
return prefix + "/notice";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询公告列表
|
||||
*/
|
||||
@RequiresPermissions("system:notice:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysNotice notice)
|
||||
{
|
||||
startPage();
|
||||
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增公告
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存公告
|
||||
*/
|
||||
@RequiresPermissions("system:notice:add")
|
||||
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(SysNotice notice)
|
||||
{
|
||||
notice.setCreateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(noticeService.insertNotice(notice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改公告
|
||||
*/
|
||||
@GetMapping("/edit/{noticeId}")
|
||||
public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("notice", noticeService.selectNoticeById(noticeId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存公告
|
||||
*/
|
||||
@RequiresPermissions("system:notice:edit")
|
||||
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(SysNotice notice)
|
||||
{
|
||||
notice.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(noticeService.updateNotice(notice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除公告
|
||||
*/
|
||||
@RequiresPermissions("system:notice:remove")
|
||||
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(noticeService.deleteNoticeByIds(ids));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,163 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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.ResponseBody;
|
||||
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.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.ShiroUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.SysPost;
|
||||
import com.ruoyi.system.service.ISysPostService;
|
||||
|
||||
/**
|
||||
* 岗位信息操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/post")
|
||||
public class SysPostController extends BaseController
|
||||
{
|
||||
private String prefix = "system/post";
|
||||
|
||||
@Autowired
|
||||
private ISysPostService postService;
|
||||
|
||||
@RequiresPermissions("system:post:view")
|
||||
@GetMapping()
|
||||
public String operlog()
|
||||
{
|
||||
return prefix + "/post";
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:post:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysPost post)
|
||||
{
|
||||
startPage();
|
||||
List<SysPost> list = postService.selectPostList(post);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("system:post:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(SysPost post)
|
||||
{
|
||||
List<SysPost> list = postService.selectPostList(post);
|
||||
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
|
||||
return util.exportExcel(list, "岗位数据");
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:post:remove")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
try
|
||||
{
|
||||
return toAjax(postService.deletePostByIds(ids));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增岗位
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存岗位
|
||||
*/
|
||||
@RequiresPermissions("system:post:add")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(@Validated SysPost post)
|
||||
{
|
||||
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
||||
{
|
||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
}
|
||||
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
||||
{
|
||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
post.setCreateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(postService.insertPost(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改岗位
|
||||
*/
|
||||
@GetMapping("/edit/{postId}")
|
||||
public String edit(@PathVariable("postId") Long postId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("post", postService.selectPostById(postId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存岗位
|
||||
*/
|
||||
@RequiresPermissions("system:post:edit")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(@Validated SysPost post)
|
||||
{
|
||||
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
||||
{
|
||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
}
|
||||
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
||||
{
|
||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
post.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(postService.updatePost(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验岗位名称
|
||||
*/
|
||||
@PostMapping("/checkPostNameUnique")
|
||||
@ResponseBody
|
||||
public String checkPostNameUnique(SysPost post)
|
||||
{
|
||||
return postService.checkPostNameUnique(post);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验岗位编码
|
||||
*/
|
||||
@PostMapping("/checkPostCodeUnique")
|
||||
@ResponseBody
|
||||
public String checkPostCodeUnique(SysPost post)
|
||||
{
|
||||
return postService.checkPostCodeUnique(post);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,194 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import com.ruoyi.common.config.ThirdAuthConfig;
|
||||
import com.ruoyi.system.domain.CntSettleSummaryModel;
|
||||
import com.ruoyi.system.domain.SysAuthUser;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
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.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.ShiroUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 个人信息 业务处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/user/profile")
|
||||
public class SysProfileController extends BaseController {
|
||||
private static final Logger log = LoggerFactory.getLogger(SysProfileController.class);
|
||||
|
||||
private String prefix = "system/user/profile";
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private SysPasswordService passwordService;
|
||||
|
||||
/**
|
||||
* 个人信息
|
||||
*/
|
||||
@GetMapping()
|
||||
public String profile(ModelMap mmap) {
|
||||
SysUser user = ShiroUtils.getSysUser();
|
||||
mmap.put("user", user);
|
||||
mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId()));
|
||||
mmap.put("postGroup", userService.selectUserPostGroup(user.getUserId()));
|
||||
List<SysAuthUser> authUsers = userService.selectAuthUserListByUserId(user.getUserId());
|
||||
String[] sources = ThirdAuthConfig.getSupportSources();
|
||||
List<Object> userAuths = new ArrayList<Object>();
|
||||
for (String i : sources) {
|
||||
Optional<SysAuthUser> authOpt = authUsers.stream().filter(x -> x.getSource().equals(i)).findFirst();
|
||||
Boolean hasBind = false;
|
||||
Long authId = (long) 0;
|
||||
if (authOpt.isPresent()) {
|
||||
hasBind = true;
|
||||
SysAuthUser auth = authOpt.get();
|
||||
authId = auth.getAuthId();
|
||||
}
|
||||
Boolean finalHasBind = hasBind;
|
||||
Long finalAuthId = authId;
|
||||
Object authInfo = new Object() {
|
||||
public String source = i;
|
||||
public Boolean hasBind = finalHasBind;
|
||||
public Long authId = finalAuthId;
|
||||
};
|
||||
userAuths.add(authInfo);
|
||||
}
|
||||
mmap.put("userAuths", userAuths);
|
||||
return prefix + "/profile";
|
||||
}
|
||||
|
||||
@GetMapping("/checkPassword")
|
||||
@ResponseBody
|
||||
public boolean checkPassword(String password) {
|
||||
SysUser user = ShiroUtils.getSysUser();
|
||||
if (passwordService.matches(user, password)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@GetMapping("/resetPwd")
|
||||
public String resetPwd(ModelMap mmap) {
|
||||
SysUser user = ShiroUtils.getSysUser();
|
||||
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||
return prefix + "/resetPwd";
|
||||
}
|
||||
|
||||
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/resetPwd")
|
||||
@ResponseBody
|
||||
public AjaxResult resetPwd(String oldPassword, String newPassword) {
|
||||
SysUser user = ShiroUtils.getSysUser();
|
||||
// boolean checks = passwordService.checks(newPassword);
|
||||
// if (!checks){
|
||||
// return error("密码校验规则不正确");
|
||||
// }
|
||||
if (!passwordService.matches(user, oldPassword)) {
|
||||
return error("修改密码失败,旧密码错误");
|
||||
}
|
||||
if (passwordService.matches(user, newPassword)) {
|
||||
return error("新密码不能与旧密码相同");
|
||||
}
|
||||
user.setSalt(ShiroUtils.randomSalt());
|
||||
user.setPassword(passwordService.encryptPassword(user.getLoginName(), newPassword, user.getSalt()));
|
||||
user.setPwdUpdateDate(DateUtils.getNowDate());
|
||||
if (userService.resetUserPwd(user) > 0) {
|
||||
ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
|
||||
return success();
|
||||
}
|
||||
return error("修改密码异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@GetMapping("/edit")
|
||||
public String edit(ModelMap mmap) {
|
||||
SysUser user = ShiroUtils.getSysUser();
|
||||
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改头像
|
||||
*/
|
||||
@GetMapping("/avatar")
|
||||
public String avatar(ModelMap mmap) {
|
||||
SysUser user = ShiroUtils.getSysUser();
|
||||
mmap.put("user", userService.selectUserById(user.getUserId()));
|
||||
return prefix + "/avatar";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
@ResponseBody
|
||||
public AjaxResult update(SysUser user) {
|
||||
SysUser currentUser = ShiroUtils.getSysUser();
|
||||
currentUser.setUserName(user.getUserName());
|
||||
currentUser.setEmail(user.getEmail());
|
||||
currentUser.setPhonenumber(user.getPhonenumber());
|
||||
currentUser.setSex(user.getSex());
|
||||
if (userService.updateUserInfo(currentUser) > 0) {
|
||||
ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId()));
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存头像
|
||||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/updateAvatar")
|
||||
@ResponseBody
|
||||
public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file) {
|
||||
SysUser currentUser = ShiroUtils.getSysUser();
|
||||
try {
|
||||
if (!file.isEmpty()) {
|
||||
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file);
|
||||
currentUser.setAvatar(avatar);
|
||||
if (userService.updateUserInfo(currentUser) > 0) {
|
||||
ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId()));
|
||||
return success();
|
||||
}
|
||||
}
|
||||
return error();
|
||||
} catch (Exception e) {
|
||||
log.error("修改头像失败!", e);
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Log(title = "第三方绑定", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/removeauth")
|
||||
@ResponseBody
|
||||
public AjaxResult removeAuth(@RequestBody Long id) {
|
||||
return toAjax(userService.deleteAuthUser(id));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
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.framework.shiro.service.SysRegisterService;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
|
||||
/**
|
||||
* 注册验证
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
public class SysRegisterController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private SysRegisterService registerService;
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
@GetMapping("/register")
|
||||
public String register()
|
||||
{
|
||||
return "register";
|
||||
}
|
||||
|
||||
@PostMapping("/register")
|
||||
@ResponseBody
|
||||
public AjaxResult ajaxRegister(SysUser 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,298 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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.ResponseBody;
|
||||
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.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.ShiroUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.shiro.util.AuthorizationUtils;
|
||||
import com.ruoyi.system.domain.SysUserRole;
|
||||
import com.ruoyi.system.service.ISysRoleService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
|
||||
/**
|
||||
* 角色信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/role")
|
||||
public class SysRoleController extends BaseController
|
||||
{
|
||||
private String prefix = "system/role";
|
||||
|
||||
@Autowired
|
||||
private ISysRoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@RequiresPermissions("system:role:view")
|
||||
@GetMapping()
|
||||
public String role()
|
||||
{
|
||||
return prefix + "/role";
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:role:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysRole role)
|
||||
{
|
||||
startPage();
|
||||
List<SysRole> list = roleService.selectRoleList(role);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("system:role:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(SysRole role)
|
||||
{
|
||||
List<SysRole> list = roleService.selectRoleList(role);
|
||||
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
|
||||
return util.exportExcel(list, "角色数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增角色
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存角色
|
||||
*/
|
||||
@RequiresPermissions("system:role:add")
|
||||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(@Validated SysRole role)
|
||||
{
|
||||
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
||||
{
|
||||
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
}
|
||||
else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
||||
{
|
||||
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}
|
||||
role.setCreateBy(ShiroUtils.getLoginName());
|
||||
AuthorizationUtils.clearAllCachedAuthorizationInfo();
|
||||
return toAjax(roleService.insertRole(role));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改角色
|
||||
*/
|
||||
@GetMapping("/edit/{roleId}")
|
||||
public String edit(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("role", roleService.selectRoleById(roleId));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存角色
|
||||
*/
|
||||
@RequiresPermissions("system:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(@Validated SysRole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
||||
{
|
||||
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
}
|
||||
else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
||||
{
|
||||
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}
|
||||
role.setUpdateBy(ShiroUtils.getLoginName());
|
||||
AuthorizationUtils.clearAllCachedAuthorizationInfo();
|
||||
return toAjax(roleService.updateRole(role));
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色分配数据权限
|
||||
*/
|
||||
@GetMapping("/authDataScope/{roleId}")
|
||||
public String authDataScope(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("role", roleService.selectRoleById(roleId));
|
||||
return prefix + "/dataScope";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存角色分配数据权限
|
||||
*/
|
||||
@RequiresPermissions("system:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/authDataScope")
|
||||
@ResponseBody
|
||||
public AjaxResult authDataScopeSave(SysRole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
role.setUpdateBy(ShiroUtils.getLoginName());
|
||||
if (roleService.authDataScope(role) > 0)
|
||||
{
|
||||
ShiroUtils.setSysUser(userService.selectUserById(ShiroUtils.getSysUser().getUserId()));
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:role:remove")
|
||||
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(roleService.deleteRoleByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验角色名称
|
||||
*/
|
||||
@PostMapping("/checkRoleNameUnique")
|
||||
@ResponseBody
|
||||
public String checkRoleNameUnique(SysRole role)
|
||||
{
|
||||
return roleService.checkRoleNameUnique(role);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验角色权限
|
||||
*/
|
||||
@PostMapping("/checkRoleKeyUnique")
|
||||
@ResponseBody
|
||||
public String checkRoleKeyUnique(SysRole role)
|
||||
{
|
||||
return roleService.checkRoleKeyUnique(role);
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择菜单树
|
||||
*/
|
||||
@GetMapping("/selectMenuTree")
|
||||
public String selectMenuTree()
|
||||
{
|
||||
return prefix + "/tree";
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色状态修改
|
||||
*/
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:role:edit")
|
||||
@PostMapping("/changeStatus")
|
||||
@ResponseBody
|
||||
public AjaxResult changeStatus(SysRole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
return toAjax(roleService.changeStatus(role));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分配用户
|
||||
*/
|
||||
@RequiresPermissions("system:role:edit")
|
||||
@GetMapping("/authUser/{roleId}")
|
||||
public String authUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("role", roleService.selectRoleById(roleId));
|
||||
return prefix + "/authUser";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询已分配用户角色列表
|
||||
*/
|
||||
@RequiresPermissions("system:role:list")
|
||||
@PostMapping("/authUser/allocatedList")
|
||||
@ResponseBody
|
||||
public TableDataInfo allocatedList(SysUser user)
|
||||
{
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectAllocatedList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消授权
|
||||
*/
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PostMapping("/authUser/cancel")
|
||||
@ResponseBody
|
||||
public AjaxResult cancelAuthUser(SysUserRole userRole)
|
||||
{
|
||||
return toAjax(roleService.deleteAuthUser(userRole));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量取消授权
|
||||
*/
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PostMapping("/authUser/cancelAll")
|
||||
@ResponseBody
|
||||
public AjaxResult cancelAuthUserAll(Long roleId, String userIds)
|
||||
{
|
||||
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择用户
|
||||
*/
|
||||
@GetMapping("/authUser/selectUser/{roleId}")
|
||||
public String selectUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
|
||||
{
|
||||
mmap.put("role", roleService.selectRoleById(roleId));
|
||||
return prefix + "/selectUser";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询未分配用户角色列表
|
||||
*/
|
||||
@RequiresPermissions("system:role:list")
|
||||
@PostMapping("/authUser/unallocatedList")
|
||||
@ResponseBody
|
||||
public TableDataInfo unallocatedList(SysUser user)
|
||||
{
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectUnallocatedList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量选择用户授权
|
||||
*/
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PostMapping("/authUser/selectAll")
|
||||
@ResponseBody
|
||||
public AjaxResult selectAuthUserAll(Long roleId, String userIds)
|
||||
{
|
||||
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,297 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
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.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.ShiroUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||
import com.ruoyi.system.service.ISysPostService;
|
||||
import com.ruoyi.system.service.ISysRoleService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import com.ruoyi.system.service.ITblProjectService;
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/system/user")
|
||||
public class SysUserController extends BaseController {
|
||||
private String prefix = "system/user";
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private ISysRoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private ISysPostService postService;
|
||||
|
||||
@Autowired
|
||||
private SysPasswordService passwordService;
|
||||
|
||||
@Autowired
|
||||
private ITblProjectService projectService;
|
||||
|
||||
@RequiresPermissions("system:user:view")
|
||||
@GetMapping()
|
||||
public String user() {
|
||||
return prefix + "/user";
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:user:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(SysUser user) {
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectUserList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("system:user:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(SysUser user) {
|
||||
List<SysUser> list = userService.selectUserList(user);
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
return util.exportExcel(list, "用户数据");
|
||||
}
|
||||
|
||||
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||
@RequiresPermissions("system:user:import")
|
||||
@PostMapping("/importData")
|
||||
@ResponseBody
|
||||
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 = ShiroUtils.getSysUser().getLoginName();
|
||||
String message = userService.importUser(userList, updateSupport, operName);
|
||||
return AjaxResult.success(message);
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:user:view")
|
||||
@GetMapping("/importTemplate")
|
||||
@ResponseBody
|
||||
public AjaxResult importTemplate() {
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
return util.importTemplateExcel("用户数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add(ModelMap mmap) {
|
||||
mmap.put("roles", roleService.selectRoleAll().stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||
mmap.put("posts", postService.selectPostAll());
|
||||
mmap.put("mgtusers",userService.selectAllAvailableUserList(new SysUser()));
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存用户
|
||||
*/
|
||||
@RequiresPermissions("system:user:add")
|
||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(@Validated SysUser user) {
|
||||
if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user.getLoginName()))) {
|
||||
return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||
&& UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
|
||||
return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getEmail())
|
||||
&& UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user))) {
|
||||
return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
|
||||
// boolean checks = passwordService.checks(user.getPassword());
|
||||
// if (!checks){
|
||||
// return error("密码校验规则不正确");
|
||||
// }
|
||||
|
||||
user.setSalt(ShiroUtils.randomSalt());
|
||||
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
||||
user.setCreateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(userService.insertUser(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@GetMapping("/edit/{userId}")
|
||||
public String edit(@PathVariable("userId") Long userId, ModelMap mmap) {
|
||||
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
||||
mmap.put("user", userService.selectUserById(userId));
|
||||
mmap.put("roles", SysUser.isAdmin(userId) ? roles
|
||||
: roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||
mmap.put("posts", postService.selectPostsByUserId(userId));
|
||||
mmap.put("mgtusers",userService.selectAllAvailableUserList(new SysUser()));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存用户
|
||||
*/
|
||||
@RequiresPermissions("system:user:edit")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(@Validated SysUser user) {
|
||||
userService.checkUserAllowed(user);
|
||||
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||
&& UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
|
||||
return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getEmail())
|
||||
&& UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user))) {
|
||||
return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setUpdateBy(ShiroUtils.getLoginName());
|
||||
return toAjax(userService.updateUser(user));
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:user:resetPwd")
|
||||
@GetMapping("/resetPwd/{userId}")
|
||||
public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap) {
|
||||
mmap.put("user", userService.selectUserById(userId));
|
||||
return prefix + "/resetPwd";
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:user:resetPwd")
|
||||
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/resetPwd")
|
||||
@ResponseBody
|
||||
public AjaxResult resetPwdSave(SysUser user) {
|
||||
userService.checkUserAllowed(user);
|
||||
// boolean checks = passwordService.checks(user.getPassword());
|
||||
// if (!checks){
|
||||
// return error("密码校验规则不正确");
|
||||
// }
|
||||
user.setSalt(ShiroUtils.randomSalt());
|
||||
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
||||
if (userService.resetUserPwd(user) > 0) {
|
||||
if (ShiroUtils.getUserId().longValue() == user.getUserId().longValue()) {
|
||||
ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
|
||||
}
|
||||
return success();
|
||||
}
|
||||
return error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入授权角色页
|
||||
*/
|
||||
@GetMapping("/authRole/{userId}")
|
||||
public String authRole(@PathVariable("userId") Long userId, ModelMap mmap) {
|
||||
SysUser user = userService.selectUserById(userId);
|
||||
// 获取用户所属的角色列表
|
||||
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
||||
mmap.put("user", user);
|
||||
mmap.put("roles", SysUser.isAdmin(userId) ? roles
|
||||
: roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||
return prefix + "/authRole";
|
||||
}
|
||||
|
||||
@GetMapping("/authProject/{userId}")
|
||||
public String authProject(@PathVariable("userId") Long userId, ModelMap mmap) {
|
||||
SysUser user = userService.selectUserById(userId);
|
||||
// 获取用户所属的角色列表
|
||||
mmap.put("user", user);
|
||||
mmap.put("project", projectService.selectTblUserProjectList(userId));
|
||||
return prefix + "/authProject";
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户授权角色
|
||||
*/
|
||||
@RequiresPermissions("system:user:add")
|
||||
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
||||
@PostMapping("/authRole/insertAuthRole")
|
||||
@ResponseBody
|
||||
public AjaxResult insertAuthRole(Long userId, Long[] roleIds) {
|
||||
userService.insertUserAuth(userId, roleIds);
|
||||
return success();
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:user:add")
|
||||
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
||||
@PostMapping("/authProject/insert")
|
||||
@ResponseBody
|
||||
public AjaxResult insertAuthProject(Long userId, String[] mine) {
|
||||
projectService.insertAuthProject(userId, mine);
|
||||
return success();
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:user:remove")
|
||||
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids) {
|
||||
return toAjax(userService.deleteUserByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验用户名
|
||||
*/
|
||||
@PostMapping("/checkLoginNameUnique")
|
||||
@ResponseBody
|
||||
public String checkLoginNameUnique(SysUser user) {
|
||||
return userService.checkLoginNameUnique(user.getLoginName());
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验手机号码
|
||||
*/
|
||||
@PostMapping("/checkPhoneUnique")
|
||||
@ResponseBody
|
||||
public String checkPhoneUnique(SysUser user) {
|
||||
return userService.checkPhoneUnique(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验email邮箱
|
||||
*/
|
||||
@PostMapping("/checkEmailUnique")
|
||||
@ResponseBody
|
||||
public String checkEmailUnique(SysUser user) {
|
||||
return userService.checkEmailUnique(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户状态修改
|
||||
*/
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@RequiresPermissions("system:user:edit")
|
||||
@PostMapping("/changeStatus")
|
||||
@ResponseBody
|
||||
public AjaxResult changeStatus(SysUser user) {
|
||||
userService.checkUserAllowed(user);
|
||||
return toAjax(userService.changeStatus(user));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.ruoyi.web.controller.tool;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
|
||||
/**
|
||||
* build 表单构建
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/tool/build")
|
||||
public class BuildController extends BaseController
|
||||
{
|
||||
private String prefix = "tool/build";
|
||||
|
||||
@RequiresPermissions("tool:build:view")
|
||||
@GetMapping()
|
||||
public String build()
|
||||
{
|
||||
return prefix + "/build";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.ruoyi.web.controller.tool;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
|
||||
/**
|
||||
* swagger 接口
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/tool/swagger")
|
||||
public class SwaggerController extends BaseController
|
||||
{
|
||||
@RequiresPermissions("tool:swagger:view")
|
||||
@GetMapping()
|
||||
public String index()
|
||||
{
|
||||
return redirect("/swagger-ui.html");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,175 @@
|
|||
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.RequestMapping;
|
||||
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.utils.StringUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
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 AjaxResult userList()
|
||||
{
|
||||
List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
|
||||
return AjaxResult.success(userList);
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户详细")
|
||||
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
|
||||
@GetMapping("/{userId}")
|
||||
public AjaxResult getUser(@PathVariable Integer userId)
|
||||
{
|
||||
if (!users.isEmpty() && users.containsKey(userId))
|
||||
{
|
||||
return AjaxResult.success(users.get(userId));
|
||||
}
|
||||
else
|
||||
{
|
||||
return error("用户不存在");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("新增用户")
|
||||
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
|
||||
@PostMapping("/save")
|
||||
public AjaxResult save(UserEntity user)
|
||||
{
|
||||
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
||||
{
|
||||
return error("用户ID不能为空");
|
||||
}
|
||||
return AjaxResult.success(users.put(user.getUserId(), user));
|
||||
}
|
||||
|
||||
@ApiOperation("更新用户")
|
||||
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
|
||||
@PutMapping("/update")
|
||||
public AjaxResult update(UserEntity user)
|
||||
{
|
||||
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
||||
{
|
||||
return error("用户ID不能为空");
|
||||
}
|
||||
if (users.isEmpty() || !users.containsKey(user.getUserId()))
|
||||
{
|
||||
return error("用户不存在");
|
||||
}
|
||||
users.remove(user.getUserId());
|
||||
return AjaxResult.success(users.put(user.getUserId(), user));
|
||||
}
|
||||
|
||||
@ApiOperation("删除用户信息")
|
||||
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
|
||||
@DeleteMapping("/{userId}")
|
||||
public AjaxResult delete(@PathVariable Integer userId)
|
||||
{
|
||||
if (!users.isEmpty() && users.containsKey(userId))
|
||||
{
|
||||
users.remove(userId);
|
||||
return success();
|
||||
}
|
||||
else
|
||||
{
|
||||
return error("用户不存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ApiModel("用户实体")
|
||||
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,69 @@
|
|||
package com.ruoyi.web.core.config;
|
||||
|
||||
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 springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.Contact;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
/**
|
||||
* Swagger2的接口配置
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
public class SwaggerConfig
|
||||
{
|
||||
/** 是否开启swagger */
|
||||
@Value("${swagger.enabled}")
|
||||
private boolean enabled;
|
||||
|
||||
/**
|
||||
* 创建API
|
||||
*/
|
||||
@Bean
|
||||
public Docket createRestApi()
|
||||
{
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
// 是否启用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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加摘要信息
|
||||
*/
|
||||
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,59 @@
|
|||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
#测试环境及生产环境部署
|
||||
url: jdbc:mysql://localhost:3306/ts?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username:
|
||||
#生产环境密码
|
||||
password:
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 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:
|
||||
login-password:
|
||||
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,157 @@
|
|||
# 项目相关配置
|
||||
ruoyi:
|
||||
# 名称
|
||||
name: RuoYi
|
||||
# 版本
|
||||
version: 4.6.0
|
||||
# 版权年份
|
||||
copyrightYear: 2021
|
||||
# 实例演示开关
|
||||
demoEnabled: false
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
# 开发环境配置为 E:\work\code\ruoyi\ryupload 测试环境配置为 /ruoyi/ryupload 生产环境配置为 /home/ruoyi/uploadPath)
|
||||
# profile: E:\work\code\ruoyi\ryupload
|
||||
# profile: /ruoyi/ryupload
|
||||
profile: /home/ruoyi/uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为80
|
||||
port: 8080
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
# tomcat最大线程数,默认为200
|
||||
max-threads: 800
|
||||
# Tomcat启动初始化的线程数,默认值25
|
||||
min-spare-threads: 30
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.ruoyi: error
|
||||
org.springframework: error
|
||||
|
||||
# 用户配置
|
||||
user:
|
||||
password:
|
||||
# 密码错误{maxRetryCount}次锁定10分钟
|
||||
maxRetryCount: 5
|
||||
|
||||
# Spring配置
|
||||
spring:
|
||||
# 模板引擎
|
||||
thymeleaf:
|
||||
mode: HTML
|
||||
encoding: utf-8
|
||||
# 禁用缓存
|
||||
cache: false
|
||||
# 资源信息
|
||||
messages:
|
||||
# 国际化资源文件路径
|
||||
basename: static/i18n/messages
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
profiles:
|
||||
active: druid
|
||||
# 文件上传
|
||||
servlet:
|
||||
multipart:
|
||||
# 单个文件大小
|
||||
max-file-size: 10MB
|
||||
# 设置总上传的文件大小
|
||||
max-request-size: 20MB
|
||||
# 服务模块
|
||||
devtools:
|
||||
restart:
|
||||
# 热部署开关
|
||||
enabled: true
|
||||
|
||||
# MyBatis
|
||||
mybatis:
|
||||
# 搜索指定包别名
|
||||
typeAliasesPackage: com.ruoyi.**.domain
|
||||
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||
# 加载全局的配置文件
|
||||
configLocation: classpath:mybatis/mybatis-config.xml
|
||||
|
||||
# PageHelper分页插件
|
||||
pagehelper:
|
||||
helperDialect: mysql
|
||||
reasonable: true
|
||||
supportMethodsArguments: true
|
||||
params: count=countSql
|
||||
|
||||
# Shiro
|
||||
shiro:
|
||||
user:
|
||||
# 登录地址
|
||||
loginUrl: /login
|
||||
# 权限认证失败地址
|
||||
unauthorizedUrl: /unauth
|
||||
# 首页地址
|
||||
indexUrl: /index
|
||||
# 验证码开关
|
||||
captchaEnabled: false
|
||||
# 验证码类型 math 数组计算 char 字符
|
||||
captchaType: math
|
||||
cookie:
|
||||
# 设置Cookie的域名 默认空,即当前访问的域名
|
||||
domain:
|
||||
# 设置cookie的有效访问路径
|
||||
path: /
|
||||
# 设置HttpOnly属性
|
||||
httpOnly: true
|
||||
# 设置Cookie的过期时间,天为单位
|
||||
maxAge: 30
|
||||
# 设置密钥,务必保持唯一性(生成方式,直接拷贝到main运行即可)KeyGenerator keygen = KeyGenerator.getInstance("AES"); SecretKey deskey = keygen.generateKey(); System.out.println(Base64.encodeToString(deskey.getEncoded()));
|
||||
cipherKey: zSyK5Kp6PZAAjlT+eeNMlg==
|
||||
session:
|
||||
# Session超时时间,-1代表永不过期(默认30分钟)
|
||||
expireTime: 30
|
||||
# 同步session到数据库的周期(默认1分钟)
|
||||
dbSyncPeriod: 1
|
||||
# 相隔多久检查一次session的有效性,默认就是10分钟
|
||||
validationInterval: 10
|
||||
# 同一个用户最大会话数,比如2的意思是同一个账号允许最多同时两个人登录(默认-1不限制)
|
||||
maxSession: -1
|
||||
# 踢出之前登录的/之后登录的用户,默认踢出之前登录的用户
|
||||
kickoutAfter: false
|
||||
rememberMe:
|
||||
enabled: true
|
||||
|
||||
# 防止XSS攻击
|
||||
xss:
|
||||
# 过滤开关
|
||||
enabled: true
|
||||
# 排除链接(多个用逗号分隔)
|
||||
excludes: /system/notice/*
|
||||
# 匹配链接
|
||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||
|
||||
# Swagger配置
|
||||
swagger:
|
||||
# 是否开启swagger
|
||||
enabled: false
|
||||
#thirdauth
|
||||
thirdauth:
|
||||
#以下是thridauth测试环境配置
|
||||
#企业微信配置
|
||||
weChatEnterpriseCorpID:
|
||||
|
||||
#以下是thirdauth生产环境配置
|
||||
#微信配置
|
||||
weChatAppId:
|
||||
weChatAppSecret:
|
||||
weChatCallBack:
|
||||
#企业微信配置
|
||||
weChatEnterpriseAgentId:
|
||||
weChatEnterpriseSecret:
|
||||
weChatEnterpriseCallBack:
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
Application Version: ${ruoyi.version}
|
||||
Spring Boot Version: ${spring-boot.version}
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// _ooOoo_ //
|
||||
// o8888888o //
|
||||
// 88" . "88 //
|
||||
// (| ^_^ |) //
|
||||
// O\ = /O //
|
||||
// ____/`---'\____ //
|
||||
// .' \\| |// `. //
|
||||
// / \\||| : |||// \ //
|
||||
// / _||||| -:- |||||- \ //
|
||||
// | | \\\ - /// | | //
|
||||
// | \_| ''\---/'' | | //
|
||||
// \ .-\__ `-` ___/-. / //
|
||||
// ___`. .' /--.--\ `. . ___ //
|
||||
// ."" '< `.___\_<|>_/___.' >'"". //
|
||||
// | | : `- \`.;`\ _ /`;.`/ - ` : | | //
|
||||
// \ \ `-. \_ __\ /__ _/ .-` / / //
|
||||
// ========`-.____`-.___\_____/___.-`____.-'======== //
|
||||
// `=---=' //
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
|
||||
// 佛祖保佑 永不宕机 永无BUG //
|
||||
////////////////////////////////////////////////////////////////////
|
||||
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue