pull/2/head
parent
c6320d82d4
commit
ee452eb9a7
@ -0,0 +1,5 @@
|
||||
|
||||
*.html linguist-language=Java
|
||||
*.js linguist-language=Java
|
||||
*.xml linguist-language=Java
|
||||
*.css linguist-language=Java
|
||||
@ -0,0 +1,31 @@
|
||||
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/
|
||||
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
import java.net.*;
|
||||
import java.io.*;
|
||||
import java.nio.channels.*;
|
||||
import java.util.Properties;
|
||||
|
||||
public class MavenWrapperDownloader {
|
||||
|
||||
private static final String WRAPPER_VERSION = "0.5.5";
|
||||
/**
|
||||
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
|
||||
*/
|
||||
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
|
||||
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
|
||||
|
||||
/**
|
||||
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
|
||||
* use instead of the default one.
|
||||
*/
|
||||
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
|
||||
".mvn/wrapper/maven-wrapper.properties";
|
||||
|
||||
/**
|
||||
* Path where the maven-wrapper.jar will be saved to.
|
||||
*/
|
||||
private static final String MAVEN_WRAPPER_JAR_PATH =
|
||||
".mvn/wrapper/maven-wrapper.jar";
|
||||
|
||||
/**
|
||||
* Name of the property which should be used to override the default download url for the wrapper.
|
||||
*/
|
||||
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
|
||||
|
||||
public static void main(String args[]) {
|
||||
System.out.println("- Downloader started");
|
||||
File baseDirectory = new File(args[0]);
|
||||
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
|
||||
|
||||
// If the maven-wrapper.properties exists, read it and check if it contains a custom
|
||||
// wrapperUrl parameter.
|
||||
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
|
||||
String url = DEFAULT_DOWNLOAD_URL;
|
||||
if(mavenWrapperPropertyFile.exists()) {
|
||||
FileInputStream mavenWrapperPropertyFileInputStream = null;
|
||||
try {
|
||||
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
|
||||
Properties mavenWrapperProperties = new Properties();
|
||||
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
|
||||
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
|
||||
} catch (IOException e) {
|
||||
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
|
||||
} finally {
|
||||
try {
|
||||
if(mavenWrapperPropertyFileInputStream != null) {
|
||||
mavenWrapperPropertyFileInputStream.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// Ignore ...
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("- Downloading from: " + url);
|
||||
|
||||
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
|
||||
if(!outputFile.getParentFile().exists()) {
|
||||
if(!outputFile.getParentFile().mkdirs()) {
|
||||
System.out.println(
|
||||
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
|
||||
}
|
||||
}
|
||||
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
|
||||
try {
|
||||
downloadFileFromURL(url, outputFile);
|
||||
System.out.println("Done");
|
||||
System.exit(0);
|
||||
} catch (Throwable e) {
|
||||
System.out.println("- Error downloading");
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
|
||||
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
|
||||
String username = System.getenv("MVNW_USERNAME");
|
||||
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
|
||||
Authenticator.setDefault(new Authenticator() {
|
||||
@Override
|
||||
protected PasswordAuthentication getPasswordAuthentication() {
|
||||
return new PasswordAuthentication(username, password);
|
||||
}
|
||||
});
|
||||
}
|
||||
URL website = new URL(urlString);
|
||||
ReadableByteChannel rbc;
|
||||
rbc = Channels.newChannel(website.openStream());
|
||||
FileOutputStream fos = new FileOutputStream(destination);
|
||||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
||||
fos.close();
|
||||
rbc.close();
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
@ -0,0 +1,2 @@
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar
|
||||
@ -0,0 +1,310 @@
|
||||
#!/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)`"
|
||||
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
|
||||
if [ -n "$MVNW_REPOURL" ]; then
|
||||
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
|
||||
else
|
||||
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
|
||||
fi
|
||||
while IFS="=" read key value; do
|
||||
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
|
||||
esac
|
||||
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Downloading from: $jarUrl"
|
||||
fi
|
||||
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
|
||||
if $cygwin; then
|
||||
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
|
||||
fi
|
||||
|
||||
if command -v wget > /dev/null; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Found wget ... using wget"
|
||||
fi
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
wget "$jarUrl" -O "$wrapperJarPath"
|
||||
else
|
||||
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
|
||||
fi
|
||||
elif command -v curl > /dev/null; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Found curl ... using curl"
|
||||
fi
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
curl -o "$wrapperJarPath" "$jarUrl" -f
|
||||
else
|
||||
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
|
||||
fi
|
||||
|
||||
else
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo "Falling back to using Java to download"
|
||||
fi
|
||||
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
||||
# For Cygwin, switch paths to Windows format before running javac
|
||||
if $cygwin; then
|
||||
javaClass=`cygpath --path --windows "$javaClass"`
|
||||
fi
|
||||
if [ -e "$javaClass" ]; then
|
||||
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo " - Compiling MavenWrapperDownloader.java ..."
|
||||
fi
|
||||
# Compiling the Java class
|
||||
("$JAVA_HOME/bin/javac" "$javaClass")
|
||||
fi
|
||||
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||
# Running the downloader
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo " - Running MavenWrapperDownloader.java ..."
|
||||
fi
|
||||
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
##########################################################################################
|
||||
# End of extension
|
||||
##########################################################################################
|
||||
|
||||
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
echo $MAVEN_PROJECTBASEDIR
|
||||
fi
|
||||
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
||||
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
||||
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
||||
fi
|
||||
|
||||
# Provide a "standardized" way to retrieve the CLI args that will
|
||||
# work with both Windows and non-Windows executions.
|
||||
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
||||
export MAVEN_CMD_LINE_ARGS
|
||||
|
||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
exec "$JAVACMD" \
|
||||
$MAVEN_OPTS \
|
||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
||||
@ -0,0 +1,182 @@
|
||||
@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 by setting MAVEN_BATCH_ECHO to 'on'
|
||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||
|
||||
@REM set %HOME% to equivalent of $HOME
|
||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||
|
||||
@REM Execute a user defined script before this one
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%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.5.5/maven-wrapper-0.5.5.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% (
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Found %WRAPPER_JAR%
|
||||
)
|
||||
) else (
|
||||
if not "%MVNW_REPOURL%" == "" (
|
||||
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
|
||||
)
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||
echo Downloading from: %DOWNLOAD_URL%
|
||||
)
|
||||
|
||||
powershell -Command "&{"^
|
||||
"$webclient = new-object System.Net.WebClient;"^
|
||||
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
||||
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
||||
"}"^
|
||||
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
|
||||
"}"
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Finished downloading %WRAPPER_JAR%
|
||||
)
|
||||
)
|
||||
@REM End of extension
|
||||
|
||||
@REM Provide a "standardized" way to retrieve the CLI args that will
|
||||
@REM work with both Windows and non-Windows executions.
|
||||
set MAVEN_CMD_LINE_ARGS=%*
|
||||
|
||||
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
||||
if ERRORLEVEL 1 goto error
|
||||
goto end
|
||||
|
||||
:error
|
||||
set ERROR_CODE=1
|
||||
|
||||
:end
|
||||
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
|
||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%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,39 @@
|
||||
package com.yeqifu;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.web.servlet.MultipartConfigFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.util.unit.DataSize;
|
||||
|
||||
import javax.servlet.MultipartConfigElement;
|
||||
|
||||
/**
|
||||
* @author luoyi-
|
||||
*/
|
||||
@Configuration
|
||||
@SpringBootApplication
|
||||
@MapperScan(basePackages = {"com.yeqifu.*.mapper"})
|
||||
public class WarehouseApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(WarehouseApplication.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MultipartConfigElement multipartConfigElement() {
|
||||
MultipartConfigFactory factory = new MultipartConfigFactory();
|
||||
/**
|
||||
* 单个数据大小
|
||||
*/
|
||||
factory.setMaxFileSize(DataSize.parse("102400KB"));
|
||||
/**
|
||||
* 总上传数据大小6
|
||||
*/
|
||||
factory.setMaxRequestSize(DataSize.parse("102400KB"));
|
||||
return factory.createMultipartConfig();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,236 @@
|
||||
package com.yeqifu.bus.cache;
|
||||
|
||||
import com.yeqifu.bus.entity.Customer;
|
||||
import com.yeqifu.bus.entity.Goods;
|
||||
import com.yeqifu.sys.cache.CachePool;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: 落亦-
|
||||
* @Date: 2019/12/5 16:39
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
@EnableAspectJAutoProxy
|
||||
public class BusinessCacheAspect {
|
||||
/**
|
||||
* 日志出处
|
||||
*/
|
||||
private Log log = LogFactory.getLog(BusinessCacheAspect.class);
|
||||
|
||||
/**
|
||||
* 声明一个缓存容器
|
||||
*/
|
||||
private Map<String,Object> CACHE_CONTAINER = CachePool.CACHE_CONTAINER;
|
||||
|
||||
|
||||
/**
|
||||
* 声明客户的切面表达式
|
||||
*/
|
||||
private static final String POINTCUT_CUSTOMER_ADD="execution(* com.yeqifu.bus.service.impl.CustomerServiceImpl.save(..))";
|
||||
private static final String POINTCUT_CUSTOMER_UPDATE="execution(* com.yeqifu.bus.service.impl.CustomerServiceImpl.updateById(..))";
|
||||
private static final String POINTCUT_CUSTOMER_GET="execution(* com.yeqifu.bus.service.impl.CustomerServiceImpl.getById(..))";
|
||||
private static final String POINTCUT_CUSTOMER_DELETE="execution(* com.yeqifu.bus.service.impl.CustomerServiceImpl.removeById(..))";
|
||||
private static final String POINTCUT_CUSTOMER_BATCHDELETE="execution(* com.yeqifu.bus.service.impl.CustomerServiceImpl.removeByIds(..))";
|
||||
|
||||
private static final String CACHE_CUSTOMER_PROFIX="customer:";
|
||||
|
||||
/**
|
||||
* 添加客户切入
|
||||
* @param joinPoint
|
||||
* @return
|
||||
*/
|
||||
@Around(value = POINTCUT_CUSTOMER_ADD)
|
||||
public Object cacheCustomerAdd(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
//取出第一个参数
|
||||
Customer object = (Customer) joinPoint.getArgs()[0];
|
||||
Boolean res = (Boolean) joinPoint.proceed();
|
||||
if (res){
|
||||
CACHE_CONTAINER.put(CACHE_CUSTOMER_PROFIX + object.getId(),object);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询客户切入
|
||||
* @param joinPoint
|
||||
* @return
|
||||
*/
|
||||
@Around(value = POINTCUT_CUSTOMER_GET)
|
||||
public Object cacheCustomerGet(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
//取出第一个参数
|
||||
Integer object = (Integer) joinPoint.getArgs()[0];
|
||||
//从缓存里面取
|
||||
Object res1 = CACHE_CONTAINER.get(CACHE_CUSTOMER_PROFIX + object);
|
||||
if (res1!=null){
|
||||
log.info("已从缓存里面找到客户对象"+CACHE_CUSTOMER_PROFIX + object);
|
||||
return res1;
|
||||
}else {
|
||||
log.info("未从缓存里面找到客户对象,从数据库中查询并放入缓存");
|
||||
Customer res2 =(Customer) joinPoint.proceed();
|
||||
CACHE_CONTAINER.put(CACHE_CUSTOMER_PROFIX+res2.getId(),res2);
|
||||
return res2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新客户切入
|
||||
* @param joinPoint
|
||||
* @return
|
||||
*/
|
||||
@Around(value = POINTCUT_CUSTOMER_UPDATE)
|
||||
public Object cacheCustomerUpdate(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
//取出第一个参数
|
||||
Customer customerVo = (Customer) joinPoint.getArgs()[0];
|
||||
Boolean isSuccess = (Boolean) joinPoint.proceed();
|
||||
if (isSuccess){
|
||||
Customer customer =(Customer) CACHE_CONTAINER.get(CACHE_CUSTOMER_PROFIX + customerVo.getId());
|
||||
if (null==customer){
|
||||
customer=new Customer();
|
||||
}
|
||||
BeanUtils.copyProperties(customerVo,customer);
|
||||
log.info("客户对象缓存已更新"+CACHE_CUSTOMER_PROFIX + customerVo.getId());
|
||||
CACHE_CONTAINER.put(CACHE_CUSTOMER_PROFIX+customer.getId(),customer);
|
||||
}
|
||||
return isSuccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除客户切入
|
||||
* @param joinPoint
|
||||
* @return
|
||||
*/
|
||||
@Around(value = POINTCUT_CUSTOMER_DELETE)
|
||||
public Object cacheCustomerDelete(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
//取出第一个参数
|
||||
Integer id = (Integer) joinPoint.getArgs()[0];
|
||||
Boolean isSuccess = (Boolean) joinPoint.proceed();
|
||||
if (isSuccess){
|
||||
//删除缓存
|
||||
CACHE_CONTAINER.remove(CACHE_CUSTOMER_PROFIX+id);
|
||||
}
|
||||
return isSuccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除客户切入
|
||||
*
|
||||
* @throws Throwable
|
||||
*/
|
||||
@Around(value = POINTCUT_CUSTOMER_BATCHDELETE)
|
||||
public Object cacheCustomerBatchDelete(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
// 取出第一个参数
|
||||
@SuppressWarnings("unchecked")
|
||||
Collection<Serializable> idList = (Collection<Serializable>) joinPoint.getArgs()[0];
|
||||
Boolean isSuccess = (Boolean) joinPoint.proceed();
|
||||
if (isSuccess) {
|
||||
for (Serializable id : idList) {
|
||||
// 删除缓存
|
||||
CACHE_CONTAINER.remove(CACHE_CUSTOMER_PROFIX + id);
|
||||
log.info("客户对象缓存已删除" + CACHE_CUSTOMER_PROFIX + id);
|
||||
}
|
||||
}
|
||||
return isSuccess;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 声明商品的切面表达式
|
||||
*/
|
||||
private static final String POINTCUT_GOODS_ADD="execution(* com.yeqifu.bus.service.impl.GoodsServiceImpl.save(..))";
|
||||
private static final String POINTCUT_GOODS_UPDATE="execution(* com.yeqifu.bus.service.impl.GoodsServiceImpl.updateById(..))";
|
||||
private static final String POINTCUT_GOODS_GET="execution(* com.yeqifu.bus.service.impl.GoodsServiceImpl.getById(..))";
|
||||
private static final String POINTCUT_GOODS_DELETE="execution(* com.yeqifu.bus.service.impl.GoodsServiceImpl.removeById(..))";
|
||||
|
||||
private static final String CACHE_GOODS_PROFIX="goods:";
|
||||
|
||||
/**
|
||||
* 添加商品切入
|
||||
* @param joinPoint
|
||||
* @return
|
||||
*/
|
||||
@Around(value = POINTCUT_GOODS_ADD)
|
||||
public Object cacheGoodsAdd(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
//取出第一个参数
|
||||
Goods object = (Goods) joinPoint.getArgs()[0];
|
||||
Boolean res = (Boolean) joinPoint.proceed();
|
||||
if (res){
|
||||
CACHE_CONTAINER.put(CACHE_GOODS_PROFIX + object.getId(),object);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品切入
|
||||
* @param joinPoint
|
||||
* @return
|
||||
*/
|
||||
@Around(value = POINTCUT_GOODS_GET)
|
||||
public Object cacheGoodsGet(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
//取出第一个参数
|
||||
Integer object = (Integer) joinPoint.getArgs()[0];
|
||||
//从缓存里面取
|
||||
Object res1 = CACHE_CONTAINER.get(CACHE_GOODS_PROFIX + object);
|
||||
if (res1!=null){
|
||||
log.info("已从缓存里面找到商品对象"+CACHE_GOODS_PROFIX + object);
|
||||
return res1;
|
||||
}else {
|
||||
log.info("未从缓存里面找到商品对象,从数据库中查询并放入缓存");
|
||||
Goods res2 =(Goods) joinPoint.proceed();
|
||||
CACHE_CONTAINER.put(CACHE_GOODS_PROFIX+res2.getId(),res2);
|
||||
return res2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新商品切入
|
||||
* @param joinPoint
|
||||
* @return
|
||||
*/
|
||||
@Around(value = POINTCUT_GOODS_UPDATE)
|
||||
public Object cacheGoodsUpdate(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
//取出第一个参数
|
||||
Goods goodsVo = (Goods) joinPoint.getArgs()[0];
|
||||
Boolean isSuccess = (Boolean) joinPoint.proceed();
|
||||
if (isSuccess){
|
||||
Goods goods =(Goods) CACHE_CONTAINER.get(CACHE_GOODS_PROFIX + goodsVo.getId());
|
||||
if (null==goods){
|
||||
goods=new Goods();
|
||||
}
|
||||
BeanUtils.copyProperties(goodsVo,goods);
|
||||
log.info("商品对象缓存已更新"+CACHE_GOODS_PROFIX + goodsVo.getId());
|
||||
CACHE_CONTAINER.put(CACHE_GOODS_PROFIX+goods.getId(),goods);
|
||||
}
|
||||
return isSuccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品切入
|
||||
* @param joinPoint
|
||||
* @return
|
||||
*/
|
||||
@Around(value = POINTCUT_GOODS_DELETE)
|
||||
public Object cacheGoodsDelete(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
//取出第一个参数
|
||||
Integer id = (Integer) joinPoint.getArgs()[0];
|
||||
Boolean isSuccess = (Boolean) joinPoint.proceed();
|
||||
if (isSuccess){
|
||||
//删除缓存
|
||||
CACHE_CONTAINER.remove(CACHE_GOODS_PROFIX+id);
|
||||
}
|
||||
return isSuccess;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
package com.yeqifu.bus.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
/**
|
||||
* 业务管理的路由器
|
||||
* @Author: 落亦-
|
||||
* @Date: 2019/12/5 9:33
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("bus")
|
||||
public class BusinessController {
|
||||
|
||||
/**
|
||||
* 跳转到客户管理页面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toCustomerManager")
|
||||
public String toCustomerManager(){
|
||||
return "business/customer/customerManager";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到供应商管理页面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toProviderManager")
|
||||
public String toProviderManager(){
|
||||
return "business/provider/providerManager";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到商品管理页面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toGoodsManager")
|
||||
public String toGoodsManager(){
|
||||
return "business/goods/goodsManager";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到进货管理页面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toInportManager")
|
||||
public String toInportManager(){
|
||||
return "business/inport/inportManager";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到退货管理页面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toOutportManager")
|
||||
public String toOutportManager(){
|
||||
return "business/outport/outportManager";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到商品销售管理页面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toSalesManager")
|
||||
public String toSalesManager(){
|
||||
return "business/sales/salesManager";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到商品销售管理页面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toSalesbackManager")
|
||||
public String toSalesbackManager(){
|
||||
return "business/salesback/salesbackManager";
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,121 @@
|
||||
package com.yeqifu.bus.controller;
|
||||
|
||||
|
||||
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.yeqifu.bus.entity.Customer;
|
||||
import com.yeqifu.bus.service.ICustomerService;
|
||||
import com.yeqifu.bus.vo.CustomerVo;
|
||||
import com.yeqifu.sys.common.Constast;
|
||||
import com.yeqifu.sys.common.DataGridView;
|
||||
import com.yeqifu.sys.common.ResultObj;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-05
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/customer")
|
||||
public class CustomerController {
|
||||
|
||||
@Autowired
|
||||
private ICustomerService customerService;
|
||||
|
||||
/**
|
||||
* 查询所有的客户
|
||||
* @param customerVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("loadAllCustomer")
|
||||
public DataGridView loadAllCustomer(CustomerVo customerVo){
|
||||
//1.声明一个分页page对象
|
||||
IPage<Customer> page = new Page<Customer>(customerVo.getPage(),customerVo.getLimit());
|
||||
//2.声明一个queryWrapper
|
||||
QueryWrapper<Customer> queryWrapper = new QueryWrapper<Customer>();
|
||||
queryWrapper.like(StringUtils.isNotBlank(customerVo.getCustomername()),"customername",customerVo.getCustomername());
|
||||
queryWrapper.like(StringUtils.isNotBlank(customerVo.getConnectionpersion()),"connectionpersion",customerVo.getConnectionpersion());
|
||||
queryWrapper.like(StringUtils.isNotBlank(customerVo.getPhone()),"phone",customerVo.getPhone());
|
||||
customerService.page(page,queryWrapper);
|
||||
return new DataGridView(page.getTotal(),page.getRecords());
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加一个客户
|
||||
* @param customerVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("addCustomer")
|
||||
public ResultObj addCustomer(CustomerVo customerVo){
|
||||
try {
|
||||
customerService.save(customerVo);
|
||||
return ResultObj.ADD_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.ADD_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改一个客户
|
||||
* @param customerVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("updateCustomer")
|
||||
public ResultObj updateCustomer(CustomerVo customerVo){
|
||||
try {
|
||||
customerService.updateById(customerVo);
|
||||
return ResultObj.UPDATE_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.UPDATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除一个客户
|
||||
* @param id 客户的ID
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除一个客户",notes = "删除一个客户")
|
||||
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "客户ID",required = true,paramType = "query",dataType = "Integer")})
|
||||
@RequestMapping(value = "deleteCustomer",method = RequestMethod.DELETE)
|
||||
public ResultObj deleteCustomer(Integer id){
|
||||
try {
|
||||
customerService.deleteCustomerById(id);
|
||||
return ResultObj.DELETE_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.DELETE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 加载所有客户的下拉列表
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("loadAllCustomerForSelect")
|
||||
public DataGridView loadAllCustomerForSelect(){
|
||||
QueryWrapper<Customer> queryWrapper = new QueryWrapper<Customer>();
|
||||
queryWrapper.eq("available", Constast.AVAILABLE_TRUE);
|
||||
List<Customer> list = customerService.list(queryWrapper);
|
||||
return new DataGridView(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,184 @@
|
||||
package com.yeqifu.bus.controller;
|
||||
|
||||
|
||||
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.yeqifu.bus.entity.Goods;
|
||||
import com.yeqifu.bus.entity.Provider;
|
||||
import com.yeqifu.bus.service.IGoodsService;
|
||||
import com.yeqifu.bus.service.IProviderService;
|
||||
import com.yeqifu.bus.vo.GoodsVo;
|
||||
import com.yeqifu.sys.common.AppFileUtils;
|
||||
import com.yeqifu.sys.common.Constast;
|
||||
import com.yeqifu.sys.common.DataGridView;
|
||||
import com.yeqifu.sys.common.ResultObj;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB; (`providerid`) REFER `warehouse/bus_provider`(`id`) 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/goods")
|
||||
public class GoodsController {
|
||||
|
||||
@Autowired
|
||||
private IGoodsService goodsService;
|
||||
|
||||
@Autowired
|
||||
private IProviderService providerService;
|
||||
|
||||
/**
|
||||
* 查询商品
|
||||
* @param goodsVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("loadAllGoods")
|
||||
public DataGridView loadAllGoods(GoodsVo goodsVo){
|
||||
IPage<Goods> page = new Page<Goods>(goodsVo.getPage(),goodsVo.getLimit());
|
||||
QueryWrapper<Goods> queryWrapper = new QueryWrapper<Goods>();
|
||||
queryWrapper.eq(goodsVo.getProviderid()!=null&&goodsVo.getProviderid()!=0,"providerid",goodsVo.getProviderid());
|
||||
queryWrapper.like(StringUtils.isNotBlank(goodsVo.getGoodsname()),"goodsname",goodsVo.getGoodsname());
|
||||
queryWrapper.like(StringUtils.isNotBlank(goodsVo.getProductcode()),"productcode",goodsVo.getProductcode());
|
||||
queryWrapper.like(StringUtils.isNotBlank(goodsVo.getPromitcode()),"promitcode",goodsVo.getPromitcode());
|
||||
queryWrapper.like(StringUtils.isNotBlank(goodsVo.getDescription()),"description",goodsVo.getDescription());
|
||||
queryWrapper.like(StringUtils.isNotBlank(goodsVo.getSize()),"size",goodsVo.getSize());
|
||||
|
||||
queryWrapper.orderByDesc("id");
|
||||
goodsService.page(page,queryWrapper);
|
||||
List<Goods> records = page.getRecords();
|
||||
for (Goods goods : records) {
|
||||
Provider provider = providerService.getById(goods.getProviderid());
|
||||
if (null!=provider){
|
||||
goods.setProvidername(provider.getProvidername());
|
||||
}
|
||||
}
|
||||
return new DataGridView(page.getTotal(),page.getRecords());
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加商品
|
||||
* @param goodsVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("addGoods")
|
||||
public ResultObj addGoods(GoodsVo goodsVo){
|
||||
try {
|
||||
System.out.println("====================================");
|
||||
System.out.println(goodsVo.getGoodsimg());
|
||||
if (goodsVo.getGoodsimg()!=null&&goodsVo.getGoodsimg().endsWith("_temp")){
|
||||
String newName = AppFileUtils.renameFile(goodsVo.getGoodsimg());
|
||||
goodsVo.setGoodsimg(newName);
|
||||
}
|
||||
goodsService.save(goodsVo);
|
||||
return ResultObj.ADD_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.ADD_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品
|
||||
* @param goodsVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("updateGoods")
|
||||
public ResultObj updateGoods(GoodsVo goodsVo){
|
||||
try {
|
||||
//商品图片不是默认图片
|
||||
if (!(goodsVo.getGoodsimg()!=null&&goodsVo.getGoodsimg().equals(Constast.DEFAULT_IMG_GOODS))){
|
||||
|
||||
if (goodsVo.getGoodsimg().endsWith("_temp")){
|
||||
String newName = AppFileUtils.renameFile(goodsVo.getGoodsimg());
|
||||
goodsVo.setGoodsimg(newName);
|
||||
//删除原先的图片
|
||||
String oldPath = goodsService.getById(goodsVo.getId()).getGoodsimg();
|
||||
AppFileUtils.removeFileByPath(oldPath);
|
||||
}
|
||||
}
|
||||
goodsService.updateById(goodsVo);
|
||||
return ResultObj.UPDATE_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.UPDATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品
|
||||
* @param id 商品id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("deleteGoods")
|
||||
public ResultObj deleteGoods(Integer id,String goodsimg){
|
||||
try {
|
||||
//删除商品的图片
|
||||
AppFileUtils.removeFileByPath(goodsimg);
|
||||
// goodsService.removeById(id);
|
||||
goodsService.deleteGoodsById(id);
|
||||
return ResultObj.DELETE_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.DELETE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载所有可用的商品
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("loadAllGoodsForSelect")
|
||||
public DataGridView loadAllGoodsForSelect(){
|
||||
QueryWrapper<Goods> queryWrapper = new QueryWrapper<Goods>();
|
||||
queryWrapper.eq("available",Constast.AVAILABLE_TRUE);
|
||||
List<Goods> list = goodsService.list(queryWrapper);
|
||||
for (Goods goods : list) {
|
||||
Provider provider = providerService.getById(goods.getProviderid());
|
||||
if (null!=provider){
|
||||
goods.setProvidername(provider.getProvidername());
|
||||
}
|
||||
}
|
||||
return new DataGridView(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据供应商ID查询商品信息
|
||||
* @param providerid 供应商ID
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("loadGoodsByProviderId")
|
||||
public DataGridView loadGoodsByProviderId(Integer providerid){
|
||||
QueryWrapper<Goods> queryWrapper = new QueryWrapper<Goods>();
|
||||
queryWrapper.eq("available",Constast.AVAILABLE_TRUE);
|
||||
queryWrapper.eq(providerid!=null,"providerid",providerid);
|
||||
List<Goods> list = goodsService.list(queryWrapper);
|
||||
for (Goods goods : list) {
|
||||
Provider provider = providerService.getById(goods.getProviderid());
|
||||
if (null!=provider){
|
||||
goods.setProvidername(provider.getProvidername());
|
||||
}
|
||||
}
|
||||
return new DataGridView(list);
|
||||
}
|
||||
|
||||
@RequestMapping("loadAllWarningGoods")
|
||||
public DataGridView loadAllWarningGoods(){
|
||||
List<Goods> goods = goodsService.loadAllWarning();
|
||||
return new DataGridView((long) goods.size(),goods);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,141 @@
|
||||
package com.yeqifu.bus.controller;
|
||||
|
||||
|
||||
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.yeqifu.bus.entity.Goods;
|
||||
import com.yeqifu.bus.entity.Inport;
|
||||
import com.yeqifu.bus.entity.Provider;
|
||||
import com.yeqifu.bus.service.IGoodsService;
|
||||
import com.yeqifu.bus.service.IInportService;
|
||||
import com.yeqifu.bus.service.IProviderService;
|
||||
import com.yeqifu.bus.vo.InportVo;
|
||||
import com.yeqifu.sys.common.DataGridView;
|
||||
import com.yeqifu.sys.common.ResultObj;
|
||||
import com.yeqifu.sys.common.WebUtils;
|
||||
import com.yeqifu.sys.entity.User;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB; (`providerid`) REFER `warehouse/bus_provider`(`id`); (`goo 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-18
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("inport")
|
||||
public class InportController {
|
||||
|
||||
@Autowired
|
||||
private IInportService inportService;
|
||||
|
||||
@Autowired
|
||||
private IProviderService providerService;
|
||||
|
||||
@Autowired
|
||||
private IGoodsService goodsService;
|
||||
|
||||
/**
|
||||
* 查询商品进货
|
||||
* @param inportVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("loadAllInport")
|
||||
public DataGridView loadAllInport(InportVo inportVo){
|
||||
IPage<Inport> page = new Page<Inport>(inportVo.getPage(),inportVo.getLimit());
|
||||
QueryWrapper<Inport> queryWrapper = new QueryWrapper<Inport>();
|
||||
//对供应商进行查询
|
||||
queryWrapper.eq(inportVo.getProviderid()!=null&&inportVo.getProviderid()!=0,"providerid",inportVo.getProviderid());
|
||||
//对商品进行查询
|
||||
queryWrapper.eq(inportVo.getGoodsid()!=null&&inportVo.getGoodsid()!=0,"goodsid",inportVo.getGoodsid());
|
||||
//对时间进行查询要求大于开始时间小于结束时间
|
||||
queryWrapper.ge(inportVo.getStartTime()!=null,"inporttime",inportVo.getStartTime());
|
||||
queryWrapper.le(inportVo.getEndTime()!=null,"inporttime",inportVo.getEndTime());
|
||||
//通过进货时间对商品进行排序
|
||||
queryWrapper.orderByDesc("inporttime");
|
||||
IPage<Inport> page1 = inportService.page(page, queryWrapper);
|
||||
List<Inport> records = page1.getRecords();
|
||||
for (Inport inport : records) {
|
||||
Provider provider = providerService.getById(inport.getProviderid());
|
||||
if (provider!=null){
|
||||
//设置供应商姓名
|
||||
inport.setProvidername(provider.getProvidername());
|
||||
}
|
||||
Goods goods = goodsService.getById(inport.getGoodsid());
|
||||
if (goods!=null){
|
||||
//设置商品名称
|
||||
inport.setGoodsname(goods.getGoodsname());
|
||||
//设置商品规格
|
||||
inport.setSize(goods.getSize());
|
||||
}
|
||||
}
|
||||
return new DataGridView(page1.getTotal(),page1.getRecords());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加进货商品
|
||||
* @param inportVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("addInport")
|
||||
public ResultObj addInport(InportVo inportVo){
|
||||
try {
|
||||
//获得当前系统用户
|
||||
User user = (User) WebUtils.getSession().getAttribute("user");
|
||||
//设置操作人
|
||||
inportVo.setOperateperson(user.getName());
|
||||
//设置进货时间
|
||||
inportVo.setInporttime(new Date());
|
||||
inportService.save(inportVo);
|
||||
return ResultObj.ADD_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.ADD_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新进货商品
|
||||
* @param inportVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("updateInport")
|
||||
public ResultObj updateInport(InportVo inportVo){
|
||||
try {
|
||||
inportService.updateById(inportVo);
|
||||
return ResultObj.UPDATE_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.UPDATE_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除进货商品
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("deleteInport")
|
||||
public ResultObj deleteInport(Integer id){
|
||||
try {
|
||||
inportService.removeById(id);
|
||||
return ResultObj.DELETE_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.DELETE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,116 @@
|
||||
package com.yeqifu.bus.controller;
|
||||
|
||||
|
||||
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.yeqifu.bus.entity.Goods;
|
||||
import com.yeqifu.bus.entity.Outport;
|
||||
import com.yeqifu.bus.entity.Provider;
|
||||
import com.yeqifu.bus.service.IGoodsService;
|
||||
import com.yeqifu.bus.service.IOutportService;
|
||||
import com.yeqifu.bus.service.IProviderService;
|
||||
import com.yeqifu.bus.vo.OutportVo;
|
||||
import com.yeqifu.sys.common.DataGridView;
|
||||
import com.yeqifu.sys.common.ResultObj;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/outport")
|
||||
public class OutportController {
|
||||
|
||||
@Autowired
|
||||
private IOutportService outportService;
|
||||
|
||||
@Autowired
|
||||
private IProviderService providerService;
|
||||
|
||||
@Autowired
|
||||
private IGoodsService goodsService;
|
||||
|
||||
/**
|
||||
* 添加退货信息
|
||||
* @param id 进货单ID
|
||||
* @param number 退货数量
|
||||
* @param remark 备注
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("addOutport")
|
||||
public ResultObj addOutport(Integer id,Integer number,String remark){
|
||||
try {
|
||||
outportService.addOutport(id,number,remark);
|
||||
return ResultObj.BACKINPORT_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.BACKINPORT_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/**t
|
||||
* 查询商品退货
|
||||
* @param outportVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("loadAllOutport")
|
||||
public DataGridView loadAllOuport(OutportVo outportVo){
|
||||
IPage<Outport> page = new Page<Outport>(outportVo.getPage(),outportVo.getLimit());
|
||||
QueryWrapper<Outport> queryWrapper = new QueryWrapper<Outport>();
|
||||
//对供应商进行查询
|
||||
queryWrapper.eq(outportVo.getProviderid()!=null&&outportVo.getProviderid()!=0,"providerid",outportVo.getProviderid());
|
||||
//对商品进行查询
|
||||
queryWrapper.eq(outportVo.getGoodsid()!=null&&outportVo.getGoodsid()!=0,"goodsid",outportVo.getGoodsid());
|
||||
//对时间进行查询要求大于开始时间小于结束时间
|
||||
queryWrapper.ge(outportVo.getStartTime()!=null,"outputtime",outportVo.getStartTime());
|
||||
queryWrapper.le(outportVo.getEndTime()!=null,"outputtime",outportVo.getEndTime());
|
||||
//通过进货时间对商品进行排序
|
||||
queryWrapper.orderByDesc("outputtime");
|
||||
IPage<Outport> page1 = outportService.page(page, queryWrapper);
|
||||
List<Outport> records = page1.getRecords();
|
||||
for (Outport ouport : records) {
|
||||
Provider provider = providerService.getById(ouport.getProviderid());
|
||||
if (provider!=null){
|
||||
//设置供应商姓名
|
||||
ouport.setProvidername(provider.getProvidername());
|
||||
}
|
||||
Goods goods = goodsService.getById(ouport.getGoodsid());
|
||||
if (goods!=null){
|
||||
//设置商品名称
|
||||
ouport.setGoodsname(goods.getGoodsname());
|
||||
//设置商品规格
|
||||
ouport.setSize(goods.getSize());
|
||||
}
|
||||
}
|
||||
return new DataGridView(page1.getTotal(),page1.getRecords());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除退货信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("deleteOutport")
|
||||
public ResultObj deleteOutport(Integer id){
|
||||
try {
|
||||
outportService.removeById(id);
|
||||
return ResultObj.DELETE_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.DELETE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,117 @@
|
||||
package com.yeqifu.bus.controller;
|
||||
|
||||
|
||||
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.yeqifu.bus.entity.Provider;
|
||||
import com.yeqifu.bus.service.IProviderService;
|
||||
import com.yeqifu.bus.vo.ProviderVo;
|
||||
import com.yeqifu.sys.common.Constast;
|
||||
import com.yeqifu.sys.common.DataGridView;
|
||||
import com.yeqifu.sys.common.ResultObj;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-05
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/provider")
|
||||
public class ProviderController {
|
||||
|
||||
@Autowired
|
||||
private IProviderService providerService;
|
||||
|
||||
/**
|
||||
* 查询所有的供应商
|
||||
* @param providerVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("loadAllProvider")
|
||||
public DataGridView loadAllProvider(ProviderVo providerVo){
|
||||
//1.声明一个分页page对象
|
||||
IPage<Provider> page = new Page(providerVo.getPage(),providerVo.getLimit());
|
||||
//2.声明一个queryWrapper
|
||||
QueryWrapper<Provider> queryWrapper = new QueryWrapper();
|
||||
queryWrapper.like(StringUtils.isNotBlank(providerVo.getProvidername()),"providername",providerVo.getProvidername());
|
||||
queryWrapper.like(StringUtils.isNotBlank(providerVo.getConnectionperson()),"connectionperson",providerVo.getConnectionperson());
|
||||
queryWrapper.like(StringUtils.isNotBlank(providerVo.getPhone()),"phone",providerVo.getPhone());
|
||||
providerService.page(page,queryWrapper);
|
||||
return new DataGridView(page.getTotal(),page.getRecords());
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加一个供应商
|
||||
* @param providerVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("addProvider")
|
||||
public ResultObj addProvider(ProviderVo providerVo){
|
||||
try {
|
||||
providerService.save(providerVo);
|
||||
return ResultObj.ADD_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.ADD_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改一个供应商
|
||||
* @param providerVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("updateProvider")
|
||||
public ResultObj updateProvider(ProviderVo providerVo){
|
||||
try {
|
||||
providerService.updateById(providerVo);
|
||||
return ResultObj.UPDATE_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.UPDATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除一个供应商
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("deleteProvider")
|
||||
public ResultObj deleteProvider(Integer id){
|
||||
try {
|
||||
providerService.deleteProviderById(id);
|
||||
return ResultObj.DELETE_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.DELETE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 加载所有可用的供应商
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("loadAllProviderForSelect")
|
||||
public DataGridView loadAllProviderForSelect(){
|
||||
QueryWrapper<Provider> queryWrapper = new QueryWrapper<Provider>();
|
||||
queryWrapper.eq("available", Constast.AVAILABLE_TRUE);
|
||||
List<Provider> list = providerService.list(queryWrapper);
|
||||
return new DataGridView(list);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,137 @@
|
||||
package com.yeqifu.bus.controller;
|
||||
|
||||
|
||||
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.yeqifu.bus.entity.Customer;
|
||||
import com.yeqifu.bus.entity.Goods;
|
||||
import com.yeqifu.bus.entity.Sales;
|
||||
import com.yeqifu.bus.service.ICustomerService;
|
||||
import com.yeqifu.bus.service.IGoodsService;
|
||||
import com.yeqifu.bus.service.ISalesService;
|
||||
import com.yeqifu.bus.vo.SalesVo;
|
||||
import com.yeqifu.sys.common.DataGridView;
|
||||
import com.yeqifu.sys.common.ResultObj;
|
||||
import com.yeqifu.sys.common.WebUtils;
|
||||
import com.yeqifu.sys.entity.User;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sales")
|
||||
public class SalesController {
|
||||
|
||||
@Autowired
|
||||
private ISalesService salesService;
|
||||
|
||||
@Autowired
|
||||
private ICustomerService customerService;
|
||||
|
||||
@Autowired
|
||||
private IGoodsService goodsService;
|
||||
|
||||
/**
|
||||
* 查询所有商品销售信息
|
||||
* @param salesVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("loadAllSales")
|
||||
public DataGridView loadAllSales(SalesVo salesVo){
|
||||
IPage<Sales> page = new Page<>(salesVo.getPage(),salesVo.getLimit());
|
||||
QueryWrapper<Sales> queryWrapper = new QueryWrapper<Sales>();
|
||||
//根据客户进行模糊查询
|
||||
queryWrapper.eq(salesVo.getCustomerid()!=null&&salesVo.getCustomerid()!=0,"customerid",salesVo.getCustomerid());
|
||||
//根据商品模糊查询
|
||||
queryWrapper.eq(salesVo.getGoodsid()!=null&&salesVo.getGoodsid()!=0,"goodsid",salesVo.getGoodsid());
|
||||
//根据时间进行模糊查询
|
||||
queryWrapper.ge(salesVo.getStartTime()!=null,"salestime",salesVo.getStartTime());
|
||||
queryWrapper.le(salesVo.getEndTime()!=null,"salestime",salesVo.getEndTime());
|
||||
IPage<Sales> page1 = salesService.page(page, queryWrapper);
|
||||
List<Sales> records = page1.getRecords();
|
||||
for (Sales sales : records) {
|
||||
//设置客户姓名
|
||||
Customer customer = customerService.getById(sales.getCustomerid());
|
||||
if(null!=customer){
|
||||
sales.setCustomername(customer.getCustomername());
|
||||
}
|
||||
//设置商品名称
|
||||
Goods goods = goodsService.getById(sales.getGoodsid());
|
||||
if (null!=goods){
|
||||
//设置商品名称
|
||||
sales.setGoodsname(goods.getGoodsname());
|
||||
//设置商品规格
|
||||
sales.setSize(goods.getSize());
|
||||
}
|
||||
}
|
||||
return new DataGridView(page1.getTotal(),page1.getRecords());
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加商品销售信息
|
||||
* @param salesVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("addSales")
|
||||
public ResultObj addSales(SalesVo salesVo){
|
||||
try {
|
||||
//获得当前系统用户
|
||||
User user = (User) WebUtils.getSession().getAttribute("user");
|
||||
//设置操作人
|
||||
salesVo.setOperateperson(user.getName());
|
||||
//设置销售时间
|
||||
salesVo.setSalestime(new Date());
|
||||
salesService.save(salesVo);
|
||||
return ResultObj.ADD_SUCCESS;
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.ADD_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新商品销售信息
|
||||
* @param salesVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("updateSales")
|
||||
public ResultObj updateSales(SalesVo salesVo){
|
||||
try {
|
||||
salesService.updateById(salesVo);
|
||||
return ResultObj.UPDATE_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.UPDATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品销售信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("deleteSales")
|
||||
public ResultObj deleteSales(Integer id){
|
||||
try {
|
||||
salesService.removeById(id);
|
||||
return ResultObj.DELETE_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.DELETE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,116 @@
|
||||
package com.yeqifu.bus.controller;
|
||||
|
||||
|
||||
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.yeqifu.bus.entity.Customer;
|
||||
import com.yeqifu.bus.entity.Goods;
|
||||
import com.yeqifu.bus.entity.Salesback;
|
||||
import com.yeqifu.bus.service.ICustomerService;
|
||||
import com.yeqifu.bus.service.IGoodsService;
|
||||
import com.yeqifu.bus.service.ISalesbackService;
|
||||
import com.yeqifu.bus.vo.SalesbackVo;
|
||||
import com.yeqifu.sys.common.DataGridView;
|
||||
import com.yeqifu.sys.common.ResultObj;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/salesback")
|
||||
public class SalesbackController {
|
||||
|
||||
@Autowired
|
||||
private ISalesbackService salesbackService;
|
||||
|
||||
@Autowired
|
||||
private ICustomerService customerService;
|
||||
|
||||
@Autowired
|
||||
private IGoodsService goodsService;
|
||||
|
||||
/**
|
||||
* 添加退货信息
|
||||
* @param id 进货单ID
|
||||
* @param number 退货数量
|
||||
* @param remark 备注
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("addSalesback")
|
||||
public ResultObj addSalesback(Integer id,Integer number,String remark){
|
||||
try {
|
||||
salesbackService.addSalesback(id,number,remark);
|
||||
return ResultObj.BACKINPORT_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.BACKINPORT_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品销售退货
|
||||
* @param salesbackVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("loadAllSalesback")
|
||||
public DataGridView loadAllSalesback(SalesbackVo salesbackVo){
|
||||
IPage<Salesback> page = new Page<Salesback>(salesbackVo.getPage(),salesbackVo.getLimit());
|
||||
QueryWrapper<Salesback> queryWrapper = new QueryWrapper<Salesback>();
|
||||
//对客户进行查询
|
||||
queryWrapper.eq(salesbackVo.getCustomerid()!=null&&salesbackVo.getCustomerid()!=0,"customerid",salesbackVo.getCustomerid());
|
||||
//对商品进行查询
|
||||
queryWrapper.eq(salesbackVo.getGoodsid()!=null&&salesbackVo.getGoodsid()!=0,"goodsid",salesbackVo.getGoodsid());
|
||||
//对时间进行查询要求大于开始时间小于结束时间
|
||||
queryWrapper.ge(salesbackVo.getStartTime()!=null,"salesbacktime",salesbackVo.getStartTime());
|
||||
queryWrapper.le(salesbackVo.getEndTime()!=null,"salesbacktime",salesbackVo.getEndTime());
|
||||
//通过商品退货时间对商品进行排序
|
||||
queryWrapper.orderByDesc("salesbacktime");
|
||||
salesbackService.page(page, queryWrapper);
|
||||
List<Salesback> records = page.getRecords();
|
||||
for (Salesback salesback : records) {
|
||||
System.out.println("============================");
|
||||
Customer customer = customerService.getById(salesback.getCustomerid());
|
||||
if (customer!=null){
|
||||
//设置客户姓名
|
||||
salesback.setCustomername(customer.getCustomername());
|
||||
}
|
||||
Goods goods = goodsService.getById(salesback.getGoodsid());
|
||||
if (goods!=null){
|
||||
//设置商品名称
|
||||
salesback.setGoodsname(goods.getGoodsname());
|
||||
//设置商品规格
|
||||
salesback.setSize(goods.getSize());
|
||||
}
|
||||
}
|
||||
return new DataGridView(page.getTotal(),page.getRecords());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品销售退回信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("deleteSalesback")
|
||||
public ResultObj deleteSalesback(Integer id){
|
||||
try {
|
||||
salesbackService.removeById(id);
|
||||
return ResultObj.DELETE_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.DELETE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,56 @@
|
||||
package com.yeqifu.bus.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-05
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("bus_customer")
|
||||
@ToString
|
||||
public class Customer implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private String customername;
|
||||
|
||||
private String zip;
|
||||
|
||||
private String address;
|
||||
|
||||
private String telephone;
|
||||
|
||||
private String connectionpersion;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String bank;
|
||||
|
||||
private String account;
|
||||
|
||||
private String email;
|
||||
|
||||
private String fax;
|
||||
|
||||
private Integer available;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
package com.yeqifu.bus.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 lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB; (`providerid`) REFER `warehouse/bus_provider`(`id`)
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-06
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("bus_goods")
|
||||
@ToString
|
||||
public class Goods implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private String goodsname;
|
||||
|
||||
private String produceplace;
|
||||
|
||||
private String size;
|
||||
|
||||
private String goodspackage;
|
||||
|
||||
private String productcode;
|
||||
|
||||
private String promitcode;
|
||||
|
||||
private String description;
|
||||
|
||||
private Double price;
|
||||
|
||||
private Integer number;
|
||||
|
||||
private Integer dangernum;
|
||||
|
||||
private String goodsimg;
|
||||
|
||||
private Integer available;
|
||||
|
||||
private Integer providerid;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String providername;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
package com.yeqifu.bus.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 lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB; (`providerid`) REFER `warehouse/bus_provider`(`id`); (`goo
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-18
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("bus_inport")
|
||||
public class Inport implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private String paytype;
|
||||
|
||||
private Date inporttime;
|
||||
|
||||
private String operateperson;
|
||||
|
||||
private Integer number;
|
||||
|
||||
private String remark;
|
||||
|
||||
private Double inportprice;
|
||||
|
||||
private Integer providerid;
|
||||
|
||||
private Integer goodsid;
|
||||
|
||||
/**
|
||||
* 供应商姓名
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String providername;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String goodsname;
|
||||
|
||||
/**
|
||||
* 商品规格
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String size;
|
||||
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
package com.yeqifu.bus.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 lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-19
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("bus_outport")
|
||||
public class Outport implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private Integer providerid;
|
||||
|
||||
private String paytype;
|
||||
|
||||
private Date outputtime;
|
||||
|
||||
private String operateperson;
|
||||
|
||||
private Double outportprice;
|
||||
|
||||
private Integer number;
|
||||
|
||||
private String remark;
|
||||
|
||||
private Integer goodsid;
|
||||
|
||||
/**
|
||||
* 供应商姓名
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String providername;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String goodsname;
|
||||
|
||||
/**
|
||||
* 商品规格
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String size;
|
||||
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package com.yeqifu.bus.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-05
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("bus_provider")
|
||||
@ToString
|
||||
public class Provider implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private String providername;
|
||||
|
||||
private String zip;
|
||||
|
||||
private String address;
|
||||
|
||||
private String telephone;
|
||||
|
||||
private String connectionperson;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String bank;
|
||||
|
||||
private String account;
|
||||
|
||||
private String email;
|
||||
|
||||
private String fax;
|
||||
|
||||
private Integer available;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
package com.yeqifu.bus.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 lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-21
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("bus_sales")
|
||||
public class Sales implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private Integer customerid;
|
||||
|
||||
private String paytype;
|
||||
|
||||
private Date salestime;
|
||||
|
||||
private String operateperson;
|
||||
|
||||
private Integer number;
|
||||
|
||||
private String remark;
|
||||
|
||||
private Double saleprice;
|
||||
|
||||
private Integer goodsid;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String customername;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String goodsname;
|
||||
|
||||
/**
|
||||
* 商品规格
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String size;
|
||||
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
package com.yeqifu.bus.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 lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("bus_salesback")
|
||||
public class Salesback implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private Integer customerid;
|
||||
|
||||
private String paytype;
|
||||
|
||||
private Date salesbacktime;
|
||||
|
||||
private Double salebackprice;
|
||||
|
||||
private String operateperson;
|
||||
|
||||
private Integer number;
|
||||
|
||||
private String remark;
|
||||
|
||||
private Integer goodsid;
|
||||
|
||||
/**
|
||||
* 客户姓名
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String customername;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String goodsname;
|
||||
|
||||
/**
|
||||
* 商品规格
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String size;
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.yeqifu.bus.mapper;
|
||||
|
||||
import com.yeqifu.bus.entity.Customer;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-05
|
||||
*/
|
||||
public interface CustomerMapper extends BaseMapper<Customer> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package com.yeqifu.bus.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yeqifu.bus.entity.Goods;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB; (`providerid`) REFER `warehouse/bus_provider`(`id`) Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-06
|
||||
*/
|
||||
public interface GoodsMapper extends BaseMapper<Goods> {
|
||||
|
||||
/**
|
||||
* 根据商品id删除商品销售信息
|
||||
* @param id1
|
||||
*/
|
||||
void deleteSaleByGoodsId(@Param("goodsid") Integer id1);
|
||||
|
||||
/**
|
||||
* 根据商品id删除商品销售退货信息
|
||||
* @param id1
|
||||
*/
|
||||
void deleteSaleBackByGoodsId(@Param("goodsid") Integer id1);
|
||||
|
||||
/**
|
||||
* 根据商品id删除商品进货信息
|
||||
* @param id
|
||||
*/
|
||||
void deleteInportByGoodsId(@Param("goodsid") Integer id);
|
||||
|
||||
|
||||
/**
|
||||
* 根据商品id删除商品退货信息
|
||||
* @param id
|
||||
*/
|
||||
void deleteOutportByGoodsId(@Param("goodsid") Integer id);
|
||||
|
||||
/**
|
||||
* 根据客户id删除商品销售
|
||||
* @param id 客户id
|
||||
*/
|
||||
void deleteSaleByCustomerId(Integer id);
|
||||
|
||||
/**
|
||||
* 根据客户id删除商品销售退货信息
|
||||
* @param id 客户id
|
||||
*/
|
||||
void deleteSaleBackByCustomerId(Integer id);
|
||||
|
||||
/**
|
||||
* 加载所有库存预警商品
|
||||
*/
|
||||
List<Goods> loadAllWarning();
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.yeqifu.bus.mapper;
|
||||
|
||||
import com.yeqifu.bus.entity.Inport;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB; (`providerid`) REFER `warehouse/bus_provider`(`id`); (`goo Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-18
|
||||
*/
|
||||
public interface InportMapper extends BaseMapper<Inport> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.yeqifu.bus.mapper;
|
||||
|
||||
import com.yeqifu.bus.entity.Outport;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-19
|
||||
*/
|
||||
public interface OutportMapper extends BaseMapper<Outport> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package com.yeqifu.bus.mapper;
|
||||
|
||||
import com.yeqifu.bus.entity.Provider;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-05
|
||||
*/
|
||||
public interface ProviderMapper extends BaseMapper<Provider> {
|
||||
|
||||
/**
|
||||
* 根据供应商id删除商品信息
|
||||
* @param id
|
||||
*/
|
||||
void deleteGoodsByProviderId(@Param("pid") Integer id);
|
||||
|
||||
/**
|
||||
* 根据供应商id删除商品进货信息
|
||||
* @param id
|
||||
*/
|
||||
void deleteInportByProviderId(@Param("pid") Integer id);
|
||||
|
||||
/**
|
||||
* 根据供应商id删除商品退货信息
|
||||
* @param id
|
||||
*/
|
||||
void deleteOutPortByProviderId(@Param("pid") Integer id);
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.yeqifu.bus.mapper;
|
||||
|
||||
import com.yeqifu.bus.entity.Sales;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-21
|
||||
*/
|
||||
public interface SalesMapper extends BaseMapper<Sales> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.yeqifu.bus.mapper;
|
||||
|
||||
import com.yeqifu.bus.entity.Salesback;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-23
|
||||
*/
|
||||
public interface SalesbackMapper extends BaseMapper<Salesback> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.yeqifu.bus.service;
|
||||
|
||||
import com.yeqifu.bus.entity.Customer;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-05
|
||||
*/
|
||||
public interface ICustomerService extends IService<Customer> {
|
||||
|
||||
/**
|
||||
* 根据客户id删除客户
|
||||
* @param id 客户id
|
||||
*/
|
||||
void deleteCustomerById(Integer id);
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.yeqifu.bus.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yeqifu.bus.entity.Goods;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB; (`providerid`) REFER `warehouse/bus_provider`(`id`) 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-06
|
||||
*/
|
||||
public interface IGoodsService extends IService<Goods> {
|
||||
|
||||
/**
|
||||
* 根据商品id删除商品
|
||||
* @param id
|
||||
*/
|
||||
void deleteGoodsById(Integer id);
|
||||
|
||||
/**
|
||||
* 加载所有的库存预警商品
|
||||
* @return
|
||||
*/
|
||||
List<Goods> loadAllWarning();
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.yeqifu.bus.service;
|
||||
|
||||
import com.yeqifu.bus.entity.Inport;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB; (`providerid`) REFER `warehouse/bus_provider`(`id`); (`goo 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-18
|
||||
*/
|
||||
public interface IInportService extends IService<Inport> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package com.yeqifu.bus.service;
|
||||
|
||||
import com.yeqifu.bus.entity.Outport;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-19
|
||||
*/
|
||||
public interface IOutportService extends IService<Outport> {
|
||||
|
||||
/**
|
||||
* 对商品进货进行退货处理
|
||||
* @param id 进货单ID
|
||||
* @param number 退货数量
|
||||
* @param remark 备注
|
||||
*/
|
||||
void addOutport(Integer id, Integer number, String remark);
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.yeqifu.bus.service;
|
||||
|
||||
import com.yeqifu.bus.entity.Provider;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-05
|
||||
*/
|
||||
public interface IProviderService extends IService<Provider> {
|
||||
|
||||
/**
|
||||
* 根据供应商ID删除供应商
|
||||
* @param id
|
||||
*/
|
||||
void deleteProviderById(Integer id);
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.yeqifu.bus.service;
|
||||
|
||||
import com.yeqifu.bus.entity.Sales;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-21
|
||||
*/
|
||||
public interface ISalesService extends IService<Sales> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.yeqifu.bus.service;
|
||||
|
||||
import com.yeqifu.bus.entity.Salesback;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-23
|
||||
*/
|
||||
public interface ISalesbackService extends IService<Salesback> {
|
||||
|
||||
/**
|
||||
* 对商品销售进行退货处理
|
||||
* @param id 销售单ID
|
||||
* @param number 退货数量
|
||||
* @param remark 备注
|
||||
*/
|
||||
void addSalesback(Integer id, Integer number, String remark);
|
||||
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
package com.yeqifu.bus.service.impl;
|
||||
|
||||
import com.yeqifu.bus.entity.Customer;
|
||||
import com.yeqifu.bus.mapper.CustomerMapper;
|
||||
import com.yeqifu.bus.mapper.GoodsMapper;
|
||||
import com.yeqifu.bus.service.ICustomerService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-05
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements ICustomerService {
|
||||
|
||||
@Autowired
|
||||
private GoodsMapper goodsMapper;
|
||||
|
||||
@Override
|
||||
public boolean save(Customer entity) {
|
||||
return super.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateById(Customer entity) {
|
||||
return super.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeById(Serializable id) {
|
||||
return super.removeById(id);
|
||||
}
|
||||
@Override
|
||||
public Customer getById(Serializable id) {
|
||||
return super.getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeByIds(Collection<? extends Serializable> idList) {
|
||||
return super.removeByIds(idList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据客户id删除客户
|
||||
* @param id 客户id
|
||||
*/
|
||||
@Override
|
||||
public void deleteCustomerById(Integer id) {
|
||||
//根据客户id删除商品销售
|
||||
goodsMapper.deleteSaleByCustomerId(id);
|
||||
//根据客户id删除商品销售退货
|
||||
goodsMapper.deleteSaleBackByCustomerId(id);
|
||||
this.removeById(id);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
package com.yeqifu.bus.service.impl;
|
||||
|
||||
import com.yeqifu.bus.entity.Goods;
|
||||
import com.yeqifu.bus.mapper.GoodsMapper;
|
||||
import com.yeqifu.bus.service.IGoodsService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB; (`providerid`) REFER `warehouse/bus_provider`(`id`) 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-06
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements IGoodsService {
|
||||
|
||||
@Override
|
||||
public boolean save(Goods entity) {
|
||||
return super.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateById(Goods entity) {
|
||||
return super.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeById(Serializable id) {
|
||||
return super.removeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Goods getById(Serializable id) {
|
||||
return super.getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteGoodsById(Integer id) {
|
||||
//根据商品id删除商品销售信息
|
||||
this.getBaseMapper().deleteSaleByGoodsId(id);
|
||||
//根据商品id删除商品销售退货信息
|
||||
this.getBaseMapper().deleteSaleBackByGoodsId(id);
|
||||
//根据商品id删除商品进货信息
|
||||
this.getBaseMapper().deleteInportByGoodsId(id);
|
||||
//根据商品id删除商品退货信息
|
||||
this.getBaseMapper().deleteOutportByGoodsId(id);
|
||||
//删除商品信息
|
||||
this.removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有库存预警商品
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Goods> loadAllWarning() {
|
||||
List<Goods> goods = baseMapper.loadAllWarning();
|
||||
return goods;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,80 @@
|
||||
package com.yeqifu.bus.service.impl;
|
||||
|
||||
import com.yeqifu.bus.entity.Goods;
|
||||
import com.yeqifu.bus.entity.Inport;
|
||||
import com.yeqifu.bus.mapper.GoodsMapper;
|
||||
import com.yeqifu.bus.mapper.InportMapper;
|
||||
import com.yeqifu.bus.service.IInportService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB; (`providerid`) REFER `warehouse/bus_provider`(`id`); (`goo 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-18
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
public class InportServiceImpl extends ServiceImpl<InportMapper, Inport> implements IInportService {
|
||||
|
||||
@Autowired
|
||||
private GoodsMapper goodsMapper;
|
||||
|
||||
/**
|
||||
* 保存商品进货
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean save(Inport entity) {
|
||||
//根据商品ID查询商品
|
||||
Goods goods = goodsMapper.selectById(entity.getGoodsid());
|
||||
goods.setNumber(goods.getNumber()+entity.getNumber());
|
||||
goodsMapper.updateById(goods);
|
||||
//保存进货信息
|
||||
return super.save(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新商品进货
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean updateById(Inport entity) {
|
||||
//根据进货ID查询进货信息
|
||||
Inport inport = baseMapper.selectById(entity.getId());
|
||||
//根据商品ID查询商品信息
|
||||
Goods goods = goodsMapper.selectById(entity.getGoodsid());
|
||||
//库存算法 当前库存-进货单修改之前的数量+修改之后的数量
|
||||
goods.setNumber(goods.getNumber()-inport.getNumber()+entity.getNumber());
|
||||
goodsMapper.updateById(goods);
|
||||
//更新进货单
|
||||
return super.updateById(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品进货信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean removeById(Serializable id) {
|
||||
//根据进货ID查询进货信息
|
||||
Inport inport = baseMapper.selectById(id);
|
||||
//根据商品ID查询商品信息
|
||||
Goods goods = goodsMapper.selectById(inport.getGoodsid());
|
||||
//库存算法 当前库存-进货单数量
|
||||
goods.setNumber(goods.getNumber()-inport.getNumber());
|
||||
goodsMapper.updateById(goods);
|
||||
//更新商品的数量
|
||||
return super.removeById(id);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
package com.yeqifu.bus.service.impl;
|
||||
|
||||
import com.yeqifu.bus.entity.Goods;
|
||||
import com.yeqifu.bus.entity.Inport;
|
||||
import com.yeqifu.bus.entity.Outport;
|
||||
import com.yeqifu.bus.mapper.GoodsMapper;
|
||||
import com.yeqifu.bus.mapper.InportMapper;
|
||||
import com.yeqifu.bus.mapper.OutportMapper;
|
||||
import com.yeqifu.bus.service.IOutportService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yeqifu.sys.common.WebUtils;
|
||||
import com.yeqifu.sys.entity.User;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-19
|
||||
*/
|
||||
@Service
|
||||
public class OutportServiceImpl extends ServiceImpl<OutportMapper, Outport> implements IOutportService {
|
||||
|
||||
@Autowired
|
||||
private InportMapper inportMapper;
|
||||
|
||||
@Autowired
|
||||
private GoodsMapper goodsMapper;
|
||||
|
||||
/**
|
||||
* @param id 进货单ID
|
||||
* @param number 退货数量
|
||||
* @param remark 备注
|
||||
*/
|
||||
@Override
|
||||
public void addOutport(Integer id, Integer number, String remark) {
|
||||
//1.通过进货单ID查询出进货单信息
|
||||
Inport inport = inportMapper.selectById(id);
|
||||
//2.根据商品ID查询商品信息
|
||||
Goods goods = goodsMapper.selectById(inport.getGoodsid());
|
||||
//3.修改商品的数量 商品的数量-退货的数量
|
||||
goods.setNumber(goods.getNumber()-number);
|
||||
|
||||
//修改进货的数量
|
||||
inport.setNumber(inport.getNumber()-number);
|
||||
inportMapper.updateById(inport);
|
||||
|
||||
//4.进行修改
|
||||
goodsMapper.updateById(goods);
|
||||
|
||||
//5.添加退货单信息
|
||||
Outport outport = new Outport();
|
||||
outport.setGoodsid(inport.getGoodsid());
|
||||
outport.setNumber(number);
|
||||
User user = (User) WebUtils.getSession().getAttribute("user");
|
||||
outport.setOperateperson(user.getName());
|
||||
|
||||
outport.setOutportprice(inport.getInportprice());
|
||||
|
||||
outport.setPaytype(inport.getPaytype());
|
||||
outport.setOutputtime(new Date());
|
||||
outport.setRemark(remark);
|
||||
outport.setProviderid(inport.getProviderid());
|
||||
getBaseMapper().insert(outport);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
package com.yeqifu.bus.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yeqifu.bus.entity.Goods;
|
||||
import com.yeqifu.bus.entity.Provider;
|
||||
import com.yeqifu.bus.mapper.GoodsMapper;
|
||||
import com.yeqifu.bus.mapper.ProviderMapper;
|
||||
import com.yeqifu.bus.service.IProviderService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-05
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
public class ProviderServiceImpl extends ServiceImpl<ProviderMapper, Provider> implements IProviderService {
|
||||
|
||||
@Autowired
|
||||
private GoodsMapper goodsMapper;
|
||||
|
||||
@Override
|
||||
public boolean save(Provider entity) {
|
||||
return super.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateById(Provider entity) {
|
||||
return super.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeById(Serializable id) {
|
||||
return super.removeById(id);
|
||||
}
|
||||
@Override
|
||||
public Provider getById(Serializable id) {
|
||||
return super.getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeByIds(Collection<? extends Serializable> idList) {
|
||||
return super.removeByIds(idList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据供应商id删除供应商
|
||||
* @param id 供应商id
|
||||
*/
|
||||
@Override
|
||||
public void deleteProviderById(Integer id) {
|
||||
//根据供应商id查询出商品id
|
||||
QueryWrapper<Goods> queryWrapper = new QueryWrapper<Goods>();
|
||||
queryWrapper.eq("providerid",id);
|
||||
List<Goods> goods = goodsMapper.selectList(queryWrapper);
|
||||
for (Goods good : goods) {
|
||||
//获取一个商品id
|
||||
Integer id1 = good.getId();
|
||||
//根据商品id删除商品销售信息
|
||||
goodsMapper.deleteSaleByGoodsId(id1);
|
||||
//根据商品id删除商品销售退货信息
|
||||
goodsMapper.deleteSaleBackByGoodsId(id1);
|
||||
}
|
||||
//根据供应商id删除商品退货信息
|
||||
this.getBaseMapper().deleteOutPortByProviderId(id);
|
||||
//根据供应商id删除商品进货信息
|
||||
this.getBaseMapper().deleteInportByProviderId(id);
|
||||
//根据供应商id删除商品
|
||||
this.getBaseMapper().deleteGoodsByProviderId(id);
|
||||
//删除供应商
|
||||
this.removeById(id);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
package com.yeqifu.bus.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yeqifu.bus.entity.Goods;
|
||||
import com.yeqifu.bus.entity.Sales;
|
||||
import com.yeqifu.bus.mapper.GoodsMapper;
|
||||
import com.yeqifu.bus.mapper.SalesMapper;
|
||||
import com.yeqifu.bus.service.ISalesService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-21
|
||||
*/
|
||||
@Service
|
||||
public class SalesServiceImpl extends ServiceImpl<SalesMapper, Sales> implements ISalesService {
|
||||
|
||||
@Autowired
|
||||
private GoodsMapper goodsMapper;
|
||||
|
||||
/**
|
||||
* 添加商品销售
|
||||
* @param entity 商品销售实体类
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean save(Sales entity) {
|
||||
Goods goods = goodsMapper.selectById(entity.getGoodsid());
|
||||
goods.setNumber(goods.getNumber()-entity.getNumber());
|
||||
//更新商品的库存信息
|
||||
goodsMapper.updateById(goods);
|
||||
return super.save(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新商品销售
|
||||
* @param entity 商品销售实体类
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean updateById(Sales entity) {
|
||||
//根据销售单ID查询销售单信息
|
||||
Sales sales = baseMapper.selectById(entity.getId());
|
||||
Goods goods = goodsMapper.selectById(entity.getGoodsid());
|
||||
//仓库商品数量=原库存-销售单修改之前的数量+修改之后的数量
|
||||
// 80 +40 - 50 30
|
||||
goods.setNumber(goods.getNumber()+sales.getNumber()-entity.getNumber());
|
||||
//更新商品
|
||||
goodsMapper.updateById(goods);
|
||||
return super.updateById(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品销售信息
|
||||
* @param id 商品销售单ID
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean removeById(Serializable id) {
|
||||
//根据商品销售单ID查询出销售单数据
|
||||
Sales sales = baseMapper.selectById(id);
|
||||
Goods goods = goodsMapper.selectById(sales.getGoodsid());
|
||||
//仓库商品数量=原库存+删除商品销售单的数量
|
||||
goods.setNumber(goods.getNumber()+sales.getNumber());
|
||||
goodsMapper.updateById(goods);
|
||||
return super.removeById(id);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
package com.yeqifu.bus.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yeqifu.bus.entity.Goods;
|
||||
import com.yeqifu.bus.entity.Sales;
|
||||
import com.yeqifu.bus.entity.Salesback;
|
||||
import com.yeqifu.bus.mapper.GoodsMapper;
|
||||
import com.yeqifu.bus.mapper.SalesMapper;
|
||||
import com.yeqifu.bus.mapper.SalesbackMapper;
|
||||
import com.yeqifu.bus.service.ISalesbackService;
|
||||
import com.yeqifu.sys.common.WebUtils;
|
||||
import com.yeqifu.sys.entity.User;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-12-23
|
||||
*/
|
||||
@Service
|
||||
public class SalesbackServiceImpl extends ServiceImpl<SalesbackMapper, Salesback> implements ISalesbackService {
|
||||
|
||||
@Autowired
|
||||
private SalesMapper salesMapper;
|
||||
|
||||
@Autowired
|
||||
private GoodsMapper goodsMapper;
|
||||
|
||||
/**
|
||||
* @param id 销售单ID
|
||||
* @param number 退货数量
|
||||
* @param remark 备注
|
||||
*/
|
||||
@Override
|
||||
public void addSalesback(Integer id, Integer number, String remark) {
|
||||
//1.通过销售单ID查询出销售单信息
|
||||
Sales sales = salesMapper.selectById(id);
|
||||
//2.根据商品ID查询商品信息
|
||||
Goods goods = goodsMapper.selectById(sales.getGoodsid());
|
||||
//3.修改商品的数量 商品的数量-退货的数量
|
||||
goods.setNumber(goods.getNumber()+number);
|
||||
|
||||
//修改进货的数量
|
||||
sales.setNumber(sales.getNumber()-number);
|
||||
salesMapper.updateById(sales);
|
||||
|
||||
//4.进行修改
|
||||
goodsMapper.updateById(goods);
|
||||
|
||||
//5.添加退货单信息
|
||||
Salesback salesback = new Salesback();
|
||||
salesback.setGoodsid(sales.getGoodsid());
|
||||
|
||||
salesback.setNumber(number);
|
||||
User user = (User) WebUtils.getSession().getAttribute("user");
|
||||
salesback.setOperateperson(user.getName());
|
||||
|
||||
|
||||
salesback.setSalebackprice(sales.getSaleprice());
|
||||
salesback.setPaytype(sales.getPaytype());
|
||||
|
||||
salesback.setSalesbacktime(new Date());
|
||||
salesback.setRemark(remark);
|
||||
|
||||
|
||||
salesback.setCustomerid(sales.getCustomerid());
|
||||
|
||||
|
||||
getBaseMapper().insert(salesback);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.yeqifu.bus.vo;
|
||||
|
||||
import com.yeqifu.bus.entity.Goods;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @Author: 落亦-
|
||||
* @Date: 2019/12/6 22:30
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class GoodsVo extends Goods {
|
||||
|
||||
private Integer page=1;
|
||||
private Integer limit=10;
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.yeqifu.bus.vo;
|
||||
|
||||
import com.yeqifu.bus.entity.Inport;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author: 落亦-
|
||||
* @Date: 2019/12/18 10:29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class InportVo extends Inport {
|
||||
|
||||
private Integer page = 1;
|
||||
|
||||
private Integer limit = 10;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date startTime;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date endTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.yeqifu.bus.vo;
|
||||
|
||||
import com.yeqifu.bus.entity.Outport;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author: 落亦-
|
||||
* @Date: 2019/12/18 10:29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class OutportVo extends Outport {
|
||||
|
||||
private Integer page = 1;
|
||||
|
||||
private Integer limit = 10;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date startTime;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date endTime;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.yeqifu.bus.vo;
|
||||
|
||||
import com.yeqifu.bus.entity.Sales;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author: 落亦-
|
||||
* @Date: 2019/12/18 10:29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SalesVo extends Sales {
|
||||
|
||||
private Integer page = 1;
|
||||
|
||||
private Integer limit = 10;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date startTime;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date endTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.yeqifu.bus.vo;
|
||||
|
||||
import com.yeqifu.bus.entity.Salesback;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author: 落亦-
|
||||
* @Date: 2019/12/18 10:29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SalesbackVo extends Salesback {
|
||||
|
||||
private Integer page = 1;
|
||||
|
||||
private Integer limit = 10;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date startTime;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date endTime;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,211 @@
|
||||
package com.yeqifu.sys.cache;
|
||||
|
||||
import com.yeqifu.sys.entity.Dept;
|
||||
import com.yeqifu.sys.entity.User;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: 落亦-
|
||||
* @Date: 2019/11/27 18:42
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
@EnableAspectJAutoProxy
|
||||
public class CacheAspect {
|
||||
|
||||
/**
|
||||
* 日志出处
|
||||
*/
|
||||
private Log log = LogFactory.getLog(CacheAspect.class);
|
||||
|
||||
/**
|
||||
* 声明一个缓存容器
|
||||
*/
|
||||
private Map<String,Object> CACHE_CONTAINER = CachePool.CACHE_CONTAINER;
|
||||
|
||||
/**
|
||||
* 声明部门的切面表达式
|
||||
*/
|
||||
private static final String POINTCUT_DEPT_ADD="execution(* com.yeqifu.sys.service.impl.DeptServiceImpl.save(..))";
|
||||
private static final String POINTCUT_DEPT_UPDATE="execution(* com.yeqifu.sys.service.impl.DeptServiceImpl.updateById(..))";
|
||||
private static final String POINTCUT_DEPT_GET="execution(* com.yeqifu.sys.service.impl.DeptServiceImpl.getById(..))";
|
||||
private static final String POINTCUT_DEPT_DELETE="execution(* com.yeqifu.sys.service.impl.DeptServiceImpl.removeById(..))";
|
||||
|
||||
private static final String CACHE_DEPT_PROFIX="dept:";
|
||||
|
||||
/**
|
||||
* 添加部门切入
|
||||
* @param joinPoint
|
||||
* @return
|
||||
*/
|
||||
@Around(value = POINTCUT_DEPT_ADD)
|
||||
public Object cacheDeptAdd(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
//取出第一个参数
|
||||
Dept object = (Dept) joinPoint.getArgs()[0];
|
||||
Boolean res = (Boolean) joinPoint.proceed();
|
||||
if (res){
|
||||
CACHE_CONTAINER.put(CACHE_DEPT_PROFIX + object.getId(),object);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询部门切入
|
||||
* @param joinPoint
|
||||
* @return
|
||||
*/
|
||||
@Around(value = POINTCUT_DEPT_GET)
|
||||
public Object cacheDeptGet(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
//取出第一个参数
|
||||
Integer object = (Integer) joinPoint.getArgs()[0];
|
||||
//从缓存里面取
|
||||
Object res1 = CACHE_CONTAINER.get(CACHE_DEPT_PROFIX + object);
|
||||
if (res1!=null){
|
||||
log.info("已从缓存里面找到部门对象"+CACHE_DEPT_PROFIX + object);
|
||||
return res1;
|
||||
}else {
|
||||
log.info("未从缓存里面找到部门对象,从数据库中查询并放入缓存");
|
||||
Dept res2 =(Dept) joinPoint.proceed();
|
||||
CACHE_CONTAINER.put(CACHE_DEPT_PROFIX+res2.getId(),res2);
|
||||
return res2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新部门切入
|
||||
* @param joinPoint
|
||||
* @return
|
||||
*/
|
||||
@Around(value = POINTCUT_DEPT_UPDATE)
|
||||
public Object cacheDeptUpdate(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
//取出第一个参数
|
||||
Dept deptVo = (Dept) joinPoint.getArgs()[0];
|
||||
Boolean isSuccess = (Boolean) joinPoint.proceed();
|
||||
if (isSuccess){
|
||||
Dept dept =(Dept) CACHE_CONTAINER.get(CACHE_DEPT_PROFIX + deptVo.getId());
|
||||
if (null==dept){
|
||||
dept=new Dept();
|
||||
}
|
||||
BeanUtils.copyProperties(deptVo,dept);
|
||||
log.info("部门对象缓存已更新"+CACHE_DEPT_PROFIX + deptVo.getId());
|
||||
CACHE_CONTAINER.put(CACHE_DEPT_PROFIX+dept.getId(),dept);
|
||||
}
|
||||
return isSuccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除部门切入
|
||||
* @param joinPoint
|
||||
* @return
|
||||
*/
|
||||
@Around(value = POINTCUT_DEPT_DELETE)
|
||||
public Object cacheDeptDelete(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
|
||||
//取出第一个参数
|
||||
Integer id = (Integer) joinPoint.getArgs()[0];
|
||||
Boolean isSuccess = (Boolean) joinPoint.proceed();
|
||||
if (isSuccess){
|
||||
//删除缓存
|
||||
CACHE_CONTAINER.remove(CACHE_DEPT_PROFIX+id);
|
||||
}
|
||||
return isSuccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* 声明用户的切面表达式
|
||||
*/
|
||||
private static final String POINTCUT_USER_UPDATE="execution(* com.yeqifu.sys.service.impl.UserServiceImpl.updateById(..))";
|
||||
private static final String POINTCUT_USER_ADD="execution(* com.yeqifu.sys.service.impl.UserServiceImpl.updateById(..))";
|
||||
private static final String POINTCUT_USER_GET="execution(* com.yeqifu.sys.service.impl.UserServiceImpl.getById(..))";
|
||||
private static final String POINTCUT_USER_DELETE="execution(* com.yeqifu.sys.service.impl.UserServiceImpl.removeById(..))";
|
||||
|
||||
private static final String CACHE_USER_PROFIX="user:";
|
||||
|
||||
/**
|
||||
* 添加用户切入
|
||||
* @param joinPoint
|
||||
* @return
|
||||
*/
|
||||
@Around(value = POINTCUT_USER_ADD)
|
||||
public Object cacheUserAdd(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
//取出第一个参数
|
||||
User object = (User) joinPoint.getArgs()[0];
|
||||
Boolean res = (Boolean) joinPoint.proceed();
|
||||
if (res){
|
||||
CACHE_CONTAINER.put(CACHE_USER_PROFIX + object.getId(),object);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户切入
|
||||
* @param joinPoint
|
||||
* @return
|
||||
*/
|
||||
@Around(value = POINTCUT_USER_GET)
|
||||
public Object cacheUserGet(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
//取出第一个参数
|
||||
Integer object = (Integer) joinPoint.getArgs()[0];
|
||||
//从缓存里面取
|
||||
Object res1 = CACHE_CONTAINER.get(CACHE_USER_PROFIX + object);
|
||||
if (res1!=null){
|
||||
log.info("已从缓存里面找到用户对象"+CACHE_USER_PROFIX + object);
|
||||
return res1;
|
||||
}else {
|
||||
log.info("未从缓存里面找到用户对象,从数据库中查询并放入缓存");
|
||||
User res2 =(User) joinPoint.proceed();
|
||||
CACHE_CONTAINER.put(CACHE_USER_PROFIX+res2.getId(),res2);
|
||||
return res2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户切入
|
||||
* @param joinPoint
|
||||
* @return
|
||||
*/
|
||||
@Around(value = POINTCUT_USER_UPDATE)
|
||||
public Object cacheUserUpdate(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
//取出第一个参数
|
||||
User userVo = (User) joinPoint.getArgs()[0];
|
||||
Boolean isSuccess = (Boolean) joinPoint.proceed();
|
||||
if (isSuccess){
|
||||
User user =(User) CACHE_CONTAINER.get(CACHE_USER_PROFIX + userVo.getId());
|
||||
if (null==user){
|
||||
user=new User();
|
||||
}
|
||||
BeanUtils.copyProperties(userVo,user);
|
||||
log.info("用户对象缓存已更新"+CACHE_USER_PROFIX + userVo.getId());
|
||||
CACHE_CONTAINER.put(CACHE_USER_PROFIX+user.getId(),user);
|
||||
}
|
||||
return isSuccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户切入
|
||||
* @param joinPoint
|
||||
* @return
|
||||
*/
|
||||
@Around(value = POINTCUT_USER_DELETE)
|
||||
public Object cacheUserDelete(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
|
||||
//取出第一个参数
|
||||
Integer id = (Integer) joinPoint.getArgs()[0];
|
||||
Boolean isSuccess = (Boolean) joinPoint.proceed();
|
||||
if (isSuccess){
|
||||
//删除缓存
|
||||
CACHE_CONTAINER.remove(CACHE_USER_PROFIX+id);
|
||||
}
|
||||
return isSuccess;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
package com.yeqifu.sys.cache;
|
||||
|
||||
import com.yeqifu.bus.entity.Customer;
|
||||
import com.yeqifu.bus.entity.Goods;
|
||||
import com.yeqifu.bus.entity.Provider;
|
||||
import com.yeqifu.bus.mapper.CustomerMapper;
|
||||
import com.yeqifu.bus.mapper.GoodsMapper;
|
||||
import com.yeqifu.bus.mapper.ProviderMapper;
|
||||
import com.yeqifu.sys.common.SpringUtil;
|
||||
import com.yeqifu.sys.entity.Dept;
|
||||
import com.yeqifu.sys.entity.User;
|
||||
import com.yeqifu.sys.mapper.DeptMapper;
|
||||
import com.yeqifu.sys.mapper.UserMapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: 落亦-
|
||||
* @Date: 2019/12/20 18:05
|
||||
*/
|
||||
public class CachePool {
|
||||
|
||||
/**
|
||||
* 所有的缓存数据放到这个CACHE_CONTAINER 类似于redis
|
||||
*/
|
||||
public static volatile Map<String,Object> CACHE_CONTAINER = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 根据KEY删除缓存
|
||||
* @param key 键
|
||||
*/
|
||||
public static void removeCacheByKey(String key){
|
||||
if (CACHE_CONTAINER.containsKey(key)){
|
||||
CACHE_CONTAINER.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空所有缓存
|
||||
*/
|
||||
public static void removeAll(){
|
||||
CACHE_CONTAINER.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步缓存
|
||||
*/
|
||||
public static void syncData(){
|
||||
//同步部门数据
|
||||
DeptMapper deptMapper = SpringUtil.getBean(DeptMapper.class);
|
||||
List<Dept> deptList = deptMapper.selectList(null);
|
||||
for (Dept dept : deptList) {
|
||||
CACHE_CONTAINER.put("dept:"+dept.getId(),dept);
|
||||
}
|
||||
//同步用户数据
|
||||
UserMapper userMapper = SpringUtil.getBean(UserMapper.class);
|
||||
List<User> userList = userMapper.selectList(null);
|
||||
for (User user : userList) {
|
||||
CACHE_CONTAINER.put("user:"+user.getId(),user);
|
||||
}
|
||||
|
||||
//同步客户数据
|
||||
CustomerMapper customerMapper = SpringUtil.getBean(CustomerMapper.class);
|
||||
List<Customer> customerList = customerMapper.selectList(null);
|
||||
for (Customer customer : customerList) {
|
||||
CACHE_CONTAINER.put("customer:"+customer.getId(),customer);
|
||||
}
|
||||
|
||||
//同步供应商数据
|
||||
ProviderMapper providerMapper = SpringUtil.getBean(ProviderMapper.class);
|
||||
List<Provider> providerList = providerMapper.selectList(null);
|
||||
for (Provider provider : providerList) {
|
||||
CACHE_CONTAINER.put("provider:"+provider.getId(),provider);
|
||||
}
|
||||
|
||||
//同步商品数据
|
||||
GoodsMapper goodsMapper = SpringUtil.getBean(GoodsMapper.class);
|
||||
List<Goods> goodsList = goodsMapper.selectList(null);
|
||||
for (Goods goods : goodsList) {
|
||||
CACHE_CONTAINER.put("goods:"+goods.getId(),goods);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.yeqifu.sys.common;
|
||||
|
||||
import com.yeqifu.sys.entity.User;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: 落亦-
|
||||
* @Date: 2019/11/21 20:41
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ActiverUser {
|
||||
|
||||
private User user;
|
||||
|
||||
private List<String> roles;
|
||||
|
||||
private List<String> permission;
|
||||
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package com.yeqifu.sys.common;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
||||
/**
|
||||
* @Author: 落亦-
|
||||
* @Date: 2019/12/20 18:40
|
||||
*/
|
||||
public class CacheBean {
|
||||
|
||||
private String key;
|
||||
|
||||
private Object value;
|
||||
|
||||
public CacheBean() {
|
||||
}
|
||||
|
||||
public CacheBean(String key, Object value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return JSON.toJSON(value).toString();
|
||||
}
|
||||
|
||||
public void setValue(Object value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
package com.yeqifu.sys.common;
|
||||
|
||||
/**
|
||||
* @Author: 落亦-
|
||||
* @Date: 2019/11/21 21:39
|
||||
*/
|
||||
public class Constast {
|
||||
|
||||
/**
|
||||
* 状态码 正常 200 错误 -1
|
||||
*/
|
||||
public static final Integer OK=200;
|
||||
public static final Integer ERROR=-1;
|
||||
|
||||
/**
|
||||
* 用户默认密码
|
||||
*/
|
||||
public static final String USER_DEFAULT_PWD="123456";
|
||||
|
||||
/**
|
||||
* 菜单可用状态 0不可用 1可用
|
||||
*/
|
||||
public static final Object AVAILABLE_TRUE = 1;
|
||||
public static final Object AVAILABLE_FALSE = 0;
|
||||
|
||||
/**
|
||||
* 菜单和权限类型 menu 菜单 permission 权限
|
||||
*/
|
||||
public static final String TYPE_MENU = "menu";
|
||||
public static final String TYPE_PERMISSION = "permission";
|
||||
|
||||
/**
|
||||
* 用户类型 0 超级管理员 1 系统用户
|
||||
*/
|
||||
public static final Integer USER_TYPE_SUPER = 0;
|
||||
public static final Integer USER_TYPE_NORMAL = 1;
|
||||
|
||||
/**
|
||||
* 菜单是否展开 0不展开 1展开
|
||||
*/
|
||||
public static final Integer OPEN_TRUE = 1;
|
||||
public static final Integer OPEN_FALSE = 0;
|
||||
|
||||
/**
|
||||
* 商品默认图片
|
||||
*/
|
||||
public static final String DEFAULT_IMG_GOODS = "/images/noDefaultImage.jpg";
|
||||
|
||||
/**
|
||||
* hash散列次数
|
||||
*/
|
||||
public static final Integer HASHITERATIONS = 2;
|
||||
|
||||
/**
|
||||
* 用户默认图片
|
||||
*/
|
||||
public static final String DEFAULT_IMG_USER="/images/defaultUserTitle.jpg";
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package com.yeqifu.sys.common;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* json数据实体
|
||||
* @Author: 落亦-
|
||||
* @Date: 2019/11/22 15:17
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DataGridView {
|
||||
|
||||
private Integer code=0;
|
||||
private String msg="";
|
||||
/**
|
||||
* 返回的记录总条数
|
||||
*/
|
||||
private Long count=0L;
|
||||
/**
|
||||
* 返回的记录
|
||||
*/
|
||||
private Object data;
|
||||
|
||||
public DataGridView(Long count, Object data) {
|
||||
this.count = count;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public DataGridView(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package com.yeqifu.sys.common;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author: 落亦-
|
||||
* @Date: 2019/11/21 21:35
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ResultObj {
|
||||
|
||||
private Integer code;
|
||||
private String msg;
|
||||
|
||||
public static final ResultObj LOGIN_SUCCESS=new ResultObj(Constast.OK,"登陆成功");
|
||||
public static final ResultObj LOGIN_ERROR_PASS=new ResultObj(Constast.ERROR,"用户名或密码错误");
|
||||
public static final ResultObj LOGIN_ERROR_CODE=new ResultObj(Constast.ERROR,"验证码错误");
|
||||
|
||||
public static final ResultObj ADD_SUCCESS = new ResultObj(Constast.OK,"添加成功");
|
||||
public static final ResultObj ADD_ERROR = new ResultObj(Constast.ERROR,"添加失败");
|
||||
|
||||
public static final ResultObj DELETE_SUCCESS = new ResultObj(Constast.OK,"删除成功");
|
||||
public static final ResultObj DELETE_ERROR = new ResultObj(Constast.ERROR,"删除失败");
|
||||
|
||||
public static final ResultObj UPDATE_SUCCESS = new ResultObj(Constast.OK,"修改成功");
|
||||
public static final ResultObj UPDATE_ERROR = new ResultObj(Constast.ERROR,"修改失败");
|
||||
|
||||
public static final ResultObj RESET_SUCCESS = new ResultObj(Constast.OK,"重置成功");
|
||||
public static final ResultObj RESET_ERROR = new ResultObj(Constast.ERROR,"重置失败");
|
||||
|
||||
public static final ResultObj DISPATCH_SUCCESS = new ResultObj(Constast.OK,"分配成功");
|
||||
public static final ResultObj DISPATCH_ERROR = new ResultObj(Constast.ERROR,"分配失败");
|
||||
|
||||
public static final ResultObj BACKINPORT_SUCCESS = new ResultObj(Constast.OK,"退货成功");
|
||||
public static final ResultObj BACKINPORT_ERROR = new ResultObj(Constast.ERROR,"退货失败");
|
||||
public static final ResultObj SYNCCACHE_SUCCESS = new ResultObj(Constast.OK,"同步缓存成功");
|
||||
|
||||
public static final ResultObj DELETE_ERROR_NEWS = new ResultObj(Constast.ERROR,"删除用户失败,该用户是其他用户的直属领导,请先修改该用户的下属的直属领导,再进行删除操作");
|
||||
public static final ResultObj DELETE_QUERY = new ResultObj();
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.yeqifu.sys.common;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author: 落亦-
|
||||
* @Date: 2019/12/20 18:23
|
||||
*/
|
||||
@Component
|
||||
public class SpringUtil implements ApplicationContextAware {
|
||||
|
||||
private static ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext act) throws BeansException {
|
||||
applicationContext = act;
|
||||
}
|
||||
|
||||
public static ApplicationContext getApplicationContext(){
|
||||
return applicationContext;
|
||||
}
|
||||
|
||||
public static <T> T getBean(Class<T> cls){
|
||||
return applicationContext.getBean(cls);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,82 @@
|
||||
package com.yeqifu.sys.common;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: 落亦-
|
||||
* @Date: 2019/11/22 15:25
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TreeNode {
|
||||
|
||||
private Integer id;
|
||||
@JsonProperty("parentId")
|
||||
private Integer pid;
|
||||
private String title;
|
||||
private String icon;
|
||||
private String href;
|
||||
private Boolean spread;
|
||||
private List<TreeNode> children = new ArrayList<TreeNode>();
|
||||
|
||||
/**
|
||||
* 0为不选中 1为选中
|
||||
*/
|
||||
private String checkArr="0";
|
||||
|
||||
/**
|
||||
* 首页左边导航菜单的构造器
|
||||
* @param id
|
||||
* @param pid
|
||||
* @param title
|
||||
* @param icon
|
||||
* @param href
|
||||
* @param spread
|
||||
*/
|
||||
public TreeNode(Integer id, Integer pid, String title, String icon, String href, Boolean spread) {
|
||||
this.id = id;
|
||||
this.pid = pid;
|
||||
this.title = title;
|
||||
this.icon = icon;
|
||||
this.href = href;
|
||||
this.spread = spread;
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门 dtree的构造器
|
||||
* @param id
|
||||
* @param pid
|
||||
* @param title
|
||||
* @param spread
|
||||
*/
|
||||
public TreeNode(Integer id, Integer pid, String title, Boolean spread) {
|
||||
this.id = id;
|
||||
this.pid = pid;
|
||||
this.title = title;
|
||||
this.spread = spread;
|
||||
}
|
||||
|
||||
/**
|
||||
* 给角色分配权限的构造器
|
||||
* @param id
|
||||
* @param pid
|
||||
* @param title
|
||||
* @param spread
|
||||
* @param checkArr
|
||||
*/
|
||||
public TreeNode(Integer id, Integer pid, String title, Boolean spread, String checkArr) {
|
||||
this.id = id;
|
||||
this.pid = pid;
|
||||
this.title = title;
|
||||
this.spread = spread;
|
||||
this.checkArr = checkArr;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.yeqifu.sys.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 把没有层级关系的集合变成有层级关系的集合
|
||||
* @Author: 落亦-
|
||||
* @Date: 2019/11/22 16:31
|
||||
*/
|
||||
public class TreeNodeBuilder {
|
||||
public static List<TreeNode> build(List<TreeNode> treeNodes, Integer topPid) {
|
||||
List<TreeNode> nodes = new ArrayList<TreeNode>();
|
||||
for (TreeNode n1 : treeNodes) {
|
||||
if (n1.getPid()==topPid){
|
||||
nodes.add(n1);
|
||||
}
|
||||
for (TreeNode n2 : treeNodes) {
|
||||
if (n1.getId()==n2.getPid()){
|
||||
n1.getChildren().add(n2);
|
||||
}
|
||||
}
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package com.yeqifu.sys.common;
|
||||
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
/**
|
||||
* @Author: 落亦-
|
||||
* @Date: 2019/11/21 21:43
|
||||
*/
|
||||
public class WebUtils {
|
||||
|
||||
/**
|
||||
* 得到request
|
||||
* @return
|
||||
*/
|
||||
public static HttpServletRequest getRequest(){
|
||||
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
HttpServletRequest request = requestAttributes.getRequest();
|
||||
return request;
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到session
|
||||
* @return
|
||||
*/
|
||||
public static HttpSession getSession(){
|
||||
return getRequest().getSession();
|
||||
}
|
||||
|
||||
public static ServletRequestAttributes getServletRequestAttributes() {
|
||||
return (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到当前线程的请求对象
|
||||
* @return
|
||||
*/
|
||||
public static HttpServletRequest getHttpServletRequest() {
|
||||
return getServletRequestAttributes().getRequest();
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到session对象
|
||||
*/
|
||||
public static HttpSession getHttpSession() {
|
||||
return getHttpServletRequest().getSession();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.yeqifu.sys.config;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||
|
||||
/**
|
||||
* @Author: 落亦-
|
||||
* @Date: 2019/11/23 19:16
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnClass(value= {PaginationInterceptor.class})
|
||||
public class MybatisPlusConfig {
|
||||
@Bean
|
||||
public PaginationInterceptor paginationInterceptor() {
|
||||
return new PaginationInterceptor();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.yeqifu.sys.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.Contact;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
/**
|
||||
* @Author: 落亦-
|
||||
* @Date: 2020/3/8 17:30
|
||||
*/
|
||||
@Configuration
|
||||
@EnableSwagger2 //启用Swagger2
|
||||
public class Swagger2AutoConfiguration {
|
||||
|
||||
/**
|
||||
* 在IOC容器里面创建可以扫描Controller里面的是否有Swagger相关的注解
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public Docket swaggerSpringMvcPlugin(){
|
||||
return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()
|
||||
.apis(RequestHandlerSelectors.withClassAnnotation(RestController.class)).build();
|
||||
}
|
||||
|
||||
private ApiInfo apiInfo(){
|
||||
return new ApiInfoBuilder().description("仓库后台管理系统SwaggerUI接口工具")
|
||||
//名片
|
||||
.contact(new Contact("luoyi-","http://39.97.277.129","1784525940@qq.com"))
|
||||
//版本
|
||||
.version("1.0")
|
||||
//所有者
|
||||
.license("luoyi-工作室")
|
||||
//构造
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
package com.yeqifu.sys.controller;
|
||||
|
||||
import com.yeqifu.sys.cache.CachePool;
|
||||
import com.yeqifu.sys.common.CacheBean;
|
||||
import com.yeqifu.sys.common.DataGridView;
|
||||
import com.yeqifu.sys.common.ResultObj;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 缓存管理控制器
|
||||
* @Author: 落亦-
|
||||
* @Date: 2019/12/20 18:36
|
||||
*/
|
||||
@Api(description = "缓存管理")
|
||||
@RestController
|
||||
@RequestMapping("cache")
|
||||
public class CacheController {
|
||||
|
||||
private static volatile Map<String,Object> CACHE_CONTAINER= CachePool.CACHE_CONTAINER;
|
||||
|
||||
/**
|
||||
* 查询所有缓存
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询所有缓存",notes = "查询所有缓存")
|
||||
@RequestMapping(value = "loadAllCache",method = RequestMethod.GET)
|
||||
public DataGridView loadAllCache(){
|
||||
List<CacheBean> list = new ArrayList<>();
|
||||
|
||||
Set<Map.Entry<String, Object>> entrySet = CACHE_CONTAINER.entrySet();
|
||||
for (Map.Entry<String, Object> entry : entrySet) {
|
||||
list.add(new CacheBean(entry.getKey(),entry.getValue()));
|
||||
}
|
||||
return new DataGridView(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除缓存
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("deleteCache")
|
||||
public ResultObj deleteCache(String key){
|
||||
CachePool.removeCacheByKey(key);
|
||||
return ResultObj.DELETE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空所有缓存
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("removeAllCache")
|
||||
public ResultObj removeAllCache(){
|
||||
CachePool.removeAll();
|
||||
return ResultObj.DELETE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步缓存
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("syncCache")
|
||||
public ResultObj syncCache(){
|
||||
CachePool.syncData();
|
||||
return ResultObj.SYNCCACHE_SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package com.yeqifu.sys.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.yeqifu.sys.common.AppFileUtils;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: 落亦-
|
||||
* @Date: 2019/12/15 23:46
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("file")
|
||||
public class FileController {
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
* @param mf
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("uploadFile")
|
||||
public Map<String,Object> uploadFile(MultipartFile mf) {
|
||||
//1.得到文件名
|
||||
String oldName = mf.getOriginalFilename();
|
||||
//2.根据旧的文件名生成新的文件名
|
||||
String newName=AppFileUtils.createNewFileName(oldName);
|
||||
//3.得到当前日期的字符串
|
||||
String dirName= DateUtil.format(new Date(), "yyyy-MM-dd");
|
||||
//4.构造文件夹
|
||||
File dirFile=new File(AppFileUtils.UPLOAD_PATH,dirName);
|
||||
//5.判断当前文件夹是否存在
|
||||
if(!dirFile.exists()) {
|
||||
//如果不存在则创建新文件夹
|
||||
dirFile.mkdirs();
|
||||
}
|
||||
//6.构造文件对象
|
||||
File file=new File(dirFile, newName+"_temp");
|
||||
//7.把mf里面的图片信息写入file
|
||||
try {
|
||||
mf.transferTo(file);
|
||||
} catch (IllegalStateException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Map<String,Object> map=new HashMap<String, Object>();
|
||||
map.put("path",dirName+"/"+newName+"_temp");
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片下载
|
||||
*/
|
||||
@RequestMapping("showImageByPath")
|
||||
public ResponseEntity<byte[]> showImageByPath(String path) {
|
||||
// 规范路径,防止路径穿越
|
||||
Path normalizedPath = Paths.get(AppFileUtils.UPLOAD_PATH, path).normalize();
|
||||
if (!normalizedPath.startsWith(AppFileUtils.UPLOAD_PATH)) {
|
||||
// 如果路径越界,则返回错误响应
|
||||
return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
package com.yeqifu.sys.controller;
|
||||
|
||||
import cn.hutool.captcha.CaptchaUtil;
|
||||
import cn.hutool.captcha.LineCaptcha;
|
||||
import com.yeqifu.sys.common.ActiverUser;
|
||||
import com.yeqifu.sys.common.ResultObj;
|
||||
import com.yeqifu.sys.common.WebUtils;
|
||||
import com.yeqifu.sys.entity.Loginfo;
|
||||
import com.yeqifu.sys.service.ILoginfoService;
|
||||
import com.yeqifu.sys.vo.UserVo;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 登陆前端控制器
|
||||
* @Author: 落亦-
|
||||
* @Date: 2019/11/21 21:33
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("login")
|
||||
public class LoginController {
|
||||
|
||||
@Autowired
|
||||
private ILoginfoService loginfoService;
|
||||
|
||||
@RequestMapping("login")
|
||||
public ResultObj login(UserVo userVo,String code,HttpSession session){
|
||||
|
||||
//获得存储在session中的验证码
|
||||
String sessionCode = (String) session.getAttribute("code");
|
||||
if (code!=null&&sessionCode.equals(code)){
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
AuthenticationToken token = new UsernamePasswordToken(userVo.getLoginname(),userVo.getPwd());
|
||||
try {
|
||||
//对用户进行认证登陆
|
||||
subject.login(token);
|
||||
//通过subject获取以认证活动的user
|
||||
ActiverUser activerUser = (ActiverUser) subject.getPrincipal();
|
||||
//将user存储到session中
|
||||
WebUtils.getSession().setAttribute("user",activerUser.getUser());
|
||||
//记录登陆日志
|
||||
Loginfo entity = new Loginfo();
|
||||
entity.setLoginname(activerUser.getUser().getName()+"-"+activerUser.getUser().getLoginname());
|
||||
entity.setLoginip(WebUtils.getRequest().getRemoteAddr());
|
||||
entity.setLogintime(new Date());
|
||||
loginfoService.save(entity);
|
||||
|
||||
return ResultObj.LOGIN_SUCCESS;
|
||||
} catch (AuthenticationException e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.LOGIN_ERROR_PASS;
|
||||
}
|
||||
}else {
|
||||
return ResultObj.LOGIN_ERROR_CODE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到登陆验证码
|
||||
* @param response
|
||||
* @param session
|
||||
* @throws IOException
|
||||
*/
|
||||
@RequestMapping("getCode")
|
||||
public void getCode(HttpServletResponse response, HttpSession session) throws IOException{
|
||||
//定义图形验证码的长和宽
|
||||
LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(116, 36,4,5);
|
||||
session.setAttribute("code",lineCaptcha.getCode());
|
||||
try {
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
lineCaptcha.write(outputStream);
|
||||
outputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
package com.yeqifu.sys.controller;
|
||||
|
||||
|
||||
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.sun.org.apache.regexp.internal.RE;
|
||||
import com.yeqifu.sys.common.DataGridView;
|
||||
import com.yeqifu.sys.common.ResultObj;
|
||||
import com.yeqifu.sys.entity.Loginfo;
|
||||
import com.yeqifu.sys.service.ILoginfoService;
|
||||
import com.yeqifu.sys.vo.LoginfoVo;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-11-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("loginfo")
|
||||
public class LoginfoController {
|
||||
|
||||
@Autowired
|
||||
private ILoginfoService loginfoService;
|
||||
|
||||
/**
|
||||
* 查询所有登陆日志的信息
|
||||
* @param loginfoVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("loadAllLoginfo")
|
||||
public DataGridView loadAllLoginfo(LoginfoVo loginfoVo){
|
||||
IPage<Loginfo> page = new Page<Loginfo>(loginfoVo.getPage(),loginfoVo.getLimit());
|
||||
QueryWrapper<Loginfo> queryWrapper = new QueryWrapper<Loginfo>();
|
||||
//进行模糊查询
|
||||
queryWrapper.like(StringUtils.isNotBlank(loginfoVo.getLoginname()),"loginname",loginfoVo.getLoginname());
|
||||
queryWrapper.like(StringUtils.isNotBlank(loginfoVo.getLoginip()),"loginip",loginfoVo.getLoginip());
|
||||
//数据库中登陆时间要大于用户输入的开始时间且小于用户登陆的结束时间
|
||||
queryWrapper.ge(loginfoVo.getStartTime()!=null,"logintime",loginfoVo.getStartTime());
|
||||
queryWrapper.le(loginfoVo.getEndTime()!=null,"logintime",loginfoVo.getEndTime());
|
||||
//根据登陆时间进行降序排序
|
||||
queryWrapper.orderByDesc("logintime");
|
||||
loginfoService.page(page,queryWrapper);
|
||||
return new DataGridView(page.getTotal(),page.getRecords());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单条日志
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("deleteLoginfo")
|
||||
public ResultObj deleteLoginfo(Integer id){
|
||||
try {
|
||||
loginfoService.removeById(id);
|
||||
return ResultObj.DELETE_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.DELETE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param loginfoVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("batchDeleteLoginfo")
|
||||
public ResultObj batchDeleteLoginfo(LoginfoVo loginfoVo){
|
||||
try {
|
||||
Collection<Serializable> idList = new ArrayList<Serializable>();
|
||||
for (Integer id : loginfoVo.getIds()) {
|
||||
idList.add(id);
|
||||
}
|
||||
this.loginfoService.removeByIds(idList);
|
||||
return ResultObj.DELETE_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.DELETE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,144 @@
|
||||
package com.yeqifu.sys.controller;
|
||||
|
||||
|
||||
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.yeqifu.sys.common.DataGridView;
|
||||
import com.yeqifu.sys.common.ResultObj;
|
||||
import com.yeqifu.sys.common.WebUtils;
|
||||
import com.yeqifu.sys.entity.Notice;
|
||||
import com.yeqifu.sys.entity.User;
|
||||
import com.yeqifu.sys.service.INoticeService;
|
||||
import com.yeqifu.sys.vo.NoticeVo;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-11-25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("notice")
|
||||
public class NoticeController {
|
||||
|
||||
@Autowired
|
||||
private INoticeService noticeService;
|
||||
|
||||
/**
|
||||
* 公告的查询
|
||||
* @param noticeVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("loadAllNotice")
|
||||
public DataGridView loadAllNotice(NoticeVo noticeVo){
|
||||
IPage<Notice> page = new Page<Notice>(noticeVo.getPage(),noticeVo.getLimit());
|
||||
QueryWrapper<Notice> queryWrapper = new QueryWrapper<Notice>();
|
||||
//进行模糊查询
|
||||
queryWrapper.like(StringUtils.isNotBlank(noticeVo.getTitle()),"title",noticeVo.getTitle());
|
||||
queryWrapper.like(StringUtils.isNotBlank(noticeVo.getOpername()),"opername",noticeVo.getOpername());
|
||||
//公告创建时间应该大于搜索开始时间小于搜索结束时间
|
||||
queryWrapper.ge(noticeVo.getStartTime()!=null,"createtime",noticeVo.getStartTime());
|
||||
queryWrapper.le(noticeVo.getEndTime()!=null,"createtime",noticeVo.getEndTime());
|
||||
//根据公告创建时间进行排序
|
||||
queryWrapper.orderByDesc("createtime");
|
||||
noticeService.page(page,queryWrapper);
|
||||
return new DataGridView(page.getTotal(),page.getRecords());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据公告ID查询一条公告
|
||||
* @param id 公告ID
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("loadNoticeById")
|
||||
public DataGridView loadNoticeById(Integer id){
|
||||
Notice notice = noticeService.getById(id);
|
||||
return new DataGridView(notice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加公告
|
||||
* @param noticeVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("addNotice")
|
||||
public ResultObj addNotice(NoticeVo noticeVo){
|
||||
try {
|
||||
noticeVo.setCreatetime(new Date());
|
||||
User user = (User) WebUtils.getSession().getAttribute("user");
|
||||
noticeVo.setOpername(user.getName());
|
||||
noticeService.save(noticeVo);
|
||||
return ResultObj.ADD_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.ADD_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改公告
|
||||
* @param noticeVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("updateNotice")
|
||||
public ResultObj updateNotice(NoticeVo noticeVo){
|
||||
try {
|
||||
noticeService.updateById(noticeVo);
|
||||
return ResultObj.UPDATE_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.UPDATE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除公告
|
||||
* @param noticeVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("deleteNotice")
|
||||
public ResultObj deleteNotice(NoticeVo noticeVo){
|
||||
try {
|
||||
noticeService.removeById(noticeVo);
|
||||
return ResultObj.DELETE_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.DELETE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除公告
|
||||
* @param noticeVo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("batchDeleteNotice")
|
||||
public ResultObj batchDeleteNotice(NoticeVo noticeVo){
|
||||
try {
|
||||
Collection<Serializable> idList = new ArrayList<>();
|
||||
for (Integer id : noticeVo.getIds()) {
|
||||
idList.add(id);
|
||||
}
|
||||
noticeService.removeByIds(idList);
|
||||
return ResultObj.DELETE_SUCCESS;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultObj.DELETE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,198 @@
|
||||
package com.yeqifu.sys.controller;
|
||||
|
||||
import com.yeqifu.sys.common.WebUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
/**
|
||||
* 系统进行跳转的路由
|
||||
* @Author: 落亦-
|
||||
* @Date: 2019/11/21 21:19
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("sys")
|
||||
public class SystemController {
|
||||
|
||||
/**
|
||||
* 跳转到登陆页面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toLogin")
|
||||
public String toLogin(){
|
||||
return "system/index/login";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到个人资料页面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toUserInfo")
|
||||
public String toUserInfo(){
|
||||
return "system/user/userInfo";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到修改密码页面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toChangePassword")
|
||||
public String toChangePassword(){
|
||||
return "system/user/changePassword";
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出然后跳转到登陆页面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toSignOut")
|
||||
public String toSignOut(){
|
||||
//销毁session
|
||||
WebUtils.getSession().removeAttribute("user");
|
||||
return "system/index/login";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到首页
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("index")
|
||||
public String index(){
|
||||
return "system/index/index";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到登陆台
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toDeskManager")
|
||||
public String toDeskManager(){
|
||||
return "system/index/deskManager";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到日志管理
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toLoginfoManager")
|
||||
public String toLoginfoManager(){
|
||||
return "system/loginfo/loginfoManager";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到公告管理
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toNoticeManager")
|
||||
public String toNoticeManager(){
|
||||
return "system/notice/noticeManager";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到部门管理
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toDeptManager")
|
||||
public String toDeptManager(){
|
||||
return "system/dept/deptManager";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到部门管理--left
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toDeptLeft")
|
||||
public String toDeptLeft(){
|
||||
return "system/dept/deptLeft";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到部门管理--right
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toDeptRight")
|
||||
public String toDeptRight(){
|
||||
return "system/dept/deptRight";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到菜单管理
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toMenuManager")
|
||||
public String toMenuManager(){
|
||||
return "system/menu/menuManager";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到菜单管理--left
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toMenuLeft")
|
||||
public String toMenuLeft(){
|
||||
return "system/menu/menuLeft";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到菜单管理--right
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toMenuRight")
|
||||
public String toMenuRight(){
|
||||
return "system/menu/menuRight";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到权限管理
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toPermissionManager")
|
||||
public String toPermissionManager(){
|
||||
return "system/permission/permissionManager";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到权限管理--left
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toPermissionLeft")
|
||||
public String toPermissionLeft(){
|
||||
return "system/permission/permissionLeft";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到权限管理--right
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toPermissionRight")
|
||||
public String toPermissionRight(){
|
||||
return "system/permission/permissionRight";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到角色管理
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toRoleManager")
|
||||
public String toRoleManager(){
|
||||
return "system/role/roleManager";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到用户管理
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toUserManager")
|
||||
public String toUserManager(){
|
||||
return "system/user/userManager";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到缓存管理
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("toCacheManager")
|
||||
public String toCacheManager(){
|
||||
return "system/cache/cacheManager";
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package com.yeqifu.sys.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-11-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("sys_loginfo")
|
||||
public class Loginfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private String loginname;
|
||||
|
||||
private String loginip;
|
||||
|
||||
private Date logintime;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.yeqifu.sys.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-11-25
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("sys_notice")
|
||||
public class Notice implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private String title;
|
||||
|
||||
private String content;
|
||||
|
||||
private Date createtime;
|
||||
|
||||
private String opername;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.yeqifu.sys.mapper;
|
||||
|
||||
import com.yeqifu.sys.entity.Dept;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-11-26
|
||||
*/
|
||||
public interface DeptMapper extends BaseMapper<Dept> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.yeqifu.sys.mapper;
|
||||
|
||||
import com.yeqifu.sys.entity.Loginfo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-11-23
|
||||
*/
|
||||
public interface LoginfoMapper extends BaseMapper<Loginfo> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.yeqifu.sys.mapper;
|
||||
|
||||
import com.yeqifu.sys.entity.Notice;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-11-25
|
||||
*/
|
||||
public interface NoticeMapper extends BaseMapper<Notice> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.yeqifu.sys.mapper;
|
||||
|
||||
import com.yeqifu.sys.entity.Permission;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-11-22
|
||||
*/
|
||||
public interface PermissionMapper extends BaseMapper<Permission> {
|
||||
|
||||
/**
|
||||
* 根据权限ID或菜单ID删除sys_role_permission表里面的数据
|
||||
* @param id
|
||||
*/
|
||||
void deleteRolePermissionByPid(@Param("id") Serializable id);
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
package com.yeqifu.sys.mapper;
|
||||
|
||||
import com.yeqifu.sys.entity.Role;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-11-28
|
||||
*/
|
||||
@Mapper
|
||||
public interface RoleMapper extends BaseMapper<Role> {
|
||||
|
||||
/**
|
||||
* 根据角色ID删除sys_role_permission表中的数据
|
||||
* @param id 角色的id
|
||||
*/
|
||||
void deleteRolePermissionByRid(@Param("pid") Serializable id);
|
||||
|
||||
/**
|
||||
* 根据角色ID删除sys_user_role表中的数据
|
||||
* @param id 角色的id
|
||||
*/
|
||||
void deleteUserRoleByRid(@Param("pid") Serializable id);
|
||||
|
||||
/**
|
||||
* 根据角色ID查询当前角色拥有的菜单ID和权限ID
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
List<Integer> queryRolePermissionIdsByRid(@Param("roleId") Integer roleId);
|
||||
|
||||
/**
|
||||
* 保存角色和菜单权限之间的关系
|
||||
* @param rid
|
||||
* @param pid
|
||||
*/
|
||||
void saveRolePermission(@Param("rid") Integer rid,@Param("pid") Integer pid);
|
||||
|
||||
/**
|
||||
* 根据用户id删除用户角色中间表的数据
|
||||
* @param id
|
||||
*/
|
||||
void deleteRoleUserByUid(@Param("id") Serializable id);
|
||||
|
||||
/**
|
||||
* 查询当前用户拥有的角色ID集合
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<Integer> queryUserRoleIdsByUid(@Param("id") Integer id);
|
||||
|
||||
/**
|
||||
* 保存用户和角色的关系
|
||||
* @param uid 用户的ID
|
||||
* @param rid 用户拥有的角色的ID的数组
|
||||
*/
|
||||
void insertUserRole(@Param("uid") Integer uid,@Param("rid") Integer rid);
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.yeqifu.sys.mapper;
|
||||
|
||||
import com.yeqifu.sys.entity.User;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB; (`deptid`) REFER `warehouse/sys_dept`(`id`) ON UPDATE CASC Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-11-21
|
||||
*/
|
||||
public interface UserMapper extends BaseMapper<User> {
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.yeqifu.sys.service;
|
||||
|
||||
import com.yeqifu.sys.entity.Dept;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-11-26
|
||||
*/
|
||||
public interface IDeptService extends IService<Dept> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.yeqifu.sys.service;
|
||||
|
||||
import com.yeqifu.sys.entity.Loginfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-11-23
|
||||
*/
|
||||
public interface ILoginfoService extends IService<Loginfo> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.yeqifu.sys.service;
|
||||
|
||||
import com.yeqifu.sys.entity.Notice;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-11-25
|
||||
*/
|
||||
public interface INoticeService extends IService<Notice> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.yeqifu.sys.service;
|
||||
|
||||
import com.yeqifu.sys.entity.Permission;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-11-22
|
||||
*/
|
||||
public interface IPermissionService extends IService<Permission> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package com.yeqifu.sys.service;
|
||||
|
||||
import com.yeqifu.sys.entity.Role;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-11-28
|
||||
*/
|
||||
public interface IRoleService extends IService<Role> {
|
||||
|
||||
/**
|
||||
* 根据角色ID查询当前角色拥有的菜单ID和权限ID
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
List<Integer> queryRolePermissionIdsByRid(Integer roleId);
|
||||
|
||||
/**
|
||||
* 保存角色和菜单权限之间的关系
|
||||
* @param rid
|
||||
* @param ids
|
||||
*/
|
||||
void saveRolePermission(Integer rid, Integer[] ids);
|
||||
|
||||
/**
|
||||
* 查询当前用户拥有的角色ID集合
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<Integer> queryUserRoleIdsByUid(Integer id);
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.yeqifu.sys.service;
|
||||
|
||||
import com.yeqifu.sys.entity.User;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* InnoDB free: 9216 kB; (`deptid`) REFER `warehouse/sys_dept`(`id`) ON UPDATE CASC 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author luoyi-
|
||||
* @since 2019-11-21
|
||||
*/
|
||||
public interface IUserService extends IService<User> {
|
||||
|
||||
/**
|
||||
* 保存用户和角色的关系
|
||||
* @param uid 用户的ID
|
||||
* @param ids 用户拥有的角色的ID的数组
|
||||
*/
|
||||
void saveUserRole(Integer uid, Integer[] ids);
|
||||
|
||||
/**
|
||||
* 查询当前用户是否是其他用户的直属领导
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
Boolean queryMgrByUserId(Integer userId);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue