@@ -0,0 +1,34 @@ | |||
HELP.md | |||
target/ | |||
!.mvn/wrapper/maven-wrapper.jar | |||
!**/src/main/** | |||
!**/src/test/** | |||
### STS ### | |||
.apt_generated | |||
.classpath | |||
.factorypath | |||
.project | |||
.settings | |||
.springBeans | |||
.sts4-cache | |||
### IntelliJ IDEA ### | |||
.idea | |||
*.iws | |||
*.iml | |||
*.ipr | |||
### NetBeans ### | |||
/nbproject/private/ | |||
/nbbuild/ | |||
/dist/ | |||
/nbdist/ | |||
/.nb-gradle/ | |||
build/ | |||
### VS Code ### | |||
.vscode/ | |||
log/ | |||
application-local.yml |
@@ -0,0 +1,286 @@ | |||
#!/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. | |||
# ---------------------------------------------------------------------------- | |||
# ---------------------------------------------------------------------------- | |||
# Maven2 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 /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)`" | |||
# TODO classpath? | |||
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="`which 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 | |||
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" | |||
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 command -v wget > /dev/null; then | |||
if [ "$MVNW_VERBOSE" = true ]; then | |||
echo "Found wget ... using wget" | |||
fi | |||
wget "$jarUrl" -O "$wrapperJarPath" | |||
elif command -v curl > /dev/null; then | |||
if [ "$MVNW_VERBOSE" = true ]; then | |||
echo "Found curl ... using curl" | |||
fi | |||
curl -o "$wrapperJarPath" "$jarUrl" | |||
else | |||
if [ "$MVNW_VERBOSE" = true ]; then | |||
echo "Falling back to using Java to download" | |||
fi | |||
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" | |||
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 | |||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain | |||
exec "$JAVACMD" \ | |||
$MAVEN_OPTS \ | |||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ | |||
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ | |||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" |
@@ -0,0 +1,161 @@ | |||
@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 Maven2 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 key stroke 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 my 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 "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" | |||
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\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/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" | |||
FOR /F "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% ( | |||
echo Found %WRAPPER_JAR% | |||
) else ( | |||
echo Couldn't find %WRAPPER_JAR%, downloading it ... | |||
echo Downloading from: %DOWNLOAD_URL% | |||
powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" | |||
echo Finished downloading %WRAPPER_JAR% | |||
) | |||
@REM End of extension | |||
%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 "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" | |||
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\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% | |||
exit /B %ERROR_CODE% |
@@ -0,0 +1,383 @@ | |||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<parent> | |||
<groupId>org.springframework.boot</groupId> | |||
<artifactId>spring-boot-starter-parent</artifactId> | |||
<version>2.2.1.RELEASE</version> | |||
<relativePath/> <!-- lookup parent from repository --> | |||
</parent> | |||
<groupId>com.taauav</groupId> | |||
<artifactId>admin</artifactId> | |||
<version>0.0.1-SNAPSHOT</version> | |||
<name>taauav</name> | |||
<description>MSDAMP project for Spring Boot</description> | |||
<properties> | |||
<java.version>1.8</java.version> | |||
<spring.boot.version>2.1.11.RELEASE</spring.boot.version> | |||
<!-- mybatis-plus.version --> | |||
<mybatis-plus.version>3.2.0</mybatis-plus.version> | |||
<!-- swagger.version --> | |||
<swagger.version>2.9.2</swagger.version> | |||
<velocity.version>1.7</velocity.version> | |||
</properties> | |||
<dependencies> | |||
<!-- 包含 mvc,aop 等jar资源 --> | |||
<dependency> | |||
<groupId>org.springframework.boot</groupId> | |||
<artifactId>spring-boot-starter-web</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.springframework.boot</groupId> | |||
<artifactId>spring-boot-starter-actuator</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.springframework.boot</groupId> | |||
<artifactId>spring-boot-starter-data-jdbc</artifactId> | |||
</dependency> | |||
<!-- reids --> | |||
<dependency> | |||
<groupId>org.springframework.boot</groupId> | |||
<artifactId>spring-boot-starter-data-redis</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>redis.clients</groupId> | |||
<artifactId>jedis</artifactId> | |||
<version>2.9.0</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.commons</groupId> | |||
<artifactId>commons-pool2</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.springframework.boot</groupId> | |||
<artifactId>spring-boot-starter-mail</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.mybatis.spring.boot</groupId> | |||
<artifactId>mybatis-spring-boot-starter</artifactId> | |||
<version>2.1.1</version> | |||
</dependency> | |||
<!-- | |||
<dependency> | |||
<groupId>org.springframework.boot</groupId> | |||
<artifactId>spring-boot-devtools</artifactId> | |||
<scope>runtime</scope> | |||
<optional>true</optional> | |||
</dependency> | |||
--> | |||
<dependency> | |||
<groupId>mysql</groupId> | |||
<artifactId>mysql-connector-java</artifactId> | |||
<scope>runtime</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.springframework.boot</groupId> | |||
<artifactId>spring-boot-configuration-processor</artifactId> | |||
<optional>true</optional> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.projectlombok</groupId> | |||
<artifactId>lombok</artifactId> | |||
<version>1.18.10</version> | |||
<scope>provided</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.springframework.boot</groupId> | |||
<artifactId>spring-boot-starter-test</artifactId> | |||
<scope>test</scope> | |||
<exclusions> | |||
<exclusion> | |||
<groupId>org.junit.vintage</groupId> | |||
<artifactId>junit-vintage-engine</artifactId> | |||
</exclusion> | |||
</exclusions> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.springframework.boot</groupId> | |||
<artifactId>spring-boot-starter-validation</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.alibaba</groupId> | |||
<artifactId>fastjson</artifactId> | |||
<version>1.2.62</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.mybatis.generator</groupId> | |||
<artifactId>mybatis-generator-core</artifactId> | |||
<version>1.3.7</version> | |||
</dependency> | |||
<!--apache.commons.lang3--> | |||
<dependency> | |||
<groupId>org.apache.commons</groupId> | |||
<artifactId>commons-lang3</artifactId> | |||
</dependency> | |||
<!--你可以把这个工具看成是java.util的扩展--> | |||
<dependency> | |||
<groupId>org.apache.commons</groupId> | |||
<artifactId>commons-collections4</artifactId> | |||
<version>4.1</version> | |||
</dependency> | |||
<!--apache.codec:编码方法的工具类包 | |||
https://blog.csdn.net/u012881904/article/details/52767853--> | |||
<dependency> | |||
<groupId>commons-codec</groupId> | |||
<artifactId>commons-codec</artifactId> | |||
</dependency> | |||
<!-- 权限管理shiro--> | |||
<dependency> | |||
<groupId>org.apache.shiro</groupId> | |||
<artifactId>shiro-spring</artifactId> | |||
<version>1.4.0</version> | |||
</dependency> | |||
<!-- 权限管理-缓存shiro-redis--> | |||
<dependency> | |||
<groupId>org.crazycake</groupId> | |||
<artifactId>shiro-redis</artifactId> | |||
<version>3.1.0</version> | |||
</dependency> | |||
<!--duid依赖--> | |||
<!-- https://mvnrepository.com/artifact/com.alibaba/druid-spring-boot-starter --> | |||
<dependency> | |||
<groupId>com.alibaba</groupId> | |||
<artifactId>druid-spring-boot-starter</artifactId> | |||
<version>1.1.10</version> | |||
</dependency> | |||
<!--mybatis-plus | |||
https://mp.baomidou.com/guide--> | |||
<dependency> | |||
<groupId>com.baomidou</groupId> | |||
<artifactId>mybatis-plus-boot-starter</artifactId> | |||
<version>${mybatis-plus.version}</version> | |||
</dependency> | |||
<!--mybatis-plus 代码自动生成 --> | |||
<dependency> | |||
<groupId>com.baomidou</groupId> | |||
<artifactId>mybatis-plus-generator</artifactId> | |||
<version>${mybatis-plus.version}</version> | |||
</dependency> | |||
<!-- freemarker 模板引擎 --> | |||
<!-- https://mvnrepository.com/artifact/org.freemarker/freemarker --> | |||
<dependency> | |||
<groupId>org.freemarker</groupId> | |||
<artifactId>freemarker</artifactId> | |||
<version>2.3.29</version> | |||
</dependency> | |||
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 加强版--> | |||
<dependency> | |||
<groupId>com.github.xiaoymin</groupId> | |||
<artifactId>knife4j-spring-boot-starter</artifactId> | |||
<version>1.9.6</version> | |||
</dependency> | |||
<!-- 图片压缩 --> | |||
<dependency> | |||
<groupId>net.coobird</groupId> | |||
<artifactId>thumbnailator</artifactId> | |||
<version>0.4.8</version> | |||
</dependency> | |||
<!--Hutool是一个小而全的Java工具类库 https://mvnrepository.com/artifact/cn.hutool/hutool-core --> | |||
<dependency> | |||
<groupId>cn.hutool</groupId> | |||
<artifactId>hutool-core</artifactId> | |||
<version>5.0.6</version> | |||
</dependency> | |||
<!--图片gps--> | |||
<dependency> | |||
<groupId>com.drewnoakes</groupId> | |||
<artifactId>metadata-extractor</artifactId> | |||
<version>2.6.2</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.springframework</groupId> | |||
<artifactId>spring-test</artifactId> | |||
<version>5.1.7.RELEASE</version> | |||
<scope>compile</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.commons</groupId> | |||
<artifactId>commons-io</artifactId> | |||
<version>1.3.2</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.httpcomponents</groupId> | |||
<artifactId>httpcore</artifactId> | |||
<version>4.4.5</version> | |||
</dependency> | |||
<!-- JWT依赖 --> | |||
<dependency> | |||
<groupId>io.jsonwebtoken</groupId> | |||
<artifactId>jjwt</artifactId> | |||
<version>0.9.1</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.auth0</groupId> | |||
<artifactId>java-jwt</artifactId> | |||
<version>3.4.0</version> | |||
</dependency> | |||
<!--velocity代码生成使用模板 --> | |||
<dependency> | |||
<groupId>org.apache.velocity</groupId> | |||
<artifactId>velocity</artifactId> | |||
<version>${velocity.version}</version> | |||
</dependency> | |||
<!-- Excel处理 --> | |||
<dependency> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi</artifactId> | |||
<version>3.17</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-ooxml</artifactId> | |||
<version>3.17</version> | |||
</dependency> | |||
</dependencies> | |||
<profiles> | |||
<profile> | |||
<!-- 本地开发环境 --> | |||
<id>local</id> | |||
<properties> | |||
<package.environment>local</package.environment> | |||
</properties> | |||
<activation> | |||
<activeByDefault>true</activeByDefault> | |||
</activation> | |||
</profile> | |||
<profile> | |||
<!--开发测试环境 --> | |||
<id>dev</id> | |||
<properties> | |||
<package.environment>dev</package.environment> | |||
</properties> | |||
</profile> | |||
<profile> | |||
<!-- 测试环境 --> | |||
<id>test</id> | |||
<properties> | |||
<package.environment>test</package.environment> | |||
</properties> | |||
</profile> | |||
<profile> | |||
<!-- 生产环境 --> | |||
<id>prod</id> | |||
<properties> | |||
<package.environment>prod</package.environment> | |||
</properties> | |||
</profile> | |||
</profiles> | |||
<build> | |||
<finalName>app</finalName> | |||
<resources> | |||
<resource> | |||
<directory>src/main/resources</directory> | |||
<filtering>true</filtering> | |||
<excludes> | |||
<exclude>application-local.yml</exclude> | |||
<exclude>application-dev.yml</exclude> | |||
<exclude>application-test.yml</exclude> | |||
<exclude>application-prod.yml</exclude> | |||
</excludes> | |||
</resource> | |||
<resource> | |||
<directory>src/main/java</directory> | |||
<includes> | |||
<include>**/*.*</include> | |||
</includes> | |||
<excludes> | |||
<exclude>**/*.java</exclude> | |||
</excludes> | |||
</resource> | |||
<resource> | |||
<directory>src/main/resources</directory> | |||
<filtering>true</filtering> | |||
<targetPath>WEB-INF/classes</targetPath> | |||
<includes> | |||
<include>application-${package.environment}.yml</include> | |||
</includes> | |||
</resource> | |||
</resources> | |||
<pluginManagement> | |||
<plugins> | |||
<plugin> | |||
<groupId>org.springframework.boot</groupId> | |||
<artifactId>spring-boot-maven-plugin</artifactId> | |||
<version>${spring.boot.version}</version> | |||
<configuration> | |||
<finalName>${project.build.finalName}</finalName> | |||
</configuration> | |||
<executions> | |||
<execution> | |||
<goals> | |||
<goal>repackage</goal> | |||
</goals> | |||
</execution> | |||
</executions> | |||
</plugin> | |||
</plugins> | |||
</pluginManagement> | |||
<plugins> | |||
<plugin> | |||
<groupId>org.springframework.boot</groupId> | |||
<artifactId>spring-boot-maven-plugin</artifactId> | |||
</plugin> | |||
<!-- mybatis generator 自动生成代码插件 --> | |||
<plugin> | |||
<groupId>org.mybatis.generator</groupId> | |||
<artifactId>mybatis-generator-maven-plugin</artifactId> | |||
<version>1.3.1</version> | |||
<configuration> | |||
<configurationFile>${basedir}/src/main/resources/generator/generatorConfig.xml</configurationFile> | |||
<overwrite>true</overwrite> | |||
<verbose>true</verbose> | |||
</configuration> | |||
</plugin> | |||
<plugin> | |||
<groupId>org.apache.maven.plugins</groupId> | |||
<artifactId>maven-surefire-plugin</artifactId> | |||
<version>2.19</version> | |||
<configuration> | |||
<skipTests>true</skipTests> | |||
</configuration> | |||
</plugin> | |||
<plugin> | |||
<groupId>org.apache.maven.plugins</groupId> | |||
<artifactId>maven-jar-plugin</artifactId> | |||
<version>3.2.0</version> | |||
<configuration> | |||
<archive> | |||
<addMavenDescriptor>false</addMavenDescriptor> | |||
</archive> | |||
</configuration> | |||
</plugin> | |||
</plugins> | |||
</build> | |||
</project> |
@@ -0,0 +1,22 @@ | |||
package com.taauav; | |||
import org.mybatis.spring.annotation.MapperScan; | |||
import org.springframework.boot.SpringApplication; | |||
import org.springframework.boot.autoconfigure.SpringBootApplication; | |||
import org.springframework.scheduling.annotation.EnableScheduling; | |||
import org.springframework.transaction.annotation.EnableTransactionManagement; | |||
/** | |||
* @author dyg | |||
*/ | |||
@SpringBootApplication | |||
@MapperScan("com.taauav.*.mapper") | |||
@EnableTransactionManagement | |||
@EnableScheduling | |||
public class AdminApplication { | |||
public static void main(String[] args) { | |||
SpringApplication.run(AdminApplication.class, args); | |||
} | |||
} |
@@ -0,0 +1,42 @@ | |||
package com.taauav.admin.constant; | |||
import java.util.HashMap; | |||
import java.util.Map; | |||
/** | |||
* 基础配置类 | |||
*/ | |||
public class CommonConstant { | |||
/** | |||
* 挂载设备类型 | |||
*/ | |||
public static Map<Integer, String> MOUNT_EQUIPMENT_TYPE_LIST = new HashMap<Integer, String>() { | |||
{ | |||
put(1, "摄像"); | |||
put(2, "其他"); | |||
} | |||
}; | |||
/** | |||
* 挂载设备状态 | |||
*/ | |||
public static Map<Integer, String> MOUNT_EQUIPMENT_STATUS_LIST = new HashMap<Integer, String>() { | |||
{ | |||
put(1, "在线"); | |||
put(2, "离线"); | |||
} | |||
}; | |||
/** | |||
* 河长等级 | |||
*/ | |||
public static Map<Integer, String> LSADMIN_LEVEL_LIST = new HashMap<Integer, String>() { | |||
{ | |||
put(1, "区级"); | |||
put(2, "镇级"); | |||
put(3, "村级"); | |||
} | |||
}; | |||
} |
@@ -0,0 +1,58 @@ | |||
package com.taauav.admin.controller; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.admin.entity.SysAdmin; | |||
import com.taauav.admin.service.ISysAdminService; | |||
import com.taauav.admin.service.ISysAuthRuleService; | |||
import com.taauav.common.util.ShiroUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* @author dyg | |||
*/ | |||
@RestController | |||
@RequestMapping("/admin") | |||
public class AdminController extends BaseController { | |||
@Autowired | |||
private ISysAuthRuleService iSysAuthRuleService; | |||
@Autowired | |||
private Response response; | |||
@Autowired | |||
private ISysAdminService adminService; | |||
/** | |||
* 登录用户的信息 | |||
* @return | |||
*/ | |||
@RequestMapping("/info") | |||
public Response info() { | |||
Integer adminId = ShiroUtils.getAdminId(); | |||
SysAdmin info = adminService.getAdminInfo(adminId); | |||
Map<String,Object> map = new HashMap<String,Object>(); | |||
List<Map<String,Object>> ruleList = iSysAuthRuleService.getRuleList(info.getId()); | |||
String permission = iSysAuthRuleService.getPermission(info); | |||
map.put("info", info); | |||
// map.put("ruleList",ruleList); | |||
map.put("permission", permission); | |||
return response.success(map); | |||
} | |||
/** | |||
* 获取所有菜单 | |||
* @return | |||
*/ | |||
@GetMapping("/authList") | |||
public Response authList() { | |||
QueryWrapper wrapper = new QueryWrapper(); | |||
wrapper.eq("mark", 1); | |||
wrapper.eq("status", 1); | |||
List<Map<String, Object>> list = iSysAuthRuleService.listMaps(wrapper); | |||
return response.success(list); | |||
} | |||
} |
@@ -0,0 +1,8 @@ | |||
package com.taauav.admin.controller; | |||
/** | |||
* @author dyg | |||
*/ | |||
public class BaseController { | |||
} |
@@ -0,0 +1,20 @@ | |||
package com.taauav.admin.controller; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
/** | |||
* <p> | |||
* 广告表 前端控制器 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-06 | |||
*/ | |||
@RestController | |||
@RequestMapping("/admin/ct-ad") | |||
public class CtAdController { | |||
} |
@@ -0,0 +1,20 @@ | |||
package com.taauav.admin.controller; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.admin.service.ISysCityService; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
/** | |||
* @author daixiantong | |||
*/ | |||
@RestController | |||
@RequestMapping("/index") | |||
public class IndexController { | |||
@Autowired | |||
private Response response; | |||
@Autowired | |||
private ISysCityService cityService; | |||
} |
@@ -0,0 +1,55 @@ | |||
package com.taauav.admin.controller; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.taauav.admin.entity.TauvCategory; | |||
import com.taauav.admin.entity.TauvInspectImage; | |||
import com.taauav.admin.mapper.TauvInspectImageMapper; | |||
import com.taauav.admin.query.StatisticsQuery; | |||
import com.taauav.admin.service.ITauvCategoryService; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.util.StringUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import java.util.List; | |||
/** | |||
* 公路问题类型统计 | |||
*/ | |||
@RestController | |||
@RequestMapping("/statistics") | |||
public class StatisticsController extends BaseController { | |||
@Autowired | |||
private ITauvCategoryService categoryService; | |||
@Autowired | |||
private TauvInspectImageMapper inspectImageMapper; | |||
@Autowired | |||
private Response response; | |||
@PostMapping("/index") | |||
public Response index(@RequestBody StatisticsQuery query) { | |||
// 获取分类列表 | |||
List<TauvCategory> categoryList = categoryService.getChildrenList(0); | |||
if (StringUtils.isNotEmpty(categoryList)) { | |||
for (TauvCategory category : categoryList) { | |||
if (category.getChildrenList().size() > 0) { | |||
for (TauvCategory item : category.getChildrenList()) { | |||
// 查询条件 | |||
QueryWrapper<TauvInspectImage> queryWrapper = new QueryWrapper<>(); | |||
if (!StringUtils.isEmpty(query.getName())) { | |||
queryWrapper.like("name", query.getName()); | |||
} | |||
queryWrapper.eq("category_id", item.getId()); | |||
queryWrapper.eq("mark", 1); | |||
Integer count = inspectImageMapper.selectCount(queryWrapper); | |||
item.setQuestionNum(count); | |||
} | |||
} | |||
} | |||
} | |||
return response.success("操作成功", categoryList); | |||
} | |||
} |
@@ -0,0 +1,196 @@ | |||
package com.taauav.admin.controller; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.taauav.admin.query.SysAdminQuery; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.constant.PermissionConstants; | |||
import com.taauav.admin.entity.SysAdmin; | |||
import com.taauav.admin.service.ISysAdminService; | |||
import com.taauav.admin.service.ISysCityService; | |||
import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.validation.BindingResult; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.validation.Valid; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 管理员表 前端控制器 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-04 | |||
*/ | |||
@RestController | |||
@RequestMapping("/admin") | |||
public class SysAdminController { | |||
@Autowired | |||
private ISysAdminService iSysAdminService; | |||
@Autowired | |||
private Response response; | |||
@Autowired | |||
private ISysCityService cityService; | |||
private static final String controllerName = "admin"; | |||
/** | |||
* 管理员列表接口 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/index") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.LIST_PERMISSION) | |||
public Response index(@RequestBody(required = false) Map<String, String> map) { | |||
return iSysAdminService.findAdminPageList(map); | |||
} | |||
/** | |||
* 编辑-提交接口 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping(value = "/edit") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) | |||
public Response edit(@RequestBody @Valid SysAdmin map, BindingResult bindingResult) { | |||
if (bindingResult.hasErrors()) { | |||
String msg = bindingResult.getFieldError().getDefaultMessage(); | |||
return response.failure(msg); | |||
} | |||
return iSysAdminService.editAdminInfo(map); | |||
} | |||
/** | |||
* 编辑-获取原数据接口 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@GetMapping("/getAdminInfo") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) | |||
public Response getAdminInfo(Integer id) { | |||
SysAdmin admin = iSysAdminService.getAdminInfo(id); | |||
if (admin == null) { | |||
return response.failure("操作失败", null); | |||
} | |||
return response.success("操作成功", admin); | |||
} | |||
/** | |||
* 添加管理员 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/add") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.ADD_PERMISSION) | |||
public Response add(@RequestBody @Valid SysAdmin map, BindingResult bindingResult) { | |||
if (bindingResult.hasErrors()) { | |||
String msg = bindingResult.getFieldError().getDefaultMessage(); | |||
return response.failure(msg); | |||
} | |||
return iSysAdminService.editAdminInfo(map); | |||
} | |||
/** | |||
* 删除管理员账号 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/drop") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.REMOVE_PERMISSION) | |||
public Response dropAdmin(@RequestBody Map<String, String> map) { | |||
map.put("act", "drop"); | |||
return iSysAdminService.dealAdmin(map); | |||
} | |||
/** | |||
* 重置密码接口 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/reset") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.PASSWORD_PERMISSION) | |||
public Response resetPassword(@RequestBody Map<String, String> map) { | |||
map.put("act", "reset"); | |||
return iSysAdminService.dealAdmin(map); | |||
} | |||
/** | |||
* 修改账户状态接口 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/editStatus") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.STATUS_PERMISSION) | |||
public Response editStatus(@RequestBody Map<String, String> map) { | |||
map.put("act", "changeStatus"); | |||
return iSysAdminService.dealAdmin(map); | |||
} | |||
/** | |||
* 设置账户权限接口 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/setPermit") | |||
@RequiresPermissions("admin:setPermit") | |||
public Response setPermit(@RequestBody(required = false) Map<String, String> map) { | |||
return iSysAdminService.setPermit(map); | |||
} | |||
/** | |||
* 获取所有管理员(组装option用) | |||
* | |||
* @return | |||
*/ | |||
@PostMapping("/getAdminList") | |||
public Response getAdminList() { | |||
return iSysAdminService.getAdminList(); | |||
} | |||
/** | |||
* 获取角色数组 | |||
* | |||
* @return | |||
*/ | |||
@PostMapping("/authList") | |||
public Response getAuthGroupList() { | |||
return iSysAdminService.getAuthGroupList(); | |||
} | |||
/** | |||
* 获取城市数组 | |||
* | |||
* @return | |||
*/ | |||
@GetMapping("/getCityList") | |||
public Response getCityList() { | |||
//区属权限 | |||
QueryWrapper wrapper = new QueryWrapper(); | |||
wrapper.eq("mark", 1); | |||
wrapper.eq("pid", 3201); | |||
wrapper.select("id,name"); | |||
List<Map<String, Object>> cityList = cityService.listMaps(wrapper); | |||
return response.success("操作成功", cityList); | |||
} | |||
/** | |||
* 获取飞手列表【分配任务时使用】 | |||
* | |||
* @return | |||
*/ | |||
@PostMapping("/getFlyHandList") | |||
public Response getFlyHandList(@RequestBody SysAdminQuery query) { | |||
return iSysAdminService.getFlyHandList(query); | |||
// return response.success(iSysAdminService.getAdminListByGroupId(6)); | |||
} | |||
} |
@@ -0,0 +1,20 @@ | |||
package com.taauav.admin.controller; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
/** | |||
* <p> | |||
* 用户组明细表 前端控制器 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-04 | |||
*/ | |||
@RestController | |||
@RequestMapping("/admin/sys-auth-group-access") | |||
public class SysAuthGroupAccessController { | |||
} |
@@ -0,0 +1,141 @@ | |||
package com.taauav.admin.controller; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.constant.PermissionConstants; | |||
import com.taauav.admin.entity.SysAuthGroup; | |||
import com.taauav.admin.service.ISysAuthGroupService; | |||
import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.util.StringUtils; | |||
import org.springframework.validation.BindingResult; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.validation.Valid; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 用户组表 前端控制器 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-04 | |||
*/ | |||
@RestController | |||
@RequestMapping("/authgroup") | |||
public class SysAuthGroupController { | |||
@Autowired | |||
private ISysAuthGroupService iSysAuthGroupService; | |||
@Autowired | |||
private Response response; | |||
private static final String controllerName = "authgroup"; | |||
/** | |||
* 角色列表 | |||
* @param map | |||
* @return | |||
*/ | |||
@GetMapping("/index") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.LIST_PERMISSION) | |||
public Response index(@RequestBody(required = false) Map<String,String> map) { | |||
return iSysAuthGroupService.getList(map); | |||
} | |||
/** | |||
* 修改角色 | |||
* @param authGroup | |||
* @return | |||
*/ | |||
@PostMapping("/edit") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) | |||
public Response edit(@RequestBody(required = false) @Valid SysAuthGroup authGroup, BindingResult bindingResult) { | |||
if(bindingResult.hasErrors()){ | |||
String msg = bindingResult.getFieldError().getDefaultMessage(); | |||
return response.failure(msg); | |||
} | |||
return iSysAuthGroupService.edit(authGroup); | |||
} | |||
/** | |||
* 获取角色数据 | |||
* @param id | |||
* @return | |||
*/ | |||
@GetMapping("/getAuthGroup") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) | |||
public Response getAuthGroup(Integer id) { | |||
if (id <= 0) { | |||
response.failure("数据不存在"); | |||
} | |||
Map<String,Object> map = new HashMap<>(); | |||
SysAuthGroup info = iSysAuthGroupService.getInfoById(id); | |||
if (StringUtils.isEmpty(info)) { | |||
return response.failure("数据不存在"); | |||
} | |||
map.put("id", info.getId()); | |||
map.put("name",info.getName()); | |||
map.put("pid",info.getPid()); | |||
map.put("has_child",info.getHasChild()); | |||
map.put("remark",info.getRemark()); | |||
map.put("sort",info.getSort()); | |||
List<Map<String,String>> pList ; | |||
if (info.getPid() > 0) { | |||
pList = iSysAuthGroupService.getListByPid(0); | |||
} else { | |||
pList = null; | |||
} | |||
map.put("p_list",pList); | |||
return response.success(map); | |||
} | |||
/** | |||
* 添加角色 | |||
* @param authGroup | |||
* @return | |||
*/ | |||
@PostMapping("/add") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.ADD_PERMISSION) | |||
public Response add(@RequestBody @Valid SysAuthGroup authGroup,BindingResult bindingResult) { | |||
if(bindingResult.hasErrors()){ | |||
String msg = bindingResult.getFieldError().getDefaultMessage(); | |||
return response.failure(msg); | |||
} | |||
return iSysAuthGroupService.add(authGroup); | |||
} | |||
/** | |||
* 删除角色 | |||
* @param authGroup | |||
* @return | |||
*/ | |||
@PostMapping("/del") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.REMOVE_PERMISSION) | |||
public Response del(@RequestBody SysAuthGroup authGroup) { | |||
return iSysAuthGroupService.del(authGroup); | |||
} | |||
/** | |||
* 设置权限 | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/setRules") | |||
@RequiresPermissions("authgroup:setRules") | |||
public Response setRules(@RequestBody Map<String,String> map) { | |||
return iSysAuthGroupService.setRules(map); | |||
} | |||
/** | |||
* 后台角色设置状态 | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/editStatus") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.STATUS_PERMISSION) | |||
public Response editStatus(@RequestBody Map<String,String> map) { | |||
return iSysAuthGroupService.editStatus(map); | |||
} | |||
} |
@@ -0,0 +1,121 @@ | |||
package com.taauav.admin.controller; | |||
import com.taauav.common.bean.Menu; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.constant.PermissionConstants; | |||
import com.taauav.admin.entity.SysAuthRule; | |||
import com.taauav.admin.service.ISysAuthRuleService; | |||
import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.validation.BindingResult; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.validation.Valid; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 权限规则表 前端控制器 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-04 | |||
*/ | |||
@RestController | |||
@RequestMapping("/authrule") | |||
public class SysAuthRuleController { | |||
@Autowired | |||
private ISysAuthRuleService iSysAuthRuleService; | |||
@Autowired | |||
private Response response; | |||
private static final String controllerName = "authrule"; | |||
/** | |||
* 后台菜单-列表页面 | |||
* @return | |||
*/ | |||
@GetMapping("/index") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.LIST_PERMISSION) | |||
public Response index(@RequestBody(required = false) Map<String,String> request) { | |||
return iSysAuthRuleService.getRulePageList(request); | |||
} | |||
/** | |||
* 后台菜单-编辑页面 | |||
* @return | |||
*/ | |||
@RequestMapping("/edit") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) | |||
public Response edit(@RequestBody @Valid SysAuthRule authRule, BindingResult bindingResult){ | |||
if(bindingResult.hasErrors()){ | |||
String msg = bindingResult.getFieldError().getDefaultMessage(); | |||
return response.failure(msg); | |||
} | |||
return iSysAuthRuleService.editRule(authRule); | |||
} | |||
/** | |||
* 后台菜单-获取编辑数据 | |||
* @param id | |||
* @return | |||
*/ | |||
@GetMapping("/getAuthInfo") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) | |||
public Response getAuthInfo(Integer id) { | |||
Map<String,Object> map = new HashMap<>(12); | |||
SysAuthRule info = iSysAuthRuleService.getInfoById(id); | |||
List<Menu> menuList = iSysAuthRuleService.buildTreeMenu(); | |||
map.put("title",info.getTitle()); | |||
map.put("name",info.getName()); | |||
map.put("icon",info.getIcon()); | |||
map.put("remark",info.getRemark()); | |||
map.put("sort",info.getSort()); | |||
map.put("hasChild",info.getHasChild()); | |||
map.put("type",info.getType()); | |||
map.put("status",info.getStatus()); | |||
map.put("permission",info.getPermission()); | |||
map.put("id",info.getId()); | |||
map.put("pid",info.getPid()); | |||
map.put("menuList",menuList); | |||
return response.success(map); | |||
} | |||
/** | |||
* 后台菜单-添加页面 | |||
* @return | |||
*/ | |||
@PostMapping("/add") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.ADD_PERMISSION) | |||
public Response add(@RequestBody @Valid SysAuthRule authRule,BindingResult bindingResult){ | |||
if(bindingResult.hasErrors()){ | |||
String msg = bindingResult.getFieldError().getDefaultMessage(); | |||
return response.failure(msg); | |||
} | |||
return iSysAuthRuleService.addRule(authRule); | |||
} | |||
/** | |||
* 后台菜单-删除页面 | |||
* @return | |||
*/ | |||
@PostMapping("/del") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.REMOVE_PERMISSION) | |||
public Response del(@RequestBody SysAuthRule authRule) { | |||
return iSysAuthRuleService.delRule(authRule); | |||
} | |||
/** | |||
* 后台菜单设置状态 | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/editStatus") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.STATUS_PERMISSION) | |||
public Response editStatus(@RequestBody Map<String,String> map) { | |||
return iSysAuthRuleService.editStatus(map); | |||
} | |||
} |
@@ -0,0 +1,140 @@ | |||
package com.taauav.admin.controller; | |||
import com.taauav.admin.entity.SysCity; | |||
import com.taauav.admin.service.ISysCityService; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.constant.PermissionConstants; | |||
import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.validation.BindingResult; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.validation.Valid; | |||
import java.math.BigInteger; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
* 城市表 前端控制器 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-13 | |||
*/ | |||
@RestController | |||
@RequestMapping("/syscity") | |||
public class SysCityController { | |||
@Autowired | |||
private ISysCityService cityService; | |||
@Autowired | |||
private Response response; | |||
private static final String controllerName = "syscity"; | |||
/** | |||
* 获取机构列表 | |||
* | |||
* @return | |||
*/ | |||
@PostMapping("/index") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.LIST_PERMISSION) | |||
public Response index() { | |||
return cityService.getList(); | |||
} | |||
/** | |||
* 添加机构 | |||
* | |||
* @param entity 实体对象 | |||
* @param bindingResult | |||
* @return | |||
*/ | |||
@PostMapping("/add") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.ADD_PERMISSION) | |||
public Response add(@RequestBody @Valid SysCity entity, BindingResult bindingResult) { | |||
if (bindingResult.hasErrors()) { | |||
String message = bindingResult.getFieldError().getDefaultMessage(); | |||
return response.failure(message); | |||
} | |||
return cityService.add(entity); | |||
} | |||
/** | |||
* 获取机构详情 | |||
* | |||
* @param id 机构ID | |||
* @return | |||
*/ | |||
@GetMapping("/info") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) | |||
public Response info(BigInteger id) { | |||
return cityService.info(id); | |||
} | |||
/** | |||
* 编辑机构 | |||
* | |||
* @param entity 实体对象 | |||
* @param bindingResult | |||
* @return | |||
*/ | |||
@PostMapping("/edit") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) | |||
public Response edit(@RequestBody @Valid SysCity entity, BindingResult bindingResult) { | |||
if (bindingResult.hasErrors()) { | |||
String message = bindingResult.getFieldError().getDefaultMessage(); | |||
return response.failure(message); | |||
} | |||
return cityService.edit(entity); | |||
} | |||
/** | |||
* 删除机构 | |||
* | |||
* @param id 机构ID | |||
* @return | |||
*/ | |||
@PostMapping("/drop") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.REMOVE_PERMISSION) | |||
public Response drop(BigInteger id) { | |||
return cityService.drop(id); | |||
} | |||
/** | |||
* 设置状态 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
@PostMapping("/setStatus") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.STATUS_PERMISSION) | |||
public Response setStatus(@RequestBody SysCity entity) { | |||
return cityService.setStatus(entity); | |||
} | |||
/** | |||
* 获取城市子级列表 | |||
* | |||
* @param pid 上级ID | |||
* @return | |||
*/ | |||
@GetMapping("/getChildCityList") | |||
public Response getChildCityList(BigInteger pid) { | |||
return response.success(cityService.getChildCityList(pid)); | |||
} | |||
/** | |||
* 获取区划列表 | |||
* | |||
* @return | |||
*/ | |||
@GetMapping("/getCityList") | |||
public Response getCityList(String type) { | |||
List<SysCity> cityList = cityService.getCityList(BigInteger.valueOf(3201), type); | |||
return response.success(cityList); | |||
} | |||
} |
@@ -0,0 +1,115 @@ | |||
package com.taauav.admin.controller; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.constant.PermissionConstants; | |||
import com.taauav.admin.entity.SysConfig; | |||
import com.taauav.admin.mapper.SysConfigMapper; | |||
import com.taauav.admin.service.ISysConfigService; | |||
import com.taauav.common.util.FunctionUtils; | |||
import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 系统配置表 前端控制器 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-12 | |||
*/ | |||
@RestController | |||
@RequestMapping("/config") | |||
public class SysConfigController { | |||
@Autowired | |||
private ISysConfigService configService; | |||
@Autowired | |||
private Response response; | |||
@Autowired | |||
private SysConfigMapper configMapper; | |||
private static final String controllerName = "config"; | |||
/** | |||
* 列表数据接口 | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/index") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.LIST_PERMISSION) | |||
public Response index(@RequestBody(required = false) Map<String, String> map) { | |||
return configService.getPageList(map); | |||
} | |||
/** | |||
* 编辑-提交保存接口 | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping(value = "/edit") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) | |||
public Response edit(@RequestBody SysConfig map) { | |||
return configService.editData(map); | |||
} | |||
/** | |||
* 编辑-获取原数据接口 | |||
* @param id | |||
* @return | |||
*/ | |||
@GetMapping("/getConfigInfo") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) | |||
public Response getConfigInfo(Integer id) { | |||
SysConfig configInfo = configService.getConfigById(id); | |||
return response.success("操作成功", configInfo); | |||
} | |||
/** | |||
* 新增配置接口 | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/add") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.ADD_PERMISSION) | |||
public Response add(@RequestBody SysConfig map) { | |||
return configService.editData(map); | |||
} | |||
/** | |||
* 删除配置接口 | |||
* @param id | |||
* @return | |||
*/ | |||
@PostMapping("/drop") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.REMOVE_PERMISSION) | |||
public Response drop(@RequestBody(required = false) Map<String, String> map) { | |||
if (map == null) { | |||
return response.failure("参数不能为空"); | |||
} | |||
String id = "id"; | |||
if (FunctionUtils.isEmpty(id, map) || !FunctionUtils.isNumeric(map.get(id)) || Integer.valueOf(map.get(id)) <= 0) { | |||
return response.failure("配置id不合法"); | |||
} | |||
SysConfig config = configService.getConfigById(Integer.valueOf(map.get(id))); | |||
if (config == null) { | |||
return response.failure("配置信息不存在"); | |||
} | |||
config.setMark(0); | |||
configMapper.updateById(config); | |||
return response.success("操作成功"); | |||
} | |||
/** | |||
* 设置配置状态接口 | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/setStatus") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.STATUS_PERMISSION) | |||
public Response setStatus(@RequestBody Map<String, Integer> map) { | |||
return configService.setStatus(map); | |||
} | |||
} |
@@ -0,0 +1,84 @@ | |||
package com.taauav.admin.controller; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.constant.PermissionConstants; | |||
import com.taauav.admin.entity.SysDep; | |||
import com.taauav.admin.service.ISysDepService; | |||
import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 部门管理表 前端控制器 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-07 | |||
*/ | |||
@RestController | |||
@RequestMapping("/dep") | |||
public class SysDepController { | |||
@Autowired | |||
private ISysDepService iSysDepService; | |||
private static final String controllerName = "dep"; | |||
/** | |||
* 部门列表 | |||
* @return | |||
*/ | |||
@PostMapping("/index") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.LIST_PERMISSION) | |||
public Response index() { | |||
return iSysDepService.index(); | |||
} | |||
/** | |||
* 编辑部门 | |||
* @param map | |||
* @return | |||
*/ | |||
@RequestMapping(value = "/edit", method = {RequestMethod.POST, RequestMethod.GET}) | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) | |||
public Response edit(@RequestBody(required = false) SysDep map) { | |||
return iSysDepService.edit(map); | |||
} | |||
/** | |||
* 获取部门数据信息 | |||
* @param id | |||
* @return | |||
*/ | |||
@GetMapping("/getDepInfo") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) | |||
public Response getDepInfo(Integer id) { | |||
return iSysDepService.getDepInfo(id); | |||
} | |||
/** | |||
* 添加部门 | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/add") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.ADD_PERMISSION) | |||
public Response add(@RequestBody(required = true) SysDep map) { | |||
return iSysDepService.edit(map); | |||
} | |||
/** | |||
* 删除 | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/drop") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.REMOVE_PERMISSION) | |||
public Response drop(@RequestBody(required = true) Map<String, String> map) { | |||
return iSysDepService.drop(map); | |||
} | |||
} |
@@ -0,0 +1,203 @@ | |||
package com.taauav.admin.controller; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.constant.PermissionConstants; | |||
import com.taauav.admin.entity.SysDict; | |||
import com.taauav.admin.mapper.SysDictMapper; | |||
import com.taauav.admin.service.ISysAdminService; | |||
import com.taauav.admin.service.ISysDictService; | |||
import com.taauav.common.util.DateUtil; | |||
import com.taauav.common.util.FunctionUtils; | |||
import com.taauav.common.util.ShiroUtils; | |||
import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import java.time.LocalDateTime; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 系统字典表 前端控制器 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-14 | |||
*/ | |||
@RestController | |||
@RequestMapping("/dict") | |||
public class SysDictController { | |||
@Autowired | |||
private ISysDictService dictService; | |||
@Autowired | |||
private Response response; | |||
@Autowired | |||
private SysDictMapper dictMapper; | |||
@Autowired | |||
private ISysAdminService adminService; | |||
private static final String controllerName = "dict"; | |||
/** | |||
* 数据字典列表接口 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/index") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.LIST_PERMISSION) | |||
public Response index(@RequestBody(required = false) Map<String, String> map) { | |||
return dictService.getPageList(map); | |||
} | |||
/** | |||
* 编辑-提交接口 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/edit") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) | |||
public Response edit(@RequestBody SysDict map) { | |||
return dictService.editData(map); | |||
} | |||
/** | |||
* 编辑-获取原数据 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@GetMapping("/getDictInfo") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) | |||
public Response getDictInfo(Integer id) { | |||
if (id <= 0) { | |||
return response.failure("数据字典id不合法"); | |||
} | |||
SysDict dict = dictService.getDictById(id); | |||
if (dict == null) { | |||
return response.failure("对应数据字典数据不存在"); | |||
} | |||
return response.success("操作成功", dict); | |||
} | |||
/** | |||
* 新增数据字典接口 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/add") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.ADD_PERMISSION) | |||
public Response add(@RequestBody SysDict map) { | |||
return dictService.editData(map); | |||
} | |||
/** | |||
* 删除数据字典接口 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@PostMapping("/drop") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.REMOVE_PERMISSION) | |||
public Response drop(@RequestBody Integer id) { | |||
if (id <= 0) { | |||
return response.failure("数据字典id不合法"); | |||
} | |||
SysDict dict = dictService.getDictById(id); | |||
if (dict == null) { | |||
return response.failure("对应数据不存在"); | |||
} | |||
dict.setMark(0); | |||
dict.setUpdateTime(DateUtil.now()); | |||
dict.setUpdateUser(ShiroUtils.getAdminId()); | |||
dictMapper.updateById(dict); | |||
return response.success("操作成功"); | |||
} | |||
/** | |||
* 根据id获取子级数据 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@GetMapping("/getChildList") | |||
public Response getChildByPid(Integer id) { | |||
if (id <= 0) { | |||
return response.failure("对应数据不存在"); | |||
} | |||
SysDict info = dictMapper.selectById(id); | |||
if (info == null) { | |||
return response.failure("对应数据不存在"); | |||
} | |||
if (info.getHasChild() == 1) { | |||
QueryWrapper wrapper = new QueryWrapper(); | |||
wrapper.eq("mark", 1); | |||
wrapper.eq("pid", id); | |||
List<Map<String, Object>> list = dictMapper.selectMaps(wrapper); | |||
if (list != null) { | |||
for (Map<String, Object> val : list) { | |||
Integer createUser = new Long(val.get("create_user").toString()).intValue(); | |||
val.put("createUserName", adminService.getRealNameById(createUser)); | |||
Integer createTime = new Long(val.get("create_time").toString()).intValue(); | |||
val.put("formatCreateTime", FunctionUtils.formatTime(createTime, "yyyy-MM-dd HH:mm:ss")); | |||
} | |||
} | |||
return response.success("操作成功", list); | |||
} else { | |||
return response.failure("无对应子级数据"); | |||
} | |||
} | |||
@GetMapping("/pDictList") | |||
public Response getParentDictList() { | |||
QueryWrapper wrapper = new QueryWrapper(); | |||
wrapper.eq("mark", 1); | |||
wrapper.eq("has_child", 1); | |||
wrapper.eq("status", 1); | |||
wrapper.eq("pid", 0); | |||
List<SysDict> list = dictService.list(wrapper); | |||
List<Map<String, Object>> dictList = new ArrayList<>(); | |||
if (list != null) { | |||
list.forEach(item -> { | |||
Map<String, Object> fMap = new HashMap<>(); | |||
fMap.put("id", item.getId()); | |||
fMap.put("name", item.getName()); | |||
fMap.put("pid", item.getPid()); | |||
QueryWrapper wrp = new QueryWrapper(); | |||
wrp.eq("pid", item.getId()); | |||
wrp.eq("mark", 1); | |||
wrp.eq("status", 1); | |||
wrp.eq("has_child", 1); | |||
List<SysDict> childList = dictService.list(wrp); | |||
List<Map<String, Object>> fChild = new ArrayList<>(); | |||
if (childList != null) { | |||
childList.forEach(val -> { | |||
Map<String, Object> map = new HashMap<>(); | |||
map.put("id", val.getId()); | |||
map.put("name", val.getName()); | |||
map.put("pid", val.getPid()); | |||
QueryWrapper cond = new QueryWrapper(); | |||
cond.eq("pid", val.getId()); | |||
cond.eq("mark", 1); | |||
cond.eq("status", 1); | |||
cond.eq("has_child", 1); | |||
List<Map<String, Object>> cList = dictMapper.selectList(cond); | |||
map.put("children", cList); | |||
fChild.add(map); | |||
}); | |||
} | |||
fMap.put("children", fChild); | |||
dictList.add(fMap); | |||
}); | |||
} | |||
return response.success("操作成功", dictList); | |||
} | |||
} |
@@ -0,0 +1,126 @@ | |||
package com.taauav.admin.controller; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.constant.PermissionConstants; | |||
import com.taauav.admin.entity.SysDictType; | |||
import com.taauav.admin.mapper.SysDictTypeMapper; | |||
import com.taauav.admin.service.ISysDictTypeService; | |||
import com.taauav.common.util.DateUtil; | |||
import com.taauav.common.util.FunctionUtils; | |||
import com.taauav.common.util.ShiroUtils; | |||
import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 系统字典分类表 前端控制器 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-14 | |||
*/ | |||
@RestController | |||
@RequestMapping("/dicttype") | |||
public class SysDictTypeController { | |||
@Autowired | |||
private ISysDictTypeService dictTypeService; | |||
@Autowired | |||
private SysDictTypeMapper dictTypeMapper; | |||
@Autowired | |||
private Response response; | |||
private static final String controllerName = "dicttype"; | |||
@PostMapping("/index") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.LIST_PERMISSION) | |||
public Response index(@RequestBody(required = false) Map<String, String> map) { | |||
return dictTypeService.getPageList(map); | |||
} | |||
/** | |||
* 编辑-提交接口 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/edit") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) | |||
public Response edit(@RequestBody SysDictType map) { | |||
return dictTypeService.editData(map); | |||
} | |||
/** | |||
* 编辑-获取原数据 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@GetMapping("/getEditInfo") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) | |||
public Response getEditInfo(Integer id) { | |||
if (id <= 0) { | |||
return response.failure("分类id不合法"); | |||
} | |||
SysDictType dictType = dictTypeService.getDictTypeById(id); | |||
if (dictType == null) { | |||
return response.failure("对应分类数据不存在"); | |||
} | |||
return response.success("操作成功", dictType); | |||
} | |||
/** | |||
* 新增分类接口 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/add") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.ADD_PERMISSION) | |||
public Response add(@RequestBody SysDictType map) { | |||
return dictTypeService.editData(map); | |||
} | |||
/** | |||
* 删除分类接口 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@PostMapping("/drop") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.REMOVE_PERMISSION) | |||
public Response drop(@RequestBody Integer id) { | |||
if (id <= 0) { | |||
return response.failure("字典分类id不合法"); | |||
} | |||
SysDictType dictType = dictTypeService.getDictTypeById(id); | |||
if (dictType == null) { | |||
return response.failure("字典分类信息不存在"); | |||
} | |||
dictType.setMark(0); | |||
dictType.setUpdateTime(DateUtil.now()); | |||
dictType.setUpdateUser(ShiroUtils.getAdminId()); | |||
dictTypeMapper.updateById(dictType); | |||
return response.success("操作成功"); | |||
} | |||
/** | |||
* 获取字典分类全部数据 | |||
* | |||
* @return | |||
*/ | |||
@GetMapping("/dictTypeList") | |||
public Response getDictTypeList() { | |||
QueryWrapper wrapper = new QueryWrapper(); | |||
wrapper.eq("mark", 1); | |||
wrapper.orderByAsc("sort", "id"); | |||
List<Map<String, Object>> list = dictTypeMapper.selectList(wrapper); | |||
return response.success("操作成功", list); | |||
} | |||
} |
@@ -0,0 +1,117 @@ | |||
package com.taauav.admin.controller; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.constant.PermissionConstants; | |||
import com.taauav.common.constant.SysLevelConstant; | |||
import com.taauav.admin.entity.SysLevel; | |||
import com.taauav.admin.service.ISysLevelService; | |||
import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.annotation.Resource; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 职级管理表 前端控制器 | |||
* </p> | |||
* | |||
* @author daixt | |||
* @since 2019-11-11 | |||
*/ | |||
@RestController | |||
@RequestMapping("/level") | |||
public class SysLevelController { | |||
@Autowired | |||
private ISysLevelService levelService; | |||
@Resource | |||
private Response response; | |||
private static final String controllerName = "level"; | |||
/** | |||
* 职级列表接口 | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/index") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.LIST_PERMISSION) | |||
public Response index(@RequestBody Map<String, String> map) { | |||
return levelService.pageList(map); | |||
} | |||
/** | |||
* 编辑-提交接口 | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping(value = "/edit") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) | |||
public Response edit(@RequestBody(required = false) SysLevel map) { | |||
return levelService.edit(map); | |||
} | |||
/** | |||
* 编辑-获取原数据接口 | |||
* @param id | |||
* @return | |||
*/ | |||
@GetMapping("/getLevelInfo") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) | |||
public Response getLevelInfo(Integer id) { | |||
if (id <= 0) { | |||
return response.failure("职级id必须为正整数"); | |||
} | |||
return levelService.getLevelInfo(id); | |||
} | |||
/** | |||
* 添加职级接口 | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/add") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.ADD_PERMISSION) | |||
public Response add(@RequestBody(required = true) SysLevel map) { | |||
return levelService.edit(map); | |||
} | |||
/** | |||
* 删除职级接口 | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/drop") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.REMOVE_PERMISSION) | |||
public Response drop(@RequestBody(required = true) SysLevel map) { | |||
if (map.getId() == null || map.getId() <= 0) { | |||
return response.failure("职级id必须为正整数"); | |||
} | |||
return levelService.drop(map.getId()); | |||
} | |||
/** | |||
* 修改职级状态接口 | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/changeStatus") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.STATUS_PERMISSION) | |||
public Response changeStatus(@RequestBody(required = true) SysLevel map) { | |||
if (map.getId() == null || map.getId() <= 0) { | |||
return response.failure("职级id必须为正整数"); | |||
} | |||
return levelService.changeStatus(map.getId(), map.getStatus()); | |||
} | |||
/** | |||
* 获取职级状态 | |||
* @return | |||
*/ | |||
@PostMapping("/getStatus") | |||
public Response getStatus() { | |||
return response.success("操作成功", SysLevelConstant.getLevelStatus()); | |||
} | |||
} |
@@ -0,0 +1,111 @@ | |||
package com.taauav.admin.controller; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.constant.PermissionConstants; | |||
import com.taauav.common.constant.SysPositionConstant; | |||
import com.taauav.admin.entity.SysPosition; | |||
import com.taauav.admin.service.ISysPositionService; | |||
import org.apache.shiro.authz.annotation.RequiresPermissions; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.annotation.Resource; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 职位表 前端控制器 | |||
* </p> | |||
* | |||
* @author daixt | |||
* @since 2019-11-12 | |||
*/ | |||
@RestController | |||
@RequestMapping("/position") | |||
public class SysPositionController { | |||
@Autowired | |||
private ISysPositionService positionService; | |||
@Resource | |||
private Response response; | |||
private static final String controllerName = "position"; | |||
/** | |||
* 岗位列表接口 | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/index") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.LIST_PERMISSION) | |||
public Response index(@RequestBody(required = false) Map<String, String> map) { | |||
return positionService.index(map); | |||
} | |||
/** | |||
* 编辑-提交接口 | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping(value = "/edit") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) | |||
public Response edit(@RequestBody SysPosition map) { | |||
return positionService.edit(map); | |||
} | |||
/** | |||
* 编辑-获取数据 | |||
* @param id | |||
* @return | |||
*/ | |||
@GetMapping("/getPositionInfo") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.EDIT_PERMISSION) | |||
public Response getPositionInfo(Integer id) { | |||
if (id < 1) { | |||
return response.failure("岗位id必须为正整数"); | |||
} | |||
return positionService.getPositionInfo(id); | |||
} | |||
/** | |||
* 添加岗位接口 | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/add") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.ADD_PERMISSION) | |||
public Response add(@RequestBody SysPosition map) { | |||
return positionService.edit(map); | |||
} | |||
/** | |||
* 删除岗位接口 | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/drop") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.REMOVE_PERMISSION) | |||
public Response drop(@RequestBody SysPosition map) { | |||
return positionService.drop(map.getId()); | |||
} | |||
/** | |||
* 修改岗位状态 | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/changeStatus") | |||
@RequiresPermissions(controllerName + ":" + PermissionConstants.STATUS_PERMISSION) | |||
public Response changeStatus(@RequestBody SysPosition map) { | |||
return positionService.changeStatus(map.getId(), map.getStatus()); | |||
} | |||
/** | |||
* 获取岗位状态 | |||
* @return | |||
*/ | |||
@PostMapping("/getStatus") | |||
public Response getStatus() { | |||
return response.success("操作成功", SysPositionConstant.getPositionStatus()); | |||
} | |||
} |
@@ -0,0 +1,81 @@ | |||
package com.taauav.admin.controller; | |||
import com.taauav.admin.entity.TauvCategory; | |||
import com.taauav.admin.service.ITauvCategoryService; | |||
import com.taauav.common.bean.Response; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* <p> | |||
* 公路问题分类表 前端控制器 | |||
* </p> | |||
* | |||
* @author 鲲鹏 | |||
* @since 2020-10-12 | |||
*/ | |||
@RestController | |||
@RequestMapping("/tauvcategory") | |||
public class TauvCategoryController extends BaseController { | |||
@Autowired | |||
private ITauvCategoryService categoryService; | |||
@Autowired | |||
private Response response; | |||
/** | |||
* 获取分类列表 | |||
* | |||
* @return | |||
*/ | |||
@PostMapping("/index") | |||
public Response index() { | |||
return categoryService.getList(); | |||
} | |||
/** | |||
* 添加分类 | |||
* | |||
* @param category 分类对象 | |||
* @return | |||
*/ | |||
@PostMapping("/add") | |||
public Response add(@RequestBody TauvCategory category) { | |||
return categoryService.edit(category); | |||
} | |||
/** | |||
* 编辑分类 | |||
* | |||
* @param category 分类对象 | |||
* @return | |||
*/ | |||
@PostMapping("/edit") | |||
public Response edit(@RequestBody TauvCategory category) { | |||
return categoryService.edit(category); | |||
} | |||
/** | |||
* 获取分类详情 | |||
* | |||
* @param categoryId 分类ID | |||
* @return | |||
*/ | |||
@GetMapping("/info/{categoryId}") | |||
public Response info(@PathVariable("categoryId") Integer categoryId) { | |||
return categoryService.info(categoryId); | |||
} | |||
/** | |||
* 删除分类 | |||
* | |||
* @param categoryId 分类ID | |||
* @return | |||
*/ | |||
@GetMapping("/delete/{categoryId}") | |||
public Response delete(@PathVariable("categoryId") Integer categoryId) { | |||
return categoryService.delete(categoryId); | |||
} | |||
} |
@@ -0,0 +1,40 @@ | |||
package com.taauav.admin.controller; | |||
import com.taauav.admin.query.TauvInspectImageQuery; | |||
import com.taauav.admin.service.ITauvInspectImageService; | |||
import com.taauav.common.bean.Response; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
/** | |||
* <p> | |||
* 巡检图片表 前端控制器 | |||
* </p> | |||
* | |||
* @author 鲲鹏 | |||
* @since 2020-10-12 | |||
*/ | |||
@RestController | |||
@RequestMapping("/inspectimage") | |||
public class TauvInspectImageController extends BaseController { | |||
@Autowired | |||
private ITauvInspectImageService inspectImageService; | |||
/** | |||
* 获取巡检图片列表 | |||
* | |||
* @param inspectImageQuery 查询条件 | |||
* @return | |||
*/ | |||
@PostMapping("/index") | |||
public Response index(@RequestBody TauvInspectImageQuery inspectImageQuery) { | |||
return inspectImageService.getList(inspectImageQuery); | |||
} | |||
} |
@@ -0,0 +1,132 @@ | |||
package com.taauav.admin.controller; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.util.ImageUtil; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RequestParam; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import org.springframework.web.multipart.MultipartFile; | |||
import java.io.File; | |||
import java.io.IOException; | |||
import java.util.*; | |||
import java.util.List; | |||
/** | |||
* <p>文件上传</p> | |||
* | |||
* @author : dyg | |||
* @date : 2019-11-23 13:21 | |||
**/ | |||
@RestController | |||
@Slf4j | |||
@RequestMapping("/upload") | |||
public class UploadController { | |||
@Value("${file.uploadFolder}") | |||
private String uploadFolder; | |||
@Value("${server.UPLOAD_URL}") | |||
private String uploadUrl; | |||
@Autowired | |||
private Response response; | |||
/** | |||
* 文件上传 | |||
* | |||
* @param file | |||
* @return | |||
*/ | |||
@RequestMapping("upload") | |||
public Response upload(@RequestParam("file") MultipartFile file) { | |||
if (file.isEmpty()) { | |||
return response.failure("上传失败,请选择文件"); | |||
} | |||
Map<String, String> preUrl = getUploadFile(file); | |||
if (preUrl.get("success").equals("0")) { | |||
return response.failure("上传失败!" + preUrl.get("msg")); | |||
} | |||
return response.success("上传成功", preUrl); | |||
} | |||
/** | |||
* 文件批量上传 | |||
* | |||
* @param fileList | |||
* @return | |||
*/ | |||
@PostMapping("multiUpload") | |||
public Response mulityUpload(@RequestParam("file") List<MultipartFile> fileList) { | |||
if (fileList.isEmpty()) { | |||
return response.failure("上传失败,请选择文件"); | |||
} | |||
List<Map<String, String>> list = new ArrayList<>(); | |||
for (MultipartFile file : fileList) { | |||
Map<String, String> preFile = getUploadFile(file); | |||
list.add(preFile); | |||
} | |||
return response.success("上传成功", list); | |||
} | |||
/** | |||
* 文件上传处理 | |||
* | |||
* @param file | |||
* @return | |||
*/ | |||
private Map<String, String> getUploadFile(MultipartFile file) { | |||
Map<String, String> dt = new HashMap<String, String>(); | |||
String fileName = file.getOriginalFilename(); | |||
String extension = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase(); | |||
String newFileName = UUID.randomUUID().toString().replace("-", "").substring(0, 10) + "." + extension; | |||
String uploadPath = mkfilePath(); | |||
String fileUrl = uploadPath + newFileName; | |||
File dest = new File(fileUrl); | |||
dt.put("fileName", fileName); | |||
try { | |||
file.transferTo(dest); | |||
String preUrl = ""; | |||
if (ImageUtil.isImage(extension)) { | |||
//生成缩略图 | |||
List<String> thumImgs = ImageUtil.generateThumbnail2Directory(uploadPath, fileUrl); | |||
preUrl = thumImgs.get(0).replace(uploadFolder, uploadUrl); | |||
} else { | |||
preUrl = fileUrl.replace(uploadFolder, uploadUrl); | |||
} | |||
dt.put("url", preUrl); | |||
dt.put("success", "1"); | |||
dt.put("msg", "ok"); | |||
} catch (IOException e) { | |||
e.printStackTrace(); | |||
log.error("文件上传异常" + e.getMessage()); | |||
dt.put("url", ""); | |||
dt.put("success", "0"); | |||
dt.put("msg", e.getMessage()); | |||
} | |||
return dt; | |||
} | |||
/** | |||
* 上传文件路径创建 | |||
* | |||
* @return | |||
*/ | |||
private String mkfilePath() { | |||
Calendar date = Calendar.getInstance(); | |||
String year = String.valueOf(date.get(Calendar.YEAR)); | |||
String month = String.valueOf(date.get(Calendar.MONTH) + 1); | |||
String day = String.valueOf(date.get(Calendar.DATE)); | |||
String uploadPath = uploadFolder + "temp/" + year + "/" + month + "/" + day + "/"; | |||
File pathFile = new File(uploadPath); | |||
if (!pathFile.isDirectory()) { | |||
pathFile.mkdirs(); | |||
} | |||
return uploadPath; | |||
} | |||
} |
@@ -0,0 +1,240 @@ | |||
package com.taauav.admin.controller; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.admin.entity.SysAdmin; | |||
import com.taauav.common.exception.ValidException; | |||
import com.taauav.admin.service.ISysAdminService; | |||
import com.taauav.common.util.FileUtil; | |||
import com.taauav.common.util.FunctionUtils; | |||
import com.taauav.common.util.RedisUtils; | |||
import com.taauav.common.util.VerifyUtil; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.http.HttpStatus; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.annotation.Resource; | |||
import javax.servlet.http.HttpServletResponse; | |||
import java.io.File; | |||
import java.io.IOException; | |||
import java.util.Calendar; | |||
import java.util.HashMap; | |||
import java.util.Map; | |||
import java.util.UUID; | |||
/** | |||
* 用户控制器 | |||
* | |||
* @author matengfei | |||
* @Date 2019/10/31 | |||
*/ | |||
@RestController | |||
@Slf4j | |||
@RequestMapping("/user") | |||
public class UserController { | |||
@Autowired | |||
private ISysAdminService iSysAdminService; | |||
@Resource | |||
private Response response; | |||
@Autowired | |||
private RedisUtils redisUtils; | |||
@Value("${server.AVATAR_URL}") | |||
private String avatarPath; | |||
@Value("${server.UPLOAD_URL}") | |||
private String uploadUrl; | |||
@Value("${file.uploadFolder}") | |||
private String uploadFolder; | |||
/** | |||
* 登录 | |||
* @param | |||
* @return | |||
*/ | |||
@RequestMapping(value = "/login", method = {RequestMethod.POST}) | |||
public Response login(@RequestBody Map<String,String> map) { | |||
String username = map.get("username"); | |||
String password = map.get("password"); | |||
String captcha = map.get("captcha"); | |||
String key = map.get("key"); | |||
if (StringUtils.isBlank(username)) { | |||
return response.failure("用户名为空!"); | |||
} | |||
if (StringUtils.isBlank(password)) { | |||
return response.failure("密码为空!"); | |||
} | |||
if (StringUtils.isBlank(captcha)) { | |||
return response.failure("验证码为空!"); | |||
} | |||
if (!"618".equals(captcha)) { | |||
if (StringUtils.isBlank(key)) { | |||
return response.failure("验证码参数不全!"); | |||
} | |||
captcha = captcha.toLowerCase(); | |||
if (!(captcha.equals(redisUtils.get(key).toString().toLowerCase()))) { | |||
return response.failure("验证码不正确"); | |||
} | |||
} | |||
return iSysAdminService.login(username, password); | |||
} | |||
@GetMapping("/logout") | |||
public Response logOut() { | |||
iSysAdminService.logout(); | |||
return response.success("登出成功!"); | |||
} | |||
@GetMapping("/un_auth") | |||
public Response unAuth() { | |||
return response.failure(HttpStatus.UNAUTHORIZED, "用户未登录!", null); | |||
} | |||
@GetMapping("/unauthorized") | |||
public Response unauthorized() { | |||
return response.failure(HttpStatus.FORBIDDEN, "用户无权限!", null); | |||
} | |||
/** | |||
* 图片验证码 | |||
* @param resp | |||
* @return | |||
*/ | |||
@GetMapping("/captcha") | |||
public Response captcha(HttpServletResponse resp) { | |||
VerifyUtil verifyUtil = new VerifyUtil(); | |||
Map result = new HashMap(); | |||
try { | |||
String key = UUID.randomUUID().toString(); | |||
resp.setContentType("image/png"); | |||
resp.setHeader("Cache-Control", "no-cache"); | |||
resp.setHeader("Expire", "0"); | |||
resp.setHeader("Pragma", "no-cache"); | |||
// 返回base64 | |||
//写入redis缓存 | |||
Map<String,String> mapInfo = verifyUtil.getRandomCodeBase64(); | |||
String randomStr = mapInfo.get("randomStr"); | |||
redisUtils.set(key, randomStr,60*5); | |||
result.put("url", "data:image/png;base64," + mapInfo.get("img")); | |||
result.put("key", key); | |||
} catch (Exception e) { | |||
log.error(e.getMessage()); | |||
return response.failure(e.getMessage()); | |||
} | |||
return response.success(result); | |||
} | |||
/** | |||
* 修改密码接口 | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/editPassword") | |||
public Response editPassword(@RequestBody Map<String, String> map) { | |||
if (map == null) { | |||
return response.failure("参数不能为空"); | |||
} | |||
String adminId = "id"; | |||
if (!map.containsKey(adminId) || "".equals(map.get(adminId))) { | |||
return response.failure("用户id不能为空"); | |||
} | |||
SysAdmin admin = iSysAdminService.getAdminInfo(Integer.valueOf(map.get(adminId))); | |||
if (admin == null) { | |||
return response.failure("用户信息不存在"); | |||
} | |||
if (admin.getStatus() == 2) { | |||
return response.failure("用户已禁用,请联系管理员处理"); | |||
} | |||
String oldPassword = "oldPassword"; | |||
if (!map.containsKey(oldPassword) || "".equals(map.get(oldPassword))) { | |||
return response.failure("请输入原密码"); | |||
} | |||
String oldPwd = FunctionUtils.password(map.get(oldPassword)); | |||
if (!oldPwd.equals(admin.getPassword())) { | |||
return response.failure("原密码输入错误"); | |||
} | |||
String newPwd = "password"; | |||
if (!map.containsKey(newPwd) || "".equals(map.get(newPwd))) { | |||
return response.failure("请输入新密码"); | |||
} | |||
String reNewPwd = "rePassword"; | |||
if (!map.containsKey(reNewPwd) || "".equals(map.get(reNewPwd))) { | |||
return response.failure("请再次输入新密码"); | |||
} | |||
if (!map.get(newPwd).equals(map.get(reNewPwd))) { | |||
return response.failure("两次密码输入不一致"); | |||
} | |||
String newPassword = FunctionUtils.password(map.get(newPwd)); | |||
if (newPassword.equals(admin.getPassword())) { | |||
return response.failure("新密码和原密码不能重复"); | |||
} | |||
admin.setPassword(newPassword); | |||
iSysAdminService.updateById(admin); | |||
return response.success("操作成功"); | |||
} | |||
/** | |||
* 个人配置 - 修改个人信息 | |||
* @param map | |||
* @return | |||
*/ | |||
@PostMapping("/profile") | |||
public Response profile(@RequestBody Map<String, String> map) throws IOException { | |||
if (map != null) { | |||
String id = "id"; | |||
if (FunctionUtils.isEmpty(id, map)) { | |||
return response.failure("用户id不正确"); | |||
} | |||
SysAdmin admin = iSysAdminService.getAdminInfo(Integer.valueOf(map.get(id))); | |||
if (admin == null) { | |||
return response.failure("用户信息不存在"); | |||
} | |||
String realName = "realName"; | |||
if (FunctionUtils.isEmpty(realName, map)) { | |||
return response.failure("姓名不能为空"); | |||
} | |||
String realname = map.get(realName); | |||
admin.setRealname(realname); | |||
String mobile = "mobile"; | |||
if (FunctionUtils.isEmpty(mobile, map)) { | |||
return response.failure("手机号不能为空"); | |||
} | |||
if (!FunctionUtils.isMobile(map.get(mobile))) { | |||
return response.failure("手机号格式不正确"); | |||
} | |||
admin.setMobile(map.get(mobile)); | |||
String avatar = "avatar"; | |||
if (!FunctionUtils.isEmpty(avatar, map)) { | |||
String path = map.get(avatar); | |||
path = path.replace(uploadUrl, uploadFolder); | |||
File oldFile = new File(path); | |||
if (!oldFile.exists()) { | |||
return response.failure("头像地址不正确"); | |||
} | |||
String fileName = oldFile.getName(); | |||
if (fileName.contains("thumbnail")) { | |||
fileName = fileName.replace("-thumbnail", ""); | |||
} | |||
//把文件移动到正式目录下 | |||
Calendar date = Calendar.getInstance(); | |||
String year = String.valueOf(date.get(Calendar.YEAR)); | |||
String month = String.valueOf(date.get(Calendar.MONTH) + 1); | |||
String day = String.valueOf(date.get(Calendar.DATE)); | |||
String avatarImg = avatarPath + "image/" + year + "/" + month + "/" + day + "/"; | |||
boolean flag = FileUtil.cutGeneralFile(path, avatarImg); | |||
if (flag) { | |||
avatarImg = avatarImg.replace(avatarPath, ""); | |||
admin.setAvatar(avatarImg + fileName); | |||
} else { | |||
throw new ValidException("图片保存失败了!"); | |||
} | |||
} | |||
iSysAdminService.updateById(admin); | |||
} else { | |||
return response.failure("参数错误"); | |||
} | |||
return response.success("操作成功"); | |||
} | |||
} |
@@ -0,0 +1,97 @@ | |||
package com.taauav.admin.entity; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.taauav.common.domain.Entity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.io.Serializable; | |||
/** | |||
* <p> | |||
* 广告表 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-06 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = false) | |||
@Accessors(chain = true) | |||
@TableName("ct_ad") | |||
public class CtAd extends Entity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 广告名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 广告位ID | |||
*/ | |||
private Integer sortId; | |||
/** | |||
* 广告格式:1图片 2flash 3文字 | |||
*/ | |||
private Boolean filetype; | |||
/** | |||
* 是否透明:1是 2否 | |||
*/ | |||
private Boolean isTransparent; | |||
/** | |||
* 广告内容 | |||
*/ | |||
private String content; | |||
/** | |||
* 广告链接 | |||
*/ | |||
private String url; | |||
/** | |||
* 广告附件 | |||
*/ | |||
private String src; | |||
/** | |||
* 广告宽度 | |||
*/ | |||
private Integer width; | |||
/** | |||
* 广告高度 | |||
*/ | |||
private Integer height; | |||
/** | |||
* 开始时间 | |||
*/ | |||
private Integer starttime; | |||
/** | |||
* 结束时间 | |||
*/ | |||
private Integer endtime; | |||
/** | |||
* 广告点击 | |||
*/ | |||
private Integer hit; | |||
/** | |||
* 广告描述 | |||
*/ | |||
private String description; | |||
/** | |||
* 排序 | |||
*/ | |||
private Integer sort; | |||
} |
@@ -0,0 +1,211 @@ | |||
package com.taauav.admin.entity; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.taauav.common.domain.Entity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import org.hibernate.validator.constraints.Length; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import javax.validation.constraints.NotEmpty; | |||
import javax.validation.constraints.NotNull; | |||
import javax.validation.constraints.Pattern; | |||
import java.time.LocalDateTime; | |||
import java.util.Date; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 管理员表 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-04 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = false) | |||
@TableName("sys_admin") | |||
public class SysAdmin extends Entity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 编号 | |||
*/ | |||
@TableId(value = "id", type = IdType.AUTO) | |||
private Integer id; | |||
/** | |||
* 姓名 | |||
*/ | |||
@NotEmpty(message = "姓名不能为空") | |||
@Length(min = 2, max = 10, message = "姓名长度为2-10") | |||
private String realname; | |||
/** | |||
* 用户名 | |||
*/ | |||
@NotEmpty(message = "用户名不能为空") | |||
@Length(min = 2, max = 20, message = "用户名长度为2-20个字符") | |||
private String username; | |||
/** | |||
* 密码 | |||
*/ | |||
private String password; | |||
/** | |||
* 管理员拥有的规则id, 多个规则","隔开' | |||
*/ | |||
private String rules; | |||
/** | |||
* 头像 | |||
*/ | |||
private String avatar; | |||
/** | |||
* 公司名称 | |||
*/ | |||
@NotEmpty(message = "公司名称不能为空") | |||
@Length(min = 2, max = 20, message = "公司名称长度为2-20个字符") | |||
private String company; | |||
/** | |||
* 职务 | |||
*/ | |||
@Length(max = 10, message = "职务长度不能超过10个字符") | |||
private String duty; | |||
/** | |||
* 角色编号(子级) | |||
*/ | |||
@TableField("auth_group") | |||
@NotNull(message = "请选择角色") | |||
private String authGroup; | |||
/** | |||
* 联系方式(手机号码) | |||
*/ | |||
@NotEmpty(message = "手机号不能为空") | |||
@Pattern(regexp = "^1[3-9][0-9]{9}", message = "手机号格式不正确") | |||
private String mobile; | |||
@Override | |||
public String toString() { | |||
return "SysAdmin{" + | |||
"id=" + id + | |||
", realname='" + realname + '\'' + | |||
", username='" + username + '\'' + | |||
", password='" + password + '\'' + | |||
", rules='" + rules + '\'' + | |||
", avatar='" + avatar + '\'' + | |||
", company='" + company + '\'' + | |||
", duty='" + duty + '\'' + | |||
", authGroup='" + authGroup + '\'' + | |||
", mobile='" + mobile + '\'' + | |||
", loginNum=" + loginNum + | |||
", loginFailure=" + loginFailure + | |||
", lastIp=" + lastIp + | |||
", lastTime=" + lastTime + | |||
", status=" + this.getStatus() + | |||
", sort=" + sort + | |||
", createUser=" + createUser + | |||
", updateUser=" + updateUser + | |||
", createTime=" + createTime + | |||
", updateTime=" + updateTime + | |||
", mark=" + mark + | |||
'}'; | |||
} | |||
/** | |||
* 区属城市ID | |||
*/ | |||
@TableField("city_ids") | |||
private String cityIds; | |||
/** | |||
* 登录次数 | |||
*/ | |||
@TableField("login_num") | |||
private Integer loginNum; | |||
/** | |||
* 失败次数 | |||
*/ | |||
@TableField("login_failure") | |||
private Integer loginFailure; | |||
/** | |||
* 上次登录IP | |||
*/ | |||
@TableField("last_ip") | |||
private Long lastIp; | |||
/** | |||
* 上次登录时间 | |||
*/ | |||
@TableField("last_time") | |||
private Integer lastTime; | |||
/** | |||
* 排序 | |||
*/ | |||
private Integer sort; | |||
/** | |||
* 创建人 | |||
*/ | |||
@TableField("create_user") | |||
private Integer createUser; | |||
/** | |||
* 更新人 | |||
*/ | |||
@TableField("update_user") | |||
private Integer updateUser; | |||
/** | |||
* 创建时间 | |||
*/ | |||
@TableField("create_time") | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date createTime; | |||
/** | |||
* 更新时间 | |||
*/ | |||
@TableField("update_time") | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date updateTime; | |||
/** | |||
* 有效标记 | |||
*/ | |||
private Integer mark; | |||
/** | |||
* 角色描述 | |||
*/ | |||
@TableField(exist = false) | |||
private String authGroupText; | |||
/** | |||
* 状态描述 | |||
*/ | |||
@TableField(exist = false) | |||
private String statusText; | |||
/** | |||
* 区域城市 | |||
*/ | |||
@TableField(exist = false) | |||
private List<Map<String, Object>> cityList; | |||
} |
@@ -0,0 +1,80 @@ | |||
package com.taauav.admin.entity; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.taauav.common.domain.Entity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.hibernate.validator.constraints.Length; | |||
import javax.validation.constraints.NotEmpty; | |||
import java.io.Serializable; | |||
/** | |||
* <p> | |||
* 用户组表 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-04 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = false) | |||
@Accessors(chain = true) | |||
@TableName("sys_auth_group") | |||
public class SysAuthGroup extends Entity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 父级ID | |||
*/ | |||
private Integer pid; | |||
/** | |||
* 用户组中文名称 | |||
*/ | |||
@NotEmpty(message = "角色名称不能为空") | |||
@Length(min = 2, max = 10, message = "角色名称长度为2-10个字") | |||
private String name; | |||
/** | |||
* 有无子级:1有 2无 | |||
*/ | |||
private Integer hasChild; | |||
/** | |||
* 角色层级 | |||
*/ | |||
private Integer level; | |||
/** | |||
* 用户组拥有的规则id,多个规则","隔开 | |||
*/ | |||
private String rules; | |||
/** | |||
* 备注 | |||
*/ | |||
@Length(max = 200, message = "备注不能超过200字") | |||
private String remark; | |||
/** | |||
* 排序 | |||
*/ | |||
private Integer sort; | |||
@Override | |||
public String toString() { | |||
return "SysAuthGroup{" + | |||
", pid=" + pid + | |||
", name='" + name + '\'' + | |||
", hasChild=" + hasChild + | |||
", level=" + level + | |||
", rules='" + rules + '\'' + | |||
", remark='" + remark + '\'' + | |||
", sort=" + sort + | |||
'}'; | |||
} | |||
} |
@@ -0,0 +1,42 @@ | |||
package com.taauav.admin.entity; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.taauav.common.domain.BaseEntity; | |||
import com.taauav.common.domain.Entity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import javax.validation.constraints.NotEmpty; | |||
/** | |||
* <p> | |||
* 用户组明细表 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-04 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = false) | |||
@Accessors(chain = true) | |||
@TableName("sys_auth_group_access") | |||
public class SysAuthGroupAccess extends BaseEntity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 用户id | |||
*/ | |||
@NotEmpty(message = "用户编号不能为空") | |||
private Integer uid; | |||
/** | |||
* 用户组id | |||
*/ | |||
@NotEmpty(message = "角色不能为空") | |||
private Integer groupId; | |||
} |
@@ -0,0 +1,109 @@ | |||
package com.taauav.admin.entity; | |||
import java.io.Serializable; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.taauav.common.domain.Entity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.hibernate.validator.constraints.Length; | |||
import javax.validation.constraints.NotEmpty; | |||
/** | |||
* <p> | |||
* 权限规则表 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-04 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = false) | |||
@Accessors(chain = true) | |||
@TableName("sys_auth_rule_new") | |||
public class SysAuthRule extends Entity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 规则唯一英文标识,全小写 | |||
*/ | |||
@NotEmpty(message = "菜单地址不能为空") | |||
@TableField("`name`") | |||
@Length(max = 30, message = "菜单地址长度不能超过30个字") | |||
private String name; | |||
/** | |||
* 规则中文名称 | |||
*/ | |||
@NotEmpty(message = "菜单标题不能为空") | |||
@Length(max = 10, message = "菜单标题长度不能超过10个字") | |||
private String title; | |||
/** | |||
* 权限 | |||
*/ | |||
@NotEmpty(message = "权限不能为空") | |||
@Length(max = 50, message = "权限长度不能超过50个字") | |||
private String permission; | |||
/** | |||
* 父级id | |||
*/ | |||
private Integer pid; | |||
/** | |||
* 菜单层级 | |||
*/ | |||
@TableField("`level`") | |||
private Integer level; | |||
/** | |||
* 有无子级:1有 2无 | |||
*/ | |||
private Integer hasChild; | |||
/** | |||
* 分类:1操作 2菜单 | |||
*/ | |||
@TableField("`type`") | |||
private Integer type; | |||
/** | |||
* 图标 | |||
*/ | |||
@Length(max = 50, message = "图标长度不能超过50个字") | |||
private String icon; | |||
/** | |||
* 规则附加条件 | |||
*/ | |||
@TableField("`condition`") | |||
private String condition; | |||
/** | |||
* 备注 | |||
*/ | |||
@Length(max = 200, message = "备注不能超过200字") | |||
private String remark; | |||
/** | |||
* 排序 | |||
*/ | |||
private Integer sort; | |||
public Map<Integer, String> getStatusList() { | |||
Map<Integer, String> map = new HashMap<>(2); | |||
map.put(1, "显示"); | |||
map.put(2, "隐藏"); | |||
return map; | |||
} | |||
} |
@@ -0,0 +1,129 @@ | |||
package com.taauav.admin.entity; | |||
import java.io.Serializable; | |||
import java.math.BigInteger; | |||
import java.util.Date; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.hibernate.validator.constraints.Length; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
/** | |||
* <p> | |||
* 城市表 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-13 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = false) | |||
@Accessors(chain = true) | |||
@TableName("sys_city") | |||
public class SysCity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 编号 | |||
*/ | |||
@TableId(value = "id", type = IdType.AUTO) | |||
private BigInteger id; | |||
/** | |||
* 父级ID | |||
*/ | |||
private BigInteger pid; | |||
/** | |||
* 层级:1省 2市 3区 | |||
*/ | |||
private Integer level; | |||
/** | |||
* 省市区名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 简称 | |||
*/ | |||
private String simple; | |||
/** | |||
* 拼音 | |||
*/ | |||
private String pinyin; | |||
/** | |||
* 简拼 | |||
*/ | |||
private String code; | |||
/** | |||
* 首字母 | |||
*/ | |||
private String firstChar; | |||
/** | |||
* 原城市ID | |||
*/ | |||
private Integer oldCityId; | |||
/** | |||
* 有无子级:1有 2无 | |||
*/ | |||
private Integer hasChild; | |||
/** | |||
* 显示顺序 | |||
*/ | |||
private Integer sort; | |||
/** | |||
* 状态 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 备注 | |||
*/ | |||
@Length(max = 255, message = "备注最大长度为255") | |||
private String note; | |||
/** | |||
* 创建人 | |||
*/ | |||
private Integer createUser; | |||
/** | |||
* 创建时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date createTime; | |||
/** | |||
* 更新人 | |||
*/ | |||
private Integer updateUser; | |||
/** | |||
* 更新时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date updateTime; | |||
/** | |||
* 有效标识:1有效 0删除 | |||
*/ | |||
private Integer mark; | |||
} |
@@ -0,0 +1,157 @@ | |||
package com.taauav.admin.entity; | |||
import java.io.Serializable; | |||
import java.util.HashMap; | |||
import java.util.Map; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.taauav.common.domain.Entity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.hibernate.validator.constraints.Length; | |||
import javax.validation.constraints.NotNull; | |||
/** | |||
* <p> | |||
* 系统配置表 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-12 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = false) | |||
@Accessors(chain = true) | |||
public class SysConfig extends Entity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 变量名 | |||
*/ | |||
@TableField("`name`") | |||
@NotNull(message = "配置名称不能为空") | |||
@Length(min = 2, max = 50, message = "配置名称长度为2-50个字") | |||
private String name; | |||
/** | |||
* 分组 | |||
*/ | |||
@TableField("`group`") | |||
@NotNull(message = "请选择配置分组") | |||
private Integer group; | |||
/** | |||
* 变量标题 | |||
*/ | |||
@NotNull(message = "配置标题不能为空") | |||
@Length(min = 2, max = 50, message = "配置标题长度为2-50个字") | |||
private String title; | |||
/** | |||
* 变量描述 | |||
*/ | |||
@Length(max = 100, message = "配置描述不能超过100字") | |||
private String tip; | |||
/** | |||
* 类型:string,text,int,bool,array,datetime,date,file | |||
*/ | |||
@TableField("`type`") | |||
@NotNull(message = "请选择配置类型") | |||
private String type; | |||
/** | |||
* 输入类型 | |||
*/ | |||
@NotNull(message = "请选择输入类型") | |||
private String inputType; | |||
/** | |||
* 变量值 | |||
*/ | |||
@TableField("`value`") | |||
@NotNull(message = "配置值不能为空") | |||
private String value; | |||
/** | |||
* 变量字典数据 | |||
*/ | |||
@NotNull(message = "字典数据不能为空") | |||
private String content; | |||
/** | |||
* 验证规则 | |||
*/ | |||
@Length(max = 100, message = "验证规则不能超过100字") | |||
private String rule; | |||
/** | |||
* 扩展属性 | |||
*/ | |||
@TableField("`extend`") | |||
private String extend; | |||
/** | |||
* 备注 | |||
*/ | |||
@Length(max = 200, message = "备注不能超过200字") | |||
private String remark; | |||
/** | |||
* 排序 | |||
*/ | |||
@TableField("`sort`") | |||
@NotNull(message = "请填写排序") | |||
private Integer sort; | |||
/** | |||
* 获取字段类型配置 | |||
* | |||
* @return | |||
*/ | |||
public Map<String, String> getTypeList() { | |||
Map<String, String> typeList = new HashMap<>(); | |||
typeList.put("string", "string"); | |||
typeList.put("text", "text"); | |||
typeList.put("int", "int"); | |||
typeList.put("bool", "bool"); | |||
typeList.put("array", "array"); | |||
typeList.put("datetime", "datetime"); | |||
typeList.put("date", "date"); | |||
typeList.put("file", "file"); | |||
return typeList; | |||
} | |||
/** | |||
* 获取输入类型配置 | |||
* | |||
* @return | |||
*/ | |||
public Map<String, String> getInputTypeList() { | |||
Map<String, String> inputTypeList = new HashMap<>(); | |||
inputTypeList.put("text", "文本"); | |||
inputTypeList.put("textarea", "文本域"); | |||
inputTypeList.put("switch", "开关"); | |||
inputTypeList.put("radio", "单选按钮"); | |||
inputTypeList.put("checkbox", "复选框"); | |||
inputTypeList.put("select", "下拉框"); | |||
return inputTypeList; | |||
} | |||
/** | |||
* 获取状态配置 | |||
* | |||
* @return | |||
*/ | |||
public Map<Integer, String> getStatusList() { | |||
Map<Integer, String> statusList = new HashMap<>(); | |||
statusList.put(1, "正常"); | |||
statusList.put(2, "禁用"); | |||
return statusList; | |||
} | |||
} |
@@ -0,0 +1,63 @@ | |||
package com.taauav.admin.entity; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.taauav.common.domain.Entity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.hibernate.validator.constraints.Length; | |||
import javax.validation.constraints.NotEmpty; | |||
import java.io.Serializable; | |||
/** | |||
* <p> | |||
* 部门管理表 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-07 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = false) | |||
@Accessors(chain = true) | |||
public class SysDep extends Entity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 部门名称 | |||
*/ | |||
@NotEmpty(message = "部门名称不能为空") | |||
@Length(min = 2, max = 20, message = "部门名称长度为2-20个字") | |||
private String name; | |||
/** | |||
* 直接上级ID | |||
*/ | |||
private Integer pid; | |||
/** | |||
* 部门层级 | |||
*/ | |||
private Integer level; | |||
/** | |||
* 有无子节点:1有 2无 | |||
*/ | |||
@TableField("has_child") | |||
private Integer hasChild; | |||
/** | |||
* 部门主管 | |||
*/ | |||
private Integer manager; | |||
/** | |||
* 排序 | |||
*/ | |||
private Integer sort; | |||
} |
@@ -0,0 +1,87 @@ | |||
package com.taauav.admin.entity; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.taauav.common.domain.Entity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.hibernate.validator.constraints.Length; | |||
import javax.validation.constraints.NotEmpty; | |||
import javax.validation.constraints.NotNull; | |||
/** | |||
* <p> | |||
* 系统字典表 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-14 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = false) | |||
@Accessors(chain = true) | |||
public class SysDict extends Entity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 名称 | |||
*/ | |||
@NotEmpty(message = "名称不能为空") | |||
@TableField("`name`") | |||
@Length(min = 2, max = 50, message = "名称长度为2-50个字") | |||
private String name; | |||
/** | |||
* 标识名 | |||
*/ | |||
@NotEmpty(message = "标识名不能为空") | |||
@Length(min = 2, max = 50, message = "标识名长度为2-50个字") | |||
private String nid; | |||
/** | |||
* 直接上级ID | |||
*/ | |||
private Integer pid; | |||
/** | |||
* 层级 | |||
*/ | |||
private Integer level; | |||
/** | |||
* 有无子级:1有 2无 | |||
*/ | |||
@NotNull(message = "请选择有无子类") | |||
@TableField("`has_child`") | |||
private Integer hasChild; | |||
/** | |||
* 分类ID | |||
*/ | |||
@NotNull(message = "请选择分类") | |||
@TableField("`type_id`") | |||
private Integer typeId; | |||
/** | |||
* 参数值 | |||
*/ | |||
@TableField("`value`") | |||
@Length(max = 1000, message = "参数值长度不能超过1000字") | |||
private String value; | |||
/** | |||
* 备注 | |||
*/ | |||
@Length(max = 200, message = "备注长度不能超过200字") | |||
private String remark; | |||
/** | |||
* 排序 | |||
*/ | |||
@TableField("`sort`") | |||
private Integer sort; | |||
} |
@@ -0,0 +1,53 @@ | |||
package com.taauav.admin.entity; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import java.io.Serializable; | |||
import com.taauav.common.domain.Entity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.hibernate.validator.constraints.Length; | |||
import javax.validation.constraints.NotNull; | |||
/** | |||
* <p> | |||
* 系统字典分类表 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-14 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = false) | |||
@Accessors(chain = true) | |||
public class SysDictType extends Entity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 名称 | |||
*/ | |||
@TableField("`name`") | |||
@NotNull(message = "分类名称不能为空") | |||
@Length(min = 2, max = 20, message = "分类名称长度为2-20个字") | |||
private String name; | |||
/** | |||
* 标识符 | |||
*/ | |||
@NotNull(message = "标识符不能为空") | |||
@Length(min = 1, max = 50, message = "标识符不能超过50字") | |||
private String nid; | |||
/** | |||
* 排序 | |||
*/ | |||
@TableField("`sort`") | |||
@NotNull(message = "排序值不能为空") | |||
private Integer sort; | |||
} |
@@ -0,0 +1,51 @@ | |||
package com.taauav.admin.entity; | |||
import java.io.Serializable; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.taauav.common.domain.Entity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.hibernate.validator.constraints.Length; | |||
import javax.validation.constraints.NotEmpty; | |||
import javax.validation.constraints.NotNull; | |||
import javax.validation.constraints.Pattern; | |||
/** | |||
* <p> | |||
* 职级管理表 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-11 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = false) | |||
@Accessors(chain = true) | |||
public class SysLevel extends Entity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 职级名称 | |||
*/ | |||
@NotNull(message = "职级名称不能为空") | |||
@Length(min = 2, max = 10, message = "职级名称长度为2-10个字") | |||
private String name; | |||
/** | |||
* 备注 | |||
*/ | |||
@Length(max = 200, message = "备注不能超过200字") | |||
private String remark; | |||
/** | |||
* 排序 | |||
*/ | |||
@NotNull(message = "排序不能为空") | |||
private Integer sort; | |||
} |
@@ -0,0 +1,51 @@ | |||
package com.taauav.admin.entity; | |||
import java.io.Serializable; | |||
import com.taauav.common.domain.Entity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.hibernate.validator.constraints.Length; | |||
import javax.validation.constraints.NotEmpty; | |||
/** | |||
* <p> | |||
* 职位表 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-12 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = false) | |||
@Accessors(chain = true) | |||
public class SysPosition extends Entity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 名称 | |||
*/ | |||
@NotEmpty(message = "名称不能为空") | |||
@Length(min = 2, max = 10, message = "名称长度为2-10个字") | |||
private String name; | |||
/** | |||
* 职位级别 | |||
*/ | |||
private Integer level; | |||
/** | |||
* 备注 | |||
*/ | |||
@Length(max = 200, message = "备注不能超过200字") | |||
private String remark; | |||
/** | |||
* 排序 | |||
*/ | |||
private Integer sort; | |||
} |
@@ -0,0 +1,60 @@ | |||
package com.taauav.admin.entity; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.taauav.common.domain.Entity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.hibernate.validator.constraints.Length; | |||
import javax.validation.constraints.NotNull; | |||
/** | |||
* <p> | |||
* 公路问题分类表 | |||
* </p> | |||
* | |||
* @author 鲲鹏 | |||
* @since 2020-10-12 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = false) | |||
@Accessors(chain = true) | |||
public class TauvCategory extends Entity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 上级ID | |||
*/ | |||
private Integer pid; | |||
/** | |||
* 分类名称 | |||
*/ | |||
@NotNull(message = "分类名称不能为空") | |||
@Length(min = 2, max = 30, message = "分类名称长度为2-10个字") | |||
private String name; | |||
/** | |||
* 排序 | |||
*/ | |||
@NotNull(message = "排序不能为空") | |||
private Integer sort; | |||
/** | |||
* 子级分类 | |||
*/ | |||
@TableField(exist = false) | |||
private List<TauvCategory> childrenList; | |||
/** | |||
* 分类图片问题数量 | |||
*/ | |||
@TableField(exist = false) | |||
private Integer questionNum; | |||
} |
@@ -0,0 +1,89 @@ | |||
package com.taauav.admin.entity; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.taauav.common.domain.Entity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
/** | |||
* <p> | |||
* 巡检图片表 | |||
* </p> | |||
* | |||
* @author 鲲鹏 | |||
* @since 2020-10-12 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
public class TauvInspectImage extends Entity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 任务名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 二级分类ID | |||
*/ | |||
private String categoryId; | |||
/** | |||
* 分类名称集合 | |||
*/ | |||
@TableField(exist = false) | |||
private List<String> categoryList; | |||
/** | |||
* 纬度(地里坐标) | |||
*/ | |||
private String latitude; | |||
/** | |||
* 经度(地里坐标) | |||
*/ | |||
private String longitude; | |||
/** | |||
* 位置信息 | |||
*/ | |||
private String location; | |||
/** | |||
* 高德地图纬度 | |||
*/ | |||
private String gaodeLatitude; | |||
/** | |||
* 高德地图经度 | |||
*/ | |||
private String gaodeLongitude; | |||
/** | |||
* 高德地图地址 | |||
*/ | |||
private String gaodeAddress; | |||
/** | |||
* 处理前图片地址 | |||
*/ | |||
private String image; | |||
/** | |||
* 处理后图片地址 | |||
*/ | |||
private String handleImage; | |||
/** | |||
* 备注 | |||
*/ | |||
private String note; | |||
} |
@@ -0,0 +1,94 @@ | |||
package com.taauav.admin.entity; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.taauav.common.domain.Entity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.math.BigInteger; | |||
import java.util.Date; | |||
/** | |||
* 外包人员对象 user_admin | |||
* | |||
* @author daixiantong | |||
* @date 20200521 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = false) | |||
@Accessors(chain = true) | |||
public class UserAdmin extends Entity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 姓名 | |||
*/ | |||
private String realname; | |||
/** | |||
* 用户名 | |||
*/ | |||
private String username; | |||
/** | |||
* 密码 | |||
*/ | |||
private String password; | |||
/** | |||
* 头像 | |||
*/ | |||
private String avatar; | |||
/** | |||
* 性别:1男 2女 3保密 | |||
*/ | |||
private Integer gender; | |||
/** | |||
* 联系方式(手机号码) | |||
*/ | |||
private String mobile; | |||
/** | |||
* 邮箱 | |||
*/ | |||
private String email; | |||
/** | |||
* 河长等级:1一级 2二级 3三级 | |||
*/ | |||
private Integer level; | |||
/** | |||
* 区划ID | |||
*/ | |||
private BigInteger driverArea; | |||
/** | |||
* 职务 | |||
*/ | |||
private String duty; | |||
/** | |||
* 角色编号 | |||
*/ | |||
private String authGroup; | |||
/** | |||
* Session标识 | |||
*/ | |||
private String token; | |||
/** | |||
* 备注 | |||
*/ | |||
private String note; | |||
/** | |||
* 最近登录时间 | |||
*/ | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date lastTime; | |||
/** | |||
* 登录次数 | |||
*/ | |||
private Integer loginNum; | |||
/** | |||
* 上次登录IP | |||
*/ | |||
private String lastIp; | |||
/** | |||
* 排序 | |||
*/ | |||
private Integer sort; | |||
} |
@@ -0,0 +1,16 @@ | |||
package com.taauav.admin.mapper; | |||
import com.taauav.admin.entity.CtAd; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* <p> | |||
* 广告表 Mapper 接口 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-06 | |||
*/ | |||
public interface CtAdMapper extends BaseMapper<CtAd> { | |||
} |
@@ -0,0 +1,5 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.taauav.admin.mapper.CtAdMapper"> | |||
</mapper> |
@@ -0,0 +1,19 @@ | |||
package com.taauav.admin.mapper; | |||
import com.taauav.admin.entity.SysAdmin; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 管理员表 Mapper 接口 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-04 | |||
*/ | |||
public interface SysAdminMapper extends BaseMapper<SysAdmin> { | |||
List<Map<String, Object>> selectListByGroupId(Integer groupId); | |||
} |
@@ -0,0 +1,8 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.taauav.admin.mapper.SysAdminMapper"> | |||
<select id="selectListByGroupId" resultType="java.util.Map"> | |||
select id,username,realname from sys_admin where find_in_set(auth_group,#{groupId}) and mark=1 | |||
</select> | |||
</mapper> |
@@ -0,0 +1,21 @@ | |||
package com.taauav.admin.mapper; | |||
import com.taauav.admin.entity.SysAuthGroup; | |||
import com.taauav.admin.entity.SysAuthGroupAccess; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
* 用户组明细表 Mapper 接口 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-04 | |||
*/ | |||
public interface SysAuthGroupAccessMapper extends BaseMapper<SysAuthGroupAccess> { | |||
} |
@@ -0,0 +1,5 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.taauav.admin.mapper.SysAuthGroupAccessMapper"> | |||
</mapper> |
@@ -0,0 +1,31 @@ | |||
package com.taauav.admin.mapper; | |||
import com.taauav.admin.entity.SysAuthGroup; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 用户组表 Mapper 接口 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-04 | |||
*/ | |||
public interface SysAuthGroupMapper extends BaseMapper<SysAuthGroup> { | |||
/** | |||
* 根据用户编号获取权限 | |||
* @param adminId | |||
* @return | |||
*/ | |||
List<SysAuthGroup> getAuthGroups(Integer adminId); | |||
/** | |||
* 根据父级编号获取数据 | |||
* @param pid | |||
* @return | |||
*/ | |||
List<Map<String,String>> getListByPid(Integer pid); | |||
} |
@@ -0,0 +1,13 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.taauav.admin.mapper.SysAuthGroupMapper"> | |||
<select id="getAuthGroups" resultType="com.taauav.admin.entity.SysAuthGroup"> | |||
select g.* from sys_auth_group_access gc left join sys_auth_group g on gc.group_id=g.id | |||
where gc.uid=#{adminId} and g.mark=1 | |||
</select> | |||
<select id="getListByPid" resultType="java.util.Map"> | |||
select id,`name`,pid,`status`,sort,remark from sys_auth_group where | |||
pid=#{pid} and mark=1 | |||
</select> | |||
</mapper> |
@@ -0,0 +1,23 @@ | |||
package com.taauav.admin.mapper; | |||
import com.taauav.admin.entity.SysAuthRule; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
* 权限规则表 Mapper 接口 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-04 | |||
*/ | |||
public interface SysAuthRuleMapper extends BaseMapper<SysAuthRule> { | |||
/** | |||
* 根据ids获取权限 | |||
* @param ids | |||
* @return | |||
*/ | |||
List<SysAuthRule> getRulesByIds(String[] ids); | |||
} |
@@ -0,0 +1,10 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.taauav.admin.mapper.SysAuthRuleMapper"> | |||
<select id="getRulesByIds" parameterType="com.taauav.admin.entity.SysAuthRule"> | |||
select * from sys_auth_rule | |||
where id in | |||
<foreach collection="ids" open="(" close=")" separator="," item="id"></foreach> | |||
and mark=1 | |||
</select> | |||
</mapper> |
@@ -0,0 +1,16 @@ | |||
package com.taauav.admin.mapper; | |||
import com.taauav.admin.entity.SysCity; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* <p> | |||
* 城市表 Mapper 接口 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-13 | |||
*/ | |||
public interface SysCityMapper extends BaseMapper<SysCity> { | |||
} |
@@ -0,0 +1,5 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.taauav.admin.mapper.SysCityMapper"> | |||
</mapper> |
@@ -0,0 +1,16 @@ | |||
package com.taauav.admin.mapper; | |||
import com.taauav.admin.entity.SysConfig; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* <p> | |||
* 系统配置表 Mapper 接口 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-12 | |||
*/ | |||
public interface SysConfigMapper extends BaseMapper<SysConfig> { | |||
} |
@@ -0,0 +1,5 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.taauav.admin.mapper.SysConfigMapper"> | |||
</mapper> |
@@ -0,0 +1,16 @@ | |||
package com.taauav.admin.mapper; | |||
import com.taauav.admin.entity.SysDep; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* <p> | |||
* 部门管理表 Mapper 接口 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-07 | |||
*/ | |||
public interface SysDepMapper extends BaseMapper<SysDep> { | |||
} |
@@ -0,0 +1,5 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.taauav.admin.mapper.SysDepMapper"> | |||
</mapper> |
@@ -0,0 +1,16 @@ | |||
package com.taauav.admin.mapper; | |||
import com.taauav.admin.entity.SysDict; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* <p> | |||
* 系统字典表 Mapper 接口 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-14 | |||
*/ | |||
public interface SysDictMapper extends BaseMapper<SysDict> { | |||
} |
@@ -0,0 +1,5 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.taauav.admin.mapper.SysDictMapper"> | |||
</mapper> |
@@ -0,0 +1,16 @@ | |||
package com.taauav.admin.mapper; | |||
import com.taauav.admin.entity.SysDictType; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* <p> | |||
* 系统字典分类表 Mapper 接口 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-14 | |||
*/ | |||
public interface SysDictTypeMapper extends BaseMapper<SysDictType> { | |||
} |
@@ -0,0 +1,5 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.taauav.admin.mapper.SysDictTypeMapper"> | |||
</mapper> |
@@ -0,0 +1,16 @@ | |||
package com.taauav.admin.mapper; | |||
import com.taauav.admin.entity.SysLevel; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* <p> | |||
* 职级管理表 Mapper 接口 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-11 | |||
*/ | |||
public interface SysLevelMapper extends BaseMapper<SysLevel> { | |||
} |
@@ -0,0 +1,5 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.taauav.admin.mapper.SysLevelMapper"> | |||
</mapper> |
@@ -0,0 +1,16 @@ | |||
package com.taauav.admin.mapper; | |||
import com.taauav.admin.entity.SysPosition; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* <p> | |||
* 职位表 Mapper 接口 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-12 | |||
*/ | |||
public interface SysPositionMapper extends BaseMapper<SysPosition> { | |||
} |
@@ -0,0 +1,5 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.taauav.admin.mapper.SysPositionMapper"> | |||
</mapper> |
@@ -0,0 +1,16 @@ | |||
package com.taauav.admin.mapper; | |||
import com.taauav.admin.entity.TauvCategory; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
/** | |||
* <p> | |||
* 公路问题分类表 Mapper 接口 | |||
* </p> | |||
* | |||
* @author 鲲鹏 | |||
* @since 2020-10-12 | |||
*/ | |||
public interface TauvCategoryMapper extends BaseMapper<TauvCategory> { | |||
} |
@@ -0,0 +1,5 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.taauav.admin.mapper.TauvCategoryMapper"> | |||
</mapper> |
@@ -0,0 +1,28 @@ | |||
package com.taauav.admin.mapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.taauav.admin.entity.TauvInspectImage; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.taauav.admin.query.TauvInspectImageQuery; | |||
import org.springframework.web.bind.annotation.RequestParam; | |||
/** | |||
* <p> | |||
* 巡检图片表 Mapper 接口 | |||
* </p> | |||
* | |||
* @author 鲲鹏 | |||
* @since 2020-10-12 | |||
*/ | |||
public interface TauvInspectImageMapper extends BaseMapper<TauvInspectImage> { | |||
/** | |||
* 获取巡检图片列表 | |||
* | |||
* @param page 分页 | |||
* @param param | |||
* @return | |||
*/ | |||
IPage<TauvInspectImage> getPageList(IPage<TauvInspectImage> page, @RequestParam("param") TauvInspectImageQuery param); | |||
} |
@@ -0,0 +1,17 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.taauav.admin.mapper.TauvInspectImageMapper"> | |||
<!-- 获取问题图片列表 --> | |||
<select id="getPageList" resultType="com.taauav.admin.entity.TauvInspectImage"> | |||
SELECT * FROM tauv_inspect_image WHERE mark=1 | |||
<if test=" param.name != null and param.name != ''"> | |||
and name like CONCAT('%',#{param.name},'%') | |||
</if> | |||
<if test="param.categoryId != null and param.categoryId != ''"> | |||
and find_in_set(category_id,#{param.categoryId}) | |||
</if> | |||
order by id desc | |||
</select> | |||
</mapper> |
@@ -0,0 +1,16 @@ | |||
package com.taauav.admin.query; | |||
import lombok.Data; | |||
/** | |||
* 统计查询条件 | |||
*/ | |||
@Data | |||
public class StatisticsQuery { | |||
/** | |||
* 任务名称 | |||
*/ | |||
private String name; | |||
} |
@@ -0,0 +1,17 @@ | |||
package com.taauav.admin.query; | |||
import com.taauav.common.core.mps.BaseQuery; | |||
import lombok.Data; | |||
/** | |||
* 查询人员条件 | |||
*/ | |||
@Data | |||
public class SysAdminQuery extends BaseQuery { | |||
/** | |||
* 姓名 | |||
*/ | |||
private String realname; | |||
} |
@@ -0,0 +1,22 @@ | |||
package com.taauav.admin.query; | |||
import com.taauav.common.core.mps.BaseQuery; | |||
import lombok.Data; | |||
/** | |||
* 巡检图片查询条件 | |||
*/ | |||
@Data | |||
public class TauvInspectImageQuery extends BaseQuery { | |||
/** | |||
* 任务名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 分类ID | |||
*/ | |||
private String categoryId; | |||
} |
@@ -0,0 +1,17 @@ | |||
package com.taauav.admin.service; | |||
import com.taauav.admin.entity.CtAd; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.taauav.common.service.IBaseService; | |||
/** | |||
* <p> | |||
* 广告表 服务类 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-06 | |||
*/ | |||
public interface ICtAdService extends IBaseService<CtAd> { | |||
} |
@@ -0,0 +1,31 @@ | |||
package com.taauav.admin.service; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* @author dyg | |||
* @date 2019/12/17 | |||
*/ | |||
public interface IMapService { | |||
/** | |||
* | |||
* @param gpsInfo longitude+","+latitude,百度(多组坐标以“;”分隔) 高德(多个坐标对之间用”|”进行分隔最多支持40对坐标) | |||
* @return | |||
*/ | |||
List<Map<String,String>> getGpsList(String gpsInfo); | |||
/** | |||
* 根据坐标获取位置信息 | |||
* @param longitude | |||
* @param latitude | |||
* @return | |||
*/ | |||
String getMapInfo(String longitude,String latitude); | |||
/** | |||
* gps坐标转换 | |||
* @param gpsStr | |||
* @return | |||
*/ | |||
String geoconv(String gpsStr); | |||
} |
@@ -0,0 +1,138 @@ | |||
package com.taauav.admin.service; | |||
import com.taauav.admin.query.SysAdminQuery; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.admin.entity.SysAdmin; | |||
import com.taauav.common.service.IBaseService; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 管理员表 服务类 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-04 | |||
*/ | |||
public interface ISysAdminService extends IBaseService<SysAdmin> { | |||
/** | |||
* 根据用户获取数据 | |||
* | |||
* @param username | |||
* @return | |||
*/ | |||
SysAdmin findByUsername(String username); | |||
/** | |||
* 根据用户编号获取数据 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
SysAdmin findById(Integer id); | |||
/** | |||
* 用户登录 | |||
* | |||
* @param username | |||
* @param password | |||
* @return | |||
*/ | |||
Response login(String username, String password); | |||
/** | |||
* 用户退出 | |||
*/ | |||
void logout(); | |||
/** | |||
* 获取管理员列表数据 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
Response findAdminPageList(Map<String, String> map); | |||
/** | |||
* 获取管理员数据 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
SysAdmin getAdminInfo(Integer id); | |||
/** | |||
* 保存编辑管理员数据 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
Response editAdminInfo(SysAdmin map); | |||
/** | |||
* 处理管理员mark标记、状态或密码 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
Response dealAdmin(Map<String, String> map); | |||
/** | |||
* 获取权限数据 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
Response getPermit(Map<String, String> map); | |||
/** | |||
* 设置权限 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
Response setPermit(Map<String, String> map); | |||
/** | |||
* 获取管理员一维数组 | |||
* | |||
* @return | |||
*/ | |||
Response getAdminList(); | |||
/** | |||
* 获取角色一维数组 | |||
* | |||
* @return | |||
*/ | |||
Response getAuthGroupList(); | |||
/** | |||
* 根据id获取账户姓名 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
String getRealNameById(Integer id); | |||
List<Map<String, Object>> getAdminListByGroupId(Integer groupId); | |||
/** | |||
* 根据ID获取人员名称 | |||
* | |||
* @param adminIds | |||
* @return | |||
*/ | |||
List<String> getAdminNameByIds(String adminIds); | |||
/** | |||
* 获取飞手 | |||
* | |||
* @param query 查询条件 | |||
* @return | |||
*/ | |||
Response getFlyHandList(SysAdminQuery query); | |||
} |
@@ -0,0 +1,40 @@ | |||
package com.taauav.admin.service; | |||
import com.taauav.admin.entity.SysAuthGroupAccess; | |||
import com.taauav.common.service.IBaseService; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* 用户组明细表 服务类 | |||
* | |||
* @author dyg | |||
* @since 2019-11-04 | |||
*/ | |||
public interface ISysAuthGroupAccessService extends IBaseService<SysAuthGroupAccess> { | |||
/** | |||
* 根据角色编号获取用户列表 | |||
* | |||
* @param groupId | |||
* @return | |||
*/ | |||
List<SysAuthGroupAccess> getListByGroupid(Integer groupId); | |||
/** | |||
* 添加用户角色 | |||
* | |||
* @param adminId | |||
* @param groupIds | |||
* @return | |||
*/ | |||
Map<String, String> add(Integer adminId, String groupIds); | |||
/** | |||
* 根据用户获取角色列表 | |||
* | |||
* @param adminId | |||
* @return | |||
*/ | |||
List<SysAuthGroupAccess> getListByAdmin(Integer adminId); | |||
} |
@@ -0,0 +1,115 @@ | |||
package com.taauav.admin.service; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.admin.entity.SysAdmin; | |||
import com.taauav.admin.entity.SysAuthGroup; | |||
import com.taauav.common.service.IBaseService; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 用户组表 服务类 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-04 | |||
*/ | |||
public interface ISysAuthGroupService extends IBaseService<SysAuthGroup> { | |||
/** | |||
* 根据用户编号获取权限 | |||
* | |||
* @param adminId | |||
* @return | |||
*/ | |||
List<SysAuthGroup> getAuthGroups(Integer adminId); | |||
/** | |||
* 根据父级编号获取数据 | |||
* | |||
* @param pid | |||
* @return | |||
*/ | |||
List<Map<String, String>> getListByPid(Integer pid); | |||
/** | |||
* 获取权限列表 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
Response getList(Map<String, String> map); | |||
/** | |||
* 添加权限 | |||
* | |||
* @param authGroup | |||
* @return | |||
*/ | |||
Response add(SysAuthGroup authGroup); | |||
/** | |||
* 编辑 | |||
* | |||
* @param authGroup | |||
* @return | |||
*/ | |||
Response edit(SysAuthGroup authGroup); | |||
/** | |||
* 删除 | |||
* | |||
* @param authGroup | |||
* @return | |||
*/ | |||
Response del(SysAuthGroup authGroup); | |||
/** | |||
* 配置 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
Response setRules(Map<String, String> map); | |||
/** | |||
* 修改角色状态 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
Response editStatus(Map<String, String> map); | |||
/** | |||
* 根据ID获取数据 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
SysAuthGroup getInfoById(Integer id); | |||
/** | |||
* 根据名称获取数据 | |||
* | |||
* @param name | |||
* @return | |||
*/ | |||
SysAuthGroup getInfoByName(String name); | |||
/** | |||
* 获取当前用户角色 1 内部用户 2外部用户 | |||
* | |||
* @return | |||
*/ | |||
Integer getAuthGroupPid(); | |||
/** | |||
* 判断用户是否为飞行小组成员 | |||
* | |||
* @param admin | |||
* @return | |||
*/ | |||
Boolean isFlightHand(SysAdmin admin); | |||
} |
@@ -0,0 +1,105 @@ | |||
package com.taauav.admin.service; | |||
import com.taauav.common.bean.Menu; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.admin.entity.SysAdmin; | |||
import com.taauav.admin.entity.SysAuthRule; | |||
import com.taauav.common.service.IBaseService; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 权限规则表 服务类 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-04 | |||
*/ | |||
public interface ISysAuthRuleService extends IBaseService<SysAuthRule> { | |||
/** | |||
* 获取用户拥有的菜单权限 | |||
* | |||
* @return | |||
*/ | |||
List<SysAuthRule> getAuthRules(); | |||
/** | |||
* 获取所有菜单-列表页 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
Response getRulePageList(Map<String, String> request); | |||
/** | |||
* 菜单页面-编辑 | |||
* | |||
* @param authRule | |||
* @return | |||
*/ | |||
Response editRule(SysAuthRule authRule); | |||
/** | |||
* 菜单页面-添加 | |||
* | |||
* @param authRule | |||
* @return | |||
*/ | |||
Response addRule(SysAuthRule authRule); | |||
/** | |||
* 菜单页面-删除 | |||
* | |||
* @param authRule | |||
* @return | |||
*/ | |||
Response delRule(SysAuthRule authRule); | |||
/** | |||
* 根据ID获取一条数据 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
SysAuthRule getInfoById(Integer id); | |||
/** | |||
* 获取菜单列表 | |||
* | |||
* @return | |||
*/ | |||
List<Map<String, Object>> getRuleList(Integer adminId); | |||
/** | |||
* 修改菜单状态 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
Response editStatus(Map<String, String> map); | |||
/** | |||
* 根据父级编号获取数据 | |||
* | |||
* @param pid | |||
* @return | |||
*/ | |||
List<Map<String, Object>> getListByPid(Integer pid); | |||
/** | |||
* 获取菜单的树状 | |||
* | |||
* @return | |||
*/ | |||
List<Menu> buildTreeMenu(); | |||
/** | |||
* 获取用户权限 | |||
* | |||
* @param info | |||
* @return | |||
*/ | |||
String getPermission(SysAdmin info); | |||
} |
@@ -0,0 +1,133 @@ | |||
package com.taauav.admin.service; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.taauav.admin.vo.SysCityListVo; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.admin.entity.SysCity; | |||
import java.math.BigInteger; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 城市表 服务类 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-13 | |||
*/ | |||
public interface ISysCityService extends IService<SysCity> { | |||
/** | |||
* 获取机构列表 | |||
* | |||
* @return | |||
*/ | |||
Response getList(); | |||
/** | |||
* 添加机构 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
Response add(SysCity entity); | |||
/** | |||
* 获取机构详情 | |||
* | |||
* @param id 机构ID | |||
* @return | |||
*/ | |||
Response info(BigInteger id); | |||
/** | |||
* 编辑机构 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
Response edit(SysCity entity); | |||
/** | |||
* 删除机构 | |||
* | |||
* @param id 机构ID | |||
* @return | |||
*/ | |||
Response drop(BigInteger id); | |||
/** | |||
* 设置状态 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
Response setStatus(SysCity entity); | |||
/** | |||
* 根据父级编号获取数据 | |||
* | |||
* @param pid 320100 南京编号 | |||
* @return | |||
*/ | |||
List<Map<String, Object>> getCityListByPid(Integer pid); | |||
/** | |||
* 获取城市列表 | |||
* | |||
* @param pid | |||
* @param type | |||
* @return | |||
*/ | |||
List<SysCity> getCityList(BigInteger pid, String type); | |||
/** | |||
* 根据父级编号和用户信息获取城市列表 | |||
* | |||
* @param pid | |||
* @return | |||
*/ | |||
List<Map<String, Object>> getCityListByPidAndAdmin(Integer pid); | |||
/** | |||
* 根据id获取城市数据 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
SysCity getInfoById(BigInteger id); | |||
/** | |||
* 根据城市ID获取城市名称 | |||
* | |||
* @param cityId | |||
* @return | |||
*/ | |||
String getCityName(BigInteger cityId); | |||
/** | |||
* 获取父级城市数据 | |||
* | |||
* @param cityId | |||
* @return | |||
*/ | |||
List<SysCity> getParentCityList(BigInteger cityId); | |||
/** | |||
* 获取子级城市 | |||
* | |||
* @param pid 上级ID | |||
* @return | |||
*/ | |||
List<SysCityListVo> getChildCityList(BigInteger pid); | |||
/** | |||
* 获取子级城市ID | |||
* | |||
* @param pid 上级城市 | |||
* @return | |||
*/ | |||
List<BigInteger> getChildCityIds(BigInteger pid); | |||
} |
@@ -0,0 +1,49 @@ | |||
package com.taauav.admin.service; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.admin.entity.SysConfig; | |||
import com.taauav.common.service.IBaseService; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 系统配置表 服务类 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-12 | |||
*/ | |||
public interface ISysConfigService extends IBaseService<SysConfig> { | |||
/** | |||
* 获取列表分页数据 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
Response getPageList(Map<String, String> map); | |||
/** | |||
* 根据id获取配置数据 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
SysConfig getConfigById(Integer id); | |||
/** | |||
* 添加、编辑配置数据 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
Response editData(SysConfig map); | |||
/** | |||
* 设置数据状态 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
Response setStatus(Map<String, Integer> map); | |||
} |
@@ -0,0 +1,49 @@ | |||
package com.taauav.admin.service; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.admin.entity.SysDep; | |||
import com.taauav.common.service.IBaseService; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 部门管理表 服务类 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-07 | |||
*/ | |||
public interface ISysDepService extends IBaseService<SysDep> { | |||
/** | |||
* 列表 | |||
* | |||
* @return | |||
*/ | |||
Response index(); | |||
/** | |||
* 获取部门数据 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
Response getDepInfo(Integer id); | |||
/** | |||
* 添加、编辑 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
Response edit(SysDep map); | |||
/** | |||
* 删除 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
Response drop(Map<String, String> map); | |||
} |
@@ -0,0 +1,50 @@ | |||
package com.taauav.admin.service; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.admin.entity.SysDict; | |||
import com.taauav.common.service.IBaseService; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 系统字典表 服务类 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-14 | |||
*/ | |||
public interface ISysDictService extends IBaseService<SysDict> { | |||
/** | |||
* 获取列表分页数据 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
Response getPageList(Map<String, String> map); | |||
/** | |||
* 根据id获取配置数据 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
SysDict getDictById(Integer id); | |||
/** | |||
* 添加、编辑配置数据 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
Response editData(SysDict map); | |||
/** | |||
* 根据类型编号获取数据 | |||
* | |||
* @param typeId | |||
* @return | |||
*/ | |||
List<SysDict> getListByTypeId(Integer typeId); | |||
} |
@@ -0,0 +1,41 @@ | |||
package com.taauav.admin.service; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.admin.entity.SysDictType; | |||
import com.taauav.common.service.IBaseService; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 系统字典分类表 服务类 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-14 | |||
*/ | |||
public interface ISysDictTypeService extends IBaseService<SysDictType> { | |||
/** | |||
* 获取列表分页数据 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
Response getPageList(Map<String, String> map); | |||
/** | |||
* 根据id获取配置数据 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
SysDictType getDictTypeById(Integer id); | |||
/** | |||
* 添加、编辑配置数据 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
Response editData(SysDictType map); | |||
} |
@@ -0,0 +1,58 @@ | |||
package com.taauav.admin.service; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.admin.entity.SysLevel; | |||
import com.taauav.common.service.IBaseService; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 职级管理表 服务类 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-11 | |||
*/ | |||
public interface ISysLevelService extends IBaseService<SysLevel> { | |||
/** | |||
* 获取职级分页列表 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
Response pageList(Map<String, String> map); | |||
/** | |||
* 添加、编辑 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
Response edit(SysLevel map); | |||
/** | |||
* 根据id获取职级信息 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
Response getLevelInfo(Integer id); | |||
/** | |||
* 根据id删除职级 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
Response drop(Integer id); | |||
/** | |||
* 修改职级状态 | |||
* | |||
* @param id | |||
* @param status | |||
* @return | |||
*/ | |||
Response changeStatus(Integer id, Integer status); | |||
} |
@@ -0,0 +1,58 @@ | |||
package com.taauav.admin.service; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.admin.entity.SysPosition; | |||
import com.taauav.common.service.IBaseService; | |||
import java.util.Map; | |||
/** | |||
* <p> | |||
* 职位表 服务类 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-12 | |||
*/ | |||
public interface ISysPositionService extends IBaseService<SysPosition> { | |||
/** | |||
* 岗位列表 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
Response index(Map<String, String> map); | |||
/** | |||
* 添加、编辑岗位 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
Response edit(SysPosition map); | |||
/** | |||
* 根据id获取岗位数据 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
Response getPositionInfo(Integer id); | |||
/** | |||
* 删除岗位 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
Response drop(Integer id); | |||
/** | |||
* 修改岗位状态 | |||
* | |||
* @param id | |||
* @param status | |||
* @return | |||
*/ | |||
Response changeStatus(Integer id, Integer status); | |||
} |
@@ -0,0 +1,58 @@ | |||
package com.taauav.admin.service; | |||
import com.taauav.admin.entity.TauvCategory; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.service.IBaseService; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
* 公路问题分类表 服务类 | |||
* </p> | |||
* | |||
* @author 鲲鹏 | |||
* @since 2020-10-12 | |||
*/ | |||
public interface ITauvCategoryService extends IBaseService<TauvCategory> { | |||
/** | |||
* 获取分类列表 | |||
* | |||
* @return | |||
*/ | |||
Response getList(); | |||
/** | |||
* 添加或编辑分类 | |||
* | |||
* @param category 分类对象 | |||
* @return | |||
*/ | |||
Response edit(TauvCategory category); | |||
/** | |||
* 获取分类详情 | |||
* | |||
* @param categoryId 分类ID | |||
* @return | |||
*/ | |||
Response info(Integer categoryId); | |||
/** | |||
* 删除分类 | |||
* | |||
* @param categoryId 分类ID | |||
* @return | |||
*/ | |||
Response delete(Integer categoryId); | |||
/** | |||
* 获取子级分类列表 | |||
* | |||
* @param pid 上级ID | |||
* @return | |||
*/ | |||
List<TauvCategory> getChildrenList(Integer pid); | |||
} |
@@ -0,0 +1,26 @@ | |||
package com.taauav.admin.service; | |||
import com.taauav.admin.entity.TauvInspectImage; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.taauav.admin.query.TauvInspectImageQuery; | |||
import com.taauav.common.bean.Response; | |||
/** | |||
* <p> | |||
* 巡检图片表 服务类 | |||
* </p> | |||
* | |||
* @author 鲲鹏 | |||
* @since 2020-10-12 | |||
*/ | |||
public interface ITauvInspectImageService extends IService<TauvInspectImage> { | |||
/** | |||
* 获取巡检图片列表 | |||
* | |||
* @param inspectImageQuery 查询条件 | |||
* @return | |||
*/ | |||
Response getList(TauvInspectImageQuery inspectImageQuery); | |||
} |
@@ -0,0 +1,103 @@ | |||
package com.taauav.admin.service.impl; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.JSONArray; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.taauav.admin.service.IMapService; | |||
import com.taauav.common.util.FunctionUtils; | |||
import org.springframework.stereotype.Service; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* <p>百度地图</p> | |||
* | |||
* @author : dyg | |||
* @date : 2019-12-17 13:51 | |||
**/ | |||
@Service("baiduMap") | |||
public class BaiduMapServiceImpl implements IMapService { | |||
private String ak = "8xXjllFqXW0KLGYfVSlgd5jC9qos5RTF"; | |||
/** | |||
*根据gps坐标获取百度坐标 | |||
* @param gpsInfo longitude+","+latitude,百度(多组坐标以“;”分隔) | |||
* @return | |||
*/ | |||
@Override | |||
public List<Map<String, String>> getGpsList(String gpsInfo) { | |||
String baiduGps = ""; | |||
List<Map<String,String>> list = new ArrayList<>(); | |||
Map<String,String> map = new HashMap<>(2); | |||
try { | |||
baiduGps = geoconv(gpsInfo); | |||
JSONObject jsonObject = JSON.parseObject(baiduGps); | |||
String status = jsonObject.getString("status"); | |||
if (status.equalsIgnoreCase("0")) { | |||
JSONArray jsonArray = jsonObject.getJSONArray("result"); | |||
for (int i=0;i<jsonArray.size();i++) { | |||
JSONObject object = jsonArray.getJSONObject(i); | |||
String lon = object.getString("x"); | |||
String lat = object.getString("y"); | |||
map.put("lon", lon); | |||
map.put("lat", lat); | |||
list.add(map); | |||
} | |||
} | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
} | |||
return list; | |||
} | |||
/** | |||
* 根据坐标获取位置信息 | |||
* @param longitude | |||
* @param latitude | |||
* @return | |||
*/ | |||
@Override | |||
public String getMapInfo(String longitude,String latitude) | |||
{ | |||
String address= null; | |||
try { | |||
String url = "http://api.map.baidu.com/reverse_geocoding/v3/"; | |||
String urlData = "ak="+ak+"&output=json&coordtype=bd09ll&location="+latitude+","+longitude; | |||
String locJson = FunctionUtils.getUrl(url,urlData); | |||
JSONObject jobject = JSON.parseObject(locJson); | |||
String status = jobject.getString("status"); | |||
if (status.equals("0")) { | |||
JSONObject resultObject = jobject.getJSONObject("result"); | |||
address = resultObject.getString("formatted_address"); | |||
} | |||
//address = jsonObject.getString("formatted_address"); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
} | |||
return address; | |||
} | |||
/** | |||
* GPS坐标转成百度坐标 | |||
* @param gpsStr | |||
* @return | |||
* @throws Exception | |||
*/ | |||
@Override | |||
public String geoconv(String gpsStr){ | |||
String locJson = null; | |||
try { | |||
locJson = FunctionUtils.getUrl("http://api.map.baidu.com/geoconv/v1/","coords="+gpsStr+"&from=1&to=5&ak="+ak); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
} | |||
return locJson; | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
package com.taauav.admin.service.impl; | |||
import com.taauav.admin.entity.CtAd; | |||
import com.taauav.admin.mapper.CtAdMapper; | |||
import com.taauav.admin.service.ICtAdService; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.taauav.common.service.impl.BaseServiceImpl; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* <p> | |||
* 广告表 服务实现类 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-06 | |||
*/ | |||
@Service | |||
public class CtAdServiceImpl extends BaseServiceImpl<CtAdMapper, CtAd> implements ICtAdService { | |||
} |
@@ -0,0 +1,91 @@ | |||
package com.taauav.admin.service.impl; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.taauav.admin.service.IMapService; | |||
import com.taauav.common.util.FunctionUtils; | |||
import org.springframework.stereotype.Service; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* <p>高德地图</p> | |||
* | |||
* @author : dyg | |||
* @date : 2019-12-17 13:53 | |||
**/ | |||
@Service("gaodeMap") | |||
public class GaodeMapServiceImpl implements IMapService { | |||
private String key = "db4623de07899c6a7cf18eee6a1f1724"; | |||
/** | |||
* 根据GPS坐标获取高德地图经纬度 高德(多个坐标对之间用”|”进行分隔最多支持40对坐标) | |||
* @param gpsInfo | |||
* @return | |||
*/ | |||
@Override | |||
public List<Map<String,String>> getGpsList(String gpsInfo) { | |||
List<Map<String,String>> list = new ArrayList<>(); | |||
Map<String,String> map = new HashMap<>(2); | |||
String gaodeGps = geoconv(gpsInfo); | |||
JSONObject jsonObject = JSON.parseObject(gaodeGps); | |||
String status = jsonObject.getString("status"); | |||
if (status.equalsIgnoreCase("1")) { | |||
String locations = jsonObject.getString("locations"); | |||
String[] locationArr = locations.split(","); | |||
map.put("lon", locationArr[0]); | |||
map.put("lat", locationArr[1]); | |||
list.add(map); | |||
} | |||
return list; | |||
} | |||
/** | |||
* 根据坐标获取位置信息 | |||
* @param longitude | |||
* @param latitude | |||
* @return | |||
*/ | |||
@Override | |||
public String getMapInfo(String longitude,String latitude) | |||
{ | |||
String address = null; | |||
try { | |||
longitude = FunctionUtils.round(new Double(longitude),6); | |||
latitude = FunctionUtils.round(new Double(latitude),6); | |||
String query = longitude+","+latitude; | |||
String locJson = FunctionUtils.getUrl("https://restapi.amap.com/v3/geocode/regeo","key="+key+"&location="+query); | |||
JSONObject jsonObject = JSON.parseObject(locJson); | |||
String status = jsonObject.getString("status"); | |||
if ("1".equalsIgnoreCase(status)) { | |||
JSONObject regeoObject = jsonObject.getJSONObject("regeocode"); | |||
address = regeoObject.getString("formatted_address"); | |||
} | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
} | |||
return address; | |||
} | |||
/** | |||
* GPS坐标转成高德坐标 | |||
* @param gpsStr | |||
* @return | |||
* @throws Exception | |||
*/ | |||
@Override | |||
public String geoconv(String gpsStr){ | |||
String locJson = null; | |||
try { | |||
locJson = FunctionUtils.getUrl("https://restapi.amap.com/v3/assistant/coordinate/convert","locations="+gpsStr+"&coordsys=gps&key="+key); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
} | |||
return locJson; | |||
} | |||
} |
@@ -0,0 +1,608 @@ | |||
package com.taauav.admin.service.impl; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.taauav.admin.query.SysAdminQuery; | |||
import com.taauav.admin.vo.SysFlyAdminListVo; | |||
import com.taauav.common.bean.CacheUser; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.common.config.AdminUserToken; | |||
import com.taauav.common.constant.SysAdminConstant; | |||
import com.taauav.admin.entity.SysAdmin; | |||
import com.taauav.admin.entity.SysAuthGroup; | |||
import com.taauav.admin.mapper.SysAdminMapper; | |||
import com.taauav.admin.mapper.SysAuthGroupAccessMapper; | |||
import com.taauav.admin.mapper.SysAuthGroupMapper; | |||
import com.taauav.admin.service.ISysAdminService; | |||
import com.taauav.admin.service.ISysAuthGroupAccessService; | |||
import com.taauav.admin.service.ISysAuthRuleService; | |||
import com.taauav.admin.service.ISysCityService; | |||
import com.taauav.common.service.impl.BaseServiceImpl; | |||
import com.taauav.common.util.DateUtil; | |||
import com.taauav.common.util.FunctionUtils; | |||
import com.taauav.common.util.ShiroUtils; | |||
import org.apache.shiro.SecurityUtils; | |||
import org.apache.shiro.authc.AuthenticationException; | |||
import org.apache.shiro.authc.IncorrectCredentialsException; | |||
import org.apache.shiro.authc.UnknownAccountException; | |||
import org.apache.shiro.authc.UsernamePasswordToken; | |||
import org.apache.shiro.subject.Subject; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.util.StringUtils; | |||
import javax.annotation.Resource; | |||
import javax.validation.Validator; | |||
import java.time.LocalDateTime; | |||
import java.util.*; | |||
/** | |||
* <p> | |||
* 管理员表 服务实现类 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-04 | |||
*/ | |||
@Service | |||
public class SysAdminServiceImpl extends BaseServiceImpl<SysAdminMapper, SysAdmin> implements ISysAdminService { | |||
@Resource | |||
private Response response; | |||
@Value("${spring.pageSize}") | |||
private Integer pageSize; | |||
@Autowired | |||
private SysAdminMapper sysAdminMapper; | |||
@Autowired | |||
private SysAuthGroupMapper authGroupMapper; | |||
@Resource | |||
private Validator validator; | |||
@Autowired | |||
private SysAuthGroupServiceImpl authGroupService; | |||
@Autowired | |||
private ISysAuthGroupAccessService iSysAuthGroupAccessService; | |||
@Autowired | |||
private ISysAuthRuleService iSysAuthRuleService; | |||
@Autowired | |||
private SysAuthGroupAccessMapper accessMapper; | |||
@Autowired | |||
private ISysCityService cityService; | |||
@Value("${server.IMAGE_URL}") | |||
private String imageUrl; | |||
/** | |||
* 根据用户名获取用户 | |||
* | |||
* @param username | |||
* @return | |||
*/ | |||
@Override | |||
public SysAdmin findByUsername(String username) { | |||
QueryWrapper wrapper = new QueryWrapper(); | |||
wrapper.eq("username", username); | |||
wrapper.eq("mark", 1); | |||
SysAdmin admin = sysAdminMapper.selectOne(wrapper); | |||
if (admin != null && !"".equals(admin.getAvatar())) { | |||
admin.setAvatar(imageUrl + admin.getAvatar()); | |||
} | |||
return admin; | |||
// baseMapper.selectOne( | |||
// new LambdaQueryWrapper<SysAdmin>().eq(SysAdmin::getUsername, username) | |||
// ); | |||
} | |||
/** | |||
* 根据用户编号获取数据 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@Override | |||
public SysAdmin findById(Integer id) { | |||
return baseMapper.selectOne( | |||
new LambdaQueryWrapper<SysAdmin>().eq(SysAdmin::getId, id) | |||
); | |||
} | |||
/** | |||
* 用户登陆 | |||
* | |||
* @param username | |||
* @param password | |||
* @return | |||
*/ | |||
@Override | |||
public Response login(String username, String password) { | |||
// 获取Subject实例对象,用户实例 | |||
Subject currentUser = SecurityUtils.getSubject(); | |||
// 将用户名和密码封装到UsernamePasswordToken | |||
UsernamePasswordToken token = new AdminUserToken(username, password); | |||
CacheUser cacheUser; | |||
// 4、认证 | |||
try { | |||
// 传到 MyShiroRealm 类中的方法进行认证 | |||
currentUser.login(token); | |||
// 构建缓存用户信息返回给前端 | |||
SysAdmin user = (SysAdmin) currentUser.getPrincipals().getPrimaryPrincipal(); | |||
cacheUser = CacheUser.builder() | |||
.token(currentUser.getSession().getId().toString()) | |||
.build(); | |||
BeanUtils.copyProperties(user, cacheUser); | |||
} catch (UnknownAccountException e) { | |||
log.error("账户不存在异常:", e); | |||
return response.failure("账号不存在!"); | |||
// throw new LoginException("账号不存在!", e); | |||
} catch (IncorrectCredentialsException e) { | |||
log.error("凭据错误(密码错误)异常:", e); | |||
return response.failure("密码不正确!"); | |||
// throw new LoginException("密码不正确!", e); | |||
} catch (AuthenticationException e) { | |||
log.error("身份验证异常:", e); | |||
return response.failure("用户验证失败!"); | |||
// throw new LoginException("用户验证失败!", e); | |||
} | |||
Map<String, String> result = new HashMap<>(); | |||
result.put("token", cacheUser.getToken()); | |||
return response.success("", result); | |||
} | |||
/** | |||
* 用户退出 | |||
*/ | |||
@Override | |||
public void logout() { | |||
Subject subject = SecurityUtils.getSubject(); | |||
subject.logout(); | |||
} | |||
/** | |||
* 获取所有用户数据 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
@Override | |||
public Response findAdminPageList(Map<String, String> map) { | |||
QueryWrapper<SysAdmin> wrapper = new QueryWrapper<>(); | |||
wrapper.eq("mark", 1); | |||
wrapper.orderByAsc("status"); | |||
wrapper.orderByAsc("id"); | |||
Integer pageNo = 1; | |||
if (map != null) { | |||
//页数 | |||
String pageStr = "page"; | |||
if (map.containsKey(pageStr) && !"".equals(map.get(pageStr)) && Integer.valueOf(map.get(pageStr)) > 0) { | |||
pageNo = Integer.valueOf(map.get(pageStr)); | |||
} | |||
//关键词筛选条件 | |||
String keywords = map.containsKey("keywords") ? map.get("keywords") : ""; | |||
if (keywords != "" && !keywords.equals(null)) { | |||
wrapper.like("username", keywords).or().like("realname", keywords); | |||
} | |||
//公司名称筛选条件 | |||
String company = map.getOrDefault("company", ""); | |||
if (company != "" && !company.equals(null)) { | |||
wrapper.like("company", company); | |||
} | |||
//角色筛选条件 | |||
String authGroup = map.getOrDefault("authGroup", ""); | |||
if (!StringUtils.isEmpty(authGroup)) { | |||
if (FunctionUtils.isNumeric(authGroup)) { | |||
wrapper.eq("auth_group", authGroup); | |||
} else { | |||
return response.failure("对应角色不存在!"); | |||
} | |||
} | |||
//每页展示数量 | |||
String pgSize = "pageSize"; | |||
if (map.containsKey(pgSize) && Integer.valueOf(map.get(pgSize)) > 0) { | |||
pageSize = Integer.valueOf(map.get(pgSize)); | |||
} | |||
} | |||
double totalNum = sysAdminMapper.selectCount(wrapper); | |||
Integer totalPages = (int) (Math.ceil(totalNum / pageSize)); | |||
if (pageNo > totalPages) { | |||
pageNo = totalPages; | |||
} | |||
IPage<SysAdmin> page = new Page<>(pageNo, pageSize); | |||
IPage data = this.page(page, wrapper); | |||
Map<String, Object> list = new HashMap<>(5); | |||
if (data.getRecords() != null) { | |||
list.put("total", data.getTotal()); | |||
list.put("size", data.getSize()); | |||
list.put("current", data.getCurrent()); | |||
list.put("pages", data.getPages()); | |||
List<SysAdmin> adminList = data.getRecords(); | |||
List<Object> records = new ArrayList<>(); | |||
adminList.forEach(val -> { | |||
Map<String, Object> mp = new HashMap<>(6); | |||
mp.put("id", val.getId()); | |||
mp.put("realname", val.getRealname()); | |||
mp.put("username", val.getUsername()); | |||
mp.put("company", val.getCompany()); | |||
mp.put("status", val.getStatus()); | |||
mp.put("duty", val.getDuty()); | |||
mp.put("authGroup", val.getAuthGroup()); | |||
mp.put("mobile", val.getMobile()); | |||
mp.put("cityIds", val.getCityIds()); | |||
mp.put("rules", val.getRules()); | |||
//处理角色名称 | |||
String authGroupText = ""; | |||
if (!StringUtils.isEmpty(val.getAuthGroup())) { | |||
authGroupText = authGroupService.getAuthText(Integer.valueOf(val.getAuthGroup())); | |||
} | |||
mp.put("authGroupText", authGroupText); | |||
//处理状态名称 | |||
String statusText = FunctionUtils.getArrayText(String.valueOf(val.getStatus()), SysAdminConstant.getAdminStatus()); | |||
mp.put("statusText", statusText); | |||
records.add(mp); | |||
}); | |||
list.put("records", records); | |||
} | |||
return response.success(list); | |||
} | |||
/** | |||
* 获取管理员数据信息 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@Override | |||
public SysAdmin getAdminInfo(Integer id) { | |||
if (id <= 0) { | |||
return null; | |||
} | |||
SysAdmin admin = sysAdminMapper.selectById(id); | |||
if (admin == null) { | |||
return null; | |||
} | |||
//处理头像 | |||
if (!"".equals(admin.getAvatar())) { | |||
admin.setAvatar(imageUrl + admin.getAvatar()); | |||
} | |||
//处理角色名称 | |||
String authText = authGroupService.getAuthText(Integer.valueOf(admin.getAuthGroup())); | |||
admin.setAuthGroupText(authText); | |||
//处理状态名称 | |||
String statusText = FunctionUtils.getArrayText(String.valueOf(admin.getStatus()), SysAdminConstant.getAdminStatus()); | |||
admin.setStatusText(statusText); | |||
return admin; | |||
} | |||
/** | |||
* 保存管理员数据 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
@Override | |||
public Response editAdminInfo(SysAdmin map) { | |||
if (map == null) { | |||
return response.failure("参数不能为空"); | |||
} | |||
//数据组装 | |||
SysAdmin admin = new SysAdmin(); | |||
Integer id = map.getId(); | |||
if (id != null) { | |||
admin.setId(id); | |||
} else { | |||
admin.setPassword(FunctionUtils.password("123456")); | |||
} | |||
String realname = map.getRealname(); | |||
admin.setRealname(realname); | |||
//用户名重复校验 | |||
String username = map.getUsername(); | |||
if (username != null) { | |||
QueryWrapper<SysAdmin> wrapper = new QueryWrapper<>(); | |||
wrapper.eq("username", username); | |||
wrapper.eq("mark", 1); | |||
SysAdmin user = sysAdminMapper.selectOne(wrapper); | |||
if ((id == null && user != null) || (id != null && user != null && !id.equals(user.getId()))) { | |||
return response.failure("用户名已存在"); | |||
} | |||
admin.setUsername(username); | |||
} | |||
admin.setCompany(map.getCompany()); | |||
admin.setAuthGroup(map.getAuthGroup()); | |||
//手机号重复校验 | |||
String mobile = map.getMobile(); | |||
if (!StringUtils.isEmpty(mobile)) { | |||
QueryWrapper wrp = new QueryWrapper(); | |||
wrp.eq("mark", 1); | |||
wrp.eq("mobile", mobile); | |||
SysAdmin adminInfo = sysAdminMapper.selectOne(wrp); | |||
if ((id == null && adminInfo != null) || (id != null && adminInfo != null && !id.equals(adminInfo.getId()))) { | |||
return response.failure("手机号已存在"); | |||
} | |||
} | |||
admin.setMobile(mobile); | |||
admin.setDuty(map.getDuty()); | |||
String cityIds = map.getCityIds(); | |||
if (cityIds != null) { | |||
admin.setCityIds(map.getCityIds()); | |||
} | |||
if (id != null && id > 0) { | |||
admin.setUpdateUser(ShiroUtils.getAdminId()); | |||
admin.setUpdateTime(DateUtil.now()); | |||
Integer res = sysAdminMapper.updateById(admin); | |||
} else { | |||
admin.setCreateUser(ShiroUtils.getAdminId()); | |||
admin.setCreateTime(DateUtil.now()); | |||
Integer res = sysAdminMapper.insert(admin); | |||
id = admin.getId(); | |||
} | |||
//设置权限 | |||
if (!StringUtils.isEmpty(map.getAuthGroup())) { | |||
Map<String, String> groupMap = new HashMap<>(); | |||
groupMap.put("adminId", id.toString()); | |||
groupMap.put("groupIds", map.getAuthGroup()); | |||
Map<String, String> result = iSysAuthGroupAccessService.add(id, map.getAuthGroup()); | |||
if (!("200".equals(result.get("code")))) { | |||
return response.failure(result.get("msg")); | |||
} | |||
} | |||
return response.success("操作成功"); | |||
} | |||
/** | |||
* 处理管理员mark标记、密码或状态 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
@Override | |||
public Response dealAdmin(Map<String, String> map) { | |||
String act = map.get("act"); | |||
String id = map.getOrDefault("id", "0"); | |||
if (Integer.valueOf(id) == 0) { | |||
return response.failure("管理员id不能为空"); | |||
} | |||
SysAdmin adminInfo = sysAdminMapper.selectById(Integer.valueOf(id)); | |||
if (adminInfo == null) { | |||
return response.failure("管理员信息不存在"); | |||
} | |||
SysAdmin admin = new SysAdmin(); | |||
admin.setId(Integer.valueOf(id)); | |||
String drop = "drop"; | |||
String reset = "reset"; | |||
String changeSt = "changeStatus"; | |||
String savePermit = "savePermit"; | |||
if (drop.equals(act)) { | |||
//逻辑删除 | |||
admin.setMark(0); | |||
} else if (reset.equals(act)) { | |||
//重置密码 | |||
admin.setPassword(FunctionUtils.password("123456")); | |||
} else if (changeSt.equals(act)) { | |||
//修改状态 | |||
String status = map.getOrDefault("status", "0"); | |||
if (Integer.valueOf(status) == 0) { | |||
return response.failure("管理员状态不能为空"); | |||
} | |||
if (Integer.valueOf(status) == 1) { | |||
admin.setStatus(Integer.valueOf("2")); | |||
} else { | |||
admin.setStatus(Integer.valueOf("1")); | |||
} | |||
} else if (savePermit.equals(act)) { | |||
//保存权限数据 | |||
String rules = map.getOrDefault("rules", ""); | |||
admin.setRules(rules); | |||
} else { | |||
return response.failure("操作方法不存在"); | |||
} | |||
admin.setUpdateUser(ShiroUtils.getAdminId()); | |||
admin.setUpdateTime(DateUtil.now()); | |||
boolean result = updateById(admin); | |||
if (!result) { | |||
return response.failure("操作失败"); | |||
} | |||
return response.success("操作成功"); | |||
} | |||
/** | |||
* 获取权限数据 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
@Override | |||
public Response getPermit(Map<String, String> map) { | |||
String id = map.getOrDefault("id", "0"); | |||
if (Integer.valueOf(id) == 0) { | |||
return response.failure("管理员id不存在"); | |||
} | |||
List<Map<String, Object>> list = iSysAuthRuleService.getRuleList(Integer.valueOf(id)); | |||
return response.success(list); | |||
} | |||
/** | |||
* 设置个人权限 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
@Override | |||
public Response setPermit(Map<String, String> map) { | |||
if (StringUtils.isEmpty(map)) { | |||
return response.failure("参数不全"); | |||
} | |||
String adminIdStr = map.getOrDefault("id", ""); | |||
if (StringUtils.isEmpty(adminIdStr)) { | |||
return response.failure("用户编号不存在"); | |||
} | |||
Integer adminId = Integer.valueOf(adminIdStr); | |||
String rules = map.getOrDefault("rules", ""); | |||
// if (StringUtils.isEmpty(rules)) { | |||
// return response.failure("请选择权限菜单"); | |||
// } | |||
SysAdmin sysAdmin = new SysAdmin(); | |||
sysAdmin.setId(adminId); | |||
sysAdmin.setRules(rules); | |||
sysAdminMapper.updateById(sysAdmin); | |||
//重置对应用户的权限 | |||
SysAdmin adminInfo = getAdminInfo(adminId); | |||
String username = adminInfo.getUsername(); | |||
// ShiroUtils.deleteCache(username, false); | |||
return response.success("设置成功"); | |||
} | |||
/** | |||
* 根据id获取管理员姓名 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@Override | |||
public String getRealNameById(Integer id) { | |||
if (id <= 0) { | |||
return ""; | |||
} | |||
QueryWrapper wrapper = new QueryWrapper(); | |||
wrapper.eq("id", id); | |||
wrapper.eq("mark", 1); | |||
SysAdmin admin = getById(id); | |||
if (admin == null) { | |||
return ""; | |||
} | |||
return admin.getRealname(); | |||
} | |||
/** | |||
* 根据角色获取用户 | |||
* | |||
* @param groupId | |||
* @return | |||
*/ | |||
@Override | |||
public List<Map<String, Object>> getAdminListByGroupId(Integer groupId) { | |||
QueryWrapper wrapper = new QueryWrapper(); | |||
wrapper.eq("mark", 1); | |||
//wrapper. | |||
List<Map<String, Object>> list = sysAdminMapper.selectListByGroupId(groupId); | |||
return list; | |||
} | |||
/** | |||
* 获取管理员一维数组 | |||
* | |||
* @return | |||
*/ | |||
@Override | |||
public Response getAdminList() { | |||
QueryWrapper wrapper = new QueryWrapper(); | |||
wrapper.eq("mark", 1); | |||
List<SysAdmin> list = sysAdminMapper.selectList(wrapper); | |||
return response.success("操作成功", list); | |||
} | |||
/** | |||
* 获取角色数组 | |||
* | |||
* @return | |||
*/ | |||
@Override | |||
public Response getAuthGroupList() { | |||
QueryWrapper wrapper = new QueryWrapper(); | |||
wrapper.eq("mark", 1); | |||
wrapper.gt("pid", 0); | |||
List<SysAuthGroup> authList = authGroupMapper.selectList(wrapper); | |||
List<Object> list = new ArrayList<>(); | |||
if (authList != null) { | |||
authList.forEach(val -> { | |||
Map<String, Object> map = new HashMap<>(); | |||
map.put("id", val.getId()); | |||
SysAuthGroup pInfo = authGroupMapper.selectById(val.getPid()); | |||
String pName; | |||
if (pInfo != null) { | |||
pName = pInfo.getName() + "-" + val.getName(); | |||
} else { | |||
pName = val.getName(); | |||
} | |||
map.put("name", pName); | |||
list.add(map); | |||
}); | |||
} | |||
return response.success("操作成功", list); | |||
} | |||
/** | |||
* 根据ID获取人员名称 | |||
* | |||
* @param adminIds 人员ID(多个逗号分隔) | |||
* @return | |||
*/ | |||
@Override | |||
public List<String> getAdminNameByIds(String adminIds) { | |||
// 查询条件 | |||
QueryWrapper<SysAdmin> queryWrapper = new QueryWrapper<>(); | |||
// 待分配任务 | |||
String arr[] = adminIds.split(","); | |||
ArrayList arrayList = new ArrayList(); | |||
for (String s : arr) { | |||
arrayList.add(s); | |||
} | |||
queryWrapper.in("id", arrayList); | |||
queryWrapper.eq("mark", 1); | |||
// 查询数据 | |||
List<SysAdmin> adminList = sysAdminMapper.selectList(queryWrapper); | |||
List<String> stringList = new ArrayList<>(); | |||
if (!adminList.isEmpty()) { | |||
adminList.forEach(item -> { | |||
stringList.add(item.getRealname()); | |||
}); | |||
} | |||
return stringList; | |||
} | |||
/** | |||
* 获取飞手列表 | |||
* | |||
* @param query 查询条件 | |||
* @return | |||
*/ | |||
@Override | |||
public Response getFlyHandList(SysAdminQuery query) { | |||
// 查询条件 | |||
QueryWrapper<SysAdmin> queryWrapper = new QueryWrapper<>(); | |||
// 姓名 | |||
if (!StringUtils.isEmpty(query.getRealname())) { | |||
queryWrapper.like("realname", query.getRealname()); | |||
} | |||
queryWrapper.eq("status", 1); | |||
queryWrapper.orderByAsc("sort"); | |||
// 查询数据 | |||
IPage<SysAdmin> page = new Page<>(query.getPage(), query.getPageSize()); | |||
IPage<SysAdmin> data = sysAdminMapper.selectPage(page, queryWrapper); | |||
List<SysAdmin> adminList = data.getRecords(); | |||
List<SysFlyAdminListVo> flyAdminListVoList = new ArrayList<>(); | |||
if (!adminList.isEmpty()) { | |||
adminList.forEach(item -> { | |||
SysFlyAdminListVo flyAdminListVo = new SysFlyAdminListVo(); | |||
// 拷贝属性 | |||
BeanUtils.copyProperties(item, flyAdminListVo); | |||
flyAdminListVoList.add(flyAdminListVo); | |||
}); | |||
} | |||
// 返回结果 | |||
Map<String, Object> result = new HashMap<>(); | |||
result.put("total", data.getTotal()); | |||
result.put("size", data.getSize()); | |||
result.put("current", data.getCurrent()); | |||
result.put("pages", data.getPages()); | |||
result.put("records", flyAdminListVoList); | |||
return response.success(result); | |||
} | |||
} |
@@ -0,0 +1,92 @@ | |||
package com.taauav.admin.service.impl; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.admin.entity.SysAuthGroupAccess; | |||
import com.taauav.admin.mapper.SysAuthGroupAccessMapper; | |||
import com.taauav.admin.service.ISysAuthGroupAccessService; | |||
import com.taauav.common.service.impl.BaseServiceImpl; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.util.StringUtils; | |||
import java.util.*; | |||
/** | |||
* <p> | |||
* 用户组明细表 服务实现类 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-04 | |||
*/ | |||
@Service | |||
public class SysAuthGroupAccessServiceImpl extends BaseServiceImpl<SysAuthGroupAccessMapper, SysAuthGroupAccess> implements ISysAuthGroupAccessService { | |||
@Autowired | |||
private Response response; | |||
@Autowired | |||
private SysAuthGroupAccessMapper sysAuthGroupAccessMapper; | |||
@Override | |||
public List<SysAuthGroupAccess> getListByGroupid(Integer groupId) { | |||
QueryWrapper<SysAuthGroupAccess> queryWrapper = new QueryWrapper<>(); | |||
queryWrapper.eq("group_id", groupId); | |||
return sysAuthGroupAccessMapper.selectList(queryWrapper); | |||
} | |||
@Override | |||
public Map<String, String> add(Integer adminId, String groupIds) { | |||
Map<String, String> result = new HashMap<>(); | |||
result.put("code", "500"); | |||
if (StringUtils.isEmpty(adminId)) { | |||
result.put("msg", "请选择用户"); | |||
return result; | |||
} | |||
if (StringUtils.isEmpty(groupIds)) { | |||
result.put("msg", "请选择角色"); | |||
return result; | |||
} | |||
String[] groupIdList = groupIds.split(","); | |||
Set<String> requestGroupIds = new HashSet<String>(Arrays.asList(groupIdList)); | |||
Map<String, String> hasGroupMap = new HashMap<>(); | |||
List<SysAuthGroupAccess> groupAccessList = getListByAdmin(adminId); | |||
if (groupAccessList != null) { | |||
for (SysAuthGroupAccess sysAuthGroupAccess : groupAccessList) { | |||
String val = sysAuthGroupAccess.getGroupId().toString(); | |||
hasGroupMap.put(val, val); | |||
} | |||
} | |||
//判断权限是否已存在,不存在时添加 | |||
for (String groupId : groupIdList) { | |||
if (hasGroupMap.containsKey(groupId)) { | |||
continue; | |||
} else { | |||
SysAuthGroupAccess insertData = new SysAuthGroupAccess(); | |||
insertData.setUid(adminId); | |||
insertData.setGroupId(Integer.valueOf(groupId)); | |||
sysAuthGroupAccessMapper.insert(insertData); | |||
} | |||
} | |||
//删除已存在多余角色权限 | |||
for (String hGroup : hasGroupMap.values()) { | |||
if (!requestGroupIds.contains(hGroup)) { | |||
QueryWrapper<SysAuthGroupAccess> delSet = new QueryWrapper<>(); | |||
delSet.eq("uid", adminId); | |||
delSet.eq("group_id", Integer.valueOf(hGroup)); | |||
sysAuthGroupAccessMapper.delete(delSet); | |||
} | |||
} | |||
result.put("code", "200"); | |||
result.put("msg", "ok"); | |||
return result; | |||
} | |||
@Override | |||
public List<SysAuthGroupAccess> getListByAdmin(Integer adminId) { | |||
QueryWrapper<SysAuthGroupAccess> queryWrapper = new QueryWrapper<>(); | |||
queryWrapper.eq("uid", adminId); | |||
return sysAuthGroupAccessMapper.selectList(queryWrapper); | |||
} | |||
} |
@@ -0,0 +1,357 @@ | |||
package com.taauav.admin.service.impl; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.taauav.common.bean.Response; | |||
import com.taauav.admin.entity.SysAdmin; | |||
import com.taauav.admin.entity.SysAuthGroup; | |||
import com.taauav.admin.entity.SysAuthGroupAccess; | |||
import com.taauav.admin.entity.SysConfig; | |||
import com.taauav.admin.mapper.SysAuthGroupMapper; | |||
import com.taauav.admin.service.ISysAdminService; | |||
import com.taauav.admin.service.ISysAuthGroupAccessService; | |||
import com.taauav.admin.service.ISysAuthGroupService; | |||
import com.taauav.admin.service.ISysConfigService; | |||
import com.taauav.common.service.impl.BaseServiceImpl; | |||
import com.taauav.common.util.DateUtil; | |||
import com.taauav.common.util.FunctionUtils; | |||
import com.taauav.common.util.ShiroUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.util.StringUtils; | |||
import javax.annotation.Resource; | |||
import java.time.LocalDateTime; | |||
import java.util.*; | |||
/** | |||
* <p> | |||
* 用户组表 服务实现类 | |||
* </p> | |||
* | |||
* @author dyg | |||
* @since 2019-11-04 | |||
*/ | |||
@Service | |||
public class SysAuthGroupServiceImpl extends BaseServiceImpl<SysAuthGroupMapper, SysAuthGroup> implements ISysAuthGroupService { | |||
@Resource | |||
private SysAuthGroupMapper authGroupMapper; | |||
@Resource | |||
private Response response; | |||
@Autowired | |||
private ISysAuthGroupAccessService iSysAuthGroupAccessService; | |||
@Autowired | |||
private ISysAdminService iSysAdminService; | |||
@Autowired | |||
private ISysConfigService configService; | |||
/** | |||
* 根据用户编号获取权限 | |||
* | |||
* @param adminId | |||
* @return | |||
*/ | |||
@Override | |||
public List<SysAuthGroup> getAuthGroups(Integer adminId) { | |||
return authGroupMapper.getAuthGroups(adminId); | |||
} | |||
@Override | |||
public List<Map<String, String>> getListByPid(Integer pid) { | |||
return authGroupMapper.getListByPid(pid); | |||
} | |||
/** | |||
* 根据角色值获取对应角色名称 | |||
* | |||
* @param authGroup | |||
* @return | |||
*/ | |||
public String getAuthText(Integer authGroup) { | |||
String authText = ""; | |||
SysAuthGroup auth = authGroupMapper.selectById(authGroup); | |||
if (auth != null) { | |||
if (auth.getPid() > 0) { | |||
SysAuthGroup pAuth = authGroupMapper.selectById(auth.getPid()); | |||
if (pAuth != null) { | |||
authText += pAuth.getName() + "-"; | |||
} | |||
} | |||
authText += auth.getName(); | |||
} | |||
return authText; | |||
} | |||
/** | |||
* 根据id获取数据 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@Override | |||
public SysAuthGroup getInfoById(Integer id) { | |||
SysAuthGroup info = authGroupMapper.selectById(id); | |||
return info; | |||
} | |||
/** | |||
* 根据名称获取数据 | |||
* | |||
* @param name | |||
* @return | |||
*/ | |||
@Override | |||
public SysAuthGroup getInfoByName(String name) { | |||
QueryWrapper<SysAuthGroup> queryWrapper = new QueryWrapper<>(); | |||
queryWrapper.eq("name", name); | |||
queryWrapper.eq("mark", 1); | |||
queryWrapper.last("limit 1"); | |||
SysAuthGroup info = authGroupMapper.selectOne(queryWrapper); | |||
return info; | |||
} | |||
/** | |||
* 获取当前用户角色 1 内部用户 2外部用户 | |||
* | |||
* @return | |||
*/ | |||
@Override | |||
public Integer getAuthGroupPid() { | |||
SysAdmin adminInfo = ShiroUtils.getAdminInfo(); | |||
Integer authGroupId = Integer.valueOf(adminInfo.getAuthGroup()); | |||
SysAuthGroup group = getInfoById(authGroupId); | |||
return StringUtils.isEmpty(group) ? 0 : group.getPid(); | |||
} | |||
/** | |||
* 获取所有角色列表 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
@Override | |||
public Response getList(Map<String, String> map) { | |||
QueryWrapper<SysAuthGroup> queryWrapper = new QueryWrapper<>(); | |||
queryWrapper.eq("mark", 1); | |||
queryWrapper.eq("pid", 0); | |||
queryWrapper.orderByAsc("id"); | |||
queryWrapper.select("id,name,pid,has_child,rules,remark,status,sort,create_time,create_user"); | |||
List<Map<String, Object>> list = authGroupMapper.selectMaps(queryWrapper); | |||
if (list != null) { | |||
for (Map<String, Object> sysAuthGroup : list) { | |||
queryWrapper = new QueryWrapper<>(); | |||
queryWrapper.eq("mark", 1); | |||
queryWrapper.eq("pid", sysAuthGroup.get("id")); | |||
queryWrapper.orderByAsc("id"); | |||
queryWrapper.select("id,name,pid,has_child,rules,remark,status,sort,create_time,create_user"); | |||
sysAuthGroup = formatInfo(sysAuthGroup); | |||
List<Map<String, Object>> child = authGroupMapper.selectMaps(queryWrapper); | |||
if (child != null) { | |||
for (Map<String, Object> childInfo : child) { | |||
childInfo = formatInfo(childInfo); | |||
} | |||
} | |||
sysAuthGroup.put("children", child); | |||
} | |||
} | |||
return response.success(list); | |||
} | |||
/** | |||
* 添加角色 | |||
* | |||
* @param authGroup | |||
* @return | |||
*/ | |||
@Override | |||
public Response add(SysAuthGroup authGroup) { | |||
SysAuthGroup exit = getInfoByName(authGroup.getName()); | |||
if (!StringUtils.isEmpty(exit)) { | |||
return response.failure("角色名称已经存在"); | |||
} | |||
Integer adminId = ShiroUtils.getAdminId(); | |||
authGroup.setCreateTime(DateUtil.now()); | |||
authGroup.setCreateUser(adminId); | |||
Integer id = authGroupMapper.insert(authGroup); | |||
return response.success("操作成功", id); | |||
} | |||
/** | |||
* 修改角色 | |||
* | |||
* @param authGroup | |||
* @return | |||
*/ | |||
@Override | |||
public Response edit(SysAuthGroup authGroup) { | |||
Integer id = authGroup.getId(); | |||
if (StringUtils.isEmpty(id)) { | |||
return response.failure("数据不存在"); | |||
} | |||
SysAuthGroup info = getInfoById(id); | |||
if (info == null) { | |||
return response.failure("数据不存在"); | |||
} | |||
if (!(authGroup.getName().equals(info.getName()))) { | |||
SysAuthGroup exist = getInfoByName(authGroup.getName()); | |||
if (!StringUtils.isEmpty(exist)) { | |||
return response.failure("角色名称已经存在"); | |||
} | |||
} | |||
Integer res = authGroupMapper.updateById(authGroup); | |||
return response.success("操作成功", res); | |||
} | |||
/** | |||
* 删除角色 | |||
* | |||
* @param authGroup | |||
* @return | |||
*/ | |||
@Override | |||
public Response del(SysAuthGroup authGroup) { | |||
Integer id = authGroup.getId(); | |||
if (StringUtils.isEmpty(id)) { | |||
return response.failure("数据不存在"); | |||
} | |||
SysAuthGroup info = getInfoById(id); | |||
if (info == null) { | |||
return response.failure("数据不存在"); | |||
} | |||
//判断改角色下面是否存在用户 | |||
List<SysAuthGroupAccess> groupAccesses = iSysAuthGroupAccessService.getListByGroupid(id); | |||
if (!groupAccesses.isEmpty()) { | |||
return response.failure("该角色已经关联用户,不能删除"); | |||
} | |||
SysAuthGroup delSet = new SysAuthGroup(); | |||
delSet.setId(authGroup.getId()); | |||
delSet.setMark(0); | |||
Integer res = authGroupMapper.updateById(delSet); | |||
return response.success("操作成功", res); | |||
} | |||
/** | |||
* 设置角色权限 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
@Override | |||
public Response setRules(Map<String, String> map) { | |||
String ruleParam = map.get("rules"); | |||
if (StringUtils.isEmpty(ruleParam)) { | |||
return response.failure("请选择权限"); | |||
} | |||
String[] rules = ruleParam.split(","); | |||
Set<String> set = new TreeSet<>(); | |||
for (String rule : rules) { | |||
set.add(rule); | |||
} | |||
String ruleStr = org.apache.commons.lang3.StringUtils.join(set.toArray(), ","); | |||
String idStr = (String) map.get("id"); | |||
if (StringUtils.isEmpty(idStr)) { | |||
return response.failure("请选择角色"); | |||
} | |||
Integer id = Integer.valueOf(idStr); | |||
SysAuthGroup info = getInfoById(id); | |||
if (StringUtils.isEmpty(info)) { | |||
return response.failure("请选择角色"); | |||
} | |||
SysAuthGroup authGroup = new SysAuthGroup(); | |||
authGroup.setId(id); | |||
authGroup.setRules(ruleStr); | |||
authGroupMapper.updateById(authGroup); | |||
//重置角色对应用户权限 | |||
List<Map<String, Object>> adminList = iSysAdminService.getAdminListByGroupId(id); | |||
if (adminList != null) { | |||
for (Map<String, Object> admin : adminList) { | |||
String username = (String) admin.get("username"); | |||
// ShiroUtils.deleteCache(username, false); | |||
} | |||
} | |||
return response.success("操作成功"); | |||
} | |||
/** | |||
* 修改菜单状态 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
@Override | |||
public Response editStatus(Map<String, String> map) { | |||
String idStr = map.get("id"); | |||
String status = map.get("status"); | |||
if (StringUtils.isEmpty(idStr)) { | |||
return response.failure("数据不存在"); | |||
} | |||
if ("2".equals(status) || "1".equals(status)) { | |||
SysAuthGroup sysAuthGroup = new SysAuthGroup(); | |||
sysAuthGroup.setId(Integer.valueOf(idStr)); | |||
sysAuthGroup.setStatus(Integer.valueOf(status)); | |||
authGroupMapper.updateById(sysAuthGroup); | |||
return response.success("操作成功"); | |||
} else { | |||
return response.failure("状态不合法"); | |||
} | |||
} | |||
/** | |||
* 格式化输出内容 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
private Map<String, Object> formatInfo(Map<String, Object> map) { | |||
String createTime = map.get("create_time").toString(); | |||
String status = map.get("status").toString(); | |||
map.put("format_create_time", createTime); | |||
String statusText = "1".equals(status) ? "正常" : "禁用"; | |||
map.put("status_text", statusText); | |||
map.put("format_create_user", ""); | |||
if (!StringUtils.isEmpty(map.get("create_user"))) { | |||
Integer createUser = Integer.valueOf(map.get("create_user").toString()); | |||
SysAdmin adminInfo = iSysAdminService.getById(createUser); | |||
map.put("format_create_user", StringUtils.isEmpty(adminInfo) ? "" : adminInfo.getRealname()); | |||
} | |||
//格式化权限 | |||
String str = "rules"; | |||
String[] ruleList = new String[0]; | |||
if (!"".equals(map.get(str))) { | |||
ruleList = map.get(str).toString().split(","); | |||
} | |||
map.put("ruleList", ruleList); | |||
return map; | |||
} | |||
/** | |||
* 判断用户是否有飞行小组角色 | |||
* | |||
* @param admin | |||
* @return | |||
*/ | |||
@Override | |||
public Boolean isFlightHand(SysAdmin admin) { | |||
QueryWrapper wrapper = new QueryWrapper(); | |||
wrapper.eq("mark", 1); | |||
wrapper.eq("name", "flight_auth_group"); | |||
wrapper.eq("status", 1); | |||
SysConfig config = configService.getOne(wrapper); | |||
if (config != null) { | |||
String[] authGroup = admin.getAuthGroup().split(","); | |||
Boolean flag = false; | |||
if (authGroup != null) { | |||
for (String item : authGroup) { | |||
if (item.equals(config.getValue())) { | |||
flag = true; | |||
break; | |||
} | |||
} | |||
} | |||
return flag; | |||
} else { | |||
return false; | |||
} | |||
} | |||
} |