1
0
Fork 0

初始化

master
jyang_jun 2023-01-30 16:24:08 +08:00
commit 91cf5d22d6
753 changed files with 167573 additions and 0 deletions

43
.gitignore vendored Normal file
View File

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

43
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,43 @@
variables:
MAVEN_CLI_OPTS: "-s $CI_PROJECT_DIR/.m2/settings.xml --batch-mode"
MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository"
MAVEN_USER_HOME: "$CI_PROJECT_DIR/.m2"
REGISTRY_MIRROR: docker.repository.zcunsoft.com
stages:
- build
- package
.set-docker-tag: &set-docker-tag
- if [[ $CI_BUILD_REF_NAME == "main" ]];
then
export DOCKER_TAG=latest;
else
export DOCKER_TAG="${CI_BUILD_REF_NAME}";
fi
maven-build:
image: openjdk:8-slim
stage: build
cache:
key: maven-cache
paths:
- .m2/repository/
- .m2/wrapper/
script:
- ./mvnw $MAVEN_CLI_OPTS package
artifacts:
name: "$CI_PROJECT_NAME-$CI_COMMIT_REF_NAME"
paths:
- "ruoyi-admin/target/*.jar"
docker-build:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
stage: package
script:
- *set-docker-tag
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"gitlab-ci-token\",\"password\":\"$CI_JOB_TOKEN\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --build-arg JAR_FILE="$(ls ruoyi-admin/target/*.jar | sort | head -n 1)" --destination $CI_REGISTRY_IMAGE:$DOCKER_TAG --cache=true --registry-mirror=$REGISTRY_MIRROR

10
.m2/settings.xml Normal file
View File

@ -0,0 +1,10 @@
<settings>
<mirrors>
<mirror>
<id>zcunsoft-mirror</id>
<name>Mirror Repository on repository.zcunsoft.com</name>
<url>https://repository.zcunsoft.com/repository/maven-public</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
</settings>

BIN
.mvn/wrapper/maven-wrapper.jar vendored Normal file

Binary file not shown.

2
.mvn/wrapper/maven-wrapper.properties vendored Normal file
View File

@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar

28
Dockerfile Normal file
View File

@ -0,0 +1,28 @@
# First stage - Compiling application
FROM registry.cn-hangzhou.aliyuncs.com/acs/maven:3-jdk-8 AS build-env
ENV MY_HOME=/app
RUN mkdir -p $MY_HOME
WORKDIR $MY_HOME
ADD pom.xml $MY_HOME
# get all the downloads out of the way
RUN ["/usr/local/bin/mvn-entrypoint.sh","mvn","verify","clean","--fail-never"]
# add source
ADD . $MY_HOME
# run maven verify
RUN ["/usr/local/bin/mvn-entrypoint.sh","mvn","verify"]
# Second stage - build image
FROM openjdk:8-jre-alpine
COPY --from=build-env /app/ruoyi-admin/target/*.jar /app.jar
ENV JAVA_OPTS=""
ENV SERVER_PORT 8082
EXPOSE ${SERVER_PORT}
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/urandom -jar /app.jar" ]

20
LICENSE Normal file
View File

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2018 RuoYi
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

91
README.md Normal file
View File

@ -0,0 +1,91 @@
## 平台简介
一直想做一款后台管理系统看了很多优秀的开源项目但是发现没有合适的。于是利用空闲休息时间开始自己写了一套后台系统。如此有了若依。她可以用于所有的Web应用程序如网站管理后台网站会员中心CMSCRMOA。所有前端后台代码封装过后十分精简易上手出错概率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。
性别男,若依是给女儿取的名字(寓意:你若不离不弃,我必生死相依)
若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
* 前后端分离版本,请移步[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)&nbsp;&nbsp;
* 阿里云优惠券:[点我领取](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)&nbsp;&nbsp;
## 内置功能
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。
3. 岗位管理:配置系统用户所属担任职务。
4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。
5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。
6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。
7. 参数管理:对系统动态配置常用参数。
8. 通知公告:系统通知公告信息发布维护。
9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
10. 登录日志:系统登录日志记录查询包含登录异常。
11. 在线用户:当前系统中活跃用户状态监控。
12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
13. 代码生成前后端代码的生成java、html、xml、sql支持CRUD下载 。
14. 系统接口根据业务代码自动生成相关的api接口文档。
15. 服务监控监视当前系统CPU、内存、磁盘、堆栈等相关信息。
16. 缓存监控:对系统的缓存查询,删除、清空等操作。
17. 在线构建器拖动表单元素生成相应的HTML代码。
18. 连接池监视监视当前系统数据库连接池状态可进行分析SQL找出系统性能瓶颈。
## 在线体验
- admin/admin123
- 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。
演示地址http://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群 [![加入QQ群](https://img.shields.io/badge/已满-1389287-blue.svg)](https://jq.qq.com/?_wv=1027&k=5HBAaYN) [![加入QQ群](https://img.shields.io/badge/已满-1679294-blue.svg)](https://jq.qq.com/?_wv=1027&k=5cHeRVW) [![加入QQ群](https://img.shields.io/badge/已满-1529866-blue.svg)](https://jq.qq.com/?_wv=1027&k=53R0L5Z) [![加入QQ群](https://img.shields.io/badge/已满-1772718-blue.svg)](https://jq.qq.com/?_wv=1027&k=5g75dCU) [![加入QQ群](https://img.shields.io/badge/已满-1366522-blue.svg)](https://jq.qq.com/?_wv=1027&k=58cPoHA) [![加入QQ群](https://img.shields.io/badge/已满-1382251-blue.svg)](https://jq.qq.com/?_wv=1027&k=5Ofd4Pb) [![加入QQ群](https://img.shields.io/badge/已满-1145125-blue.svg)](https://jq.qq.com/?_wv=1027&k=5yugASz) [![加入QQ群](https://img.shields.io/badge/已满-86752435-blue.svg)](https://jq.qq.com/?_wv=1027&k=5Rf3d2P) [![加入QQ群](https://img.shields.io/badge/已满-134072510-blue.svg)](https://jq.qq.com/?_wv=1027&k=5ZIjaeP) [![加入QQ群](https://img.shields.io/badge/已满-210336300-blue.svg)](https://jq.qq.com/?_wv=1027&k=5CJw1jY) [![加入QQ群](https://img.shields.io/badge/已满-339522636-blue.svg)](https://jq.qq.com/?_wv=1027&k=5omzbKc) [![加入QQ群](https://img.shields.io/badge/已满-130035985-blue.svg)](https://jq.qq.com/?_wv=1027&k=qPIKBb7s) [![加入QQ群](https://img.shields.io/badge/143151071-blue.svg)](https://jq.qq.com/?_wv=1027&k=4NsjKbtU)

12
bin/clean.bat Normal file
View File

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

12
bin/package.bat Normal file
View File

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

14
bin/run.bat Normal file
View File

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

5
docker-entrypoint.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/sh
set -e
exec java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true -jar /app.jar "$@"

316
mvnw vendored Normal file
View File

@ -0,0 +1,316 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /usr/local/etc/mavenrc ] ; then
. /usr/local/etc/mavenrc
fi
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="`/usr/libexec/java_home`"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`\\unset -f command; \\command -v java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=`cd "$wdir/.."; pwd`
fi
# end of workaround
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
exit 1;
fi
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found .mvn/wrapper/maven-wrapper.jar"
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
fi
if [ -n "$MVNW_REPOURL" ]; then
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
else
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
fi
while IFS="=" read key value; do
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
esac
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
if [ "$MVNW_VERBOSE" = true ]; then
echo "Downloading from: $jarUrl"
fi
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
if $cygwin; then
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
fi
if command -v wget > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found wget ... using wget"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
else
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
fi
elif command -v curl > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found curl ... using curl"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
curl -o "$wrapperJarPath" "$jarUrl" -f
else
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Falling back to using Java to download"
fi
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
# For Cygwin, switch paths to Windows format before running javac
if $cygwin; then
javaClass=`cygpath --path --windows "$javaClass"`
fi
if [ -e "$javaClass" ]; then
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Compiling MavenWrapperDownloader.java ..."
fi
# Compiling the Java class
("$JAVA_HOME/bin/javac" "$javaClass")
fi
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
# Running the downloader
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Running MavenWrapperDownloader.java ..."
fi
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
fi
fi
fi
fi
##########################################################################################
# End of extension
##########################################################################################
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
if [ "$MVNW_VERBOSE" = true ]; then
echo $MAVEN_PROJECTBASEDIR
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
$MAVEN_OPTS \
$MAVEN_DEBUG_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" \
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

188
mvnw.cmd vendored Normal file
View File

@ -0,0 +1,188 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% ^
%JVM_CONFIG_MAVEN_PROPS% ^
%MAVEN_OPTS% ^
%MAVEN_DEBUG_OPTS% ^
-classpath %WRAPPER_JAR% ^
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%"=="on" pause
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
cmd /C exit /B %ERROR_CODE%

288
pom.xml Normal file
View File

@ -0,0 +1,288 @@
<?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>0.0.1-RELEASE</version>
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>Nexus Release Repository</name>
<url>http://139.196.139.197:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Nexus Snapshot Repository</name>
<url>http://139.196.139.197:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<name>ruoyi</name>
<url>http://www.ruoyi.vip</url>
<description>若依管理系统</description>
<properties>
<ruoyi.version>0.0.1-RELEASE</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>
</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>

121
ruoyi-admin/pom.xml Normal file
View File

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>0.0.1-RELEASE</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>
</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>

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,163 @@
package com.ruoyi.system.controller;
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.selectAvailableUserList(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.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.selectAvailableUserList(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("修改合同失败,起始时间大于结束时间");
}
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";
}
}

View File

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

View File

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

View File

@ -0,0 +1,522 @@
package com.ruoyi.system.controller;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSON;
import com.ruoyi.system.PinYinUtil;
import com.ruoyi.system.domain.excel.CostDetailForExcel;
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;
import javax.servlet.http.HttpServletResponse;
/**
* 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("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()));
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 = 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);
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());
List<SysUser> users = userService.selectAvailableUserList(user);
if (users.size() != 1) {
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 = users.get(0).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());
}
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("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);
}
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));
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,171 @@
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;
/**
*
*/
@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;
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;
}
@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();
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,44 @@
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;
public String getSumType() {
return sumType;
}
public String getQueryId() {
return queryId;
}
public Date getStartDate() {
return startDate;
}
public Date getEndDate() {
return endDate;
}
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;
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,100 @@
package com.ruoyi.system.mapper;
import java.util.Date;
import java.util.List;
import com.ruoyi.system.domain.ProjectSumModel;
import com.ruoyi.system.domain.TblProject;
import com.ruoyi.system.domain.TblProjectCost;
import com.ruoyi.system.domain.UserLastWeekSumModel;
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);
}

View File

@ -0,0 +1,74 @@
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;
/**
* 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(Long userId);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,99 @@
package com.ruoyi.system.service;
import java.util.Date;
import java.util.List;
import com.ruoyi.system.domain.ProjectSumModel;
import com.ruoyi.system.domain.TblProjectCost;
import com.ruoyi.system.domain.UserLastWeekSumModel;
/**
* 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);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,149 @@
package com.ruoyi.system.service.impl;
import java.util.Date;
import java.util.List;
import com.ruoyi.system.domain.ProjectSumModel;
import com.ruoyi.system.domain.UserLastWeekSumModel;
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.domain.TblProjectCost;
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);
}
}

View File

@ -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) {
return tblProjectMapper.selectTblProjectListByUserProject(userId);
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,62 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
#本地开发环境
# url: jdbc:mysql://shufe.servers.zcunsoft.com:3306/pm_cxl?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
#本地连接测试环境数据库
# url: jdbc:mysql://zclab-timesheet.servers.zcunsoft.com:3306/ts?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
#测试环境及生产环境部署
url: jdbc:mysql://103.229.214.97:6033/timesheet?serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: kKM#0QC0AzyYnn5&
# 从库数据源
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

View File

@ -0,0 +1,162 @@
# 项目相关配置
ruoyi:
# 名称
name: RuoYi
# 版本
version: 4.6.0
# 版权年份
copyrightYear: 2021
# 实例演示开关
demoEnabled: false
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /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: 8082
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测试环境配置
#微信配置
weChatAppId: wxa2cc69bf2e38b6ab
weChatAppSecret: 3f237f4070968918b01a7475a8e840ea
weChatCallBack: https://zclab-timesheet.servers.zcunsoft.com/auth/callback/wechat
#企业微信配置
weChatEnterpriseCorpID: wxf2ff89c3a55dcf61
# weChatEnterpriseAgentId: 1000015
# weChatEnterpriseSecret: jxaCFTlNGdcmMeVI9s5ywwWGrB5z66nzFcJK_zrvmw8
# weChatEnterpriseCallBack: https://zclab-timesheet.servers.zcunsoft.com/auth/callback/wechat_enterprise
#以下是企业微信 工时系统DEMO配置
# weChatEnterpriseAgentId: 1000021
# weChatEnterpriseSecret: zrwqrzUrxKQSYAy3ZLmyKkzDYT7uBfcpIwtwfuSTb18
# weChatEnterpriseCallBack: https://tsdemo.zcunsoft.com/auth/callback/wechat_enterprise
#以下是thirdauth生产环境配置
weChatEnterpriseAgentId: 1000018
weChatEnterpriseSecret: VlZ6j3m-cuRQC1Ue_Iwg731dq5vzDrL1fKbWWgyUoHw
weChatEnterpriseCallBack: https://ts.zcunsoft.com/auth/callback/wechat_enterprise

View File

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

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